diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index c7df54809..b828c1161 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -31,19 +31,19 @@ jobs: name: Cache ~/.cabal/packages with: path: ~/.cabal/packages - key: ${{ runner.os }}-${{ matrix.ghc }}-cabal-packages + key: ${{ runner.os }}-${{ matrix.ghc }}-v1-cabal-packages - uses: actions/cache@v1 name: Cache ~/.cabal/store with: path: ~/.cabal/store - key: ${{ runner.os }}-${{ matrix.ghc }}-v10-cabal-store + key: ${{ runner.os }}-${{ matrix.ghc }}-v11-cabal-store - uses: actions/cache@v1 name: Cache dist-newstyle with: path: dist-newstyle - key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-semantic-dist + key: ${{ runner.os }}-${{ matrix.ghc }}-${{ matrix.cabal }}-v1-semantic-dist # - name: hlint # run: | @@ -52,7 +52,7 @@ jobs: - name: Install dependencies run: | - script/bootstrap + cabal v2-update cabal v2-configure --project-file=cabal.project.ci --disable-optimization --enable-benchmarks --enable-tests --write-ghc-environment-files=always -j2 cabal v2-build --project-file=cabal.project.ci all --only-dependencies @@ -61,7 +61,14 @@ jobs: cabal v2-build --project-file=cabal.project.ci cabal v2-run --project-file=cabal.project.ci semantic:test cabal v2-run --project-file=cabal.project.ci semantic-core: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-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; cd .. cd semantic-source; cabal v2-run --project-file=cabal.project.ci semantic-source:doctest -- src; cd .. diff --git a/Dockerfile b/Dockerfile index 4375c8b65..699948432 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,9 @@ RUN go get github.com/golang/protobuf/proto && \ 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 diff --git a/README.md b/README.md index 5d30af822..40d87d3af 100644 --- a/README.md +++ b/README.md @@ -82,12 +82,13 @@ Available options: | 3 | TypeScript | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 | | | 4 | Python | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 | | | 5 | Go | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | 🚧 | | -| | PHP | 🚧 | 🚧 | 🚧 | 🚧| 🚧 | | | | -| | Java | 🚧 | 🚧 | 🚧 | 🔶 | ✅ | | | | -| | JSON | ✅ | ✅ | ✅ | N/A | N/A | N/A | N/A| | +| | PHP | 🚧 | 🚧 | 🚧 | 🚧 | 🚧 | | | | +| | Java | 🚧 | N/A | 🚧 | 🚧 | ✅ | | | | +| | JSON | ✅ | N/A | ✅ | N/A | N/A | N/A | N/A| | | | JSX | ✅ | ✅ | ✅ | 🔶 | | | | | | | Haskell | 🚧 | 🚧 | 🚧 | 🔶 | 🚧 | | | | -| | Markdown | ✅ | ✅ | ✅ | 🔶 | N/A | N/A | N/A |   | +| | Markdown | 🚧 | 🚧 | 🚧 | 🚧 | N/A | N/A | N/A |   | +| | CodeQL | 🚧 | N/A | 🚧 | 🚧 | 🚧 | | | | * ✅ — Supported * 🔶 — Partial support diff --git a/bench/Evaluation.hs b/bench/Evaluation.hs index d7c582946..58e215a91 100644 --- a/bench/Evaluation.hs +++ b/bench/Evaluation.hs @@ -38,7 +38,7 @@ callGraphProject' :: ( Language.SLanguage lang callGraphProject' session proxy path | Just (SomeParser parser) <- parserForLanguage analysisParsers lang = fmap (bimap show (const ())) . runTask session $ do blob <- readBlobFromPath (Path.toAbsRel path) - package <- fmap snd <$> runParse (Duration.fromSeconds 10) (parsePackage parser (Project (Path.toString (Path.takeDirectory path)) [blob] lang [])) + package <- fmap snd <$> runParse (Duration.fromSeconds 10) (parsePackage parser (Project (Path.toAbsRel (Path.takeDirectory path)) [blob] lang [])) modules <- topologicalSort <$> runImportGraphToModules proxy package runCallGraph proxy False modules package | otherwise = error $ "Analysis not supported for: " <> show lang diff --git a/cabal.project b/cabal.project index f3f2006eb..813fd2456 100644 --- a/cabal.project +++ b/cabal.project @@ -28,8 +28,3 @@ source-repository-package type: git location: https://github.com/antitypical/fused-syntax.git tag: d11e14581217590a5c67f79cbaeee35ac8acee6a - -source-repository-package - type: git - location: https://github.com/fused-effects/fused-effects-readline.git - tag: 7a96949c77c73c6e5975c8d6171ffb63eb76b467 diff --git a/cabal.project.ci b/cabal.project.ci index b5a7e64f4..bcaa59e7f 100644 --- a/cabal.project.ci +++ b/cabal.project.ci @@ -29,11 +29,6 @@ source-repository-package location: https://github.com/antitypical/fused-syntax.git tag: d11e14581217590a5c67f79cbaeee35ac8acee6a -source-repository-package - type: git - location: https://github.com/fused-effects/fused-effects-readline.git - tag: 7a96949c77c73c6e5975c8d6171ffb63eb76b467 - -- Treat warnings as errors for CI builds package semantic diff --git a/docs/codegen.md b/docs/codegen.md new file mode 100644 index 000000000..d68ec4ee4 --- /dev/null +++ b/docs/codegen.md @@ -0,0 +1,119 @@ +@ -1,216 +0,0 @@ +# CodeGen Documentation + +CodeGen is the process for auto-generating language-specific, strongly-typed ASTs to be used in [Semantic](https://github.com/github/semantic-code/blob/d9f91a05dc30a61b9ff8c536d75661d417f3c506/design-docs/precise-code-navigation.md). + +### Prerequisites +To get started, first make sure your language has: + +1. An existing [tree-sitter](http://tree-sitter.github.io/tree-sitter/) parser; +2. An existing Cabal package in [tree-sitter](http://tree-sitter.github.io/tree-sitter/) for said language. This will provide an interface into tree-sitter's C source. [Here](https://github.com/tree-sitter/haskell-tree-sitter/tree/master/tree-sitter-python) is an example of a library for Python, a supported language that the remaining documentation will refer to. + +### CodeGen Pipeline + +During parser generation, tree-sitter produces a JSON file that captures the structure of a language's grammar. Based on this, we're able to derive datatypes representing surface languages, and then use those datatypes to generically build ASTs. This automates the engineering effort [historically required for adding a new language](https://github.com/github/semantic/blob/master/docs/adding-new-languages.md). + +The following steps provide a high-level outline of the process: + +1. [**Deserialize.**](https://github.com/github/semantic/blob/master/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. +2. [**Generate Syntax.**](https://github.com/github/semantic/blob/master/semantic-ast/src/AST/GenerateSyntax.hs) We then use Template Haskell to auto-generate language-specific, strongly-typed datatypes that represent various language constructs. 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/master/semantic-python/src/Language/Python/AST.hs) module. +3. [**Unmarshal.**](https://github.com/github/semantic/blob/master/semantic-ast/src/AST/Unmarshal.hs) Unmarshaling is the 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. + +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| + +The remaining document provides more details on generating ASTs, inspecting datatypes, tests, and information on decisions pertaining to relevant APIs. +___ + +### Table of Contents +- [CodeGen Documentation](#codegen-documentation) + - [Prerequisites](#prerequisites) + - [CodeGen Pipeline](#codegen-pipeline) + - [Table of Contents](#table-of-contents) + - [Generating ASTs](#generating-asts) + - [Inspecting auto-generated datatypes](#inspecting-auto-generated-datatypes) + - [Tests](#tests) + - [Additional notes](#additional-notes) +___ + +### 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"}))))})))})) :| []}))))})]}) +``` + +### 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 +``` + +### 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` + +### Additional notes + +- [GenerateSyntax](https://github.com/tree-sitter/haskell-tree-sitter/blob/master/tree-sitter/src/TreeSitter/GenerateSyntax.hs) provides a way to pre-define certain datatypes for which Template Haskell is not used. 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. 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. +- Annotations are captured by a polymorphic parameter `a` +- [Unmarshal](https://github.com/tree-sitter/haskell-tree-sitter/blob/master/tree-sitter/src/TreeSitter/Unmarshal.hs) 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`, `[]`—we actually preference doing things non-generically. Since `[]` is a sum, the generic behavior for `:+:` would be invoked and expect that we’d have repetitions represented in the parse tree as right-nested singly-linked lists (ex., `(a (b (c (d…))))`) rather than as just consecutive sibling nodes (ex., `(a b c ...d)`, which is what our trees have). We want to match the latter. diff --git a/proto/semantic.proto b/proto/semantic.proto index 76e62835a..7f6f3459f 100644 --- a/proto/semantic.proto +++ b/proto/semantic.proto @@ -27,6 +27,14 @@ message ParseTreeGraphResponse { repeated ParseTreeFileGraph files = 1; } +message StackGraphRequest { + repeated Blob blobs = 1; +} + +message StackGraphResponse { + repeated StackGraphFile files = 1; +} + message ParseTreeFileGraph { string path = 1; string language = 2; @@ -174,3 +182,37 @@ message Span { Position start = 1; Position end = 2; } + +message StackGraphFile { + string path = 1; + string language = 2; + repeated StackGraphNode nodes = 3; + repeated StackGraphPath paths = 4; + repeated ParseError errors = 5; +} + +message StackGraphNode { + int64 id = 1; + string name = 2; + string line = 3; + string kind = 4; + Span span = 5; + enum NodeType { + ROOT_SCOPE = 0; + JUMP_TO_SCOPE = 1; + EXPORTED_SCOPE = 2; + DEFINITION = 3; + REFERENCE = 4; + } + 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/script/bootstrap b/script/bootstrap index 659a0df3c..ca7655f3e 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -1,4 +1,3 @@ -#!/bin/bash +#!/usr/bin/env bash -git submodule sync --recursive && git submodule update --init --recursive --force cabal v2-update diff --git a/script/build-and-upload b/script/build-and-upload new file mode 100755 index 000000000..2445117e5 --- /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 cc6c6c860..e6666e801 100755 --- a/script/clone-example-repos +++ b/script/clone-example-repos @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #/ Usage: script/clone-example-repos #/ #/ Clone some example repositories for smoke testing parsing, assignment, and precise ASTs. diff --git a/script/fix-broken-cabal-store b/script/fix-broken-cabal-store index ff9cf837f..ad7f42ba7 100755 --- a/script/fix-broken-cabal-store +++ b/script/fix-broken-cabal-store @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash store_dir="$HOME/.cabal/store/ghc-$(ghc --numeric-version)" diff --git a/script/generate-example b/script/generate-example index 7030a0c5b..f9625de03 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 #/ diff --git a/script/ghci-flags b/script/ghci-flags index d0e90da7a..913f5f630 100755 --- a/script/ghci-flags +++ b/script/ghci-flags @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env 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 @@ -70,6 +70,7 @@ function flags { # 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/^/-/' diff --git a/script/ghci-flags-dependencies b/script/ghci-flags-dependencies index e8ba71b9a..cd8c87ebc 100755 --- a/script/ghci-flags-dependencies +++ b/script/ghci-flags-dependencies @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Computes the paths to files causing changes to the ghci flags. You probably won’t be running this yourself, but rather ghcide will via configuration in hie.yaml. set -e diff --git a/script/profile b/script/profile index c9bd352d8..30760dd6e 100755 --- a/script/profile +++ b/script/profile @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Usage: script/profile FILE_A FILE_B # Builds and runs semantic on the given files with profiling enabled. diff --git a/script/protoc b/script/protoc index 283de0d50..4498be504 100755 --- a/script/protoc +++ b/script/protoc @@ -12,7 +12,8 @@ PARENT_DIR=$(dirname $(pwd)) export PROJECT="github.com/github/semantic" -# Generate Haskell for semantic's protobuf types +# 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=./src \ diff --git a/script/publish b/script/publish index 8fa44915f..5fa1f54d6 100755 --- a/script/publish +++ b/script/publish @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #/ Usage: script/publish #/ #/ Build a docker image of the semantic CLI and publish to the GitHub Package Registry diff --git a/script/repl b/script/repl index 389a07cf0..1932b0856 100755 --- a/script/repl +++ b/script/repl @@ -1,4 +1,4 @@ -#!/bin/bash +#!/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. diff --git a/semantic-analysis/semantic-analysis.cabal b/semantic-analysis/semantic-analysis.cabal index cbb1aa731..df54e59ad 100644 --- a/semantic-analysis/semantic-analysis.cabal +++ b/semantic-analysis/semantic-analysis.cabal @@ -65,7 +65,7 @@ library , containers ^>= 0.6 , filepath , fused-effects ^>= 1.0 - , fused-effects-readline + , fused-effects-readline ^>= 0 , fused-syntax , hashable , haskeline ^>= 0.7.5 @@ -74,7 +74,7 @@ library , pathtype ^>= 0.8.1 , prettyprinter >= 1.2 && < 2 , prettyprinter-ansi-terminal ^>= 1.1.1 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , semilattices , terminal-size ^>= 0.3 , text ^>= 1.2.3.1 diff --git a/semantic-analysis/src/Analysis/Blob.hs b/semantic-analysis/src/Analysis/Blob.hs index 11de2338b..9454bddd8 100644 --- a/semantic-analysis/src/Analysis/Blob.hs +++ b/semantic-analysis/src/Analysis/Blob.hs @@ -4,6 +4,7 @@ module Analysis.Blob , fromSource , blobLanguage , blobPath + , blobFilePath , nullBlob ) where @@ -38,8 +39,12 @@ fromSource filepath language source blobLanguage :: Blob -> Language blobLanguage = Analysis.File.fileBody . blobFile -blobPath :: Blob -> FilePath -blobPath = Path.toString . Analysis.File.filePath . blobFile +blobPath :: Blob -> Path.AbsRelFile +blobPath = Analysis.File.filePath . blobFile + +-- | Show FilePath for error or json outputs. +blobFilePath :: Blob -> String +blobFilePath = Path.toString . blobPath nullBlob :: Blob -> Bool nullBlob = Source.null . blobSource diff --git a/semantic-analysis/src/Analysis/File.hs b/semantic-analysis/src/Analysis/File.hs index cfaeaac9e..95437627a 100644 --- a/semantic-analysis/src/Analysis/File.hs +++ b/semantic-analysis/src/Analysis/File.hs @@ -7,7 +7,6 @@ module Analysis.File ) where import Data.Maybe (fromJust, listToMaybe) -import Data.Semilattice.Lower import GHC.Stack import Source.Language as Language import Source.Span @@ -16,7 +15,7 @@ import qualified System.Path.PartClass as Path.PartClass data File a = File { filePath :: !Path.AbsRelFile - , fileSpan :: {-# UNPACK #-} !Span + , fileSpan :: Span , fileBody :: !a } deriving (Eq, Foldable, Functor, Ord, Show, Traversable) @@ -30,4 +29,4 @@ fileLanguage :: File a -> Language fileLanguage = Language.forPath . filePath fromPath :: Path.PartClass.AbsRel ar => Path.File ar -> File Language -fromPath p = File (Path.toAbsRel p) lowerBound (Language.forPath p) +fromPath p = File (Path.toAbsRel p) (point (Pos 0 0)) (Language.forPath p) diff --git a/semantic-analysis/src/Analysis/Project.hs b/semantic-analysis/src/Analysis/Project.hs index e5fe10a4e..1b5999873 100644 --- a/semantic-analysis/src/Analysis/Project.hs +++ b/semantic-analysis/src/Analysis/Project.hs @@ -12,19 +12,19 @@ import Analysis.File import Data.Text (Text) import qualified Data.Text as T import Source.Language -import System.FilePath.Posix +import qualified System.Path as Path -- | A 'Project' contains all the information that semantic needs -- to execute an analysis, diffing, or graphing pass. data Project = Project - { projectRootDir :: FilePath + { projectRootDir :: Path.AbsRelDir , projectBlobs :: [Blob] , projectLanguage :: Language - , projectExcludeDirs :: [FilePath] + , projectExcludeDirs :: [Path.AbsRelDir] } deriving (Eq, Show) projectName :: Project -> Text -projectName = T.pack . dropExtensions . takeFileName . projectRootDir +projectName = T.pack . maybe "" Path.toString . Path.takeDirName . projectRootDir projectExtensions :: Project -> [String] projectExtensions = extensionsForLanguage . projectLanguage diff --git a/semantic-ast/README.md b/semantic-ast/README.md index e954cb8ff..d5f44e402 100644 --- a/semantic-ast/README.md +++ b/semantic-ast/README.md @@ -1,217 +1,5 @@ -@ -1,216 +0,0 @@ -# CodeGen Documentation +# semantic-ast -CodeGen is the process for auto-generating language-specific, strongly-typed ASTs to be used in [Semantic](https://github.com/github/semantic-code/blob/d9f91a05dc30a61b9ff8c536d75661d417f3c506/design-docs/precise-code-navigation.md). +This package is concerned with the CodeGen generation of strongly-typed ASTs. -_Note: This project was recently moved from `tree-sitter` into `Semantic`. These docs are in the process of being updated to reflect changes._ - -### Prerequisites -To get started, first make sure your language has: - -1. An existing [tree-sitter](http://tree-sitter.github.io/tree-sitter/) parser; -2. An existing Cabal package in this repository for said language. This will provide an interface into tree-sitter's C source. [Here](https://github.com/tree-sitter/haskell-tree-sitter/tree/master/tree-sitter-python) is an example of a library for Python, a supported language that the remaining documentation will refer to. - -### CodeGen Pipeline - -During parser generation, tree-sitter produces a JSON file that captures the structure of a language's grammar. Based on this, we're able to derive datatypes representing surface languages, and then use those datatypes to generically build ASTs. This automates the engineering effort [historically required for adding a new language](https://github.com/github/semantic/blob/master/docs/adding-new-languages.md). - -The following steps provide a high-level outline of the process: - -1. [**Deserialize.**](https://github.com/github/semantic/blob/master/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. -2. [**Generate Syntax.**](https://github.com/github/semantic/blob/master/semantic-ast/src/AST/GenerateSyntax.hs) We then use Template Haskell to auto-generate language-specific, strongly-typed datatypes that represent various language constructs. 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/master/semantic-python/src/Language/Python/AST.hs) module. -3. [**Unmarshal.**](https://github.com/github/semantic/blob/master/semantic-ast/src/AST/Unmarshal.hs) Unmarshaling is the 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. - -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| - -The remaining document provides more details on generating ASTs, inspecting datatypes, tests, and information on decisions pertaining to relevant APIs. -___ - -### Table of Contents -- [CodeGen Documentation](#codegen-documentation) - - [Prerequisites](#prerequisites) - - [CodeGen Pipeline](#codegen-pipeline) - - [Table of Contents](#table-of-contents) - - [Generating ASTs](#generating-asts) - - [Inspecting auto-generated datatypes](#inspecting-auto-generated-datatypes) - - [Tests](#tests) - - [Additional notes](#additional-notes) -___ - -### Generating ASTs - -To parse source code and produce ASTs locally: - -1. Load the REPL for a given language: - -``` -cabal new-repl lib:tree-sitter-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 exemplified by `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: - -``` -parseByteString @TreeSitter.Python.AST.Module @(Source.Span.Span, Source.Range.Range) tree_sitter_python "1" -``` - -This generates the following AST: - -``` -Right - ( Module - { ann = - ( Range - { start = 0 - , end = 1 - } - , Span - { start = Pos - { line = 0 - , column = 0 - } - , end = Pos - { line = 0 - , column = 1 - } - } - ) - , extraChildren = - [ R1 - ( SimpleStatement - ( L1 - ( R1 - ( R1 - ( L1 - ( ExpressionStatement - { ann = - ( Range - { start = 0 - , end = 1 - } - , Span - { start = Pos - { line = 0 - , column = 0 - } - , end = Pos - { line = 0 - , column = 1 - } - } - ) - , extraChildren = L1 - ( L1 - ( Expression - ( L1 - ( L1 - ( L1 - ( PrimaryExpression - ( R1 - ( L1 - ( L1 - ( L1 - ( Integer - { ann = - ( Range - { start = 0 - , end = 1 - } - , Span - { start = Pos - { line = 0 - , column = 0 - } - , end = Pos - { line = 0 - , column = 1 - } - } - ) - , text = "1" - } - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) :| [] - } - ) - ) - ) - ) - ) - ) - ] - } - ) -``` - -### Inspecting auto-generated datatypes - -Datatypes are derived from a language and its `node-types.json` file using the GenerateSyntax API. Definition can be viewed in the REPL just as they would for any other datatype, using `:i`: - -``` -:i TreeSitter.Python.AST.Module -``` - -This shows us the auto-generated `Module` datatype: - -```Haskell -data TreeSitter.Python.AST.Module a - = TreeSitter.Python.AST.Module {TreeSitter.Python.AST.ann :: a, - TreeSitter.Python.AST.extraChildren :: [(GHC.Generics.:+:) - TreeSitter.Python.AST.CompoundStatement - TreeSitter.Python.AST.SimpleStatement - a]} - -- Defined at TreeSitter/Python/AST.hs:10:1 -instance Show a => Show (TreeSitter.Python.AST.Module a) - -- Defined at TreeSitter/Python/AST.hs:10:1 -instance Ord a => Ord (TreeSitter.Python.AST.Module a) - -- Defined at TreeSitter/Python/AST.hs:10:1 -instance Eq a => Eq (TreeSitter.Python.AST.Module a) - -- Defined at TreeSitter/Python/AST.hs:10:1 -instance Traversable TreeSitter.Python.AST.Module - -- Defined at TreeSitter/Python/AST.hs:10:1 -instance Functor TreeSitter.Python.AST.Module - -- Defined at TreeSitter/Python/AST.hs:10:1 -instance Foldable TreeSitter.Python.AST.Module - -- Defined at TreeSitter/Python/AST.hs:10:1 -instance Unmarshal TreeSitter.Python.AST.Module - -- Defined at TreeSitter/Python/AST.hs:10:1 -instance SymbolMatching TreeSitter.Python.AST.Module - -- Defined at TreeSitter/Python/AST.hs:10:1 -``` - -### Tests - -As of right now, Hedgehog tests are minimal and only in place for the Python library. - -To run tests: - -`cabal v2-test tree-sitter-python` - -### Additional notes - -- [GenerateSyntax](https://github.com/tree-sitter/haskell-tree-sitter/blob/master/tree-sitter/src/TreeSitter/GenerateSyntax.hs) provides a way to pre-define certain datatypes for which Template Haskell is not used. 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. 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. -- Annotations are captured by a polymorphic parameter `a` -- [Unmarshal](https://github.com/tree-sitter/haskell-tree-sitter/blob/master/tree-sitter/src/TreeSitter/Unmarshal.hs) 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`, `[]`—we actually preference doing things non-generically. Since `[]` is a sum, the generic behavior for `:+:` would be invoked and expect that we’d have repetitions represented in the parse tree as right-nested singly-linked lists (ex., `(a (b (c (d…))))`) rather than as just consecutive sibling nodes (ex., `(a b c ...d)`, which is what our trees have). We want to match the latter. \ No newline at end of file +[Documentation](https://github.com/github/semantic/blob/master/docs/codegen.md) diff --git a/semantic-ast/semantic-ast.cabal b/semantic-ast/semantic-ast.cabal index cdfa91796..1683ab05d 100644 --- a/semantic-ast/semantic-ast.cabal +++ b/semantic-ast/semantic-ast.cabal @@ -55,13 +55,13 @@ library build-depends: base ^>= 4.13 , aeson ^>= 1.4.2.0 , aeson-pretty ^>= 0.8.8 - , bytestring ^>= 0.10.8.2 + , bytestring ^>= 0.10.9.2 , containers >= 0.6.0.1 , directory ^>= 1.3.3.2 , filepath ^>= 1.4.1 , fused-effects ^>= 1.0 , tree-sitter ^>= 0.9.0.0 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , template-haskell ^>= 2.15 , bytestring ^>= 0.10.8.2 , optparse-applicative >= 0.14.3 && < 0.16 diff --git a/semantic-ast/src/AST/TestHelpers.hs b/semantic-ast/src/AST/TestHelpers.hs index 705a80bc7..954677d10 100644 --- a/semantic-ast/src/AST/TestHelpers.hs +++ b/semantic-ast/src/AST/TestHelpers.hs @@ -2,6 +2,7 @@ module AST.TestHelpers ( CorpusExample(..) , readCorpusFiles + , readCorpusFiles' , parseCorpusFile , testCorpus ) where @@ -22,7 +23,7 @@ import System.FilePath.Glob import Test.Tasty import Test.Tasty.HUnit -testCorpus :: (ByteString -> IO (Either String (t a))) -> Path.RelFile -> IO TestTree +testCorpus :: (ByteString -> IO (Either String (t a))) -> Path.AbsRelFile -> IO TestTree testCorpus parse path = do xs <- parseCorpusFile path case xs of @@ -50,10 +51,15 @@ readCorpusFiles parent = do files <- globDir1 (compile "**/*.txt") (Path.toString dir) pure (Path.relPath <$> files) +readCorpusFiles' :: Path.AbsDir -> IO [Path.AbsRelFile] +readCorpusFiles' dir = do + files <- globDir1 (compile "**/*.txt") (Path.toString dir) + pure (Path.file <$> files) + data CorpusExample = CorpusExample { name :: String, code :: ByteString } deriving (Eq, Show) -parseCorpusFile :: Path.RelFile -> IO (Either String [CorpusExample]) +parseCorpusFile :: Path.AbsRelFile -> IO (Either String [CorpusExample]) parseCorpusFile path = do c <- Data.ByteString.readFile (Path.toString path) pure $ parseOnly corpusParser c diff --git a/semantic-core/semantic-core.cabal b/semantic-core/semantic-core.cabal index f8a081b03..97aae55b7 100644 --- a/semantic-core/semantic-core.cabal +++ b/semantic-core/semantic-core.cabal @@ -55,7 +55,7 @@ library , prettyprinter >= 1.2.1 && < 2 , prettyprinter-ansi-terminal ^>= 1.1.1 , semantic-analysis ^>= 0 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , text ^>= 1.2.3.1 , trifecta >= 2 && < 2.2 , unordered-containers ^>= 0.2.10 diff --git a/semantic-go/semantic-go.cabal b/semantic-go/semantic-go.cabal index 794a73cd7..c023ecb78 100644 --- a/semantic-go/semantic-go.cabal +++ b/semantic-go/semantic-go.cabal @@ -26,12 +26,12 @@ common haskell , parsers ^>= 0.12.10 , semantic-ast , semantic-core ^>= 0.0 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , semantic-tags ^>= 0.0 , template-haskell ^>= 2.15 , text ^>= 1.2.3 , tree-sitter ^>= 0.9 - , tree-sitter-go ^>= 0.5.0.0 + , tree-sitter-go ^>= 0.5.0.1 ghc-options: -Weverything @@ -63,13 +63,12 @@ test-suite test hs-source-dirs: test main-is: Test.hs build-depends: base - , tree-sitter - , tree-sitter-go - , semantic-ast , bytestring ^>= 0.10.8.2 , hedgehog >= 0.6 && <2 , pathtype ^>= 0.8.1 - , text + , semantic-ast + , semantic-go , tasty , tasty-hedgehog , tasty-hunit + , text diff --git a/semantic-go/src/Language/Go/AST.hs b/semantic-go/src/Language/Go/AST.hs index 361c3c4c4..98b48f9ea 100644 --- a/semantic-go/src/Language/Go/AST.hs +++ b/semantic-go/src/Language/Go/AST.hs @@ -12,11 +12,12 @@ module Language.Go.AST ( module Language.Go.AST +, Go.getTestCorpusDir ) where import Prelude hiding (False, Float, Integer, Rational, String, True) import AST.GenerateSyntax import Language.Haskell.TH.Syntax (runIO) -import qualified TreeSitter.Go as Go (getNodeTypesPath, tree_sitter_go) +import qualified TreeSitter.Go as Go (getNodeTypesPath, getTestCorpusDir, tree_sitter_go) runIO Go.getNodeTypesPath >>= astDeclarationsForLanguage Go.tree_sitter_go diff --git a/semantic-go/test/Test.hs b/semantic-go/test/Test.hs index 36d7cc38a..0ad251bec 100644 --- a/semantic-go/test/Test.hs +++ b/semantic-go/test/Test.hs @@ -7,10 +7,15 @@ import Language.Go.Grammar import qualified Language.Go.AST as Go import AST.TestHelpers import AST.Unmarshal +import qualified Language.Go.AST as Go +import Language.Go.Grammar +import qualified System.Path as Path +import Test.Tasty main :: IO () main - = readCorpusFiles (Path.relDir "tree-sitter-go/vendor/tree-sitter-go/corpus") + = Path.absDir <$> Go.getTestCorpusDir + >>= readCorpusFiles' >>= traverse (testCorpus parse) >>= defaultMain . tests where parse = parseByteString @Go.SourceFile @() tree_sitter_go diff --git a/semantic-go/vendor/tree-sitter-go b/semantic-go/vendor/tree-sitter-go deleted file mode 160000 index 689cc8fbd..000000000 --- a/semantic-go/vendor/tree-sitter-go +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 689cc8fbdc0613d267434f221af85aff91a31f8c diff --git a/semantic-java/semantic-java.cabal b/semantic-java/semantic-java.cabal index 179824e96..3c59efc94 100644 --- a/semantic-java/semantic-java.cabal +++ b/semantic-java/semantic-java.cabal @@ -26,12 +26,12 @@ common haskell , parsers ^>= 0.12.10 , semantic-ast , semantic-core ^>= 0.0 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , semantic-tags ^>= 0.0 , template-haskell ^>= 2.15 , text ^>= 1.2.3 , tree-sitter ^>= 0.9 - , tree-sitter-java ^>= 0.7.0.0 + , tree-sitter-java ^>= 0.7.0.1 ghc-options: -Weverything @@ -63,11 +63,10 @@ test-suite test hs-source-dirs: test main-is: Test.hs build-depends: base - , tree-sitter - , tree-sitter-java - , semantic-ast , bytestring ^>= 0.10.8.2 , pathtype ^>= 0.8.1 - , text + , semantic-ast + , semantic-java , tasty , tasty-hunit + , text diff --git a/semantic-java/src/Language/Java/AST.hs b/semantic-java/src/Language/Java/AST.hs index 4f951d6f5..467dea0ce 100644 --- a/semantic-java/src/Language/Java/AST.hs +++ b/semantic-java/src/Language/Java/AST.hs @@ -12,11 +12,12 @@ module Language.Java.AST ( module Language.Java.AST +, Java.getTestCorpusDir ) where import AST.GenerateSyntax import AST.Token import Language.Haskell.TH.Syntax (runIO) -import qualified TreeSitter.Java as Java (getNodeTypesPath, tree_sitter_java) +import qualified TreeSitter.Java as Java (getNodeTypesPath, getTestCorpusDir, tree_sitter_java) runIO Java.getNodeTypesPath >>= astDeclarationsForLanguage Java.tree_sitter_java diff --git a/semantic-java/test/Test.hs b/semantic-java/test/Test.hs index ba65b1881..aead37232 100644 --- a/semantic-java/test/Test.hs +++ b/semantic-java/test/Test.hs @@ -7,10 +7,15 @@ import TreeSitter.Java import qualified TreeSitter.Java.AST as Java import AST.TestHelpers import AST.Unmarshal +import qualified Language.Java.AST as Java +import Language.Java.Grammar +import qualified System.Path as Path +import Test.Tasty main :: IO () main - = readCorpusFiles (Path.relDir "tree-sitter-java/vendor/tree-sitter-java/corpus") + = Path.absDir <$> Java.getTestCorpusDir + >>= readCorpusFiles' >>= traverse (testCorpus parse) >>= defaultMain . tests where diff --git a/semantic-java/vendor/tree-sitter-java b/semantic-java/vendor/tree-sitter-java deleted file mode 160000 index afc4cec79..000000000 --- a/semantic-java/vendor/tree-sitter-java +++ /dev/null @@ -1 +0,0 @@ -Subproject commit afc4cec799f6594390aeb0ca5e16ec89e73d488e diff --git a/semantic-json/semantic-json.cabal b/semantic-json/semantic-json.cabal index b8d663866..afe50ee17 100644 --- a/semantic-json/semantic-json.cabal +++ b/semantic-json/semantic-json.cabal @@ -26,12 +26,12 @@ common haskell , parsers ^>= 0.12.10 , semantic-ast , semantic-core ^>= 0.0 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , semantic-tags ^>= 0.0 , template-haskell ^>= 2.15 , text ^>= 1.2.3 , tree-sitter ^>= 0.9 - , tree-sitter-json ^>= 0.7.0.0 + , tree-sitter-json ^>= 0.7.0.1 ghc-options: -Weverything @@ -63,13 +63,12 @@ test-suite test hs-source-dirs: test main-is: Test.hs build-depends: base - , tree-sitter - , tree-sitter-json - , semantic-ast , bytestring ^>= 0.10.8.2 , hedgehog >= 0.6 && <2 , pathtype ^>= 0.8.1 - , text + , semantic-ast + , semantic-json , tasty , tasty-hedgehog , tasty-hunit + , text diff --git a/semantic-json/src/Language/JSON/AST.hs b/semantic-json/src/Language/JSON/AST.hs index 7c1a697f5..37713a0df 100644 --- a/semantic-json/src/Language/JSON/AST.hs +++ b/semantic-json/src/Language/JSON/AST.hs @@ -11,11 +11,12 @@ {-# LANGUAGE TypeApplications #-} module Language.JSON.AST ( module Language.JSON.AST +, JSON.getTestCorpusDir ) where import Prelude hiding (String) import AST.GenerateSyntax import Language.Haskell.TH.Syntax (runIO) -import qualified TreeSitter.JSON as JSON (getNodeTypesPath, tree_sitter_json) +import qualified TreeSitter.JSON as JSON (getNodeTypesPath, getTestCorpusDir, tree_sitter_json) runIO JSON.getNodeTypesPath >>= astDeclarationsForLanguage JSON.tree_sitter_json diff --git a/semantic-json/test/Test.hs b/semantic-json/test/Test.hs index d497f1c7b..f2afb7aff 100644 --- a/semantic-json/test/Test.hs +++ b/semantic-json/test/Test.hs @@ -7,10 +7,15 @@ import TreeSitter.JSON import qualified TreeSitter.JSON.AST as JSON import AST.TestHelpers import AST.Unmarshal +import qualified Language.JSON.AST as JSON +import Language.JSON.Grammar +import qualified System.Path as Path +import Test.Tasty main :: IO () main - = readCorpusFiles (Path.relDir "tree-sitter-json/vendor/tree-sitter-json/corpus") + = Path.absDir <$> JSON.getTestCorpusDir + >>= readCorpusFiles' >>= traverse (testCorpus parse) >>= defaultMain . tests where parse = parseByteString @JSON.Document @() tree_sitter_json diff --git a/semantic-json/vendor/tree-sitter-json b/semantic-json/vendor/tree-sitter-json deleted file mode 160000 index 7b6a33f30..000000000 --- a/semantic-json/vendor/tree-sitter-json +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7b6a33f300e3e88c3017e0a9d88c77b50ea6d149 diff --git a/semantic-parse/app/Main.hs b/semantic-parse/app/Main.hs index b94791cf0..475b6ec97 100644 --- a/semantic-parse/app/Main.hs +++ b/semantic-parse/app/Main.hs @@ -14,7 +14,7 @@ import Options.Applicative hiding (style) import Text.Pretty.Simple (pPrint, pPrintNoColor) import Data.Foldable (traverse_) import Control.Monad ((>=>)) -import Marshal.JSON (marshal) +import AST.Marshal.JSON (marshal) import Data.ByteString.Lazy.Char8 (putStrLn) import Data.Aeson.Encode.Pretty (encodePretty) diff --git a/semantic-parse/semantic-parse.cabal b/semantic-parse/semantic-parse.cabal index 4917efc57..67ae9e32e 100644 --- a/semantic-parse/semantic-parse.cabal +++ b/semantic-parse/semantic-parse.cabal @@ -43,7 +43,7 @@ executable semantic-parse build-depends: base , semantic-ast , tree-sitter ^>= 0.9.0.0 - , semantic-source + , semantic-source ^>= 0.1.0 , tree-sitter-python ^>= 0.9.0.1 , bytestring , optparse-applicative diff --git a/semantic-php/semantic-php.cabal b/semantic-php/semantic-php.cabal index dec7fa82b..289e8525b 100644 --- a/semantic-php/semantic-php.cabal +++ b/semantic-php/semantic-php.cabal @@ -26,7 +26,7 @@ common haskell , parsers ^>= 0.12.10 , semantic-ast , semantic-core ^>= 0.0 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , semantic-tags ^>= 0.0 , template-haskell ^>= 2.15 , text ^>= 1.2.3 @@ -54,4 +54,5 @@ library Language.PHP Language.PHP.AST Language.PHP.Grammar + Language.PHP.Tags hs-source-dirs: src diff --git a/semantic-php/src/Language/PHP.hs b/semantic-php/src/Language/PHP.hs index 41a5c60db..9d99329e4 100644 --- a/semantic-php/src/Language/PHP.hs +++ b/semantic-php/src/Language/PHP.hs @@ -1,14 +1,15 @@ --- | Semantic functionality for JSON programs. +-- | Semantic functionality for PHP programs. module Language.PHP ( Term(..) , TreeSitter.PHP.tree_sitter_php ) where +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) -import qualified AST.Unmarshal as TS newtype Term a = Term { getTerm :: PHP.Program a } @@ -19,6 +20,5 @@ instance TS.SymbolMatching Term where 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 _ _ = [] + tags src = Tags.runTagging src . PHPTags.tags . getTerm diff --git a/semantic-php/src/Language/PHP/Tags.hs b/semantic-php/src/Language/PHP/Tags.hs new file mode 100644 index 000000000..0fe8dbb26 --- /dev/null +++ b/semantic-php/src/Language/PHP/Tags.hs @@ -0,0 +1,213 @@ +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE DisambiguateRecordFields #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE OverloadedLists #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} +module Language.PHP.Tags (tags) where + +import AST.Element +import AST.Token +import AST.Traversable1 +import Control.Effect.Reader +import Control.Effect.Writer +import Data.Text (Text) +import qualified Language.PHP.AST as PHP +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 (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 (Writer Tags.Tags) sig m + , Traversable1 ToTags t + ) + => t Loc + -> m () +gtags = traverse1_ @ToTags (const (pure ())) tags + +yieldTag :: (Has (Reader Source) sig m, Has (Writer Tags.Tags) sig m) => Text -> Kind -> Loc -> Range -> m () +yieldTag name kind loc range = do + src <- ask @Source + Tags.yield (Tag name kind loc (Tags.firstLine src range) Nothing) + + +instance ToTags PHP.FunctionDefinition where + tags t@PHP.FunctionDefinition + { PHP.ann = loc@Loc { byteRange } + , PHP.name = PHP.Name { text } + } = yieldTag text Method loc byteRange >> gtags t + +instance ToTags PHP.MethodDeclaration where + tags t@PHP.MethodDeclaration + { PHP.ann = loc@Loc { byteRange } + , PHP.name = PHP.Name { text } + } = yieldTag text Function loc byteRange >> gtags t + +instance ToTags PHP.FunctionCallExpression where + tags t@PHP.FunctionCallExpression + { PHP.ann = loc@Loc { byteRange } + , PHP.function = func + } = match func + where + yield name = yieldTag name Call loc byteRange >> gtags t + match expr = case expr of + Prj (PHP.VariableName { extraChildren = PHP.Name { text } }) + -> yield text *> gtags t + Prj (PHP.QualifiedName { extraChildren = [Prj (PHP.Name { text })] }) + -> yield text *> gtags t + _ + -> gtags t + +instance ToTags PHP.MemberCallExpression where + tags t@PHP.MemberCallExpression + { PHP.ann = loc@Loc { byteRange } + , PHP.name = item + } = case item of + Prj (PHP.Name { text }) -> yieldTag text Call loc byteRange >> gtags 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.NewVariable +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-php/vendor/tree-sitter-php b/semantic-php/vendor/tree-sitter-php deleted file mode 160000 index 6bb7e0421..000000000 --- a/semantic-php/vendor/tree-sitter-php +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6bb7e04216eae8314e0b893029590247418b5998 diff --git a/semantic-python/bench/Bench.hs b/semantic-python/bench/Bench.hs index 078e830df..2e8b1d42b 100644 --- a/semantic-python/bench/Bench.hs +++ b/semantic-python/bench/Bench.hs @@ -8,8 +8,8 @@ import qualified Data.ByteString as B import Gauge import System.Exit (die) import System.Environment (getArgs) -import Language.Python.Grammar import qualified Language.Python.AST as Py +import Language.Python.Grammar import AST.Unmarshal main :: IO () diff --git a/semantic-python/semantic-python.cabal b/semantic-python/semantic-python.cabal index f59ca0f57..5a9e20014 100644 --- a/semantic-python/semantic-python.cabal +++ b/semantic-python/semantic-python.cabal @@ -27,14 +27,14 @@ common haskell , semantic-analysis ^>= 0 , semantic-ast , semantic-core ^>= 0.0 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , semantic-tags ^>= 0.0 , semantic-scope-graph ^>= 0.0 , semilattices ^>= 0 , template-haskell ^>= 2.15 , text ^>= 1.2.3 , tree-sitter ^>= 0.9 - , tree-sitter-python ^>= 0.9.0.1 + , tree-sitter-python ^>= 0.9.0.2 , containers ghc-options: -Weverything @@ -116,18 +116,17 @@ test-suite test import: haskell type: exitcode-stdio-1.0 hs-source-dirs: test - main-is: Test.hs + main-is: PreciseTest.hs build-depends: base - , tree-sitter - , tree-sitter-python - , semantic-ast , bytestring ^>= 0.10.8.2 , hedgehog >= 0.6 && <2 , pathtype ^>= 0.8.1 - , text + , semantic-ast + , semantic-python , tasty , tasty-hedgehog , tasty-hunit + , text executable benchmark import: haskell @@ -138,5 +137,4 @@ executable benchmark base , gauge ^>= 0.2.5 , bytestring - , tree-sitter - , tree-sitter-python + , semantic-python diff --git a/semantic-python/src/Language/Python/AST.hs b/semantic-python/src/Language/Python/AST.hs index 0db2bb614..fd88ab06e 100644 --- a/semantic-python/src/Language/Python/AST.hs +++ b/semantic-python/src/Language/Python/AST.hs @@ -12,11 +12,12 @@ module Language.Python.AST ( module Language.Python.AST +, Python.getTestCorpusDir ) where import Prelude hiding (False, Float, Integer, String, True) import AST.GenerateSyntax import Language.Haskell.TH.Syntax (runIO) -import qualified TreeSitter.Python as Python (getNodeTypesPath, tree_sitter_python) +import qualified TreeSitter.Python as Python (getNodeTypesPath, getTestCorpusDir, tree_sitter_python) runIO Python.getNodeTypesPath >>= astDeclarationsForLanguage Python.tree_sitter_python diff --git a/semantic-python/src/Language/Python/ScopeGraph.hs b/semantic-python/src/Language/Python/ScopeGraph.hs index 8ba1f6996..83aa11e3e 100644 --- a/semantic-python/src/Language/Python/ScopeGraph.hs +++ b/semantic-python/src/Language/Python/ScopeGraph.hs @@ -33,7 +33,6 @@ import Data.List.NonEmpty (NonEmpty (..)) import Data.Maybe import Data.Monoid import qualified Data.ScopeGraph as ScopeGraph -import Data.Semilattice.Lower import Data.Traversable import GHC.Records import GHC.TypeLits @@ -42,7 +41,7 @@ import Language.Python.Patterns import Scope.Graph.Convert (Result (..), complete, todo) import Scope.Types import Source.Loc (Loc) -import Source.Span (Span, span_) +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 @@ -197,7 +196,7 @@ instance ToScopeGraph Py.FunctionDefinition where { Props.kind = ScopeGraph.Parameter , Props.relation = ScopeGraph.Default , Props.associatedScope = Nothing - , Props.span = lowerBound + , Props.span = point (Pos 0 0) } let param (Py.Parameter (Prj (Py.Identifier pann pname))) = Just (pann, Name.name pname) param _ = Nothing diff --git a/semantic-python/src/Language/Python/Tags.hs b/semantic-python/src/Language/Python/Tags.hs index 192a9cf20..c6600a623 100644 --- a/semantic-python/src/Language/Python/Tags.hs +++ b/semantic-python/src/Language/Python/Tags.hs @@ -14,6 +14,7 @@ import AST.Token import AST.Traversable1 import Control.Effect.Reader import Control.Effect.Writer +import Data.Foldable import Data.List.NonEmpty (NonEmpty (..)) import Data.Maybe (listToMaybe) import Data.Text as Text @@ -54,8 +55,15 @@ keywordFunctionCall => t Loc -> Loc -> Range -> Text -> m () keywordFunctionCall t loc range name = yieldTag name Function loc range Nothing >> gtags t +instance ToTags Py.String where + tags Py.String { extraChildren } = for_ extraChildren $ \ x -> case x of + Prj t@Py.Interpolation { } -> tags t + _ -> pure () + instance ToTags Py.Interpolation where - tags Py.Interpolation { } = pure () + tags Py.Interpolation { extraChildren } = for_ extraChildren $ \ x -> case x of + 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" @@ -211,7 +219,6 @@ instance ToTags Py.Set instance ToTags Py.SetComprehension instance ToTags Py.SimpleStatement instance ToTags Py.Slice -instance ToTags Py.String instance ToTags Py.Subscript instance ToTags Py.True instance ToTags Py.TryStatement diff --git a/semantic-python/test-graphing/GraphTest.hs b/semantic-python/test-graphing/GraphTest.hs index 1918aab7c..9dfc0f186 100644 --- a/semantic-python/test-graphing/GraphTest.hs +++ b/semantic-python/test-graphing/GraphTest.hs @@ -58,7 +58,7 @@ The graph should be 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 (Path.toString p) "Python" mempty + info = ModuleInfo p "Python" mempty sampleGraphThing :: ScopeGraphEff sig m => m Result sampleGraphThing = do @@ -66,24 +66,24 @@ sampleGraphThing = do declare "goodbye" (Props.Declaration ScopeGraph.Assignment ScopeGraph.Default Nothing (Span (Pos 3 0) (Pos 3 12))) pure Complete -graphFile :: FilePath -> IO (ScopeGraph.ScopeGraph Name, Result) +graphFile :: Path.AbsRelFile -> IO (ScopeGraph.ScopeGraph Name, Result) graphFile fp = do - file <- ByteString.readFile fp + file <- ByteString.readFile $ Path.toString fp tree <- TS.parseByteString @Py.Term @Loc TSP.tree_sitter_python file pyModule <- either die pure tree - pure $ runScopeGraph (Path.absRel fp) (Source.fromUTF8 file) pyModule + pure $ runScopeGraph fp (Source.fromUTF8 file) pyModule assertSimpleAssignment :: HUnit.Assertion assertSimpleAssignment = do - let path = "semantic-python/test/fixtures/1-04-toplevel-assignment.py" + 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 = "semantic-python/test/fixtures/5-01-simple-reference.py" + 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 @@ -115,7 +115,7 @@ expectedImportHole = do assertLexicalScope :: HUnit.Assertion assertLexicalScope = do - let path = "semantic-python/test/fixtures/5-02-simple-function.py" + 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 @@ -132,7 +132,7 @@ expectedLexicalScope = do assertFunctionArg :: HUnit.Assertion assertFunctionArg = do - let path = "semantic-python/test/fixtures/5-03-function-argument.py" + 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 @@ -154,7 +154,7 @@ expectedFunctionArg = do assertImportHole :: HUnit.Assertion assertImportHole = do - let path = "semantic-python/test/fixtures/cheese/6-01-imports.py" + 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 @@ -163,7 +163,7 @@ assertImportHole = do assertQualifiedImport :: HUnit.Assertion assertQualifiedImport = do - let path = "semantic-python/test/fixtures/cheese/6-01-qualified-imports.py" + 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 diff --git a/semantic-python/test/PreciseTest.hs b/semantic-python/test/PreciseTest.hs index 6d5c09479..c9ae4369d 100644 --- a/semantic-python/test/PreciseTest.hs +++ b/semantic-python/test/PreciseTest.hs @@ -10,7 +10,8 @@ import AST.Unmarshal main :: IO () main - = readCorpusFiles (Path.relDir "tree-sitter-python/vendor/tree-sitter-python/test/corpus") + = Path.absDir <$> Py.getTestCorpusDir + >>= readCorpusFiles' >>= traverse (testCorpus parse) >>= defaultMain . tests where parse = parseByteString @Py.Module @() tree_sitter_python diff --git a/semantic-python/vendor/tree-sitter-python b/semantic-python/vendor/tree-sitter-python deleted file mode 160000 index 899ac8d5d..000000000 --- a/semantic-python/vendor/tree-sitter-python +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 899ac8d5d6c883b2f05362c9953e14e78aac474c diff --git a/semantic-ruby/semantic-ruby.cabal b/semantic-ruby/semantic-ruby.cabal index abfb46d3c..5536335f4 100644 --- a/semantic-ruby/semantic-ruby.cabal +++ b/semantic-ruby/semantic-ruby.cabal @@ -26,12 +26,12 @@ common haskell , parsers ^>= 0.12.10 , semantic-ast , semantic-core ^>= 0.0 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , semantic-tags ^>= 0.0 , template-haskell ^>= 2.15 , text ^>= 1.2.3 , tree-sitter ^>= 0.9 - , tree-sitter-ruby ^>= 0.5.0.1 + , tree-sitter-ruby ^>= 0.5.0.2 ghc-options: -Weverything @@ -63,16 +63,15 @@ test-suite test hs-source-dirs: test main-is: Test.hs build-depends: base - , tree-sitter - , tree-sitter-ruby - , semantic-ast , bytestring ^>= 0.10.8.2 , hedgehog >= 0.6 && <2 , pathtype ^>= 0.8.1 - , text + , semantic-ast + , semantic-ruby , tasty , tasty-hedgehog , tasty-hunit + , text executable benchmarks import: haskell @@ -87,8 +86,7 @@ executable benchmarks , Glob , lens >= 4.17 && < 4.19 , pathtype ^>= 0.8.1 - , tree-sitter - , tree-sitter-ruby + , semantic-ruby executable tree-sitter-ruby import: haskell @@ -97,5 +95,4 @@ executable tree-sitter-ruby main-is: Main.hs build-depends: base , bytestring - , tree-sitter - , tree-sitter-ruby + , semantic-ruby diff --git a/semantic-ruby/src/Language/Ruby/AST.hs b/semantic-ruby/src/Language/Ruby/AST.hs index 4e3ce2426..0e6cc0db2 100644 --- a/semantic-ruby/src/Language/Ruby/AST.hs +++ b/semantic-ruby/src/Language/Ruby/AST.hs @@ -12,11 +12,12 @@ module Language.Ruby.AST ( module Language.Ruby.AST +, Ruby.getTestCorpusDir ) where import Prelude hiding (False, Float, Integer, Rational, String, True) import AST.GenerateSyntax import Language.Haskell.TH.Syntax (runIO) -import qualified TreeSitter.Ruby as Ruby (getNodeTypesPath, tree_sitter_ruby) +import qualified TreeSitter.Ruby as Ruby (getNodeTypesPath, getTestCorpusDir, tree_sitter_ruby) runIO Ruby.getNodeTypesPath >>= astDeclarationsForLanguage Ruby.tree_sitter_ruby diff --git a/semantic-ruby/test/Test.hs b/semantic-ruby/test/Test.hs index 6c910caf6..edcf053f4 100644 --- a/semantic-ruby/test/Test.hs +++ b/semantic-ruby/test/Test.hs @@ -7,10 +7,15 @@ import TreeSitter.Ruby import qualified TreeSitter.Ruby.AST as Rb import AST.TestHelpers import AST.Unmarshal +import qualified Language.Ruby.AST as Rb +import Language.Ruby.Grammar +import qualified System.Path as Path +import Test.Tasty main :: IO () main - = readCorpusFiles (Path.relDir "tree-sitter-ruby/vendor/tree-sitter-ruby/test/corpus") + = Path.absDir <$> Rb.getTestCorpusDir + >>= readCorpusFiles' >>= traverse (testCorpus parse) >>= defaultMain . tests where parse = parseByteString @Rb.Program @() tree_sitter_ruby diff --git a/semantic-ruby/vendor/tree-sitter-ruby b/semantic-ruby/vendor/tree-sitter-ruby deleted file mode 160000 index eb2b6225b..000000000 --- a/semantic-ruby/vendor/tree-sitter-ruby +++ /dev/null @@ -1 +0,0 @@ -Subproject commit eb2b6225bfb80010f2e4cbd27db8c6f3775230b5 diff --git a/semantic-scope-graph/semantic-scope-graph.cabal b/semantic-scope-graph/semantic-scope-graph.cabal index 51c9b908a..2edad461e 100644 --- a/semantic-scope-graph/semantic-scope-graph.cabal +++ b/semantic-scope-graph/semantic-scope-graph.cabal @@ -47,7 +47,7 @@ library , lens , pathtype , semantic-analysis - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , semilattices , text ^>= 1.2.3.1 hs-source-dirs: src diff --git a/semantic-scope-graph/src/Data/Module.hs b/semantic-scope-graph/src/Data/Module.hs index 896fdcd17..885bc96b6 100644 --- a/semantic-scope-graph/src/Data/Module.hs +++ b/semantic-scope-graph/src/Data/Module.hs @@ -14,6 +14,7 @@ import Data.Maybe import Data.Semilattice.Lower import Data.Text (Text) import GHC.Stack +import qualified System.Path as Path data Module body = Module { moduleInfo :: ModuleInfo, moduleBody :: body } deriving (Eq, Foldable, Functor, Ord, Traversable) @@ -22,20 +23,20 @@ instance Show body => Show (Module body) where showsPrec d Module{..} = showsBinaryWith showsPrec showsPrec "Module" d (modulePath moduleInfo) moduleBody -type ModulePath = FilePath +type ModulePath = Path.AbsRelFile data ModuleInfo = ModuleInfo { modulePath :: ModulePath, moduleLanguage :: Text, moduleOid :: Text } deriving (Eq, Ord) instance Lower ModuleInfo where - lowerBound = ModuleInfo mempty "Unknown" mempty + lowerBound = ModuleInfo (Path.toAbsRel Path.emptyFile) "Unknown" mempty instance Show ModuleInfo where showsPrec d = showsUnaryWith showsPrec "ModuleInfo" d . modulePath moduleInfoFromSrcLoc :: SrcLoc -> ModuleInfo -moduleInfoFromSrcLoc loc = ModuleInfo (srcLocModule loc) "Unknown" mempty +moduleInfoFromSrcLoc loc = ModuleInfo (Path.absRel $ 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)) +moduleInfoFromCallStack = maybe (ModuleInfo (Path.absRel "?") "Unknown" mempty) (moduleInfoFromSrcLoc . snd) (listToMaybe (getCallStack callStack)) diff --git a/semantic-scope-graph/src/Scope/Info.hs b/semantic-scope-graph/src/Scope/Info.hs index c735b0ab9..5f41f34cf 100644 --- a/semantic-scope-graph/src/Scope/Info.hs +++ b/semantic-scope-graph/src/Scope/Info.hs @@ -37,7 +37,7 @@ instance HasSpan (Info scopeAddress) where {-# INLINE span_ #-} instance Lower (Info scopeAddress) where - lowerBound = Info lowerBound lowerBound lowerBound Public lowerBound lowerBound Nothing + lowerBound = Info lowerBound lowerBound lowerBound Public (point (Pos 0 0)) lowerBound Nothing instance AbstractHole (Info address) where hole = lowerBound diff --git a/semantic-source/CHANGELOG.md b/semantic-source/CHANGELOG.md index 96550f62e..a8c272f36 100644 --- a/semantic-source/CHANGELOG.md +++ b/semantic-source/CHANGELOG.md @@ -1,3 +1,9 @@ +# 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`. diff --git a/semantic-source/semantic-source.cabal b/semantic-source/semantic-source.cabal index fa1024711..c53790dd1 100644 --- a/semantic-source/semantic-source.cabal +++ b/semantic-source/semantic-source.cabal @@ -55,7 +55,7 @@ library , containers ^>= 0.6.2 , generic-monoid ^>= 0.1.0.0 , hashable >= 1.2.7 && < 1.4 - , lingo ^>= 0.3 + , lingo ^>= 0.3.2.0 , pathtype ^>= 0.8.1 , semilattices ^>= 0.0.0.3 , text ^>= 1.2.3.1 diff --git a/semantic-source/src/Source/Language.hs b/semantic-source/src/Source/Language.hs index 05c91e551..0019c99d5 100644 --- a/semantic-source/src/Source/Language.hs +++ b/semantic-source/src/Source/Language.hs @@ -33,11 +33,12 @@ data Language | JSON | JSX | Markdown + | PHP | Python | Ruby | TypeScript - | PHP | TSX + | CodeQL deriving (Eq, Generic, Ord, Read, Show, Bounded, Hashable, ToJSON, Enum) -- | Reifies a proxied type-level 'Language' to a value. @@ -47,6 +48,9 @@ class SLanguage (lang :: Language) where instance SLanguage 'Unknown where reflect _ = Unknown +instance SLanguage 'CodeQL where + reflect _ = CodeQL + instance SLanguage 'Go where reflect _ = Go @@ -68,6 +72,9 @@ instance SLanguage 'JSX where instance SLanguage 'Markdown where reflect _ = Markdown +instance SLanguage 'PHP where + reflect _ = PHP + instance SLanguage 'Python where reflect _ = Python @@ -77,9 +84,6 @@ instance SLanguage 'Ruby where instance SLanguage 'TypeScript where reflect _ = TypeScript -instance SLanguage 'PHP where - reflect _ = PHP - instance FromJSON Language where parseJSON = withText "Language" $ \l -> pure $ textToLanguage l @@ -106,6 +110,7 @@ forPath path = languageToText :: Language -> T.Text languageToText = \case Unknown -> "Unknown" + CodeQL -> "CodeQL" Go -> "Go" Haskell -> "Haskell" Java -> "Java" @@ -113,14 +118,15 @@ languageToText = \case JSON -> "JSON" JSX -> "JSX" Markdown -> "Markdown" + PHP -> "PHP" Python -> "Python" Ruby -> "Ruby" TypeScript -> "TypeScript" TSX -> "TSX" - PHP -> "PHP" textToLanguage :: T.Text -> Language textToLanguage = \case + "CodeQL" -> CodeQL "Go" -> Go "Haskell" -> Haskell "Java" -> Java @@ -128,9 +134,9 @@ textToLanguage = \case "JSON" -> JSON "JSX" -> JSX "Markdown" -> Markdown + "PHP" -> PHP "Python" -> Python "Ruby" -> Ruby "TypeScript" -> TypeScript "TSX" -> TSX - "PHP" -> PHP _ -> Unknown diff --git a/semantic-tags/semantic-tags.cabal b/semantic-tags/semantic-tags.cabal index 6c547c73c..dcb9e267f 100644 --- a/semantic-tags/semantic-tags.cabal +++ b/semantic-tags/semantic-tags.cabal @@ -25,7 +25,7 @@ library build-depends: base >= 4.13 && < 5 , fused-effects ^>= 1.0 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , text ^>= 1.2.3.1 hs-source-dirs: src default-language: Haskell2010 diff --git a/semantic-tsx/semantic-tsx.cabal b/semantic-tsx/semantic-tsx.cabal index 63cd2ed52..49ea77fd2 100644 --- a/semantic-tsx/semantic-tsx.cabal +++ b/semantic-tsx/semantic-tsx.cabal @@ -26,12 +26,12 @@ common haskell , parsers ^>= 0.12.10 , semantic-ast , semantic-core ^>= 0.0 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , semantic-tags ^>= 0.0 , template-haskell ^>= 2.15 , text ^>= 1.2.3 , tree-sitter ^>= 0.9 - , tree-sitter-tsx ^>= 0.5.0.0 + , tree-sitter-tsx ^>= 0.5.0.1 ghc-options: -Weverything @@ -63,13 +63,12 @@ test-suite test hs-source-dirs: test main-is: Test.hs build-depends: base - , tree-sitter - , tree-sitter-tsx - , semantic-ast , bytestring ^>= 0.10.8.2 , hedgehog >= 0.6 && <2 , pathtype ^>= 0.8.1 - , text + , semantic-ast + , semantic-tsx , tasty , tasty-hedgehog , tasty-hunit + , text diff --git a/semantic-tsx/src/Language/TSX/AST.hs b/semantic-tsx/src/Language/TSX/AST.hs index 77bf7bda0..dda33df97 100644 --- a/semantic-tsx/src/Language/TSX/AST.hs +++ b/semantic-tsx/src/Language/TSX/AST.hs @@ -12,11 +12,12 @@ module Language.TSX.AST ( module Language.TSX.AST +, TSX.getTestCorpusDir ) where import Prelude hiding (False, Float, Integer, String, True) import AST.GenerateSyntax import Language.Haskell.TH.Syntax (runIO) -import qualified TreeSitter.TSX as TSX (getNodeTypesPath, tree_sitter_tsx) +import qualified TreeSitter.TSX as TSX (getNodeTypesPath, getTestCorpusDir, tree_sitter_tsx) runIO TSX.getNodeTypesPath >>= astDeclarationsForLanguage TSX.tree_sitter_tsx diff --git a/semantic-tsx/src/Language/TSX/Tags.hs b/semantic-tsx/src/Language/TSX/Tags.hs index 60351bf05..788d968e5 100644 --- a/semantic-tsx/src/Language/TSX/Tags.hs +++ b/semantic-tsx/src/Language/TSX/Tags.hs @@ -68,6 +68,18 @@ instance ToTags Tsx.MethodDefinition where where yield name = yieldTag name Method loc byteRange >> gtags t +instance ToTags Tsx.Pair where + tags t@Tsx.Pair + { ann = loc@Loc { byteRange } + , key + , value = Tsx.Expression expr + } = case (key, expr) of + (Prj Tsx.PropertyIdentifier { text }, Prj Tsx.Function{}) -> yield text + (Prj Tsx.PropertyIdentifier { text }, Prj Tsx.ArrowFunction{}) -> yield text + _ -> gtags t + where + yield text = yieldTag text Function loc byteRange >> gtags t + instance ToTags Tsx.ClassDeclaration where tags t@Tsx.ClassDeclaration { ann = loc@Loc { byteRange } @@ -112,6 +124,34 @@ instance ToTags Tsx.Module where _ -> gtags t yield text = yieldTag text Module loc byteRange >> gtags t +instance ToTags Tsx.VariableDeclarator where + tags t@Tsx.VariableDeclarator + { ann = loc@Loc { byteRange } + , name + , value = Just (Tsx.Expression expr) + } = case (expr, name) of + (Prj Tsx.Function{}, Prj Tsx.Identifier { text }) -> yield text + (Prj Tsx.ArrowFunction{}, Prj Tsx.Identifier { text }) -> yield text + _ -> gtags t + where + yield text = yieldTag text Function loc byteRange >> gtags t + tags t = gtags t + +instance ToTags Tsx.AssignmentExpression where + tags t@Tsx.AssignmentExpression + { ann = loc@Loc { byteRange } + , left + , right = (Tsx.Expression expr) + } = case (left, expr) of + (Prj Tsx.Identifier { text }, Prj Tsx.Function{}) -> yield text + (Prj Tsx.Identifier { text }, Prj Tsx.ArrowFunction{}) -> yield text + (Prj Tsx.MemberExpression { property = Tsx.PropertyIdentifier { text } }, Prj Tsx.Function{}) -> yield text + (Prj Tsx.MemberExpression { property = Tsx.PropertyIdentifier { text } }, Prj Tsx.ArrowFunction{}) -> yield text + _ -> gtags t + where + yield text = yieldTag text Function loc byteRange >> gtags t + + instance (ToTags l, ToTags r) => ToTags (l :+: r) where tags (L1 l) = tags l tags (R1 r) = tags r @@ -151,7 +191,7 @@ instance ToTags Tsx.ArrayPattern instance ToTags Tsx.ArrayType instance ToTags Tsx.ArrowFunction instance ToTags Tsx.AsExpression -instance ToTags Tsx.AssignmentExpression +-- instance ToTags Tsx.AssignmentExpression instance ToTags Tsx.AssignmentPattern instance ToTags Tsx.AugmentedAssignmentExpression instance ToTags Tsx.AwaitExpression @@ -246,7 +286,7 @@ instance ToTags Tsx.Object instance ToTags Tsx.ObjectPattern instance ToTags Tsx.ObjectType instance ToTags Tsx.OptionalParameter -instance ToTags Tsx.Pair +-- instance ToTags Tsx.Pair instance ToTags Tsx.ParenthesizedExpression instance ToTags Tsx.ParenthesizedType instance ToTags Tsx.PredefinedType @@ -295,7 +335,7 @@ instance ToTags Tsx.Undefined instance ToTags Tsx.UnionType instance ToTags Tsx.UpdateExpression instance ToTags Tsx.VariableDeclaration -instance ToTags Tsx.VariableDeclarator +-- instance ToTags Tsx.VariableDeclarator instance ToTags Tsx.WhileStatement instance ToTags Tsx.WithStatement instance ToTags Tsx.YieldExpression diff --git a/semantic-tsx/test/Test.hs b/semantic-tsx/test/Test.hs index 467606ff6..8f8f3e753 100644 --- a/semantic-tsx/test/Test.hs +++ b/semantic-tsx/test/Test.hs @@ -7,13 +7,18 @@ import TreeSitter.TSX import qualified TreeSitter.TSX.AST as Ts import AST.TestHelpers import AST.Unmarshal +import qualified Language.TSX.AST as Tsx +import Language.TSX.Grammar +import qualified System.Path as Path +import Test.Tasty main :: IO () main - = readCorpusFiles (Path.relDir "tree-sitter-tsx/vendor/tree-sitter-typescript/tsx/corpus") + = Path.absDir <$> Tsx.getTestCorpusDir + >>= readCorpusFiles' >>= traverse (testCorpus parse) >>= defaultMain . tests - where parse = parseByteString @Ts.Program @() tree_sitter_tsx + where parse = parseByteString @Tsx.Program @() tree_sitter_tsx tests :: [TestTree] -> TestTree tests = testGroup "tree-sitter-tsx corpus tests" diff --git a/semantic-tsx/vendor/tree-sitter-typescript b/semantic-tsx/vendor/tree-sitter-typescript deleted file mode 160000 index aa950f58e..000000000 --- a/semantic-tsx/vendor/tree-sitter-typescript +++ /dev/null @@ -1 +0,0 @@ -Subproject commit aa950f58ea8aa112bc72f3481b98fc2d3c07b3e0 diff --git a/semantic-typescript/semantic-typescript.cabal b/semantic-typescript/semantic-typescript.cabal index 7257d9ee1..37c143341 100644 --- a/semantic-typescript/semantic-typescript.cabal +++ b/semantic-typescript/semantic-typescript.cabal @@ -26,12 +26,12 @@ common haskell , parsers ^>= 0.12.10 , semantic-ast , semantic-core ^>= 0.0 - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , semantic-tags ^>= 0.0 , template-haskell ^>= 2.15 , text ^>= 1.2.3 , tree-sitter ^>= 0.9.0.0 - , tree-sitter-typescript ^>= 0.5.0.0 + , tree-sitter-typescript ^>= 0.5.0.1 ghc-options: -Weverything @@ -63,13 +63,12 @@ test-suite test hs-source-dirs: test main-is: Test.hs build-depends: base - , tree-sitter - , tree-sitter-typescript - , semantic-ast , bytestring ^>= 0.10.8.2 , hedgehog >= 0.6 && <2 , pathtype ^>= 0.8.1 - , text + , semantic-ast + , semantic-typescript , tasty , tasty-hedgehog , tasty-hunit + , text diff --git a/semantic-typescript/src/Language/TypeScript/AST.hs b/semantic-typescript/src/Language/TypeScript/AST.hs index fd755b4e9..54077fb09 100644 --- a/semantic-typescript/src/Language/TypeScript/AST.hs +++ b/semantic-typescript/src/Language/TypeScript/AST.hs @@ -12,11 +12,12 @@ module Language.TypeScript.AST ( module Language.TypeScript.AST +, TypeScript.getTestCorpusDir ) where import Prelude hiding (False, Float, Integer, String, True) import AST.GenerateSyntax import Language.Haskell.TH.Syntax (runIO) -import qualified TreeSitter.TypeScript as TypeScript (getNodeTypesPath, tree_sitter_typescript) +import qualified TreeSitter.TypeScript as TypeScript (getNodeTypesPath, getTestCorpusDir, tree_sitter_typescript) runIO TypeScript.getNodeTypesPath >>= astDeclarationsForLanguage TypeScript.tree_sitter_typescript diff --git a/semantic-typescript/src/Language/TypeScript/Tags.hs b/semantic-typescript/src/Language/TypeScript/Tags.hs index d54637b1f..b2d782901 100644 --- a/semantic-typescript/src/Language/TypeScript/Tags.hs +++ b/semantic-typescript/src/Language/TypeScript/Tags.hs @@ -68,6 +68,18 @@ instance ToTags Ts.MethodDefinition where where yield name = yieldTag name Method loc byteRange >> gtags t +instance ToTags Ts.Pair where + tags t@Ts.Pair + { ann = loc@Loc { byteRange } + , key + , value = Ts.Expression expr + } = case (key, expr) of + (Prj Ts.PropertyIdentifier { text }, Prj Ts.Function{}) -> yield text + (Prj Ts.PropertyIdentifier { text }, Prj Ts.ArrowFunction{}) -> yield text + _ -> gtags t + where + yield text = yieldTag text Function loc byteRange >> gtags t + instance ToTags Ts.ClassDeclaration where tags t@Ts.ClassDeclaration { ann = loc@Loc { byteRange } @@ -101,10 +113,38 @@ instance ToTags Ts.Module where match expr = case expr of Prj Ts.Identifier { text } -> yield text -- TODO: Handle NestedIdentifiers and Strings - -- Prj Tsx.NestedIdentifier { extraChildren } -> match + -- Prj Ts.NestedIdentifier { extraChildren } -> match _ -> gtags t yield text = yieldTag text Module loc byteRange >> gtags t +instance ToTags Ts.VariableDeclarator where + tags t@Ts.VariableDeclarator + { ann = loc@Loc { byteRange } + , name + , value = Just (Ts.Expression expr) + } = case (expr, name) of + (Prj Ts.Function{}, Prj Ts.Identifier { text }) -> yield text + (Prj Ts.ArrowFunction{}, Prj Ts.Identifier { text }) -> yield text + _ -> gtags t + where + yield text = yieldTag text Function loc byteRange >> gtags t + tags t = gtags t + +instance ToTags Ts.AssignmentExpression where + tags t@Ts.AssignmentExpression + { ann = loc@Loc { byteRange } + , left + , right = (Ts.Expression expr) + } = case (left, expr) of + (Prj Ts.Identifier { text }, Prj Ts.Function{}) -> yield text + (Prj Ts.Identifier { text }, Prj Ts.ArrowFunction{}) -> yield text + (Prj Ts.MemberExpression { property = Ts.PropertyIdentifier { text } }, Prj Ts.Function{}) -> yield text + (Prj Ts.MemberExpression { property = Ts.PropertyIdentifier { text } }, Prj Ts.ArrowFunction{}) -> yield text + _ -> gtags t + where + yield text = yieldTag text Function loc byteRange >> gtags t + + instance (ToTags l, ToTags r) => ToTags (l :+: r) where tags (L1 l) = tags l tags (R1 r) = tags r @@ -144,7 +184,7 @@ instance ToTags Ts.ArrayPattern instance ToTags Ts.ArrayType instance ToTags Ts.ArrowFunction instance ToTags Ts.AsExpression -instance ToTags Ts.AssignmentExpression +-- instance ToTags Ts.AssignmentExpression instance ToTags Ts.AssignmentPattern instance ToTags Ts.AugmentedAssignmentExpression instance ToTags Ts.AwaitExpression @@ -239,7 +279,7 @@ instance ToTags Ts.Object instance ToTags Ts.ObjectPattern instance ToTags Ts.ObjectType instance ToTags Ts.OptionalParameter -instance ToTags Ts.Pair +-- instance ToTags Ts.Pair instance ToTags Ts.ParenthesizedExpression instance ToTags Ts.ParenthesizedType instance ToTags Ts.PredefinedType @@ -289,7 +329,7 @@ instance ToTags Ts.Undefined instance ToTags Ts.UnionType instance ToTags Ts.UpdateExpression instance ToTags Ts.VariableDeclaration -instance ToTags Ts.VariableDeclarator +-- instance ToTags Ts.VariableDeclarator instance ToTags Ts.WhileStatement instance ToTags Ts.WithStatement instance ToTags Ts.YieldExpression diff --git a/semantic-typescript/test/Test.hs b/semantic-typescript/test/Test.hs index 3d3126d49..aa60c7c42 100644 --- a/semantic-typescript/test/Test.hs +++ b/semantic-typescript/test/Test.hs @@ -7,10 +7,15 @@ import TreeSitter.TypeScript import qualified TreeSitter.TypeScript.AST as Ts import AST.TestHelpers import AST.Unmarshal +import qualified Language.TypeScript.AST as Ts +import Language.TypeScript.Grammar +import qualified System.Path as Path +import Test.Tasty main :: IO () main - = readCorpusFiles (Path.relDir "tree-sitter-typescript/vendor/tree-sitter-typescript/typescript/corpus") + = Path.absDir <$> Ts.getTestCorpusDir + >>= readCorpusFiles' >>= traverse (testCorpus parse) >>= defaultMain . tests where parse = parseByteString @Ts.Program @() tree_sitter_typescript diff --git a/semantic-typescript/vendor/tree-sitter-typescript b/semantic-typescript/vendor/tree-sitter-typescript deleted file mode 160000 index 40320d8e0..000000000 --- a/semantic-typescript/vendor/tree-sitter-typescript +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 40320d8e0953db5e173e6dfbb596d375a085ca65 diff --git a/semantic.cabal b/semantic.cabal index c310d299a..c1aa7f8f8 100644 --- a/semantic.cabal +++ b/semantic.cabal @@ -59,7 +59,7 @@ common dependencies , fused-effects-exceptions ^>= 1 , fused-effects-resumable ^>= 0.1 , hashable >= 1.2.7 && < 1.4 - , tree-sitter ^>= 0.9.0.0 + , tree-sitter ^>= 0.9.0.1 , mtl ^>= 2.2.2 , network ^>= 2.8.0.0 , pathtype ^>= 0.8.1 @@ -69,7 +69,7 @@ common dependencies , safe-exceptions ^>= 0.1.7.0 , semantic-analysis ^>= 0 , semantic-ast - , semantic-source ^>= 0.0.2 + , semantic-source ^>= 0.1.0 , semilattices ^>= 0.0.0.3 , streaming ^>= 0.2.2.0 , text ^>= 1.2.3.1 @@ -119,6 +119,7 @@ library , Control.Effect.Parse , Control.Effect.REPL , Control.Effect.Sum.Project + , Control.Effect.Timeout -- Datatypes for abstract interpretation , Data.Abstract.Address.Hole , Data.Abstract.Address.Monovariant @@ -180,9 +181,6 @@ library , Diffing.Algorithm.SES , Diffing.Interpreter -- Language-specific grammar/syntax types, & assignments - , Language.Markdown.Assignment - , Language.Markdown.Syntax - , Language.Markdown.Term , Language.Go.Assignment , Language.Go.Syntax , Language.Go.Term @@ -209,7 +207,6 @@ library , Language.Python.Term , Numeric.Exts -- Parser glue - , Parsing.CMark , Parsing.Parser , Parsing.TreeSitter -- Rendering formats @@ -226,6 +223,7 @@ library , Semantic.Api.Bridge , Semantic.Api.Diffs , Semantic.Api.LegacyTypes + , Semantic.Api.StackGraph , Semantic.Api.Symbols , Semantic.Api.Terms , Semantic.Api.TOCSummaries @@ -243,7 +241,6 @@ library , Semantic.Telemetry.Error , Semantic.Telemetry.Log , Semantic.Telemetry.Stat - , Semantic.Timeout , Semantic.Util , Semantic.Util.Pretty , Semantic.Version @@ -260,7 +257,6 @@ library , ansi-terminal >= 0.8.2 && <1 , array ^>= 0.5.3.0 , attoparsec ^>= 0.13.2.2 - , cmark-gfm == 0.1.8 , deepseq ^>= 1.4.4.0 , directory-tree ^>= 0.12.1 , filepath ^>= 1.4.2.1 diff --git a/src/Analysis/Abstract/Graph.hs b/src/Analysis/Abstract/Graph.hs index 2e738f8e6..0e8594374 100644 --- a/src/Analysis/Abstract/Graph.hs +++ b/src/Analysis/Abstract/Graph.hs @@ -132,9 +132,8 @@ graphingModules recur m = do where -- NB: path is null for Languages like Ruby that have module imports that require concrete value semantics. includeModule path - = let path' = if Prelude.null path then "unknown, concrete semantics required" else path - info = moduleInfo m - in moduleInclusion (moduleVertex (ModuleInfo path' (moduleLanguage info) (moduleOid info))) + = let info = moduleInfo m + in moduleInclusion (moduleVertex (ModuleInfo path (moduleLanguage info) (moduleOid info))) -- | Add vertices to the graph for imported modules. graphingModuleInfo :: ( Has (Reader ModuleInfo) sig m diff --git a/src/Analysis/TOCSummary.hs b/src/Analysis/TOCSummary.hs index 9fe13a96f..858ee6be6 100644 --- a/src/Analysis/TOCSummary.hs +++ b/src/Analysis/TOCSummary.hs @@ -28,15 +28,12 @@ import qualified Data.Error as Error import Data.Flag import Data.Foldable (toList) import Data.Language as Language -import Data.List.NonEmpty (nonEmpty) -import Data.Semigroup (sconcat) import Data.Sum import qualified Data.Syntax as Syntax import qualified Data.Syntax.Declaration as Declaration import Data.Term import Data.Text (Text) import qualified Data.Text as T -import qualified Language.Markdown.Syntax as Markdown import Source.Loc as Loc import Source.Range import Source.Source as Source @@ -110,16 +107,6 @@ class HasDeclarationBy (strategy :: Strategy) syntax where instance HasDeclarationBy 'Default syntax where toDeclarationBy _ _ _ = Nothing - --- | Produce a 'Heading' from the first line of the heading of a 'Markdown.Heading' node. -instance HasDeclarationBy 'Custom Markdown.Heading where - toDeclarationBy blob@Blob{..} ann (Markdown.Heading level terms _) - = Just $ Declaration (Heading level) (headingText terms) (Loc.span ann) (blobLanguage blob) - where headingText terms = getSource $ maybe (byteRange ann) sconcat (nonEmpty (headingByteRange <$> toList terms)) - headingByteRange (t, _) = byteRange (termAnnotation t) - getSource = firstLine . toText . Source.slice blobSource - firstLine = T.takeWhile (/= '\n') - -- | Produce an 'Error' for 'Syntax.Error' nodes. instance HasDeclarationBy 'Custom Syntax.Error where toDeclarationBy blob@Blob{..} ann err@Syntax.Error{} @@ -167,7 +154,6 @@ data Strategy = Default | Custom type family DeclarationStrategy syntax where DeclarationStrategy Declaration.Function = 'Custom DeclarationStrategy Declaration.Method = 'Custom - DeclarationStrategy Markdown.Heading = 'Custom DeclarationStrategy Syntax.Error = 'Custom DeclarationStrategy (Sum _) = 'Custom DeclarationStrategy _ = 'Default diff --git a/src/Assigning/Assignment.hs b/src/Assigning/Assignment.hs index 13dd8bd00..31ad9a65c 100644 --- a/src/Assigning/Assignment.hs +++ b/src/Assigning/Assignment.hs @@ -77,7 +77,6 @@ module Assigning.Assignment , MonadError(..) , MonadFail(..) , location -, currentNode , symbol , rawSource , source @@ -111,7 +110,6 @@ import Data.ByteString (ByteString) import Data.Error import Data.Foldable import Data.Function -import Data.Functor.Classes import Data.Ix import Data.List.NonEmpty (NonEmpty (..), nonEmpty) import Data.Maybe @@ -131,79 +129,74 @@ import TreeSitter.Language -- | 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)) +type Assignment grammar = Freer (Tracing (AssignmentF grammar)) -data AssignmentF ast grammar a where - End :: AssignmentF ast grammar () - Loc :: AssignmentF ast grammar L.Loc - 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 AssignmentF grammar a where + End :: AssignmentF grammar () + Loc :: AssignmentF grammar L.Loc + Source :: AssignmentF grammar ByteString + Children :: Assignment grammar a -> AssignmentF grammar a + Choose :: Table.Table grammar (Assignment grammar a) -> Maybe (Assignment grammar a) -> Maybe (Error (Either String grammar) -> Assignment grammar a) -> AssignmentF grammar a + Many :: Assignment grammar a -> AssignmentF grammar [a] + Alt :: [a] -> AssignmentF grammar a + Label :: Assignment grammar a -> String -> AssignmentF grammar a + Fail :: String -> AssignmentF grammar a + GetLocals :: AssignmentF grammar [Text] + PutLocals :: [Text] -> AssignmentF 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 :: Assignment 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 + _ : 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.Loc +location :: Assignment grammar L.Loc location = tracing Loc `Then` pure -getLocals :: HasCallStack => Assignment ast grammar [Text] +getLocals :: HasCallStack => Assignment grammar [Text] getLocals = tracing GetLocals `Then` pure -putLocals :: HasCallStack => [Text] -> Assignment ast grammar () +putLocals :: HasCallStack => [Text] -> Assignment grammar () putLocals l = tracing (PutLocals l) `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, HasCallStack) => grammar -> Assignment ast grammar L.Loc +symbol :: (Enum grammar, HasCallStack) => grammar -> Assignment grammar L.Loc 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 :: HasCallStack => Assignment 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 :: HasCallStack => Assignment 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 :: HasCallStack => Assignment grammar a -> Assignment grammar a children child = tracing (Children child) `Then` pure -- | Advance past the current node. -advance :: HasCallStack => Assignment ast grammar () +advance :: HasCallStack => Assignment 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 :: (Enum grammar, Ix grammar, HasCallStack) => [Assignment grammar a] -> Assignment 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 :: (Enum grammar, Ix grammar) => Assignment grammar a -> ([(grammar, Assignment grammar a)], [Assignment grammar a], [Error (Either String grammar) -> Assignment 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], []) @@ -215,7 +208,7 @@ choice alternatives mergeHandlers hs = Just (\ err -> asum (hs <*> [err])) -- | Match and advance past a node with the given symbol. -token :: (Enum grammar, HasCallStack) => grammar -> Assignment ast grammar L.Loc +token :: (Enum grammar, HasCallStack) => grammar -> Assignment grammar L.Loc token s = symbol s <* advance @@ -229,7 +222,7 @@ nodeError :: CallStack -> [Either String grammar] -> Node grammar -> Error (Eith nodeError cs expected n@Node{..} = Error (nodeSpan n) expected (Just (Right nodeSymbol)) cs -firstSet :: (Enum grammar, Ix grammar) => Assignment ast grammar a -> [grammar] +firstSet :: (Enum grammar, Ix grammar) => Assignment grammar a -> [grammar] firstSet = iterFreer (\ _ (Tracing _ assignment) -> case assignment of Choose table _ _ -> Table.tableAddresses table Label child _ -> firstSet child @@ -237,34 +230,35 @@ firstSet = iterFreer (\ _ (Tracing _ assignment) -> case assignment of -- | Run an assignment over an AST exhaustively. -assign :: (Symbol 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 :: Symbol grammar + => Source.Source -- ^ The source for the parse tree. + -> Assignment grammar a -- ^ The 'Assignment to run. + -> 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. (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 :: forall grammar a . (Symbol grammar) + => Source.Source -- ^ The source for the parse tree. + -> Assignment grammar a -- ^ The 'Assignment' to run. + -> State grammar -- ^ The current state. + -> Either (Error (Either String grammar)) (a, State 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) + where go :: Assignment grammar result -> State grammar -> Either (Error (Either String grammar)) (result, State 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 :: (x -> State grammar -> Either (Error (Either String grammar)) (result, State grammar)) + -> Tracing (AssignmentF grammar) x + -> State grammar + -> Either (Error (Either String grammar)) (result, State grammar) run yield t initialState = state `seq` maybe (anywhere Nothing) atNode (listToMaybe stateNodes) where atNode (Term (In node f)) = case runTracing t of Loc -> yield (nodeLocation node) state - CurrentNode -> yield (In node (() <$ f)) state + GetLocals -> yield stateLocals state + PutLocals l -> yield () (state { stateLocals = l }) Source -> yield (Source.bytes (Source.slice source (nodeByteRange node))) (advanceState state) Children child -> do (a, state') <- go child state { stateNodes = toList f, stateCallSites = maybe id (:) (tracingCallSite t) stateCallSites } >>= requireExhaustive (tracingCallSite t) @@ -293,7 +287,7 @@ runAssignment source = \ assignment state -> go assignment state >>= requireExha (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 :: Symbol grammar => Maybe (String, SrcLoc) -> (result, State grammar) -> Either (Error (Either String grammar)) (result, State grammar) requireExhaustive callSite (a, state) = let state' = skipTokens state stack = fromCallSiteList (maybe id (:) callSite (stateCallSites state)) @@ -301,42 +295,40 @@ requireExhaustive callSite (a, state) = [] -> Right (a, state') Term (In node _) : _ -> Left (nodeError stack [] node) -skipTokens :: Symbol grammar => State ast grammar -> State ast grammar +skipTokens :: Symbol grammar => State grammar -> State 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 grammar -> State grammar advanceState state@State{..} | Term (In node _) : rest <- stateNodes = State (Range.end (nodeByteRange node)) (Span.end (nodeSpan node)) stateCallSites rest stateLocals | otherwise = state -- | State kept while running 'Assignment's. -data State ast grammar = State +data State 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.” + , stateNodes :: ![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 (Eq, Show) -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 :: [AST grammar] -> State 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 +instance (Enum grammar, Ix grammar) => Alternative (Assignment grammar) where + empty :: HasCallStack => Assignment grammar a empty = tracing (Alt []) `Then` pure - (<|>) :: forall a. Assignment ast grammar a -> Assignment ast grammar a -> Assignment ast grammar a + (<|>) :: forall a. Assignment grammar a -> Assignment grammar a -> Assignment 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 + where go :: forall l r . Maybe (String, SrcLoc) -> AssignmentF grammar l -> (l -> Assignment grammar a) -> Maybe (String, SrcLoc) -> AssignmentF grammar r -> (r -> Assignment grammar a) -> Assignment grammar a go callSiteL la continueL callSiteR ra continueR = case (la, ra) of (Fail _, _) -> r (Alt [], _) -> r @@ -345,34 +337,34 @@ instance (Enum grammar, Eq1 ast, Ix grammar) => Alternative (Assignment ast gram (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 + where alternate :: AssignmentF grammar (Either l r) -> Assignment grammar a alternate a = rebuild a (either continueL continueR) - rebuild :: AssignmentF ast grammar x -> (x -> Assignment ast grammar a) -> Assignment ast grammar a + rebuild :: AssignmentF grammar x -> (x -> Assignment grammar a) -> Assignment grammar a rebuild a c = Tracing (callSiteL <|> callSiteR) a `Then` c - many :: HasCallStack => Assignment ast grammar a -> Assignment ast grammar [a] + many :: HasCallStack => Assignment grammar a -> Assignment grammar [a] many a = tracing (Many a) `Then` pure -instance MonadFail (Assignment ast grammar) where - fail :: HasCallStack => String -> Assignment ast grammar a +instance MonadFail (Assignment grammar) where + fail :: HasCallStack => String -> Assignment grammar a fail s = tracing (Fail s) `Then` pure -instance (Enum grammar, Eq1 ast, Ix grammar, Show grammar) => Parsing (Assignment ast grammar) where +instance (Enum grammar, Ix grammar, Show grammar) => Parsing (Assignment grammar) where try = id - () :: HasCallStack => Assignment ast grammar a -> String -> Assignment ast grammar a + () :: HasCallStack => Assignment grammar a -> String -> Assignment grammar a a s = tracing (Label a s) `Then` pure - unexpected :: String -> Assignment ast grammar a + unexpected :: String -> Assignment grammar a unexpected = fail - eof :: HasCallStack => Assignment ast grammar () + eof :: HasCallStack => Assignment grammar () eof = tracing End `Then` pure - notFollowedBy :: Show a => Assignment ast grammar a -> Assignment ast grammar () + notFollowedBy :: Show a => Assignment grammar a -> Assignment 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 +instance (Enum grammar, Ix grammar, Show grammar) => MonadError (Error (Either String grammar)) (Assignment grammar) where throwError err = fail (show err) catchError rule handler = iterFreer (\ continue (Tracing cs assignment) -> case assignment of diff --git a/src/Control/Abstract/Heap.hs b/src/Control/Abstract/Heap.hs index 9c5756a5f..d34f1feab 100644 --- a/src/Control/Abstract/Heap.hs +++ b/src/Control/Abstract/Heap.hs @@ -77,7 +77,7 @@ import Data.Semilattice.Lower import Data.Set (Set) import GHC.Generics (Generic1) import GHC.Stack -import Source.Span (Span) +import Source.Span (Pos (..), Span, point) -- | Evaluates an action locally the scope and frame of the given frame address. @@ -191,7 +191,7 @@ define :: ( HasCallStack -> Evaluator term address value m () define declaration rel accessControl def = withCurrentCallStack callStack $ do -- TODO: This span is still wrong. - declare declaration rel accessControl lowerBound Unknown Nothing + declare declaration rel accessControl (point (Pos 1 1)) Unknown Nothing slot <- lookupSlot declaration value <- def assign slot value diff --git a/src/Control/Abstract/Modules.hs b/src/Control/Abstract/Modules.hs index c39b7f477..a259338b3 100644 --- a/src/Control/Abstract/Modules.hs +++ b/src/Control/Abstract/Modules.hs @@ -40,12 +40,11 @@ import Control.Monad.IO.Class import Data.Foldable import Data.Functor.Classes import Data.Maybe.Exts -import Data.Semilattice.Lower import Data.Set (Set) import qualified Data.Set as Set import GHC.Generics (Generic1) import Source.Span -import System.FilePath.Posix (takeDirectory) +import qualified System.Path as Path import Control.Abstract.Evaluator import Data.Abstract.BaseError @@ -116,8 +115,8 @@ instance ( Has (Reader (ModuleTable (Module (ModuleResult address value)))) sig 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)) + Resolve names k -> k (find (`Set.member` paths) (map Path.absRel names)) + List dir k -> k (filter ((dir ==) . Path.toString . Path.takeDirectory) (toList paths)) alg (R other) = ModulesC (alg (R (handleCoercible other))) askModuleTable :: Has (Reader (ModuleTable (Module (ModuleResult address value)))) sig m => m (ModuleTable (Module (ModuleResult address value))) @@ -147,7 +146,7 @@ runLoadErrorWith f = raiseHandler $ With.runResumable (runEvaluator . f) throwLoadError :: Has (Resumable (BaseError (LoadError address value))) sig m => LoadError address value resume -> m resume -throwLoadError err@(ModuleNotFoundError name) = throwResumable $ BaseError (ModuleInfo name "Unknown" mempty) lowerBound err +throwLoadError err@(ModuleNotFoundError name) = throwResumable $ BaseError (ModuleInfo name "Unknown" mempty) (point (Pos 1 1)) err -- TODO: Might be able to get rest of ModuleInfo from the env ^. diff --git a/src/Control/Abstract/Primitive.hs b/src/Control/Abstract/Primitive.hs index 92aa6180f..87862b169 100644 --- a/src/Control/Abstract/Primitive.hs +++ b/src/Control/Abstract/Primitive.hs @@ -18,9 +18,9 @@ import Data.Abstract.BaseError import qualified Data.Abstract.ScopeGraph as ScopeGraph import Data.Map.Strict as Map import Data.Maybe -import Data.Semilattice.Lower import Data.Traversable import GHC.Stack +import Source.Span (Pos (..), point) defineBuiltIn :: ( HasCallStack , Has (Deref value) sig m @@ -47,11 +47,11 @@ defineBuiltIn declaration rel accessControl value = withCurrentCallStack callSta let lexicalEdges = Map.singleton Lexical [ currentScope' ] associatedScope <- newPreludeScope lexicalEdges -- TODO: This span is still wrong. - declare declaration rel accessControl lowerBound ScopeGraph.Unknown (Just associatedScope) + declare declaration rel accessControl (point (Pos 1 1)) ScopeGraph.Unknown (Just associatedScope) withScope associatedScope $ do param <- gensym - declare (Declaration param) ScopeGraph.Gensym accessControl lowerBound ScopeGraph.Unknown Nothing + declare (Declaration param) ScopeGraph.Gensym accessControl (point (Pos 1 1)) ScopeGraph.Unknown Nothing slot <- lookupSlot declaration value <- builtIn associatedScope value diff --git a/src/Control/Carrier/Parse/Measured.hs b/src/Control/Carrier/Parse/Measured.hs index 3e2886e0c..7f899c48c 100644 --- a/src/Control/Carrier/Parse/Measured.hs +++ b/src/Control/Carrier/Parse/Measured.hs @@ -11,7 +11,7 @@ module Control.Carrier.Parse.Measured ( -- * Parse carrier ParseC(..) -- * Exceptions -, ParserCancelled(..) +, AssignmentTimedOut(..) -- * Parse effect , module Control.Effect.Parse ) where @@ -19,8 +19,10 @@ module Control.Carrier.Parse.Measured import qualified Assigning.Assignment as Assignment import Control.Algebra import Control.Effect.Error +import Control.Effect.Lift import Control.Effect.Parse import Control.Effect.Reader +import Control.Effect.Timeout import Control.Effect.Trace import Control.Exception import Control.Monad @@ -30,13 +32,11 @@ import qualified Data.Error as Error import qualified Data.Flag as Flag import Data.Foldable import qualified Data.Syntax as Syntax -import Parsing.CMark import Parsing.Parser import Parsing.TreeSitter import Semantic.Config import Semantic.Task (TaskSession (..)) import Semantic.Telemetry -import Semantic.Timeout import Source.Source (Source) newtype ParseC m a = ParseC { runParse :: m a } @@ -45,8 +45,8 @@ newtype ParseC m a = ParseC { runParse :: m a } instance ( Has (Error SomeException) sig m , Has (Reader TaskSession) sig m , Has Telemetry sig m - , Has Timeout sig m , Has Trace sig m + , Has (Lift IO) sig m , MonadIO m ) => Algebra (Parse :+: sig) (ParseC m) where @@ -54,10 +54,17 @@ instance ( Has (Error SomeException) sig m alg (R other) = ParseC (alg (handleCoercible other)) -- | Parse a 'Blob' in 'IO'. -runParser :: (Has (Error SomeException) sig m, Has (Reader TaskSession) sig m, Has Telemetry sig m, Has Timeout sig m, Has Trace sig m, MonadIO m) - => Blob - -> Parser term - -> m term +runParser :: + ( Has (Error SomeException) sig m + , Has (Reader TaskSession) sig m + , Has Telemetry sig m + , Has (Lift IO) sig m + , Has Trace 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 @@ -71,10 +78,6 @@ runParser blob@Blob{..} parser = case parser of AssignmentParser parser assignment -> runAssignment Assignment.assign parser blob assignment - MarkdownParser -> - time "parse.cmark_parse" languageTag $ - let term = cmarkParser blobSource - in length term `seq` pure term where languageTag = [("language" :: String, show (blobLanguage blob))] executeParserAction act = do @@ -83,10 +86,10 @@ runParser blob@Blob{..} parser = case parser of when shouldFailFlag (throwError (SomeException AssignmentTimedOut)) act >>= either (\e -> trace (displayException e) *> throwError (SomeException e)) pure -data ParserCancelled = ParserTimedOut | AssignmentTimedOut - deriving (Show) +data AssignmentTimedOut = AssignmentTimedOut deriving (Show) + +instance Exception AssignmentTimedOut -instance Exception ParserCancelled runAssignment @@ -95,8 +98,8 @@ runAssignment , Has (Error SomeException) sig m , Has (Reader TaskSession) sig m , Has Telemetry sig m - , Has Timeout sig m , Has Trace sig m + , Has (Lift IO) sig m , MonadIO m ) => (Source -> assignment (term Assignment.Loc) -> ast -> Either (Error.Error String) (term Assignment.Loc)) @@ -109,7 +112,7 @@ runAssignment assign parser blob@Blob{..} assignment = do 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 blobFields = ("path", if isPublic taskSession || Flag.toBool LogPrintSource logPrintFlag then blobFilePath blob else "") let logFields = requestID' : isPublic' : blobFields : languageTag let shouldFailForTesting = configFailParsingForTesting $ config taskSession let shouldFailOnParsing = optionsFailOnParseError . configOptions $ config taskSession diff --git a/src/Control/Carrier/Parse/Simple.hs b/src/Control/Carrier/Parse/Simple.hs index 840bfa254..2763d6c9a 100644 --- a/src/Control/Carrier/Parse/Simple.hs +++ b/src/Control/Carrier/Parse/Simple.hs @@ -1,5 +1,11 @@ -{-# LANGUAGE FlexibleContexts, FlexibleInstances, GADTs, GeneralizedNewtypeDeriving, MultiParamTypeClasses, - RecordWildCards, TypeOperators, UndecidableInstances #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE UndecidableInstances #-} -- | A carrier for 'Parse' effects suitable for use in the repl, tests, etc. module Control.Carrier.Parse.Simple ( -- * Parse carrier @@ -19,7 +25,6 @@ import Control.Effect.Parse import Control.Exception import Control.Monad.IO.Class import Data.Blob -import Parsing.CMark import Parsing.Parser import Parsing.TreeSitter @@ -57,10 +62,6 @@ runParser timeout blob@Blob{..} parser = case parser of AssignmentParser parser assignment -> runParser timeout blob parser >>= either (throwError . toException) pure . Assignment.assign blobSource assignment - MarkdownParser -> - let term = cmarkParser blobSource - in length term `seq` pure term - newtype ParseFailure = ParseFailure String deriving (Show) diff --git a/src/Control/Effect/Timeout.hs b/src/Control/Effect/Timeout.hs new file mode 100644 index 000000000..d6421b781 --- /dev/null +++ b/src/Control/Effect/Timeout.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} +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 $ \ ctx hdl + -> 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/src/Data/AST.hs b/src/Data/AST.hs index 95e6cb6aa..2282cdd42 100644 --- a/src/Data/AST.hs +++ b/src/Data/AST.hs @@ -13,7 +13,7 @@ import Data.JSON.Fields import Source.Loc as Loc -- | An AST node labelled with symbols and source location. -type AST syntax grammar = Term syntax (Node grammar) +type AST grammar = Term [] (Node grammar) data Node grammar = Node { nodeSymbol :: !grammar diff --git a/src/Data/Abstract/BaseError.hs b/src/Data/Abstract/BaseError.hs index ec6e64dab..303866778 100644 --- a/src/Data/Abstract/BaseError.hs +++ b/src/Data/Abstract/BaseError.hs @@ -12,13 +12,15 @@ import Control.Abstract.Evaluator import qualified Data.Abstract.Module as M import Data.Functor.Classes import qualified Source.Span as S +import qualified System.Path as Path 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 + where errorLocation | startErrorLine == endErrorLine = baseModuleFilePath <> " " <> startErrorLine <> ":" <> startErrorCol <> "-" <> endErrorCol + | otherwise = baseModuleFilePath <> " " <> startErrorLine <> ":" <> startErrorCol <> "-" <> endErrorLine <> ":" <> endErrorCol + baseModuleFilePath = Path.toString $ M.modulePath baseErrorModuleInfo startErrorLine = show $ S.line (S.start baseErrorSpan) endErrorLine = show $ S.line (S.end baseErrorSpan) startErrorCol = show $ S.column (S.start baseErrorSpan) diff --git a/src/Data/Abstract/Evaluatable.hs b/src/Data/Abstract/Evaluatable.hs index 0547f0889..340dd5e52 100644 --- a/src/Data/Abstract/Evaluatable.hs +++ b/src/Data/Abstract/Evaluatable.hs @@ -35,11 +35,10 @@ import Data.Functor.Classes import Data.List.NonEmpty (nonEmpty) import Data.Scientific (Scientific) import Data.Semigroup.Foldable -import Data.Semilattice.Lower import Data.Sum import Data.Text import GHC.Stack -import Source.Span (HasSpan (..)) +import Source.Span (HasSpan (..), Pos (..), point) import Analysis.Name as X import Control.Abstract hiding (Load, String) @@ -229,7 +228,7 @@ defineSelf :: ( Has (State (ScopeGraph address)) sig m => Evaluator term address value m () defineSelf = do let self = Declaration __self - declare self ScopeGraph.Prelude Public lowerBound ScopeGraph.Unknown Nothing + declare self ScopeGraph.Prelude Public (point (Pos 1 1)) ScopeGraph.Unknown Nothing slot <- lookupSlot self assign slot =<< object =<< currentFrame diff --git a/src/Data/Abstract/ModuleTable.hs b/src/Data/Abstract/ModuleTable.hs index 121a05880..3a0875893 100644 --- a/src/Data/Abstract/ModuleTable.hs +++ b/src/Data/Abstract/ModuleTable.hs @@ -20,7 +20,7 @@ import qualified Data.Map as Map import Data.Semilattice.Lower import Data.Set (Set) import Prelude hiding (lookup) -import System.FilePath.Posix +import qualified System.Path as Path newtype ModuleTable a = ModuleTable { unModuleTable :: Map.Map ModulePath a } deriving (Eq, Foldable, Functor, Lower, Monoid, Ord, Semigroup, Traversable) @@ -32,7 +32,7 @@ modulePaths :: ModuleTable a -> Set ModulePath modulePaths = Map.keysSet . unModuleTable modulePathsInDir :: FilePath -> ModuleTable a -> [ModulePath] -modulePathsInDir k = filter (\e -> k == takeDirectory e) . Map.keys . unModuleTable +modulePathsInDir k = filter (\e -> Path.absRel k == Path.takeDirectory e) . Map.keys . unModuleTable lookup :: ModulePath -> ModuleTable a -> Maybe a lookup k = Map.lookup k . unModuleTable diff --git a/src/Data/Blob.hs b/src/Data/Blob.hs index 76e633dbf..b3cf3bd5a 100644 --- a/src/Data/Blob.hs +++ b/src/Data/Blob.hs @@ -32,12 +32,12 @@ import Data.Bifunctor import qualified Data.ByteString.Lazy as BL import Data.Edit import Data.JSON.Fields -import Data.Maybe import Data.Maybe.Exts import Data.Module +import Data.List (stripPrefix) import GHC.Generics (Generic) import Source.Language as Language -import qualified System.FilePath as FP +import qualified System.Path as Path newtype Blobs a = Blobs { blobs :: [a] } @@ -47,10 +47,10 @@ 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 +newtype NoLanguageForBlob = NoLanguageForBlob Path.AbsRelFile deriving (Eq, Exception, Ord, Show) -noLanguageForBlob :: Has (Error SomeException) sig m => FilePath -> m a +noLanguageForBlob :: Has (Error SomeException) sig m => Path.AbsRelFile -> m a noLanguageForBlob blobPath = throwError (SomeException (NoLanguageForBlob blobPath)) -- | Construct a 'Module' for a 'Blob' and @term@, relative to some root 'FilePath'. @@ -59,8 +59,16 @@ moduleForBlob :: Maybe FilePath -- ^ The root directory relative to which the mo -> 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 (FP.takeDirectory (blobPath b)) rootDir - info = ModuleInfo (FP.makeRelative root (blobPath b)) (languageToText (blobLanguage b)) mempty + where root = maybe (Path.takeDirectory $ blobPath b) Path.absRel rootDir + info = ModuleInfo (dropRelative root (blobPath b)) (languageToText (blobLanguage b)) mempty + +dropRelative :: Path.AbsRelDir -> Path.AbsRelFile -> Path.AbsRelFile +dropRelative a' b' = case as `stripPrefix` bs of + Just rs | ra == rb -> Path.toAbsRel $ (foldl (Path.) Path.currentDir rs) Path. bf + _ -> b' + where (ra, as, _) = Path.splitPath $ Path.normalise a' + (rb, bs, _) = Path.splitPath $ Path.normalise $ Path.takeDirectory b' + bf = Path.takeFileName b' -- | 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. @@ -80,7 +88,7 @@ languageForBlobPair = mergeEdit combine . bimap blobLanguage blobLanguage where | a == Unknown || b == Unknown = Unknown | otherwise = b -pathForBlobPair :: BlobPair -> FilePath +pathForBlobPair :: BlobPair -> Path.AbsRelFile pathForBlobPair = blobPath . mergeEdit (const id) languageTagForBlobPair :: BlobPair -> [(String, String)] @@ -88,12 +96,12 @@ languageTagForBlobPair pair = showLanguage (languageForBlobPair pair) where showLanguage = pure . (,) "language" . show pathKeyForBlobPair :: BlobPair -> FilePath -pathKeyForBlobPair = mergeEdit combine . bimap blobPath blobPath where +pathKeyForBlobPair = mergeEdit combine . bimap blobFilePath blobFilePath where combine before after | before == after = after | otherwise = before <> " -> " <> after instance ToJSONFields Blob where - toJSONFields p = [ "path" .= blobPath p, "language" .= blobLanguage p] + toJSONFields p = [ "path" .= blobFilePath 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 index e5e1c21b2..0ba310a6b 100644 --- a/src/Data/Blob/IO.hs +++ b/src/Data/Blob/IO.hs @@ -5,7 +5,6 @@ module Data.Blob.IO ( readBlobFromFile , readBlobFromFile' , readBlobFromPath - , readBlobsFromDir , readFilePair , readProjectFromPaths ) where @@ -13,15 +12,14 @@ module Data.Blob.IO import Analysis.Blob import Analysis.File as File import Analysis.Project -import qualified Control.Concurrent.Async as Async import Control.Monad.IO.Class import Data.Blob import qualified Data.ByteString as B import Data.Language import Data.Maybe.Exts -import Data.Semilattice.Lower import Semantic.IO import qualified Source.Source as Source +import Source.Span import qualified System.Path as Path -- | Deprecated: this has very weird semantics. @@ -44,9 +42,9 @@ readProjectFromPaths maybeRoot path lang excludeDirs = do paths <- liftIO $ findFilesInDir rootDir exts excludeDirs blobs <- liftIO $ traverse (readBlobFromFile' . toFile) paths - pure $ Project (Path.toString rootDir) blobs lang (fmap Path.toString excludeDirs) + pure $ Project rootDir blobs lang excludeDirs where - toFile path = File path lowerBound lang + toFile path = File path (point (Pos 1 1)) lang exts = extensionsForLanguage lang @@ -68,11 +66,6 @@ readBlobFromFile' file = do readBlobFromPath :: (MonadFail m, MonadIO m) => Path.AbsRelFile -> m Blob readBlobFromPath = readBlobFromFile' . File.fromPath --- | Read all blobs in the directory with Language.supportedExts. -readBlobsFromDir :: MonadIO m => Path.AbsRelDir -> m [Blob] -readBlobsFromDir path = liftIO . fmap catMaybes $ - findFilesInDir path supportedExts mempty >>= Async.mapConcurrently (readBlobFromFile . File.fromPath) - readFilePair :: MonadIO m => File Language -> File Language -> m BlobPair readFilePair a b = do before <- readBlobFromFile a diff --git a/src/Data/Error.hs b/src/Data/Error.hs index cca446b7c..bee51e207 100644 --- a/src/Data/Error.hs +++ b/src/Data/Error.hs @@ -59,7 +59,7 @@ formatError includeSource colourize blob@Blob{..} Error{..} . (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 "" + path = Just $ if Flag.toBool LogPrintSource includeSource then blobFilePath blob else "" showExcerpt :: Flag Colourize -> Span -> Blob -> ShowS showExcerpt colourize Span{..} Blob{..} diff --git a/src/Data/Graph/ControlFlowVertex.hs b/src/Data/Graph/ControlFlowVertex.hs index 43cf6cd41..77e916255 100644 --- a/src/Data/Graph/ControlFlowVertex.hs +++ b/src/Data/Graph/ControlFlowVertex.hs @@ -45,6 +45,7 @@ import GHC.Generics (V1) import Prelude hiding (span) import qualified Source.Loc as Loc import Source.Span +import qualified System.Path as Path -- | A vertex of representing some node in a control flow graph. data ControlFlowVertex @@ -60,19 +61,19 @@ packageVertex :: PackageInfo -> ControlFlowVertex packageVertex (PackageInfo name _) = Package (formatName name) moduleVertex :: ModuleInfo -> ControlFlowVertex -moduleVertex = Module . T.pack . modulePath +moduleVertex = Module . T.pack . Path.toString . modulePath unknownModuleVertex :: ModuleInfo -> ControlFlowVertex -unknownModuleVertex = UnknownModule . T.pack . modulePath +unknownModuleVertex = UnknownModule . T.pack . Path.toString . modulePath variableVertex :: Text -> ModuleInfo -> Span -> ControlFlowVertex -variableVertex name ModuleInfo{..} = Variable name (T.pack modulePath) +variableVertex name ModuleInfo{..} = Variable name (T.pack $ Path.toString modulePath) methodVertex :: Text -> ModuleInfo -> Span -> ControlFlowVertex -methodVertex name ModuleInfo{..} = Method name (T.pack modulePath) +methodVertex name ModuleInfo{..} = Method name (T.pack $ Path.toString modulePath) functionVertex :: Text -> ModuleInfo -> Span -> ControlFlowVertex -functionVertex name ModuleInfo{..} = Function name (T.pack modulePath) +functionVertex name ModuleInfo{..} = Function name (T.pack $ Path.toString modulePath) vertexIdentifier :: ControlFlowVertex -> Text vertexIdentifier v = case v of diff --git a/src/Data/Language.hs b/src/Data/Language.hs index ee3201822..9cc89de9b 100644 --- a/src/Data/Language.hs +++ b/src/Data/Language.hs @@ -5,26 +5,9 @@ module Data.Language , defaultLanguageModes , preciseLanguageModes , aLaCarteLanguageModes - , codeNavLanguages - , supportedExts ) where -import qualified Data.Languages as Lingo -import qualified Data.Map.Strict as Map -import qualified Data.Text as T -import Source.Language - -codeNavLanguages :: [Language] -codeNavLanguages = [Go, Java, Ruby, Python, JavaScript, TypeScript, PHP] - -supportedExts :: [String] -supportedExts = foldr append mempty supportedLanguages - where - append (Just l) b = fmap T.unpack (Lingo.languageExtensions l) <> b - append Nothing b = b - supportedLanguages = fmap lookup (languageToText <$> codeNavLanguages) - lookup k = Map.lookup k Lingo.languages - +import Source.Language data PerLanguageModes = PerLanguageModes { pythonMode :: LanguageMode diff --git a/src/Data/Syntax.hs b/src/Data/Syntax.hs index 0b206d65d..d9742e4b0 100644 --- a/src/Data/Syntax.hs +++ b/src/Data/Syntax.hs @@ -77,16 +77,16 @@ makeTerm1' syntax = case toList syntax of _ -> error "makeTerm1': empty structure" -- | Construct an empty term at the current position. -emptyTerm :: (Empty :< syntaxes, Sum syntaxes ~ Syntax term, Apply Foldable syntaxes, IsTerm term) => Assignment.Assignment ast grammar (term Loc) +emptyTerm :: (Empty :< syntaxes, Sum syntaxes ~ Syntax term, Apply Foldable syntaxes, IsTerm term) => Assignment.Assignment grammar (term Loc) emptyTerm = makeTerm . startLocation <$> Assignment.location <*> pure Empty where startLocation Loc{..} = Loc (Range.point (Range.start byteRange)) (Span.point (Span.start span)) -- | Catch assignment errors into an error term. -handleError :: (HasCallStack, Error :< syntaxes, Sum syntaxes ~ Syntax term, Enum grammar, Eq1 ast, Ix grammar, Show grammar, Apply Foldable syntaxes, IsTerm term) => Assignment.Assignment ast grammar (term Loc) -> Assignment.Assignment ast grammar (term Loc) +handleError :: (HasCallStack, Error :< syntaxes, Sum syntaxes ~ Syntax term, Enum grammar, Ix grammar, Show grammar, Apply Foldable syntaxes, IsTerm term) => Assignment.Assignment grammar (term Loc) -> Assignment.Assignment grammar (term Loc) handleError = flip Assignment.catchError (\ err -> makeTerm <$> Assignment.location <*> pure (errorSyntax (either id show <$> err) []) <* Assignment.source) -- | Catch parse errors into an error term. -parseError :: (Error :< syntaxes, Sum syntaxes ~ Syntax term, Bounded grammar, Enum grammar, Apply Foldable syntaxes, IsTerm term) => Assignment.Assignment ast grammar (term Loc) +parseError :: (Error :< syntaxes, Sum syntaxes ~ Syntax term, Bounded grammar, Enum grammar, Apply Foldable syntaxes, IsTerm term) => Assignment.Assignment grammar (term Loc) 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. diff --git a/src/Data/Syntax/Declaration.hs b/src/Data/Syntax/Declaration.hs index 26854beff..0c8622466 100644 --- a/src/Data/Syntax/Declaration.hs +++ b/src/Data/Syntax/Declaration.hs @@ -18,7 +18,6 @@ import Data.Functor.Classes.Generic import Data.Hashable.Lifted import qualified Data.Map.Strict as Map import Data.Maybe.Exts -import Data.Semilattice.Lower import qualified Data.Set as Set import Data.Traversable import GHC.Generics (Generic1) @@ -106,7 +105,7 @@ instance Evaluatable Method where params <- withScope associatedScope $ do -- TODO: Should we give `self` a special Relation? - declare (Declaration __self) ScopeGraph.Prelude ScopeGraph.Public lowerBound ScopeGraph.Unknown Nothing + declare (Declaration __self) ScopeGraph.Prelude ScopeGraph.Public (point (Pos 1 1)) ScopeGraph.Unknown Nothing for methodParameters $ \paramNode -> declareMaybeName (declaredName paramNode) Default ScopeGraph.Public (paramNode^.span_) ScopeGraph.Parameter Nothing addr <- lookupSlot (Declaration name) diff --git a/src/Data/Syntax/Directive.hs b/src/Data/Syntax/Directive.hs index 580219167..75d55f10a 100644 --- a/src/Data/Syntax/Directive.hs +++ b/src/Data/Syntax/Directive.hs @@ -15,6 +15,7 @@ import qualified Data.Text as T import Diffing.Algorithm import GHC.Generics (Generic1) import Source.Span +import qualified System.Path as Path -- A file directive like the Ruby constant `__FILE__`. data File a = File @@ -25,7 +26,7 @@ instance Ord1 File where liftCompare = genericLiftCompare instance Show1 File where liftShowsPrec = genericLiftShowsPrec instance Evaluatable File where - eval _ _ File = currentModule >>= string . T.pack . modulePath + eval _ _ File = currentModule >>= string . T.pack . Path.toString . modulePath -- A line directive like the Ruby constant `__LINE__`. diff --git a/src/Language/Go/Assignment.hs b/src/Language/Go/Assignment.hs index ee35acafd..5e4ffee88 100644 --- a/src/Language/Go/Assignment.hs +++ b/src/Language/Go/Assignment.hs @@ -16,6 +16,7 @@ import qualified Assigning.Assignment as Assignment import Control.Monad import qualified Data.Abstract.ScopeGraph as ScopeGraph (AccessControl (..)) import Data.ImportPath () +import Data.ImportPath (defaultAlias, importPath) import Data.List.NonEmpty (NonEmpty (..), some1) import Data.Sum import Data.Syntax @@ -28,13 +29,12 @@ 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.Grammar as Grammar import Language.Go.Syntax as Go.Syntax hiding (labelName, runeLiteral) import Language.Go.Term as Go import Language.Go.Type as Go.Type -import Data.ImportPath (importPath, defaultAlias) -import Language.Go.Grammar as Grammar -type Assignment = Assignment.Assignment [] Grammar +type Assignment = Assignment.Assignment Grammar -- | Assignment from AST in Go's grammar onto a program in Go's syntax. assignment :: Assignment (Term Loc) diff --git a/src/Language/Go/Syntax.hs b/src/Language/Go/Syntax.hs index 631bc2ed4..96a096163 100644 --- a/src/Language/Go/Syntax.hs +++ b/src/Language/Go/Syntax.hs @@ -11,9 +11,9 @@ 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.Foldable +import Data.Abstract.Path import Data.Functor.Classes import Data.Functor.Classes.Generic import Data.Hashable.Lifted @@ -27,8 +27,10 @@ import Data.Text (Text) import qualified Data.Text as T import Diffing.Algorithm import GHC.Generics (Generic1) +import qualified System.Path as Path import System.FilePath.Posix + resolveGoImport :: ( Has (Modules address value) sig m , Has (Reader ModuleInfo) sig m , Has (Reader Package.PackageInfo) sig m @@ -41,7 +43,7 @@ resolveGoImport :: ( Has (Modules address value) sig m resolveGoImport (ImportPath path Data.ImportPath.Unknown) = throwResolutionError $ GoImportError path resolveGoImport (ImportPath path Relative) = do ModuleInfo{..} <- currentModule - paths <- listModulesInDir (joinPaths (takeDirectory modulePath) path) + paths <- listModulesInDir $ (joinPaths (takeDirectory . Path.toString $ modulePath) path) case paths of [] -> throwResolutionError $ GoImportError path _ -> pure paths diff --git a/src/Language/Markdown/Assignment.hs b/src/Language/Markdown/Assignment.hs deleted file mode 100644 index 37036d8e0..000000000 --- a/src/Language/Markdown/Assignment.hs +++ /dev/null @@ -1,147 +0,0 @@ -{-# LANGUAGE DataKinds #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE RankNTypes #-} -{-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE TypeFamilies #-} -{-# LANGUAGE TypeOperators #-} -module Language.Markdown.Assignment -( assignment -, Markdown.Syntax -, Grammar -, Markdown.Term(..) -) where - -import Assigning.Assignment hiding (Assignment, Error) -import qualified Assigning.Assignment as Assignment -import qualified CMarkGFM -import Control.Monad -import Data.Sum -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 Language.Markdown.Term as Markdown -import Parsing.CMark as Grammar (Grammar (..)) - -type Assignment = Assignment.Assignment (Term.TermF [] CMarkGFM.NodeType) Grammar - -assignment :: Assignment (Term Loc) -assignment = Syntax.handleError $ makeTerm <$> symbol Document <*> children (Markup.Document <$> many blockElement) - - --- Block elements - -blockElement :: Assignment (Term Loc) -blockElement = choice - [ paragraph - , list - , blockQuote - , codeBlock - , thematicBreak - , htmlBlock - , heading - , table - ] - -paragraph :: Assignment (Term Loc) -paragraph = makeTerm <$> symbol Paragraph <*> children (Markup.Paragraph <$> many inlineElement) - -list :: Assignment (Term Loc) -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 Loc) -item = makeTerm <$> symbol Item <*> children (many blockElement) - -heading :: Assignment (Term Loc) -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 Loc) -blockQuote = makeTerm <$> symbol BlockQuote <*> children (Markup.BlockQuote <$> many blockElement) - -codeBlock :: Assignment (Term Loc) -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 Loc) -thematicBreak = makeTerm <$> token ThematicBreak <*> pure Markup.ThematicBreak - -htmlBlock :: Assignment (Term Loc) -htmlBlock = makeTerm <$> symbol HTMLBlock <*> (Markup.HTMLBlock <$> source) - -table :: Assignment (Term Loc) -table = makeTerm <$> symbol Table <*> children (Markup.Table <$> many tableRow) - -tableRow :: Assignment (Term Loc) -tableRow = makeTerm <$> symbol TableRow <*> children (Markup.TableRow <$> many tableCell) - -tableCell :: Assignment (Term Loc) -tableCell = makeTerm <$> symbol TableCell <*> children (Markup.TableCell <$> many inlineElement) - --- Inline elements - -inlineElement :: Assignment (Term Loc) -inlineElement = choice - [ strong - , emphasis - , strikethrough - , text - , link - , htmlInline - , image - , code - , lineBreak - , softBreak - ] - -strong :: Assignment (Term Loc) -strong = makeTerm <$> symbol Strong <*> children (Markup.Strong <$> many inlineElement) - -emphasis :: Assignment (Term Loc) -emphasis = makeTerm <$> symbol Emphasis <*> children (Markup.Emphasis <$> many inlineElement) - -strikethrough :: Assignment (Term Loc) -strikethrough = makeTerm <$> symbol Strikethrough <*> children (Markup.Strikethrough <$> many inlineElement) - -text :: Assignment (Term Loc) -text = makeTerm <$> symbol Text <*> (Markup.Text <$> source) - -htmlInline :: Assignment (Term Loc) -htmlInline = makeTerm <$> symbol HTMLInline <*> (Markup.HTMLBlock <$> source) - -link :: Assignment (Term Loc) -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 Loc) -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 Loc) -code = makeTerm <$> symbol Code <*> (Markup.Code Nothing <$> source) - -lineBreak :: Assignment (Term Loc) -lineBreak = makeTerm <$> token LineBreak <*> pure Markup.LineBreak - -softBreak :: Assignment (Term Loc) -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 fa9098d0d..000000000 --- a/src/Language/Markdown/Syntax.hs +++ /dev/null @@ -1,153 +0,0 @@ -{-# LANGUAGE DeriveAnyClass #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DeriveTraversable #-} -{-# LANGUAGE DuplicateRecordFields #-} -module Language.Markdown.Syntax (module Language.Markdown.Syntax) where - -import Data.Abstract.Declarations -import Data.Functor.Classes -import Data.Functor.Classes.Generic -import Data.Hashable.Lifted -import Data.JSON.Fields -import qualified Data.Text as T -import Diffing.Algorithm -import GHC.Generics (Generic1) - -newtype Document a = Document { values :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 Document where liftEq = genericLiftEq -instance Ord1 Document where liftCompare = genericLiftCompare -instance Show1 Document where liftShowsPrec = genericLiftShowsPrec - - --- Block elements - -newtype Paragraph a = Paragraph { values :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 Paragraph where liftEq = genericLiftEq -instance Ord1 Paragraph where liftCompare = genericLiftCompare -instance Show1 Paragraph where liftShowsPrec = genericLiftShowsPrec - -data Heading a = Heading { headingLevel :: Int, headingContent :: [a], sectionContent :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 Heading where liftEq = genericLiftEq -instance Ord1 Heading where liftCompare = genericLiftCompare -instance Show1 Heading where liftShowsPrec = genericLiftShowsPrec - -newtype UnorderedList a = UnorderedList { values :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 UnorderedList where liftEq = genericLiftEq -instance Ord1 UnorderedList where liftCompare = genericLiftCompare -instance Show1 UnorderedList where liftShowsPrec = genericLiftShowsPrec - -newtype OrderedList a = OrderedList { values :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 OrderedList where liftEq = genericLiftEq -instance Ord1 OrderedList where liftCompare = genericLiftCompare -instance Show1 OrderedList where liftShowsPrec = genericLiftShowsPrec - -newtype BlockQuote a = BlockQuote { values :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 BlockQuote where liftEq = genericLiftEq -instance Ord1 BlockQuote where liftCompare = genericLiftCompare -instance Show1 BlockQuote where liftShowsPrec = genericLiftShowsPrec - -data ThematicBreak a = ThematicBreak - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 ThematicBreak where liftEq = genericLiftEq -instance Ord1 ThematicBreak where liftCompare = genericLiftCompare -instance Show1 ThematicBreak where liftShowsPrec = genericLiftShowsPrec - -newtype HTMLBlock a = HTMLBlock { value :: T.Text } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 HTMLBlock where liftEq = genericLiftEq -instance Ord1 HTMLBlock where liftCompare = genericLiftCompare -instance Show1 HTMLBlock where liftShowsPrec = genericLiftShowsPrec - -newtype Table a = Table { values :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 Table where liftEq = genericLiftEq -instance Ord1 Table where liftCompare = genericLiftCompare -instance Show1 Table where liftShowsPrec = genericLiftShowsPrec - -newtype TableRow a = TableRow { values :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 TableRow where liftEq = genericLiftEq -instance Ord1 TableRow where liftCompare = genericLiftCompare -instance Show1 TableRow where liftShowsPrec = genericLiftShowsPrec - -newtype TableCell a = TableCell { values :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 TableCell where liftEq = genericLiftEq -instance Ord1 TableCell where liftCompare = genericLiftCompare -instance Show1 TableCell where liftShowsPrec = genericLiftShowsPrec - - --- Inline elements - -newtype Strong a = Strong { values :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 Strong where liftEq = genericLiftEq -instance Ord1 Strong where liftCompare = genericLiftCompare -instance Show1 Strong where liftShowsPrec = genericLiftShowsPrec - -newtype Emphasis a = Emphasis { values :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 Emphasis where liftEq = genericLiftEq -instance Ord1 Emphasis where liftCompare = genericLiftCompare -instance Show1 Emphasis where liftShowsPrec = genericLiftShowsPrec - -newtype Text a = Text { value :: T.Text} - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 Text where liftEq = genericLiftEq -instance Ord1 Text where liftCompare = genericLiftCompare -instance Show1 Text where liftShowsPrec = genericLiftShowsPrec - -data Link a = Link { linkURL :: T.Text, linkTitle :: Maybe T.Text } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 Link where liftEq = genericLiftEq -instance Ord1 Link where liftCompare = genericLiftCompare -instance Show1 Link where liftShowsPrec = genericLiftShowsPrec - -data Image a = Image { imageURL :: T.Text, imageTitle :: Maybe T.Text } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 Image where liftEq = genericLiftEq -instance Ord1 Image where liftCompare = genericLiftCompare -instance Show1 Image where liftShowsPrec = genericLiftShowsPrec - -data Code a = Code { codeLanguage :: Maybe T.Text, codeContent :: T.Text } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 Code where liftEq = genericLiftEq -instance Ord1 Code where liftCompare = genericLiftCompare -instance Show1 Code where liftShowsPrec = genericLiftShowsPrec - -data LineBreak a = LineBreak - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 LineBreak where liftEq = genericLiftEq -instance Ord1 LineBreak where liftCompare = genericLiftCompare -instance Show1 LineBreak where liftShowsPrec = genericLiftShowsPrec - -newtype Strikethrough a = Strikethrough { values :: [a] } - deriving (Declarations1, Foldable, Traversable, Functor, Generic1, Hashable1, Diffable, ToJSONFields1) - -instance Eq1 Strikethrough where liftEq = genericLiftEq -instance Ord1 Strikethrough where liftCompare = genericLiftCompare -instance Show1 Strikethrough where liftShowsPrec = genericLiftShowsPrec diff --git a/src/Language/Markdown/Term.hs b/src/Language/Markdown/Term.hs deleted file mode 100644 index 39f29daa1..000000000 --- a/src/Language/Markdown/Term.hs +++ /dev/null @@ -1,84 +0,0 @@ -{-# LANGUAGE DataKinds, GeneralizedNewtypeDeriving, RecordWildCards, TypeFamilies #-} -module Language.Markdown.Term -( Syntax -, Term(..) -) where - -import Control.Lens.Lens -import Data.Abstract.Declarations -import Data.Aeson (ToJSON) -import Data.Bifunctor -import Data.Bitraversable -import Data.Coerce -import Data.Foldable (fold) -import Data.Functor.Foldable (Base, Recursive(..)) -import qualified Data.Sum as Sum -import qualified Data.Syntax as Syntax -import qualified Data.Term as Term -import Data.Traversable -import Diffing.Interpreter -import qualified Language.Markdown.Syntax as Markup -import Source.Loc -import Source.Span - -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 - , [] - ] - - -newtype Term ann = Term { getTerm :: Term.TermF (Sum.Sum Syntax) ann (Term ann) } - deriving (Declarations, Eq, Ord, Show, ToJSON) - -instance Term.IsTerm Term where - type Syntax Term = Sum.Sum Syntax - toTermF = coerce - fromTermF = coerce - -instance Foldable Term where - foldMap = foldMapDefault - -instance Functor Term where - fmap = fmapDefault - -instance Traversable Term where - traverse f = go where go = fmap Term . bitraverse f go . getTerm - -instance Syntax.HasErrors Term where - getErrors = cata $ \ (Term.In Loc{..} syntax) -> - maybe (fold syntax) (pure . Syntax.unError span) (Sum.project syntax) - - -instance DiffTerms Term where - diffTermPair = diffTermPair . bimap (cata Term.Term) (cata Term.Term) - -type instance Base (Term ann) = Term.TermF (Sum.Sum Syntax) ann - -instance Recursive (Term ann) where - project = getTerm - -instance HasSpan ann => HasSpan (Term ann) where - span_ = inner.span_ where inner = lens getTerm (\t i -> t { getTerm = i }) - {-# INLINE span_ #-} diff --git a/src/Language/PHP/Assignment.hs b/src/Language/PHP/Assignment.hs index 20cfde9fa..d68ece97f 100644 --- a/src/Language/PHP/Assignment.hs +++ b/src/Language/PHP/Assignment.hs @@ -40,7 +40,7 @@ import qualified Language.PHP.Syntax as Syntax import Language.PHP.Term as PHP import Language.PHP.Grammar as Grammar -type Assignment = Assignment.Assignment [] Grammar +type Assignment = Assignment.Assignment Grammar -- | Assignment from AST in PHP's grammar onto a program in PHP's syntax. assignment :: Assignment (Term Loc) diff --git a/src/Language/Python/Assignment.hs b/src/Language/Python/Assignment.hs index 3bf59e143..835ae5582 100644 --- a/src/Language/Python/Assignment.hs +++ b/src/Language/Python/Assignment.hs @@ -38,11 +38,11 @@ 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 Language.Python.Grammar as Grammar import Language.Python.Syntax as Python.Syntax import Language.Python.Term as Python -import Language.Python.Grammar as Grammar -type Assignment = Assignment.Assignment [] Grammar +type Assignment = Assignment.Assignment Grammar -- | Assignment from AST in Python's grammar onto a program in Python's syntax. assignment :: Assignment (Term Loc) diff --git a/src/Language/Python/Syntax.hs b/src/Language/Python/Syntax.hs index 86bf32df3..30424e647 100644 --- a/src/Language/Python/Syntax.hs +++ b/src/Language/Python/Syntax.hs @@ -34,6 +34,7 @@ import Data.JSON.Fields import qualified Data.Language as Language import Diffing.Algorithm import Source.Span +import qualified System.Path as Path data QualifiedName = QualifiedName (NonEmpty FilePath) @@ -80,14 +81,14 @@ resolvePythonModules :: ( Has (Modules address value) sig m resolvePythonModules q = do relRootDir <- rootDir q <$> currentModule for (moduleNames q) $ \relPath -> do - x <- search relRootDir relPath + x <- search (Path.toString relRootDir) relPath x <$ traceResolve relPath x where - rootDir (QualifiedName _) ModuleInfo{..} = mempty -- overall rootDir of the Package. - rootDir (RelativeQualifiedName n _) ModuleInfo{..} = upDir numDots (takeDirectory modulePath) + rootDir (QualifiedName _) ModuleInfo{..} = Path.toAbsRel Path.currentDir -- overall rootDir of the Package. + rootDir (RelativeQualifiedName n _) ModuleInfo{..} = upDir numDots (Path.takeDirectory modulePath) where numDots = pred (length n) upDir n dir | n <= 0 = dir - | otherwise = takeDirectory (upDir (pred n) dir) + | otherwise = maybe dir (upDir (pred n)) $ Path.takeSuperDirectory dir moduleNames (QualifiedName qualifiedName) = NonEmpty.scanl1 () qualifiedName moduleNames (RelativeQualifiedName x Nothing) = error $ "importing from '" <> show x <> "' is not implemented" diff --git a/src/Language/Ruby/Assignment.hs b/src/Language/Ruby/Assignment.hs index 23acf8060..1ce62849d 100644 --- a/src/Language/Ruby/Assignment.hs +++ b/src/Language/Ruby/Assignment.hs @@ -40,11 +40,11 @@ import qualified Data.Syntax.Expression as Expression import qualified Data.Syntax.Literal as Literal import qualified Data.Syntax.Statement as Statement import qualified Data.Text as Text +import Language.Ruby.Grammar as Grammar import qualified Language.Ruby.Syntax as Ruby.Syntax import Language.Ruby.Term as Ruby -import Language.Ruby.Grammar as Grammar -type Assignment = Assignment.Assignment [] Grammar +type Assignment = Assignment.Assignment Grammar -- | Assignment from AST in Ruby’s grammar onto a program in Ruby’s syntax. assignment :: Assignment (Term Loc) diff --git a/src/Language/TSX/Assignment.hs b/src/Language/TSX/Assignment.hs index b4f69f569..2fd186bb0 100644 --- a/src/Language/TSX/Assignment.hs +++ b/src/Language/TSX/Assignment.hs @@ -45,7 +45,7 @@ import Language.TSX.Term as TSX import qualified Language.TypeScript.Resolution as TypeScript.Resolution import Language.TSX.Grammar as Grammar -type Assignment = Assignment.Assignment [] Grammar +type Assignment = Assignment.Assignment Grammar -- | Assignment from AST in TSX’s grammar onto a program in TSX’s syntax. assignment :: Assignment (Term Loc) diff --git a/src/Language/TypeScript/Assignment.hs b/src/Language/TypeScript/Assignment.hs index 2fbb670c6..6bfcbceb0 100644 --- a/src/Language/TypeScript/Assignment.hs +++ b/src/Language/TypeScript/Assignment.hs @@ -40,12 +40,12 @@ 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 Language.TypeScript.Grammar as Grammar import qualified Language.TypeScript.Resolution as TypeScript.Resolution import qualified Language.TypeScript.Syntax as TypeScript.Syntax import Language.TypeScript.Term as TypeScript -import Language.TypeScript.Grammar as Grammar -type Assignment = Assignment.Assignment [] Grammar +type Assignment = Assignment.Assignment Grammar -- | Assignment from AST in TypeScript’s grammar onto a program in TypeScript’s syntax. assignment :: Assignment (Term Loc) diff --git a/src/Language/TypeScript/Resolution.hs b/src/Language/TypeScript/Resolution.hs index b0cf9f1b0..6c91edb27 100644 --- a/src/Language/TypeScript/Resolution.hs +++ b/src/Language/TypeScript/Resolution.hs @@ -21,6 +21,7 @@ import Data.Abstract.Package import Data.Abstract.Path import Data.ImportPath import qualified Data.Language as Language +import qualified System.Path as Path -- Node.js resolution algorithm: https://nodejs.org/api/modules.html#modules_all_together -- @@ -58,7 +59,7 @@ resolveRelativePath :: ( Has (Modules address value) sig m -> Evaluator term address value m M.ModulePath resolveRelativePath relImportPath exts = do M.ModuleInfo{..} <- currentModule - let relRootDir = takeDirectory modulePath + let relRootDir = takeDirectory (Path.toString 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) @@ -87,15 +88,15 @@ resolveNonRelativePath :: ( Has (Modules address value) sig m -> Evaluator term address value m M.ModulePath resolveNonRelativePath name exts = do M.ModuleInfo{..} <- currentModule - go "." modulePath mempty + go (Path.toAbsRel Path.currentDir) (Path.takeDirectory modulePath) mempty where - nodeModulesPath dir = takeDirectory dir "node_modules" name + nodeModulesPath dir = dir Path. Path.relDir "node_modules" Path. Path.relDir 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 + res <- resolveModule (Path.toString $ nodeModulesPath path) exts case res of - Left xs | parentDir <- takeDirectory path , root /= parentDir -> go root parentDir (searched <> xs) + Left xs | Just parentDir <- Path.takeSuperDirectory path , root /= path -> go root parentDir (searched <> xs) | otherwise -> notFound (searched <> xs) Right m -> m <$ traceResolve name m notFound xs = throwResolutionError $ NotFoundError name xs Language.TypeScript diff --git a/src/Language/TypeScript/Syntax/Import.hs b/src/Language/TypeScript/Syntax/Import.hs index 3f084fa7a..7a17be14f 100644 --- a/src/Language/TypeScript/Syntax/Import.hs +++ b/src/Language/TypeScript/Syntax/Import.hs @@ -19,10 +19,10 @@ import Data.Hashable import Data.Hashable.Lifted import Data.JSON.Fields import qualified Data.Map.Strict as Map -import Data.Semilattice.Lower import Diffing.Algorithm import GHC.Generics (Generic, Generic1) import Language.TypeScript.Resolution +import Source.Span data Import a = Import { importSymbols :: ![Alias], importFrom :: ImportPath } deriving (Declarations1, Diffable, Foldable, FreeVariables1, Functor, Generic1, Hashable1, ToJSONFields1, Traversable) @@ -50,7 +50,7 @@ instance Evaluatable Import where 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) lowerBound ScopeGraph.Identifier (Declaration aliasValue) scopeAddress + insertImportReference (Reference aliasName) (point (Pos 1 1)) ScopeGraph.Identifier (Declaration aliasValue) scopeAddress -- Create edges from the current scope/frame to the import scope/frame. insertImportEdge scopeAddress @@ -110,7 +110,7 @@ instance Evaluatable QualifiedExport where withScope exportScope . for_ exportSymbols $ \Alias{..} -> do -- TODO: Replace Alias in QualifedExport with terms and use a real span - reference (Reference aliasName) lowerBound ScopeGraph.Identifier (Declaration aliasValue) + reference (Reference aliasName) (point (Pos 1 1)) ScopeGraph.Identifier (Declaration aliasValue) -- Create an export edge from a new scope to the qualifed export's scope. unit @@ -140,7 +140,7 @@ instance Evaluatable QualifiedExportFrom where withScopeAndFrame moduleFrame . for_ exportSymbols $ \Alias{..} -> do -- TODO: Replace Alias with terms in QualifiedExportFrom and use a real span below. - insertImportReference (Reference aliasName) lowerBound ScopeGraph.Identifier (Declaration aliasValue) exportScope + insertImportReference (Reference aliasName) (point (Pos 1 1)) ScopeGraph.Identifier (Declaration aliasValue) exportScope insertExportEdge exportScope insertFrameLink ScopeGraph.Export (Map.singleton exportScope exportFrame) diff --git a/src/Parsing/Parser.hs b/src/Parsing/Parser.hs index 494f9d3e1..61ff3b4e6 100644 --- a/src/Parsing/Parser.hs +++ b/src/Parsing/Parser.hs @@ -19,7 +19,7 @@ module Parsing.Parser , jsxParserALaCarte , jsxParserPrecise , jsxParser -, markdownParser +, phpParserPrecise , pythonParserALaCarte , pythonParserPrecise , pythonParser @@ -42,21 +42,17 @@ module Parsing.Parser import Assigning.Assignment import AST.Unmarshal -import qualified CMarkGFM import Data.AST -import Data.Functor.Classes import Data.Language import Data.Map (Map) import qualified Data.Map as Map import qualified Data.Syntax as Syntax -import Data.Term import Foreign.Ptr import qualified Language.Go as GoPrecise import qualified Language.Go.Assignment as GoALaCarte import Language.Go.Grammar import qualified Language.Java as Java import qualified Language.JSON as JSON -import qualified Language.Markdown.Assignment as Markdown import qualified Language.PHP as PHPPrecise import qualified Language.Python as PythonPrecise import qualified Language.Python.Assignment as PythonALaCarte @@ -76,16 +72,14 @@ import TreeSitter.TSX -- | 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) + ASTParser :: (Bounded grammar, Enum grammar, Show grammar) => Ptr TS.Language -> Parser (AST grammar) -- | A parser 'Unmarshal'ing to a precise AST type using a 'TS.Language'. UnmarshalParser :: Unmarshal t => Ptr TS.Language -> Parser (t Loc) -- | A parser producing an à la carte term given an 'AST'-producing parser and an 'Assignment' onto 'Term's in some syntax type. - AssignmentParser :: (TS.Symbol grammar, Syntax.HasErrors term, Eq1 ast, Foldable term, Foldable ast, Functor ast) - => Parser (AST ast grammar) -- ^ A parser producing AST. - -> Assignment ast grammar (term Loc) -- ^ An assignment from AST onto 'Term's. + AssignmentParser :: (TS.Symbol grammar, Syntax.HasErrors term, Foldable term) + => Parser (AST grammar) -- ^ A parser producing AST. + -> Assignment grammar (term Loc) -- ^ An assignment from AST onto 'Term's. -> Parser (term Loc) -- ^ A parser producing 'Term's. - -- | A parser for 'Markdown' using cmark. - MarkdownParser :: Parser (AST (TermF [] CMarkGFM.NodeType) Markdown.Grammar) -- $abstract @@ -158,9 +152,6 @@ jsxParser modes = case jsxMode modes of ALaCarte -> jsxParserALaCarte Precise -> jsxParserPrecise -markdownParser :: c Markdown.Term => (Language, SomeParser c Loc) -markdownParser = (Markdown, SomeParser (AssignmentParser MarkdownParser Markdown.assignment)) - phpParserPrecise :: c PHPPrecise.Term => (Language, SomeParser c Loc) phpParserPrecise = (PHP, SomeParser (UnmarshalParser @PHPPrecise.Term PHPPrecise.tree_sitter_php)) @@ -224,7 +215,6 @@ type family TermMode term where -- | The canonical set of parsers producing à la carte terms. aLaCarteParsers :: ( c GoALaCarte.Term - , c Markdown.Term , c PythonALaCarte.Term , c RubyALaCarte.Term , c TSXALaCarte.Term @@ -234,7 +224,6 @@ aLaCarteParsers aLaCarteParsers = Map.fromList [ javascriptParserALaCarte , jsxParserALaCarte - , markdownParser , pythonParserALaCarte , rubyParserALaCarte , tsxParserALaCarte @@ -273,7 +262,6 @@ allParsers , c GoPrecise.Term , c Java.Term , c JSON.Term - , c Markdown.Term , c PHPPrecise.Term , c PythonALaCarte.Term , c PythonPrecise.Term @@ -292,7 +280,6 @@ allParsers modes = Map.fromList , javascriptParser modes , jsonParser , jsxParser modes - , markdownParser , phpParserPrecise , pythonParser modes , rubyParser modes diff --git a/src/Parsing/TreeSitter.hs b/src/Parsing/TreeSitter.hs index d984d52fa..d7e9eb160 100644 --- a/src/Parsing/TreeSitter.hs +++ b/src/Parsing/TreeSitter.hs @@ -54,7 +54,7 @@ parseToAST :: ( Bounded grammar => Duration -> Ptr TS.Language -> Blob - -> m (Either TSParseException (AST [] grammar)) + -> m (Either TSParseException (AST grammar)) parseToAST parseTimeout language blob = runParse parseTimeout language blob (anaM toAST <=< peek) parseToPreciseAST @@ -103,7 +103,7 @@ runParse parseTimeout language Blob{..} action = else Exc.throw IncompatibleVersions -toAST :: forall grammar . (Bounded grammar, Enum grammar) => TS.Node -> IO (Base (AST [] grammar) TS.Node) +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 diff --git a/src/Proto/Semantic.hs b/src/Proto/Semantic.hs index c2f1e9b8c..11f7b4c0c 100644 --- a/src/Proto/Semantic.hs +++ b/src/Proto/Semantic.hs @@ -1,13 +1,10 @@ {- 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 #-} -{-# OPTIONS_GHC -fno-warn-unused-imports#-} -{-# OPTIONS_GHC -fno-warn-duplicate-exports#-} -module Proto.Semantic - (Blob(), BlobPair(), ChangeType(..), ChangeType(), +{-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies, UndecidableInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, PatternSynonyms, MagicHash, NoImplicitPrelude, DataKinds, BangPatterns, TypeApplications#-} +{-# OPTIONS_GHC -Wno-unused-imports#-} +{-# OPTIONS_GHC -Wno-duplicate-exports#-} +{-# OPTIONS_GHC -Wno-dodgy-exports#-} +module Proto.Semantic ( + Blob(), BlobPair(), ChangeType(..), ChangeType(), ChangeType'UnrecognizedValue, DeletedTerm(), DiffTreeEdge(), DiffTreeFileGraph(), DiffTreeGraphResponse(), DiffTreeRequest(), DiffTreeTOCResponse(), DiffTreeVertex(), @@ -17,5537 +14,7547 @@ module Proto.Semantic MergedTerm(), ParseError(), ParseTreeFileGraph(), ParseTreeGraphResponse(), ParseTreeRequest(), ParseTreeSymbolResponse(), PingRequest(), PingResponse(), - Position(), ReplacedTerm(), Span(), Symbol(), TOCSummaryChange(), - TOCSummaryError(), TOCSummaryFile(), TermEdge(), TermVertex()) - where -import qualified Data.ProtoLens.Runtime.Control.DeepSeq - as Control.DeepSeq -import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Prism - as Data.ProtoLens.Prism + Position(), ReplacedTerm(), Span(), StackGraphFile(), + StackGraphNode(), StackGraphNode'NodeType(..), + StackGraphNode'NodeType(), + StackGraphNode'NodeType'UnrecognizedValue, StackGraphPath(), + StackGraphRequest(), StackGraphResponse(), Symbol(), + TOCSummaryChange(), TOCSummaryError(), TOCSummaryFile(), + TermEdge(), TermVertex() + ) 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.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.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.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{_Blob'content :: !Data.Text.Text, - _Blob'path :: !Data.Text.Text, _Blob'language :: !Data.Text.Text, - _Blob'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) + + * '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 (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 _ - = (Lens.Family2.Unchecked.lens _Blob'content - (\ x__ y__ -> x__{_Blob'content = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField Blob "path" (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Blob'path - (\ x__ y__ -> x__{_Blob'path = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField Blob "language" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Blob'language - (\ x__ y__ -> x__{_Blob'language = y__})) - Prelude.. Prelude.id + 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" - 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{_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 - (("Missing required fields: ") Prelude.++ - Prelude.show (missing :: ([Prelude.String]))) - Prelude.return - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> Prelude.reverse t) - x) + messageName _ = Data.Text.pack "github.semantic.Blob" + 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 - do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt - case tag of - 10 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "content" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"content") - y - x) - 18 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "path" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y - x) - 26 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "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) + 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 - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "Blob" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"content") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - 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.before' @:: Lens' BlobPair Blob@ - * 'Proto.Semantic_Fields.maybe'before' @:: Lens' BlobPair (Prelude.Maybe Blob)@ - * 'Proto.Semantic_Fields.after' @:: Lens' BlobPair Blob@ - * 'Proto.Semantic_Fields.maybe'after' @:: Lens' BlobPair (Prelude.Maybe Blob)@ - -} -data BlobPair = BlobPair{_BlobPair'before :: !(Prelude.Maybe Blob), - _BlobPair'after :: !(Prelude.Maybe Blob), - _BlobPair'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show BlobPair where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField BlobPair "before" (Blob) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _BlobPair'before - (\ x__ y__ -> x__{_BlobPair'before = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField BlobPair "maybe'before" - (Prelude.Maybe Blob) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _BlobPair'before - (\ x__ y__ -> x__{_BlobPair'before = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField BlobPair "after" (Blob) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _BlobPair'after - (\ x__ y__ -> x__{_BlobPair'after = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField BlobPair "maybe'after" - (Prelude.Maybe Blob) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _BlobPair'after - (\ x__ y__ -> x__{_BlobPair'after = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message BlobPair where - messageName _ = Data.Text.pack "github.semantic.BlobPair" - fieldsByTag - = let before__field_descriptor - = Data.ProtoLens.FieldDescriptor "before" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor Blob) - (Data.ProtoLens.OptionalField - (Data.ProtoLens.Field.field @"maybe'before")) - :: Data.ProtoLens.FieldDescriptor BlobPair - after__field_descriptor - = Data.ProtoLens.FieldDescriptor "after" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor Blob) - (Data.ProtoLens.OptionalField - (Data.ProtoLens.Field.field @"maybe'after")) - :: Data.ProtoLens.FieldDescriptor BlobPair - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, before__field_descriptor), - (Data.ProtoLens.Tag 2, after__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _BlobPair'_unknownFields - (\ x__ y__ -> x__{_BlobPair'_unknownFields = y__}) - defMessage - = BlobPair{_BlobPair'before = Prelude.Nothing, - _BlobPair'after = Prelude.Nothing, _BlobPair'_unknownFields = ([])} - parseMessage - = let loop :: - BlobPair -> Data.ProtoLens.Encoding.Bytes.Parser BlobPair - 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 - (("Missing required fields: ") Prelude.++ - 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 <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "before" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"before") - y - x) - 18 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "after" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"after") y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) - in - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "BlobPair" - buildMessage - = (\ _x -> - (case - Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'before") _x - of - (Prelude.Nothing) -> Data.Monoid.mempty - Prelude.Just _v -> (Data.ProtoLens.Encoding.Bytes.putVarInt 10) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - (case - Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'after") _x of - (Prelude.Nothing) -> Data.Monoid.mempty - Prelude.Just _v -> (Data.ProtoLens.Encoding.Bytes.putVarInt 18) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData BlobPair where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_BlobPair'_unknownFields x__) - (Control.DeepSeq.deepseq (_BlobPair'before x__) - (Control.DeepSeq.deepseq (_BlobPair'after x__) (())))) -newtype ChangeType'UnrecognizedValue = ChangeType'UnrecognizedValue Data.Int.Int32 - deriving (Prelude.Eq, Prelude.Ord, Prelude.Show) -data ChangeType = NONE - | ADDED - | REMOVED - | MODIFIED - | ChangeType'Unrecognized !ChangeType'UnrecognizedValue - deriving (Prelude.Show, Prelude.Eq, Prelude.Ord) -instance Data.ProtoLens.MessageEnum ChangeType where - maybeToEnum 0 = Prelude.Just NONE - maybeToEnum 1 = Prelude.Just ADDED - maybeToEnum 2 = Prelude.Just REMOVED - maybeToEnum 3 = Prelude.Just MODIFIED - maybeToEnum k - = Prelude.Just - (ChangeType'Unrecognized - (ChangeType'UnrecognizedValue (Prelude.fromIntegral k))) - showEnum NONE = "NONE" - showEnum ADDED = "ADDED" - showEnum REMOVED = "REMOVED" - showEnum MODIFIED = "MODIFIED" - showEnum (ChangeType'Unrecognized (ChangeType'UnrecognizedValue k)) - = Prelude.show k - readEnum k - | (k) Prelude.== "NONE" = Prelude.Just NONE - | (k) Prelude.== "ADDED" = Prelude.Just ADDED - | (k) Prelude.== "REMOVED" = Prelude.Just REMOVED - | (k) Prelude.== "MODIFIED" = Prelude.Just MODIFIED - readEnum k - = (Text.Read.readMaybe k) Prelude.>>= Data.ProtoLens.maybeToEnum -instance Prelude.Bounded ChangeType where - minBound = NONE - maxBound = MODIFIED -instance Prelude.Enum ChangeType where - toEnum k__ - = Prelude.maybe - (Prelude.error - (("toEnum: unknown value for enum ChangeType: ") Prelude.++ - Prelude.show k__)) - Prelude.id - (Data.ProtoLens.maybeToEnum k__) - fromEnum NONE = 0 - fromEnum ADDED = 1 - fromEnum REMOVED = 2 - fromEnum MODIFIED = 3 - fromEnum (ChangeType'Unrecognized (ChangeType'UnrecognizedValue k)) - = Prelude.fromIntegral k - succ MODIFIED - = Prelude.error - "ChangeType.succ: bad argument MODIFIED. This value would be out of bounds." - succ NONE = ADDED - succ ADDED = REMOVED - succ REMOVED = MODIFIED - succ (ChangeType'Unrecognized _) - = Prelude.error "ChangeType.succ: bad argument: unrecognized value" - pred NONE - = Prelude.error - "ChangeType.pred: bad argument NONE. This value would be out of bounds." - pred ADDED = NONE - pred REMOVED = ADDED - pred MODIFIED = REMOVED - pred (ChangeType'Unrecognized _) - = Prelude.error "ChangeType.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 ChangeType where - fieldDefault = NONE -instance Control.DeepSeq.NFData ChangeType where - rnf x__ = Prelude.seq x__ (()) -{- | Fields : - - * 'Proto.Semantic_Fields.term' @:: Lens' DeletedTerm Data.Text.Text@ - * 'Proto.Semantic_Fields.span' @:: Lens' DeletedTerm Span@ - * 'Proto.Semantic_Fields.maybe'span' @:: Lens' DeletedTerm (Prelude.Maybe Span)@ - -} -data DeletedTerm = DeletedTerm{_DeletedTerm'term :: - !Data.Text.Text, - _DeletedTerm'span :: !(Prelude.Maybe Span), - _DeletedTerm'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show DeletedTerm where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField DeletedTerm "term" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DeletedTerm'term - (\ x__ y__ -> x__{_DeletedTerm'term = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField DeletedTerm "span" (Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DeletedTerm'span - (\ x__ y__ -> x__{_DeletedTerm'span = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField DeletedTerm "maybe'span" - (Prelude.Maybe Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DeletedTerm'span - (\ x__ y__ -> x__{_DeletedTerm'span = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message DeletedTerm where - messageName _ = Data.Text.pack "github.semantic.DeletedTerm" - fieldsByTag - = let term__field_descriptor - = Data.ProtoLens.FieldDescriptor "term" - (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: - Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"term")) - :: Data.ProtoLens.FieldDescriptor DeletedTerm - 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 DeletedTerm - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, term__field_descriptor), - (Data.ProtoLens.Tag 2, span__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _DeletedTerm'_unknownFields - (\ x__ y__ -> x__{_DeletedTerm'_unknownFields = y__}) - defMessage - = DeletedTerm{_DeletedTerm'term = Data.ProtoLens.fieldDefault, - _DeletedTerm'span = Prelude.Nothing, - _DeletedTerm'_unknownFields = ([])} - parseMessage - = let loop :: - DeletedTerm -> Data.ProtoLens.Encoding.Bytes.Parser DeletedTerm - 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 - (("Missing required fields: ") Prelude.++ - 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 <- (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)) - Data.ProtoLens.Encoding.Bytes. "term" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"term") y - x) - 18 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "span" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"span") y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) - in - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "DeletedTerm" - buildMessage - = (\ _x -> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"term") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. 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.ProtoLens.Encoding.Bytes.putVarInt 18) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData DeletedTerm where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_DeletedTerm'_unknownFields x__) - (Control.DeepSeq.deepseq (_DeletedTerm'term x__) - (Control.DeepSeq.deepseq (_DeletedTerm'span x__) (())))) -{- | Fields : - - * 'Proto.Semantic_Fields.source' @:: Lens' DiffTreeEdge Data.Int.Int32@ - * 'Proto.Semantic_Fields.target' @:: Lens' DiffTreeEdge Data.Int.Int32@ - -} -data DiffTreeEdge = DiffTreeEdge{_DiffTreeEdge'source :: - !Data.Int.Int32, - _DiffTreeEdge'target :: !Data.Int.Int32, - _DiffTreeEdge'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show DiffTreeEdge where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField DiffTreeEdge "source" - (Data.Int.Int32) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeEdge'source - (\ x__ y__ -> x__{_DiffTreeEdge'source = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField DiffTreeEdge "target" - (Data.Int.Int32) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeEdge'target - (\ x__ y__ -> x__{_DiffTreeEdge'target = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message DiffTreeEdge where - messageName _ = Data.Text.pack "github.semantic.DiffTreeEdge" - fieldsByTag - = let source__field_descriptor - = Data.ProtoLens.FieldDescriptor "source" - (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: - Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"source")) - :: Data.ProtoLens.FieldDescriptor DiffTreeEdge - target__field_descriptor - = Data.ProtoLens.FieldDescriptor "target" - (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: - Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"target")) - :: Data.ProtoLens.FieldDescriptor DiffTreeEdge - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, source__field_descriptor), - (Data.ProtoLens.Tag 2, target__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _DiffTreeEdge'_unknownFields - (\ x__ y__ -> x__{_DiffTreeEdge'_unknownFields = y__}) - defMessage - = DiffTreeEdge{_DiffTreeEdge'source = Data.ProtoLens.fieldDefault, - _DiffTreeEdge'target = Data.ProtoLens.fieldDefault, - _DiffTreeEdge'_unknownFields = ([])} - parseMessage - = let loop :: - DiffTreeEdge -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeEdge - 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 - (("Missing required fields: ") Prelude.++ - 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 <- (Prelude.fmap Prelude.fromIntegral - Data.ProtoLens.Encoding.Bytes.getVarInt) - Data.ProtoLens.Encoding.Bytes. "source" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"source") y - x) - 16 -> do y <- (Prelude.fmap Prelude.fromIntegral - Data.ProtoLens.Encoding.Bytes.getVarInt) - Data.ProtoLens.Encoding.Bytes. "target" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"target") - y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) - in - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "DiffTreeEdge" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"source") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 8) Data.Monoid.<> - ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude.. - Prelude.fromIntegral) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"target") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 16) Data.Monoid.<> - ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude.. - Prelude.fromIntegral) - _v) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData DiffTreeEdge where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_DiffTreeEdge'_unknownFields x__) - (Control.DeepSeq.deepseq (_DiffTreeEdge'source x__) - (Control.DeepSeq.deepseq (_DiffTreeEdge'target x__) (())))) -{- | Fields : - - * 'Proto.Semantic_Fields.path' @:: Lens' DiffTreeFileGraph Data.Text.Text@ - * 'Proto.Semantic_Fields.language' @:: Lens' DiffTreeFileGraph Data.Text.Text@ - * 'Proto.Semantic_Fields.vertices' @:: Lens' DiffTreeFileGraph [DiffTreeVertex]@ - * 'Proto.Semantic_Fields.vec'vertices' @:: Lens' DiffTreeFileGraph (Data.Vector.Vector DiffTreeVertex)@ - * 'Proto.Semantic_Fields.edges' @:: Lens' DiffTreeFileGraph [DiffTreeEdge]@ - * 'Proto.Semantic_Fields.vec'edges' @:: Lens' DiffTreeFileGraph (Data.Vector.Vector DiffTreeEdge)@ - * 'Proto.Semantic_Fields.errors' @:: Lens' DiffTreeFileGraph [ParseError]@ - * 'Proto.Semantic_Fields.vec'errors' @:: Lens' DiffTreeFileGraph (Data.Vector.Vector ParseError)@ - -} -data DiffTreeFileGraph = DiffTreeFileGraph{_DiffTreeFileGraph'path - :: !Data.Text.Text, - _DiffTreeFileGraph'language :: !Data.Text.Text, - _DiffTreeFileGraph'vertices :: - !(Data.Vector.Vector DiffTreeVertex), - _DiffTreeFileGraph'edges :: - !(Data.Vector.Vector DiffTreeEdge), - _DiffTreeFileGraph'errors :: - !(Data.Vector.Vector ParseError), - _DiffTreeFileGraph'_unknownFields :: - !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show DiffTreeFileGraph where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "path" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'path - (\ x__ y__ -> x__{_DiffTreeFileGraph'path = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "language" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'language - (\ x__ y__ -> x__{_DiffTreeFileGraph'language = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "vertices" - ([DiffTreeVertex]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'vertices - (\ x__ y__ -> x__{_DiffTreeFileGraph'vertices = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField DiffTreeFileGraph - "vec'vertices" - (Data.Vector.Vector DiffTreeVertex) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'vertices - (\ x__ y__ -> x__{_DiffTreeFileGraph'vertices = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "edges" - ([DiffTreeEdge]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'edges - (\ x__ y__ -> x__{_DiffTreeFileGraph'edges = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField DiffTreeFileGraph - "vec'edges" - (Data.Vector.Vector DiffTreeEdge) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'edges - (\ x__ y__ -> x__{_DiffTreeFileGraph'edges = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "errors" - ([ParseError]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'errors - (\ x__ y__ -> x__{_DiffTreeFileGraph'errors = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField DiffTreeFileGraph - "vec'errors" - (Data.Vector.Vector ParseError) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeFileGraph'errors - (\ x__ y__ -> x__{_DiffTreeFileGraph'errors = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message DiffTreeFileGraph where - messageName _ = Data.Text.pack "github.semantic.DiffTreeFileGraph" - 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 DiffTreeFileGraph - 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 DiffTreeFileGraph - vertices__field_descriptor - = Data.ProtoLens.FieldDescriptor "vertices" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor DiffTreeVertex) - (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked - (Data.ProtoLens.Field.field @"vertices")) - :: Data.ProtoLens.FieldDescriptor DiffTreeFileGraph - edges__field_descriptor - = Data.ProtoLens.FieldDescriptor "edges" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor DiffTreeEdge) - (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked - (Data.ProtoLens.Field.field @"edges")) - :: Data.ProtoLens.FieldDescriptor DiffTreeFileGraph - 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 DiffTreeFileGraph - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, path__field_descriptor), - (Data.ProtoLens.Tag 2, language__field_descriptor), - (Data.ProtoLens.Tag 3, vertices__field_descriptor), - (Data.ProtoLens.Tag 4, edges__field_descriptor), - (Data.ProtoLens.Tag 5, errors__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _DiffTreeFileGraph'_unknownFields - (\ x__ y__ -> x__{_DiffTreeFileGraph'_unknownFields = y__}) - defMessage - = DiffTreeFileGraph{_DiffTreeFileGraph'path = - Data.ProtoLens.fieldDefault, - _DiffTreeFileGraph'language = Data.ProtoLens.fieldDefault, - _DiffTreeFileGraph'vertices = Data.Vector.Generic.empty, - _DiffTreeFileGraph'edges = Data.Vector.Generic.empty, - _DiffTreeFileGraph'errors = Data.Vector.Generic.empty, - _DiffTreeFileGraph'_unknownFields = ([])} - parseMessage - = let loop :: - DiffTreeFileGraph -> - Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector - Data.ProtoLens.Encoding.Growing.RealWorld - DiffTreeEdge - -> - 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 - DiffTreeVertex - -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeFileGraph - loop x mutable'edges mutable'errors mutable'vertices - = do end <- Data.ProtoLens.Encoding.Bytes.atEnd - if end then - do frozen'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.unsafeFreeze - mutable'edges) - frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.unsafeFreeze - mutable'errors) - frozen'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.unsafeFreeze - mutable'vertices) - let missing = [] in - if Prelude.null missing then Prelude.return () else - Prelude.fail - (("Missing required fields: ") Prelude.++ - 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'edges") - frozen'edges - (Lens.Family2.set (Data.ProtoLens.Field.field @"vec'errors") - frozen'errors - (Lens.Family2.set - (Data.ProtoLens.Field.field @"vec'vertices") - frozen'vertices - x)))) - else - do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt - case tag of - 10 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "path" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y - x) - mutable'edges - mutable'errors - mutable'vertices - 18 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "language" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"language") - y - x) - mutable'edges - mutable'errors - mutable'vertices - 26 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "vertices" - v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.append - mutable'vertices - y) - loop x mutable'edges mutable'errors v - 34 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "edges" - v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.append - mutable'edges - y) - loop x v mutable'errors mutable'vertices - 42 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "errors" - v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.append - mutable'errors - y) - loop x mutable'edges v mutable'vertices - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) - mutable'edges - mutable'errors - mutable'vertices - in - (do mutable'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - mutable'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - loop Data.ProtoLens.defMessage mutable'edges mutable'errors - mutable'vertices) - Data.ProtoLens.Encoding.Bytes. "DiffTreeFileGraph" - buildMessage - = (\ _x -> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'vertices") - _x)) - Data.Monoid.<> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 34) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'edges") _x)) - Data.Monoid.<> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 42) Data.Monoid.<> - (((\ bs -> + 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.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'errors") _x)) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData DiffTreeFileGraph where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_DiffTreeFileGraph'_unknownFields x__) - (Control.DeepSeq.deepseq (_DiffTreeFileGraph'path x__) - (Control.DeepSeq.deepseq (_DiffTreeFileGraph'language x__) - (Control.DeepSeq.deepseq (_DiffTreeFileGraph'vertices x__) - (Control.DeepSeq.deepseq (_DiffTreeFileGraph'edges x__) - (Control.DeepSeq.deepseq (_DiffTreeFileGraph'errors x__) (()))))))) -{- | Fields : - - * 'Proto.Semantic_Fields.files' @:: Lens' DiffTreeGraphResponse [DiffTreeFileGraph]@ - * 'Proto.Semantic_Fields.vec'files' @:: Lens' DiffTreeGraphResponse (Data.Vector.Vector DiffTreeFileGraph)@ - -} -data DiffTreeGraphResponse = DiffTreeGraphResponse{_DiffTreeGraphResponse'files - :: !(Data.Vector.Vector DiffTreeFileGraph), - _DiffTreeGraphResponse'_unknownFields :: - !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show DiffTreeGraphResponse where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField DiffTreeGraphResponse - "files" - ([DiffTreeFileGraph]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeGraphResponse'files - (\ x__ y__ -> x__{_DiffTreeGraphResponse'files = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField DiffTreeGraphResponse - "vec'files" - (Data.Vector.Vector DiffTreeFileGraph) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeGraphResponse'files - (\ x__ y__ -> x__{_DiffTreeGraphResponse'files = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message DiffTreeGraphResponse where - messageName _ - = Data.Text.pack "github.semantic.DiffTreeGraphResponse" - fieldsByTag - = let files__field_descriptor - = Data.ProtoLens.FieldDescriptor "files" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor DiffTreeFileGraph) - (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked - (Data.ProtoLens.Field.field @"files")) - :: Data.ProtoLens.FieldDescriptor DiffTreeGraphResponse - in - Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _DiffTreeGraphResponse'_unknownFields - (\ x__ y__ -> x__{_DiffTreeGraphResponse'_unknownFields = y__}) - defMessage - = DiffTreeGraphResponse{_DiffTreeGraphResponse'files = - Data.Vector.Generic.empty, - _DiffTreeGraphResponse'_unknownFields = ([])} - parseMessage - = let loop :: - DiffTreeGraphResponse -> - Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector - Data.ProtoLens.Encoding.Growing.RealWorld - DiffTreeFileGraph - -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeGraphResponse - 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 - (("Missing required fields: ") Prelude.++ - 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 <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "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 - (do mutable'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - loop Data.ProtoLens.defMessage mutable'files) - Data.ProtoLens.Encoding.Bytes. "DiffTreeGraphResponse" - buildMessage - = (\ _x -> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'files") _x)) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData DiffTreeGraphResponse where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_DiffTreeGraphResponse'_unknownFields x__) - (Control.DeepSeq.deepseq (_DiffTreeGraphResponse'files x__) (()))) -{- | Fields : - - * 'Proto.Semantic_Fields.blobs' @:: Lens' DiffTreeRequest [BlobPair]@ - * 'Proto.Semantic_Fields.vec'blobs' @:: Lens' DiffTreeRequest (Data.Vector.Vector BlobPair)@ - -} -data DiffTreeRequest = DiffTreeRequest{_DiffTreeRequest'blobs :: - !(Data.Vector.Vector BlobPair), - _DiffTreeRequest'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show DiffTreeRequest where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField DiffTreeRequest "blobs" - ([BlobPair]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeRequest'blobs - (\ x__ y__ -> x__{_DiffTreeRequest'blobs = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField DiffTreeRequest "vec'blobs" - (Data.Vector.Vector BlobPair) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeRequest'blobs - (\ x__ y__ -> x__{_DiffTreeRequest'blobs = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message DiffTreeRequest where - messageName _ = Data.Text.pack "github.semantic.DiffTreeRequest" - fieldsByTag - = let blobs__field_descriptor - = Data.ProtoLens.FieldDescriptor "blobs" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor BlobPair) - (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked - (Data.ProtoLens.Field.field @"blobs")) - :: Data.ProtoLens.FieldDescriptor DiffTreeRequest - in - Data.Map.fromList [(Data.ProtoLens.Tag 1, blobs__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _DiffTreeRequest'_unknownFields - (\ x__ y__ -> x__{_DiffTreeRequest'_unknownFields = y__}) - defMessage - = DiffTreeRequest{_DiffTreeRequest'blobs = - Data.Vector.Generic.empty, - _DiffTreeRequest'_unknownFields = ([])} - parseMessage - = let loop :: - DiffTreeRequest -> - Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector - Data.ProtoLens.Encoding.Growing.RealWorld - BlobPair - -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeRequest - 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 - (("Missing required fields: ") Prelude.++ - 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 <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "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 - (do mutable'blobs <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - loop Data.ProtoLens.defMessage mutable'blobs) - Data.ProtoLens.Encoding.Bytes. "DiffTreeRequest" - buildMessage - = (\ _x -> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'blobs") _x)) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData DiffTreeRequest where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_DiffTreeRequest'_unknownFields x__) - (Control.DeepSeq.deepseq (_DiffTreeRequest'blobs x__) (()))) -{- | Fields : - - * 'Proto.Semantic_Fields.files' @:: Lens' DiffTreeTOCResponse [TOCSummaryFile]@ - * 'Proto.Semantic_Fields.vec'files' @:: Lens' DiffTreeTOCResponse (Data.Vector.Vector TOCSummaryFile)@ - -} -data DiffTreeTOCResponse = DiffTreeTOCResponse{_DiffTreeTOCResponse'files - :: !(Data.Vector.Vector TOCSummaryFile), - _DiffTreeTOCResponse'_unknownFields :: - !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show DiffTreeTOCResponse where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField DiffTreeTOCResponse "files" - ([TOCSummaryFile]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeTOCResponse'files - (\ x__ y__ -> x__{_DiffTreeTOCResponse'files = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField DiffTreeTOCResponse - "vec'files" - (Data.Vector.Vector TOCSummaryFile) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeTOCResponse'files - (\ x__ y__ -> x__{_DiffTreeTOCResponse'files = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message DiffTreeTOCResponse where - messageName _ - = Data.Text.pack "github.semantic.DiffTreeTOCResponse" - fieldsByTag - = let files__field_descriptor - = Data.ProtoLens.FieldDescriptor "files" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor TOCSummaryFile) - (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked - (Data.ProtoLens.Field.field @"files")) - :: Data.ProtoLens.FieldDescriptor DiffTreeTOCResponse - in - Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _DiffTreeTOCResponse'_unknownFields - (\ x__ y__ -> x__{_DiffTreeTOCResponse'_unknownFields = y__}) - defMessage - = DiffTreeTOCResponse{_DiffTreeTOCResponse'files = - Data.Vector.Generic.empty, - _DiffTreeTOCResponse'_unknownFields = ([])} - parseMessage - = let loop :: - DiffTreeTOCResponse -> - Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector - Data.ProtoLens.Encoding.Growing.RealWorld - TOCSummaryFile - -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeTOCResponse - 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 - (("Missing required fields: ") Prelude.++ - 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 <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "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 - (do mutable'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - loop Data.ProtoLens.defMessage mutable'files) - Data.ProtoLens.Encoding.Bytes. "DiffTreeTOCResponse" - buildMessage - = (\ _x -> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'files") _x)) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData DiffTreeTOCResponse where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_DiffTreeTOCResponse'_unknownFields x__) - (Control.DeepSeq.deepseq (_DiffTreeTOCResponse'files x__) (()))) -{- | Fields : - - * 'Proto.Semantic_Fields.diffVertexId' @:: Lens' DiffTreeVertex Data.Int.Int32@ - * 'Proto.Semantic_Fields.maybe'diffTerm' @:: Lens' DiffTreeVertex (Prelude.Maybe DiffTreeVertex'DiffTerm)@ - * 'Proto.Semantic_Fields.maybe'deleted' @:: Lens' DiffTreeVertex (Prelude.Maybe DeletedTerm)@ - * 'Proto.Semantic_Fields.deleted' @:: Lens' DiffTreeVertex DeletedTerm@ - * 'Proto.Semantic_Fields.maybe'inserted' @:: Lens' DiffTreeVertex (Prelude.Maybe InsertedTerm)@ - * 'Proto.Semantic_Fields.inserted' @:: Lens' DiffTreeVertex InsertedTerm@ - * 'Proto.Semantic_Fields.maybe'replaced' @:: Lens' DiffTreeVertex (Prelude.Maybe ReplacedTerm)@ - * 'Proto.Semantic_Fields.replaced' @:: Lens' DiffTreeVertex ReplacedTerm@ - * 'Proto.Semantic_Fields.maybe'merged' @:: Lens' DiffTreeVertex (Prelude.Maybe MergedTerm)@ - * 'Proto.Semantic_Fields.merged' @:: Lens' DiffTreeVertex MergedTerm@ - -} -data DiffTreeVertex = DiffTreeVertex{_DiffTreeVertex'diffVertexId - :: !Data.Int.Int32, - _DiffTreeVertex'diffTerm :: - !(Prelude.Maybe DiffTreeVertex'DiffTerm), - _DiffTreeVertex'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show DiffTreeVertex where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -data DiffTreeVertex'DiffTerm = DiffTreeVertex'Deleted !DeletedTerm - | DiffTreeVertex'Inserted !InsertedTerm - | DiffTreeVertex'Replaced !ReplacedTerm - | DiffTreeVertex'Merged !MergedTerm - deriving (Prelude.Show, Prelude.Eq, Prelude.Ord) -instance Data.ProtoLens.Field.HasField DiffTreeVertex - "diffVertexId" - (Data.Int.Int32) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffVertexId - (\ x__ y__ -> x__{_DiffTreeVertex'diffVertexId = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField DiffTreeVertex - "maybe'diffTerm" - (Prelude.Maybe DiffTreeVertex'DiffTerm) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm - (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField DiffTreeVertex - "maybe'deleted" - (Prelude.Maybe DeletedTerm) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm - (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__})) - Prelude.. - Lens.Family2.Unchecked.lens - (\ x__ -> - case x__ of - Prelude.Just (DiffTreeVertex'Deleted x__val) -> Prelude.Just x__val - _otherwise -> Prelude.Nothing) - (\ _ y__ -> Prelude.fmap DiffTreeVertex'Deleted y__) -instance Data.ProtoLens.Field.HasField DiffTreeVertex "deleted" - (DeletedTerm) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm - (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__})) - Prelude.. - (Lens.Family2.Unchecked.lens - (\ x__ -> - case x__ of - Prelude.Just (DiffTreeVertex'Deleted x__val) -> Prelude.Just x__val - _otherwise -> Prelude.Nothing) - (\ _ y__ -> Prelude.fmap DiffTreeVertex'Deleted y__)) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField DiffTreeVertex - "maybe'inserted" - (Prelude.Maybe InsertedTerm) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm - (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__})) - Prelude.. - Lens.Family2.Unchecked.lens - (\ x__ -> - case x__ of - Prelude.Just (DiffTreeVertex'Inserted x__val) -> Prelude.Just - x__val - _otherwise -> Prelude.Nothing) - (\ _ y__ -> Prelude.fmap DiffTreeVertex'Inserted y__) -instance Data.ProtoLens.Field.HasField DiffTreeVertex "inserted" - (InsertedTerm) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm - (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__})) - Prelude.. - (Lens.Family2.Unchecked.lens - (\ x__ -> - case x__ of - Prelude.Just (DiffTreeVertex'Inserted x__val) -> Prelude.Just - x__val - _otherwise -> Prelude.Nothing) - (\ _ y__ -> Prelude.fmap DiffTreeVertex'Inserted y__)) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField DiffTreeVertex - "maybe'replaced" - (Prelude.Maybe ReplacedTerm) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm - (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__})) - Prelude.. - Lens.Family2.Unchecked.lens - (\ x__ -> - case x__ of - Prelude.Just (DiffTreeVertex'Replaced x__val) -> Prelude.Just - x__val - _otherwise -> Prelude.Nothing) - (\ _ y__ -> Prelude.fmap DiffTreeVertex'Replaced y__) -instance Data.ProtoLens.Field.HasField DiffTreeVertex "replaced" - (ReplacedTerm) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm - (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__})) - Prelude.. - (Lens.Family2.Unchecked.lens - (\ x__ -> - case x__ of - Prelude.Just (DiffTreeVertex'Replaced x__val) -> Prelude.Just - x__val - _otherwise -> Prelude.Nothing) - (\ _ y__ -> Prelude.fmap DiffTreeVertex'Replaced y__)) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField DiffTreeVertex - "maybe'merged" - (Prelude.Maybe MergedTerm) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm - (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__})) - Prelude.. - Lens.Family2.Unchecked.lens - (\ x__ -> - case x__ of - Prelude.Just (DiffTreeVertex'Merged x__val) -> Prelude.Just x__val - _otherwise -> Prelude.Nothing) - (\ _ y__ -> Prelude.fmap DiffTreeVertex'Merged y__) -instance Data.ProtoLens.Field.HasField DiffTreeVertex "merged" - (MergedTerm) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _DiffTreeVertex'diffTerm - (\ x__ y__ -> x__{_DiffTreeVertex'diffTerm = y__})) - Prelude.. - (Lens.Family2.Unchecked.lens - (\ x__ -> - case x__ of - Prelude.Just (DiffTreeVertex'Merged x__val) -> Prelude.Just x__val - _otherwise -> Prelude.Nothing) - (\ _ y__ -> Prelude.fmap DiffTreeVertex'Merged y__)) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Message DiffTreeVertex where - messageName _ = Data.Text.pack "github.semantic.DiffTreeVertex" - fieldsByTag - = let diffVertexId__field_descriptor - = Data.ProtoLens.FieldDescriptor "diff_vertex_id" - (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: - Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"diffVertexId")) - :: Data.ProtoLens.FieldDescriptor DiffTreeVertex - deleted__field_descriptor - = Data.ProtoLens.FieldDescriptor "deleted" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor DeletedTerm) - (Data.ProtoLens.OptionalField - (Data.ProtoLens.Field.field @"maybe'deleted")) - :: Data.ProtoLens.FieldDescriptor DiffTreeVertex - inserted__field_descriptor - = Data.ProtoLens.FieldDescriptor "inserted" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor InsertedTerm) - (Data.ProtoLens.OptionalField - (Data.ProtoLens.Field.field @"maybe'inserted")) - :: Data.ProtoLens.FieldDescriptor DiffTreeVertex - replaced__field_descriptor - = Data.ProtoLens.FieldDescriptor "replaced" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor ReplacedTerm) - (Data.ProtoLens.OptionalField - (Data.ProtoLens.Field.field @"maybe'replaced")) - :: Data.ProtoLens.FieldDescriptor DiffTreeVertex - merged__field_descriptor - = Data.ProtoLens.FieldDescriptor "merged" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor MergedTerm) - (Data.ProtoLens.OptionalField - (Data.ProtoLens.Field.field @"maybe'merged")) - :: Data.ProtoLens.FieldDescriptor DiffTreeVertex - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, diffVertexId__field_descriptor), - (Data.ProtoLens.Tag 2, deleted__field_descriptor), - (Data.ProtoLens.Tag 3, inserted__field_descriptor), - (Data.ProtoLens.Tag 4, replaced__field_descriptor), - (Data.ProtoLens.Tag 5, merged__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _DiffTreeVertex'_unknownFields - (\ x__ y__ -> x__{_DiffTreeVertex'_unknownFields = y__}) - defMessage - = DiffTreeVertex{_DiffTreeVertex'diffVertexId = - Data.ProtoLens.fieldDefault, - _DiffTreeVertex'diffTerm = Prelude.Nothing, - _DiffTreeVertex'_unknownFields = ([])} - parseMessage - = let loop :: - DiffTreeVertex -> - Data.ProtoLens.Encoding.Bytes.Parser DiffTreeVertex - 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 - (("Missing required fields: ") Prelude.++ - 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 <- (Prelude.fmap Prelude.fromIntegral - Data.ProtoLens.Encoding.Bytes.getVarInt) - Data.ProtoLens.Encoding.Bytes. "diff_vertex_id" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"diffVertexId") - y - x) - 18 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "deleted" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"deleted") - y - x) - 26 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "inserted" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"inserted") - y - x) - 34 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "replaced" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"replaced") - y - x) - 42 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "merged" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"merged") - y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) - in - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "DiffTreeVertex" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"diffVertexId") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 8) Data.Monoid.<> - ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude.. - Prelude.fromIntegral) - _v) - Data.Monoid.<> - (case - Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'diffTerm") _x - of - (Prelude.Nothing) -> Data.Monoid.mempty - Prelude.Just - (DiffTreeVertex'Deleted - v) -> (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - v - Prelude.Just - (DiffTreeVertex'Inserted - v) -> (Data.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - v - Prelude.Just - (DiffTreeVertex'Replaced - v) -> (Data.ProtoLens.Encoding.Bytes.putVarInt 34) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - v - Prelude.Just - (DiffTreeVertex'Merged - v) -> (Data.ProtoLens.Encoding.Bytes.putVarInt 42) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - v) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData DiffTreeVertex where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_DiffTreeVertex'_unknownFields x__) - (Control.DeepSeq.deepseq (_DiffTreeVertex'diffVertexId x__) - (Control.DeepSeq.deepseq (_DiffTreeVertex'diffTerm x__) (())))) -instance Control.DeepSeq.NFData DiffTreeVertex'DiffTerm where - rnf (DiffTreeVertex'Deleted x__) = Control.DeepSeq.rnf x__ - rnf (DiffTreeVertex'Inserted x__) = Control.DeepSeq.rnf x__ - rnf (DiffTreeVertex'Replaced x__) = Control.DeepSeq.rnf x__ - rnf (DiffTreeVertex'Merged x__) = Control.DeepSeq.rnf x__ -_DiffTreeVertex'Deleted :: - Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm DeletedTerm -_DiffTreeVertex'Deleted - = Data.ProtoLens.Prism.prism' DiffTreeVertex'Deleted - (\ p__ -> - case p__ of - DiffTreeVertex'Deleted p__val -> Prelude.Just p__val - _otherwise -> Prelude.Nothing) -_DiffTreeVertex'Inserted :: - Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm InsertedTerm -_DiffTreeVertex'Inserted - = Data.ProtoLens.Prism.prism' DiffTreeVertex'Inserted - (\ p__ -> - case p__ of - DiffTreeVertex'Inserted p__val -> Prelude.Just p__val - _otherwise -> Prelude.Nothing) -_DiffTreeVertex'Replaced :: - Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm ReplacedTerm -_DiffTreeVertex'Replaced - = Data.ProtoLens.Prism.prism' DiffTreeVertex'Replaced - (\ p__ -> - case p__ of - DiffTreeVertex'Replaced p__val -> Prelude.Just p__val - _otherwise -> Prelude.Nothing) -_DiffTreeVertex'Merged :: - Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm MergedTerm -_DiffTreeVertex'Merged - = Data.ProtoLens.Prism.prism' DiffTreeVertex'Merged - (\ p__ -> - case p__ of - DiffTreeVertex'Merged p__val -> Prelude.Just p__val - _otherwise -> Prelude.Nothing) -{- | Fields : - - * 'Proto.Semantic_Fields.docstring' @:: Lens' Docstring Data.Text.Text@ - -} -data Docstring = Docstring{_Docstring'docstring :: !Data.Text.Text, - _Docstring'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (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 _ - = (Lens.Family2.Unchecked.lens _Docstring'docstring - (\ x__ y__ -> x__{_Docstring'docstring = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message Docstring where - messageName _ = Data.Text.pack "github.semantic.Docstring" - 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{_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 - (("Missing required fields: ") Prelude.++ - 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 <- (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)) - Data.ProtoLens.Encoding.Bytes. "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 - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "Docstring" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"docstring") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - 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{_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 (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 _ - = (Lens.Family2.Unchecked.lens _File'path - (\ x__ y__ -> x__{_File'path = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField File "language" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _File'language - (\ x__ y__ -> x__{_File'language = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField File "symbols" ([Symbol]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _File'symbols - (\ x__ y__ -> x__{_File'symbols = y__})) - Prelude.. - 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 _ - = (Lens.Family2.Unchecked.lens _File'symbols - (\ x__ y__ -> x__{_File'symbols = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField File "errors" ([ParseError]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _File'errors - (\ x__ y__ -> x__{_File'errors = y__})) - Prelude.. - 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 _ - = (Lens.Family2.Unchecked.lens _File'errors - (\ x__ y__ -> x__{_File'errors = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField File "blobOid" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _File'blobOid - (\ x__ y__ -> x__{_File'blobOid = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message File where - messageName _ = Data.Text.pack "github.semantic.File" - 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{_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 - (("Missing required fields: ") Prelude.++ - 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 <- (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)) - Data.ProtoLens.Encoding.Bytes. "path" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y - x) - mutable'errors - mutable'symbols - 18 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "language" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"language") - y - x) - mutable'errors - mutable'symbols - 26 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "symbols" - v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.append - mutable'symbols - y) - loop x mutable'errors v - 34 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "errors" - v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.append - mutable'errors - y) - loop x v mutable'symbols - 42 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "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 - (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) - Data.ProtoLens.Encoding.Bytes. "File" - buildMessage - = (\ _x -> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _x + (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 (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'symbols") _x)) - Data.Monoid.<> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 34) Data.Monoid.<> - (((\ bs -> + 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.before' @:: Lens' BlobPair Blob@ + * 'Proto.Semantic_Fields.maybe'before' @:: Lens' BlobPair (Prelude.Maybe Blob)@ + * 'Proto.Semantic_Fields.after' @:: Lens' BlobPair Blob@ + * 'Proto.Semantic_Fields.maybe'after' @:: Lens' BlobPair (Prelude.Maybe Blob)@ -} +data BlobPair + = BlobPair'_constructor {_BlobPair'before :: !(Prelude.Maybe Blob), + _BlobPair'after :: !(Prelude.Maybe Blob), + _BlobPair'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show BlobPair where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField BlobPair "before" Blob where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _BlobPair'before (\ x__ y__ -> x__ {_BlobPair'before = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField BlobPair "maybe'before" (Prelude.Maybe Blob) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _BlobPair'before (\ x__ y__ -> x__ {_BlobPair'before = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField BlobPair "after" Blob where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _BlobPair'after (\ x__ y__ -> x__ {_BlobPair'after = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField BlobPair "maybe'after" (Prelude.Maybe Blob) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _BlobPair'after (\ x__ y__ -> x__ {_BlobPair'after = y__})) + Prelude.id +instance Data.ProtoLens.Message BlobPair where + messageName _ = Data.Text.pack "github.semantic.BlobPair" + fieldsByTag + = let + before__field_descriptor + = Data.ProtoLens.FieldDescriptor + "before" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Blob) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'before")) :: + Data.ProtoLens.FieldDescriptor BlobPair + after__field_descriptor + = Data.ProtoLens.FieldDescriptor + "after" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Blob) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'after")) :: + Data.ProtoLens.FieldDescriptor BlobPair + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, before__field_descriptor), + (Data.ProtoLens.Tag 2, after__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _BlobPair'_unknownFields + (\ x__ y__ -> x__ {_BlobPair'_unknownFields = y__}) + defMessage + = BlobPair'_constructor + {_BlobPair'before = Prelude.Nothing, + _BlobPair'after = Prelude.Nothing, _BlobPair'_unknownFields = []} + parseMessage + = let + loop :: BlobPair -> Data.ProtoLens.Encoding.Bytes.Parser BlobPair + 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) + "before" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"before") 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) + "after" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"after") 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) "BlobPair" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'before") _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.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. 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 (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 42) Data.Monoid.<> - (((\ bs -> + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.ProtoLens.encodeMessage + _v)) + ((Data.Monoid.<>) + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'after") _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 BlobPair where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_BlobPair'_unknownFields x__) + (Control.DeepSeq.deepseq + (_BlobPair'before x__) + (Control.DeepSeq.deepseq (_BlobPair'after x__) ())) +newtype ChangeType'UnrecognizedValue + = ChangeType'UnrecognizedValue Data.Int.Int32 + deriving (Prelude.Eq, Prelude.Ord, Prelude.Show) +data ChangeType + = NONE | + ADDED | + REMOVED | + MODIFIED | + ChangeType'Unrecognized !ChangeType'UnrecognizedValue + deriving (Prelude.Show, Prelude.Eq, Prelude.Ord) +instance Data.ProtoLens.MessageEnum ChangeType where + maybeToEnum 0 = Prelude.Just NONE + maybeToEnum 1 = Prelude.Just ADDED + maybeToEnum 2 = Prelude.Just REMOVED + maybeToEnum 3 = Prelude.Just MODIFIED + maybeToEnum k + = Prelude.Just + (ChangeType'Unrecognized + (ChangeType'UnrecognizedValue (Prelude.fromIntegral k))) + showEnum NONE = "NONE" + showEnum ADDED = "ADDED" + showEnum REMOVED = "REMOVED" + showEnum MODIFIED = "MODIFIED" + showEnum (ChangeType'Unrecognized (ChangeType'UnrecognizedValue k)) + = Prelude.show k + readEnum k + | (Prelude.==) k "NONE" = Prelude.Just NONE + | (Prelude.==) k "ADDED" = Prelude.Just ADDED + | (Prelude.==) k "REMOVED" = Prelude.Just REMOVED + | (Prelude.==) k "MODIFIED" = Prelude.Just MODIFIED + | Prelude.otherwise + = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum +instance Prelude.Bounded ChangeType where + minBound = NONE + maxBound = MODIFIED +instance Prelude.Enum ChangeType where + toEnum k__ + = Prelude.maybe + (Prelude.error + ((Prelude.++) + "toEnum: unknown value for enum ChangeType: " (Prelude.show k__))) + Prelude.id + (Data.ProtoLens.maybeToEnum k__) + fromEnum NONE = 0 + fromEnum ADDED = 1 + fromEnum REMOVED = 2 + fromEnum MODIFIED = 3 + fromEnum (ChangeType'Unrecognized (ChangeType'UnrecognizedValue k)) + = Prelude.fromIntegral k + succ MODIFIED + = Prelude.error + "ChangeType.succ: bad argument MODIFIED. This value would be out of bounds." + succ NONE = ADDED + succ ADDED = REMOVED + succ REMOVED = MODIFIED + succ (ChangeType'Unrecognized _) + = Prelude.error "ChangeType.succ: bad argument: unrecognized value" + pred NONE + = Prelude.error + "ChangeType.pred: bad argument NONE. This value would be out of bounds." + pred ADDED = NONE + pred REMOVED = ADDED + pred MODIFIED = REMOVED + pred (ChangeType'Unrecognized _) + = Prelude.error "ChangeType.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 ChangeType where + fieldDefault = NONE +instance Control.DeepSeq.NFData ChangeType where + rnf x__ = Prelude.seq x__ () +{- | Fields : + + * 'Proto.Semantic_Fields.term' @:: Lens' DeletedTerm Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' DeletedTerm Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' DeletedTerm (Prelude.Maybe Span)@ -} +data DeletedTerm + = DeletedTerm'_constructor {_DeletedTerm'term :: !Data.Text.Text, + _DeletedTerm'span :: !(Prelude.Maybe Span), + _DeletedTerm'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DeletedTerm where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField DeletedTerm "term" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DeletedTerm'term (\ x__ y__ -> x__ {_DeletedTerm'term = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField DeletedTerm "span" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DeletedTerm'span (\ x__ y__ -> x__ {_DeletedTerm'span = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField DeletedTerm "maybe'span" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DeletedTerm'span (\ x__ y__ -> x__ {_DeletedTerm'span = y__})) + Prelude.id +instance Data.ProtoLens.Message DeletedTerm where + messageName _ = Data.Text.pack "github.semantic.DeletedTerm" + fieldsByTag + = let + term__field_descriptor + = Data.ProtoLens.FieldDescriptor + "term" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"term")) :: + Data.ProtoLens.FieldDescriptor DeletedTerm + 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 DeletedTerm + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, term__field_descriptor), + (Data.ProtoLens.Tag 2, span__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _DeletedTerm'_unknownFields + (\ x__ y__ -> x__ {_DeletedTerm'_unknownFields = y__}) + defMessage + = DeletedTerm'_constructor + {_DeletedTerm'term = Data.ProtoLens.fieldDefault, + _DeletedTerm'span = Prelude.Nothing, + _DeletedTerm'_unknownFields = []} + parseMessage + = let + loop :: + DeletedTerm -> Data.ProtoLens.Encoding.Bytes.Parser DeletedTerm + 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)) + "term" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"term") 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) + "span" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"span") 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) "DeletedTerm" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"term") _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.<>) + (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 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 DeletedTerm where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_DeletedTerm'_unknownFields x__) + (Control.DeepSeq.deepseq + (_DeletedTerm'term x__) + (Control.DeepSeq.deepseq (_DeletedTerm'span x__) ())) +{- | Fields : + + * 'Proto.Semantic_Fields.source' @:: Lens' DiffTreeEdge Data.Int.Int32@ + * 'Proto.Semantic_Fields.target' @:: Lens' DiffTreeEdge Data.Int.Int32@ -} +data DiffTreeEdge + = DiffTreeEdge'_constructor {_DiffTreeEdge'source :: !Data.Int.Int32, + _DiffTreeEdge'target :: !Data.Int.Int32, + _DiffTreeEdge'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DiffTreeEdge where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField DiffTreeEdge "source" Data.Int.Int32 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeEdge'source + (\ x__ y__ -> x__ {_DiffTreeEdge'source = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeEdge "target" Data.Int.Int32 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeEdge'target + (\ x__ y__ -> x__ {_DiffTreeEdge'target = y__})) + Prelude.id +instance Data.ProtoLens.Message DiffTreeEdge where + messageName _ = Data.Text.pack "github.semantic.DiffTreeEdge" + fieldsByTag + = let + source__field_descriptor + = Data.ProtoLens.FieldDescriptor + "source" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"source")) :: + Data.ProtoLens.FieldDescriptor DiffTreeEdge + target__field_descriptor + = Data.ProtoLens.FieldDescriptor + "target" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"target")) :: + Data.ProtoLens.FieldDescriptor DiffTreeEdge + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, source__field_descriptor), + (Data.ProtoLens.Tag 2, target__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _DiffTreeEdge'_unknownFields + (\ x__ y__ -> x__ {_DiffTreeEdge'_unknownFields = y__}) + defMessage + = DiffTreeEdge'_constructor + {_DiffTreeEdge'source = Data.ProtoLens.fieldDefault, + _DiffTreeEdge'target = Data.ProtoLens.fieldDefault, + _DiffTreeEdge'_unknownFields = []} + parseMessage + = let + loop :: + DiffTreeEdge -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeEdge + 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) + "source" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"source") y x) + 16 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "target" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"target") 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) "DiffTreeEdge" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"source") _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 @"target") _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 DiffTreeEdge where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_DiffTreeEdge'_unknownFields x__) + (Control.DeepSeq.deepseq + (_DiffTreeEdge'source x__) + (Control.DeepSeq.deepseq (_DiffTreeEdge'target x__) ())) +{- | Fields : + + * 'Proto.Semantic_Fields.path' @:: Lens' DiffTreeFileGraph Data.Text.Text@ + * 'Proto.Semantic_Fields.language' @:: Lens' DiffTreeFileGraph Data.Text.Text@ + * 'Proto.Semantic_Fields.vertices' @:: Lens' DiffTreeFileGraph [DiffTreeVertex]@ + * 'Proto.Semantic_Fields.vec'vertices' @:: Lens' DiffTreeFileGraph (Data.Vector.Vector DiffTreeVertex)@ + * 'Proto.Semantic_Fields.edges' @:: Lens' DiffTreeFileGraph [DiffTreeEdge]@ + * 'Proto.Semantic_Fields.vec'edges' @:: Lens' DiffTreeFileGraph (Data.Vector.Vector DiffTreeEdge)@ + * 'Proto.Semantic_Fields.errors' @:: Lens' DiffTreeFileGraph [ParseError]@ + * 'Proto.Semantic_Fields.vec'errors' @:: Lens' DiffTreeFileGraph (Data.Vector.Vector ParseError)@ -} +data DiffTreeFileGraph + = DiffTreeFileGraph'_constructor {_DiffTreeFileGraph'path :: !Data.Text.Text, + _DiffTreeFileGraph'language :: !Data.Text.Text, + _DiffTreeFileGraph'vertices :: !(Data.Vector.Vector DiffTreeVertex), + _DiffTreeFileGraph'edges :: !(Data.Vector.Vector DiffTreeEdge), + _DiffTreeFileGraph'errors :: !(Data.Vector.Vector ParseError), + _DiffTreeFileGraph'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DiffTreeFileGraph where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "path" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeFileGraph'path + (\ x__ y__ -> x__ {_DiffTreeFileGraph'path = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "language" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeFileGraph'language + (\ x__ y__ -> x__ {_DiffTreeFileGraph'language = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "vertices" [DiffTreeVertex] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeFileGraph'vertices + (\ x__ y__ -> x__ {_DiffTreeFileGraph'vertices = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "vec'vertices" (Data.Vector.Vector DiffTreeVertex) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeFileGraph'vertices + (\ x__ y__ -> x__ {_DiffTreeFileGraph'vertices = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "edges" [DiffTreeEdge] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeFileGraph'edges + (\ x__ y__ -> x__ {_DiffTreeFileGraph'edges = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "vec'edges" (Data.Vector.Vector DiffTreeEdge) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeFileGraph'edges + (\ x__ y__ -> x__ {_DiffTreeFileGraph'edges = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "errors" [ParseError] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeFileGraph'errors + (\ x__ y__ -> x__ {_DiffTreeFileGraph'errors = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField DiffTreeFileGraph "vec'errors" (Data.Vector.Vector ParseError) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeFileGraph'errors + (\ x__ y__ -> x__ {_DiffTreeFileGraph'errors = y__})) + Prelude.id +instance Data.ProtoLens.Message DiffTreeFileGraph where + messageName _ = Data.Text.pack "github.semantic.DiffTreeFileGraph" + 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 DiffTreeFileGraph + 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 DiffTreeFileGraph + vertices__field_descriptor + = Data.ProtoLens.FieldDescriptor + "vertices" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor DiffTreeVertex) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"vertices")) :: + Data.ProtoLens.FieldDescriptor DiffTreeFileGraph + edges__field_descriptor + = Data.ProtoLens.FieldDescriptor + "edges" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor DiffTreeEdge) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"edges")) :: + Data.ProtoLens.FieldDescriptor DiffTreeFileGraph + 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 DiffTreeFileGraph + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, path__field_descriptor), + (Data.ProtoLens.Tag 2, language__field_descriptor), + (Data.ProtoLens.Tag 3, vertices__field_descriptor), + (Data.ProtoLens.Tag 4, edges__field_descriptor), + (Data.ProtoLens.Tag 5, errors__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _DiffTreeFileGraph'_unknownFields + (\ x__ y__ -> x__ {_DiffTreeFileGraph'_unknownFields = y__}) + defMessage + = DiffTreeFileGraph'_constructor + {_DiffTreeFileGraph'path = Data.ProtoLens.fieldDefault, + _DiffTreeFileGraph'language = Data.ProtoLens.fieldDefault, + _DiffTreeFileGraph'vertices = Data.Vector.Generic.empty, + _DiffTreeFileGraph'edges = Data.Vector.Generic.empty, + _DiffTreeFileGraph'errors = Data.Vector.Generic.empty, + _DiffTreeFileGraph'_unknownFields = []} + parseMessage + = let + loop :: + DiffTreeFileGraph + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld DiffTreeEdge + -> 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 DiffTreeVertex + -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeFileGraph + loop x mutable'edges mutable'errors mutable'vertices + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze mutable'edges) + frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'errors) + frozen'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'vertices) + (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'edges") + frozen'edges + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'errors") + frozen'errors + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'vertices") + frozen'vertices + 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'edges + mutable'errors + mutable'vertices + 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'edges + mutable'errors + mutable'vertices + 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) + "vertices" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'vertices y) + loop x mutable'edges 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) + "edges" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'edges y) + loop x v mutable'errors mutable'vertices + 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 mutable'edges v mutable'vertices + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + mutable'edges + mutable'errors + mutable'vertices + in + (Data.ProtoLens.Encoding.Bytes.) + (do mutable'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop + Data.ProtoLens.defMessage + mutable'edges + mutable'errors + mutable'vertices) + "DiffTreeFileGraph" + 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'vertices") _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'edges") _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 DiffTreeFileGraph where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_DiffTreeFileGraph'_unknownFields x__) + (Control.DeepSeq.deepseq + (_DiffTreeFileGraph'path x__) + (Control.DeepSeq.deepseq + (_DiffTreeFileGraph'language x__) + (Control.DeepSeq.deepseq + (_DiffTreeFileGraph'vertices x__) + (Control.DeepSeq.deepseq + (_DiffTreeFileGraph'edges x__) + (Control.DeepSeq.deepseq (_DiffTreeFileGraph'errors x__) ()))))) +{- | Fields : + + * 'Proto.Semantic_Fields.files' @:: Lens' DiffTreeGraphResponse [DiffTreeFileGraph]@ + * 'Proto.Semantic_Fields.vec'files' @:: Lens' DiffTreeGraphResponse (Data.Vector.Vector DiffTreeFileGraph)@ -} +data DiffTreeGraphResponse + = DiffTreeGraphResponse'_constructor {_DiffTreeGraphResponse'files :: !(Data.Vector.Vector DiffTreeFileGraph), + _DiffTreeGraphResponse'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DiffTreeGraphResponse where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField DiffTreeGraphResponse "files" [DiffTreeFileGraph] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeGraphResponse'files + (\ x__ y__ -> x__ {_DiffTreeGraphResponse'files = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField DiffTreeGraphResponse "vec'files" (Data.Vector.Vector DiffTreeFileGraph) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeGraphResponse'files + (\ x__ y__ -> x__ {_DiffTreeGraphResponse'files = y__})) + Prelude.id +instance Data.ProtoLens.Message DiffTreeGraphResponse where + messageName _ + = Data.Text.pack "github.semantic.DiffTreeGraphResponse" + fieldsByTag + = let + files__field_descriptor + = Data.ProtoLens.FieldDescriptor + "files" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor DiffTreeFileGraph) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"files")) :: + Data.ProtoLens.FieldDescriptor DiffTreeGraphResponse + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _DiffTreeGraphResponse'_unknownFields + (\ x__ y__ -> x__ {_DiffTreeGraphResponse'_unknownFields = y__}) + defMessage + = DiffTreeGraphResponse'_constructor + {_DiffTreeGraphResponse'files = Data.Vector.Generic.empty, + _DiffTreeGraphResponse'_unknownFields = []} + parseMessage + = let + loop :: + DiffTreeGraphResponse + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld DiffTreeFileGraph + -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeGraphResponse + 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) + "DiffTreeGraphResponse" + 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.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - 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__) (()))))))) + (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 DiffTreeGraphResponse where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_DiffTreeGraphResponse'_unknownFields x__) + (Control.DeepSeq.deepseq (_DiffTreeGraphResponse'files x__) ()) {- | Fields : - - * 'Proto.Semantic_Fields.term' @:: Lens' InsertedTerm Data.Text.Text@ - * 'Proto.Semantic_Fields.span' @:: Lens' InsertedTerm Span@ - * 'Proto.Semantic_Fields.maybe'span' @:: Lens' InsertedTerm (Prelude.Maybe Span)@ - -} -data InsertedTerm = InsertedTerm{_InsertedTerm'term :: - !Data.Text.Text, - _InsertedTerm'span :: !(Prelude.Maybe Span), - _InsertedTerm'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show InsertedTerm where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField InsertedTerm "term" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _InsertedTerm'term - (\ x__ y__ -> x__{_InsertedTerm'term = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField InsertedTerm "span" (Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _InsertedTerm'span - (\ x__ y__ -> x__{_InsertedTerm'span = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField InsertedTerm "maybe'span" - (Prelude.Maybe Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _InsertedTerm'span - (\ x__ y__ -> x__{_InsertedTerm'span = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message InsertedTerm where - messageName _ = Data.Text.pack "github.semantic.InsertedTerm" - fieldsByTag - = let term__field_descriptor - = Data.ProtoLens.FieldDescriptor "term" - (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: - Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"term")) - :: Data.ProtoLens.FieldDescriptor InsertedTerm - 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 InsertedTerm - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, term__field_descriptor), - (Data.ProtoLens.Tag 2, span__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _InsertedTerm'_unknownFields - (\ x__ y__ -> x__{_InsertedTerm'_unknownFields = y__}) - defMessage - = InsertedTerm{_InsertedTerm'term = Data.ProtoLens.fieldDefault, - _InsertedTerm'span = Prelude.Nothing, - _InsertedTerm'_unknownFields = ([])} - parseMessage - = let loop :: - InsertedTerm -> Data.ProtoLens.Encoding.Bytes.Parser InsertedTerm - 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 - (("Missing required fields: ") Prelude.++ - Prelude.show (missing :: ([Prelude.String]))) - Prelude.return - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> Prelude.reverse t) - x) + + * 'Proto.Semantic_Fields.blobs' @:: Lens' DiffTreeRequest [BlobPair]@ + * 'Proto.Semantic_Fields.vec'blobs' @:: Lens' DiffTreeRequest (Data.Vector.Vector BlobPair)@ -} +data DiffTreeRequest + = DiffTreeRequest'_constructor {_DiffTreeRequest'blobs :: !(Data.Vector.Vector BlobPair), + _DiffTreeRequest'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DiffTreeRequest where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField DiffTreeRequest "blobs" [BlobPair] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeRequest'blobs + (\ x__ y__ -> x__ {_DiffTreeRequest'blobs = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField DiffTreeRequest "vec'blobs" (Data.Vector.Vector BlobPair) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeRequest'blobs + (\ x__ y__ -> x__ {_DiffTreeRequest'blobs = y__})) + Prelude.id +instance Data.ProtoLens.Message DiffTreeRequest where + messageName _ = Data.Text.pack "github.semantic.DiffTreeRequest" + fieldsByTag + = let + blobs__field_descriptor + = Data.ProtoLens.FieldDescriptor + "blobs" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor BlobPair) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"blobs")) :: + Data.ProtoLens.FieldDescriptor DiffTreeRequest + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, blobs__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _DiffTreeRequest'_unknownFields + (\ x__ y__ -> x__ {_DiffTreeRequest'_unknownFields = y__}) + defMessage + = DiffTreeRequest'_constructor + {_DiffTreeRequest'blobs = Data.Vector.Generic.empty, + _DiffTreeRequest'_unknownFields = []} + parseMessage + = let + loop :: + DiffTreeRequest + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld BlobPair + -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeRequest + 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 - do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt - case tag of - 10 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "term" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"term") y - x) - 18 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "span" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"span") y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) - in - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "InsertedTerm" - buildMessage - = (\ _x -> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"term") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. 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.ProtoLens.Encoding.Bytes.putVarInt 18) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData InsertedTerm where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_InsertedTerm'_unknownFields x__) - (Control.DeepSeq.deepseq (_InsertedTerm'term x__) - (Control.DeepSeq.deepseq (_InsertedTerm'span x__) (())))) + 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) + "DiffTreeRequest" + 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 DiffTreeRequest where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_DiffTreeRequest'_unknownFields x__) + (Control.DeepSeq.deepseq (_DiffTreeRequest'blobs x__) ()) {- | Fields : - - * 'Proto.Semantic_Fields.term' @:: Lens' MergedTerm Data.Text.Text@ - * 'Proto.Semantic_Fields.beforeSpan' @:: Lens' MergedTerm Span@ - * 'Proto.Semantic_Fields.maybe'beforeSpan' @:: Lens' MergedTerm (Prelude.Maybe Span)@ - * 'Proto.Semantic_Fields.afterSpan' @:: Lens' MergedTerm Span@ - * 'Proto.Semantic_Fields.maybe'afterSpan' @:: Lens' MergedTerm (Prelude.Maybe Span)@ - -} -data MergedTerm = MergedTerm{_MergedTerm'term :: !Data.Text.Text, + + * 'Proto.Semantic_Fields.files' @:: Lens' DiffTreeTOCResponse [TOCSummaryFile]@ + * 'Proto.Semantic_Fields.vec'files' @:: Lens' DiffTreeTOCResponse (Data.Vector.Vector TOCSummaryFile)@ -} +data DiffTreeTOCResponse + = DiffTreeTOCResponse'_constructor {_DiffTreeTOCResponse'files :: !(Data.Vector.Vector TOCSummaryFile), + _DiffTreeTOCResponse'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DiffTreeTOCResponse where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField DiffTreeTOCResponse "files" [TOCSummaryFile] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeTOCResponse'files + (\ x__ y__ -> x__ {_DiffTreeTOCResponse'files = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField DiffTreeTOCResponse "vec'files" (Data.Vector.Vector TOCSummaryFile) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeTOCResponse'files + (\ x__ y__ -> x__ {_DiffTreeTOCResponse'files = y__})) + Prelude.id +instance Data.ProtoLens.Message DiffTreeTOCResponse where + messageName _ + = Data.Text.pack "github.semantic.DiffTreeTOCResponse" + fieldsByTag + = let + files__field_descriptor + = Data.ProtoLens.FieldDescriptor + "files" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor TOCSummaryFile) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"files")) :: + Data.ProtoLens.FieldDescriptor DiffTreeTOCResponse + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _DiffTreeTOCResponse'_unknownFields + (\ x__ y__ -> x__ {_DiffTreeTOCResponse'_unknownFields = y__}) + defMessage + = DiffTreeTOCResponse'_constructor + {_DiffTreeTOCResponse'files = Data.Vector.Generic.empty, + _DiffTreeTOCResponse'_unknownFields = []} + parseMessage + = let + loop :: + DiffTreeTOCResponse + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld TOCSummaryFile + -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeTOCResponse + 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) + "DiffTreeTOCResponse" + 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 DiffTreeTOCResponse where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_DiffTreeTOCResponse'_unknownFields x__) + (Control.DeepSeq.deepseq (_DiffTreeTOCResponse'files x__) ()) +{- | Fields : + + * 'Proto.Semantic_Fields.diffVertexId' @:: Lens' DiffTreeVertex Data.Int.Int32@ + * 'Proto.Semantic_Fields.maybe'diffTerm' @:: Lens' DiffTreeVertex (Prelude.Maybe DiffTreeVertex'DiffTerm)@ + * 'Proto.Semantic_Fields.maybe'deleted' @:: Lens' DiffTreeVertex (Prelude.Maybe DeletedTerm)@ + * 'Proto.Semantic_Fields.deleted' @:: Lens' DiffTreeVertex DeletedTerm@ + * 'Proto.Semantic_Fields.maybe'inserted' @:: Lens' DiffTreeVertex (Prelude.Maybe InsertedTerm)@ + * 'Proto.Semantic_Fields.inserted' @:: Lens' DiffTreeVertex InsertedTerm@ + * 'Proto.Semantic_Fields.maybe'replaced' @:: Lens' DiffTreeVertex (Prelude.Maybe ReplacedTerm)@ + * 'Proto.Semantic_Fields.replaced' @:: Lens' DiffTreeVertex ReplacedTerm@ + * 'Proto.Semantic_Fields.maybe'merged' @:: Lens' DiffTreeVertex (Prelude.Maybe MergedTerm)@ + * 'Proto.Semantic_Fields.merged' @:: Lens' DiffTreeVertex MergedTerm@ -} +data DiffTreeVertex + = DiffTreeVertex'_constructor {_DiffTreeVertex'diffVertexId :: !Data.Int.Int32, + _DiffTreeVertex'diffTerm :: !(Prelude.Maybe DiffTreeVertex'DiffTerm), + _DiffTreeVertex'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show DiffTreeVertex where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +data DiffTreeVertex'DiffTerm + = DiffTreeVertex'Deleted !DeletedTerm | + DiffTreeVertex'Inserted !InsertedTerm | + DiffTreeVertex'Replaced !ReplacedTerm | + DiffTreeVertex'Merged !MergedTerm + deriving (Prelude.Show, Prelude.Eq, Prelude.Ord) +instance Data.ProtoLens.Field.HasField DiffTreeVertex "diffVertexId" Data.Int.Int32 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeVertex'diffVertexId + (\ x__ y__ -> x__ {_DiffTreeVertex'diffVertexId = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeVertex "maybe'diffTerm" (Prelude.Maybe DiffTreeVertex'DiffTerm) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeVertex'diffTerm + (\ x__ y__ -> x__ {_DiffTreeVertex'diffTerm = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField DiffTreeVertex "maybe'deleted" (Prelude.Maybe DeletedTerm) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeVertex'diffTerm + (\ x__ y__ -> x__ {_DiffTreeVertex'diffTerm = y__})) + (Lens.Family2.Unchecked.lens + (\ x__ + -> case x__ of + (Prelude.Just (DiffTreeVertex'Deleted x__val)) + -> Prelude.Just x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Deleted y__)) +instance Data.ProtoLens.Field.HasField DiffTreeVertex "deleted" DeletedTerm where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeVertex'diffTerm + (\ x__ y__ -> x__ {_DiffTreeVertex'diffTerm = y__})) + ((Prelude..) + (Lens.Family2.Unchecked.lens + (\ x__ + -> case x__ of + (Prelude.Just (DiffTreeVertex'Deleted x__val)) + -> Prelude.Just x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Deleted y__)) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage)) +instance Data.ProtoLens.Field.HasField DiffTreeVertex "maybe'inserted" (Prelude.Maybe InsertedTerm) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeVertex'diffTerm + (\ x__ y__ -> x__ {_DiffTreeVertex'diffTerm = y__})) + (Lens.Family2.Unchecked.lens + (\ x__ + -> case x__ of + (Prelude.Just (DiffTreeVertex'Inserted x__val)) + -> Prelude.Just x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Inserted y__)) +instance Data.ProtoLens.Field.HasField DiffTreeVertex "inserted" InsertedTerm where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeVertex'diffTerm + (\ x__ y__ -> x__ {_DiffTreeVertex'diffTerm = y__})) + ((Prelude..) + (Lens.Family2.Unchecked.lens + (\ x__ + -> case x__ of + (Prelude.Just (DiffTreeVertex'Inserted x__val)) + -> Prelude.Just x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Inserted y__)) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage)) +instance Data.ProtoLens.Field.HasField DiffTreeVertex "maybe'replaced" (Prelude.Maybe ReplacedTerm) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeVertex'diffTerm + (\ x__ y__ -> x__ {_DiffTreeVertex'diffTerm = y__})) + (Lens.Family2.Unchecked.lens + (\ x__ + -> case x__ of + (Prelude.Just (DiffTreeVertex'Replaced x__val)) + -> Prelude.Just x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Replaced y__)) +instance Data.ProtoLens.Field.HasField DiffTreeVertex "replaced" ReplacedTerm where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeVertex'diffTerm + (\ x__ y__ -> x__ {_DiffTreeVertex'diffTerm = y__})) + ((Prelude..) + (Lens.Family2.Unchecked.lens + (\ x__ + -> case x__ of + (Prelude.Just (DiffTreeVertex'Replaced x__val)) + -> Prelude.Just x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Replaced y__)) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage)) +instance Data.ProtoLens.Field.HasField DiffTreeVertex "maybe'merged" (Prelude.Maybe MergedTerm) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeVertex'diffTerm + (\ x__ y__ -> x__ {_DiffTreeVertex'diffTerm = y__})) + (Lens.Family2.Unchecked.lens + (\ x__ + -> case x__ of + (Prelude.Just (DiffTreeVertex'Merged x__val)) + -> Prelude.Just x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Merged y__)) +instance Data.ProtoLens.Field.HasField DiffTreeVertex "merged" MergedTerm where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _DiffTreeVertex'diffTerm + (\ x__ y__ -> x__ {_DiffTreeVertex'diffTerm = y__})) + ((Prelude..) + (Lens.Family2.Unchecked.lens + (\ x__ + -> case x__ of + (Prelude.Just (DiffTreeVertex'Merged x__val)) + -> Prelude.Just x__val + _otherwise -> Prelude.Nothing) + (\ _ y__ -> Prelude.fmap DiffTreeVertex'Merged y__)) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage)) +instance Data.ProtoLens.Message DiffTreeVertex where + messageName _ = Data.Text.pack "github.semantic.DiffTreeVertex" + fieldsByTag + = let + diffVertexId__field_descriptor + = Data.ProtoLens.FieldDescriptor + "diff_vertex_id" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"diffVertexId")) :: + Data.ProtoLens.FieldDescriptor DiffTreeVertex + deleted__field_descriptor + = Data.ProtoLens.FieldDescriptor + "deleted" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor DeletedTerm) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'deleted")) :: + Data.ProtoLens.FieldDescriptor DiffTreeVertex + inserted__field_descriptor + = Data.ProtoLens.FieldDescriptor + "inserted" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor InsertedTerm) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'inserted")) :: + Data.ProtoLens.FieldDescriptor DiffTreeVertex + replaced__field_descriptor + = Data.ProtoLens.FieldDescriptor + "replaced" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor ReplacedTerm) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'replaced")) :: + Data.ProtoLens.FieldDescriptor DiffTreeVertex + merged__field_descriptor + = Data.ProtoLens.FieldDescriptor + "merged" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor MergedTerm) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'merged")) :: + Data.ProtoLens.FieldDescriptor DiffTreeVertex + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, diffVertexId__field_descriptor), + (Data.ProtoLens.Tag 2, deleted__field_descriptor), + (Data.ProtoLens.Tag 3, inserted__field_descriptor), + (Data.ProtoLens.Tag 4, replaced__field_descriptor), + (Data.ProtoLens.Tag 5, merged__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _DiffTreeVertex'_unknownFields + (\ x__ y__ -> x__ {_DiffTreeVertex'_unknownFields = y__}) + defMessage + = DiffTreeVertex'_constructor + {_DiffTreeVertex'diffVertexId = Data.ProtoLens.fieldDefault, + _DiffTreeVertex'diffTerm = Prelude.Nothing, + _DiffTreeVertex'_unknownFields = []} + parseMessage + = let + loop :: + DiffTreeVertex + -> Data.ProtoLens.Encoding.Bytes.Parser DiffTreeVertex + 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) + "diff_vertex_id" + loop + (Lens.Family2.set + (Data.ProtoLens.Field.field @"diffVertexId") 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) + "deleted" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"deleted") y x) + 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) + "inserted" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"inserted") 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) + "replaced" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"replaced") 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) + "merged" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"merged") 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) "DiffTreeVertex" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"diffVertexId") _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.<>) + (case + Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'diffTerm") _x + of + Prelude.Nothing -> Data.Monoid.mempty + (Prelude.Just (DiffTreeVertex'Deleted 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) + (Prelude.Just (DiffTreeVertex'Inserted 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) + (Prelude.Just (DiffTreeVertex'Replaced 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) + (Prelude.Just (DiffTreeVertex'Merged 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.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x))) +instance Control.DeepSeq.NFData DiffTreeVertex where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_DiffTreeVertex'_unknownFields x__) + (Control.DeepSeq.deepseq + (_DiffTreeVertex'diffVertexId x__) + (Control.DeepSeq.deepseq (_DiffTreeVertex'diffTerm x__) ())) +instance Control.DeepSeq.NFData DiffTreeVertex'DiffTerm where + rnf (DiffTreeVertex'Deleted x__) = Control.DeepSeq.rnf x__ + rnf (DiffTreeVertex'Inserted x__) = Control.DeepSeq.rnf x__ + rnf (DiffTreeVertex'Replaced x__) = Control.DeepSeq.rnf x__ + rnf (DiffTreeVertex'Merged x__) = Control.DeepSeq.rnf x__ +_DiffTreeVertex'Deleted :: + Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm DeletedTerm +_DiffTreeVertex'Deleted + = Data.ProtoLens.Prism.prism' + DiffTreeVertex'Deleted + (\ p__ + -> case p__ of + (DiffTreeVertex'Deleted p__val) -> Prelude.Just p__val + _otherwise -> Prelude.Nothing) +_DiffTreeVertex'Inserted :: + Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm InsertedTerm +_DiffTreeVertex'Inserted + = Data.ProtoLens.Prism.prism' + DiffTreeVertex'Inserted + (\ p__ + -> case p__ of + (DiffTreeVertex'Inserted p__val) -> Prelude.Just p__val + _otherwise -> Prelude.Nothing) +_DiffTreeVertex'Replaced :: + Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm ReplacedTerm +_DiffTreeVertex'Replaced + = Data.ProtoLens.Prism.prism' + DiffTreeVertex'Replaced + (\ p__ + -> case p__ of + (DiffTreeVertex'Replaced p__val) -> Prelude.Just p__val + _otherwise -> Prelude.Nothing) +_DiffTreeVertex'Merged :: + Data.ProtoLens.Prism.Prism' DiffTreeVertex'DiffTerm MergedTerm +_DiffTreeVertex'Merged + = Data.ProtoLens.Prism.prism' + DiffTreeVertex'Merged + (\ p__ + -> case p__ of + (DiffTreeVertex'Merged p__val) -> Prelude.Just p__val + _otherwise -> Prelude.Nothing) +{- | 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 (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" + 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 (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" + 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__) ()))))) +{- | Fields : + + * 'Proto.Semantic_Fields.term' @:: Lens' InsertedTerm Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' InsertedTerm Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' InsertedTerm (Prelude.Maybe Span)@ -} +data InsertedTerm + = InsertedTerm'_constructor {_InsertedTerm'term :: !Data.Text.Text, + _InsertedTerm'span :: !(Prelude.Maybe Span), + _InsertedTerm'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show InsertedTerm where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField InsertedTerm "term" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _InsertedTerm'term (\ x__ y__ -> x__ {_InsertedTerm'term = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField InsertedTerm "span" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _InsertedTerm'span (\ x__ y__ -> x__ {_InsertedTerm'span = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField InsertedTerm "maybe'span" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _InsertedTerm'span (\ x__ y__ -> x__ {_InsertedTerm'span = y__})) + Prelude.id +instance Data.ProtoLens.Message InsertedTerm where + messageName _ = Data.Text.pack "github.semantic.InsertedTerm" + fieldsByTag + = let + term__field_descriptor + = Data.ProtoLens.FieldDescriptor + "term" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"term")) :: + Data.ProtoLens.FieldDescriptor InsertedTerm + 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 InsertedTerm + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, term__field_descriptor), + (Data.ProtoLens.Tag 2, span__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _InsertedTerm'_unknownFields + (\ x__ y__ -> x__ {_InsertedTerm'_unknownFields = y__}) + defMessage + = InsertedTerm'_constructor + {_InsertedTerm'term = Data.ProtoLens.fieldDefault, + _InsertedTerm'span = Prelude.Nothing, + _InsertedTerm'_unknownFields = []} + parseMessage + = let + loop :: + InsertedTerm -> Data.ProtoLens.Encoding.Bytes.Parser InsertedTerm + 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)) + "term" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"term") 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) + "span" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"span") 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) "InsertedTerm" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"term") _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.<>) + (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 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 InsertedTerm where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_InsertedTerm'_unknownFields x__) + (Control.DeepSeq.deepseq + (_InsertedTerm'term x__) + (Control.DeepSeq.deepseq (_InsertedTerm'span x__) ())) +{- | Fields : + + * 'Proto.Semantic_Fields.term' @:: Lens' MergedTerm Data.Text.Text@ + * 'Proto.Semantic_Fields.beforeSpan' @:: Lens' MergedTerm Span@ + * 'Proto.Semantic_Fields.maybe'beforeSpan' @:: Lens' MergedTerm (Prelude.Maybe Span)@ + * 'Proto.Semantic_Fields.afterSpan' @:: Lens' MergedTerm Span@ + * 'Proto.Semantic_Fields.maybe'afterSpan' @:: Lens' MergedTerm (Prelude.Maybe Span)@ -} +data MergedTerm + = MergedTerm'_constructor {_MergedTerm'term :: !Data.Text.Text, _MergedTerm'beforeSpan :: !(Prelude.Maybe Span), _MergedTerm'afterSpan :: !(Prelude.Maybe Span), _MergedTerm'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) + deriving (Prelude.Eq, Prelude.Ord) instance Prelude.Show MergedTerm where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField MergedTerm "term" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _MergedTerm'term - (\ x__ y__ -> x__{_MergedTerm'term = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField MergedTerm "beforeSpan" - (Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _MergedTerm'beforeSpan - (\ x__ y__ -> x__{_MergedTerm'beforeSpan = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField MergedTerm - "maybe'beforeSpan" - (Prelude.Maybe Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _MergedTerm'beforeSpan - (\ x__ y__ -> x__{_MergedTerm'beforeSpan = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField MergedTerm "afterSpan" - (Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _MergedTerm'afterSpan - (\ x__ y__ -> x__{_MergedTerm'afterSpan = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField MergedTerm "maybe'afterSpan" - (Prelude.Maybe Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _MergedTerm'afterSpan - (\ x__ y__ -> x__{_MergedTerm'afterSpan = y__})) - Prelude.. Prelude.id + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField MergedTerm "term" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _MergedTerm'term (\ x__ y__ -> x__ {_MergedTerm'term = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField MergedTerm "beforeSpan" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _MergedTerm'beforeSpan + (\ x__ y__ -> x__ {_MergedTerm'beforeSpan = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField MergedTerm "maybe'beforeSpan" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _MergedTerm'beforeSpan + (\ x__ y__ -> x__ {_MergedTerm'beforeSpan = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField MergedTerm "afterSpan" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _MergedTerm'afterSpan + (\ x__ y__ -> x__ {_MergedTerm'afterSpan = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField MergedTerm "maybe'afterSpan" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _MergedTerm'afterSpan + (\ x__ y__ -> x__ {_MergedTerm'afterSpan = y__})) + Prelude.id instance Data.ProtoLens.Message MergedTerm where - messageName _ = Data.Text.pack "github.semantic.MergedTerm" - fieldsByTag - = let term__field_descriptor - = Data.ProtoLens.FieldDescriptor "term" - (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: - Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"term")) - :: Data.ProtoLens.FieldDescriptor MergedTerm - beforeSpan__field_descriptor - = Data.ProtoLens.FieldDescriptor "before_span" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor Span) - (Data.ProtoLens.OptionalField - (Data.ProtoLens.Field.field @"maybe'beforeSpan")) - :: Data.ProtoLens.FieldDescriptor MergedTerm - afterSpan__field_descriptor - = Data.ProtoLens.FieldDescriptor "after_span" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor Span) - (Data.ProtoLens.OptionalField - (Data.ProtoLens.Field.field @"maybe'afterSpan")) - :: Data.ProtoLens.FieldDescriptor MergedTerm - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, term__field_descriptor), - (Data.ProtoLens.Tag 2, beforeSpan__field_descriptor), - (Data.ProtoLens.Tag 3, afterSpan__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _MergedTerm'_unknownFields - (\ x__ y__ -> x__{_MergedTerm'_unknownFields = y__}) - defMessage - = MergedTerm{_MergedTerm'term = Data.ProtoLens.fieldDefault, - _MergedTerm'beforeSpan = Prelude.Nothing, - _MergedTerm'afterSpan = Prelude.Nothing, - _MergedTerm'_unknownFields = ([])} - parseMessage - = let loop :: - MergedTerm -> Data.ProtoLens.Encoding.Bytes.Parser MergedTerm - 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 - (("Missing required fields: ") Prelude.++ - Prelude.show (missing :: ([Prelude.String]))) - Prelude.return - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> Prelude.reverse t) - x) + messageName _ = Data.Text.pack "github.semantic.MergedTerm" + fieldsByTag + = let + term__field_descriptor + = Data.ProtoLens.FieldDescriptor + "term" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"term")) :: + Data.ProtoLens.FieldDescriptor MergedTerm + beforeSpan__field_descriptor + = Data.ProtoLens.FieldDescriptor + "before_span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'beforeSpan")) :: + Data.ProtoLens.FieldDescriptor MergedTerm + afterSpan__field_descriptor + = Data.ProtoLens.FieldDescriptor + "after_span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'afterSpan")) :: + Data.ProtoLens.FieldDescriptor MergedTerm + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, term__field_descriptor), + (Data.ProtoLens.Tag 2, beforeSpan__field_descriptor), + (Data.ProtoLens.Tag 3, afterSpan__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _MergedTerm'_unknownFields + (\ x__ y__ -> x__ {_MergedTerm'_unknownFields = y__}) + defMessage + = MergedTerm'_constructor + {_MergedTerm'term = Data.ProtoLens.fieldDefault, + _MergedTerm'beforeSpan = Prelude.Nothing, + _MergedTerm'afterSpan = Prelude.Nothing, + _MergedTerm'_unknownFields = []} + parseMessage + = let + loop :: + MergedTerm -> Data.ProtoLens.Encoding.Bytes.Parser MergedTerm + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () else - do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt - case tag of - 10 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "term" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"term") y - x) - 18 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "before_span" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"beforeSpan") - y - x) - 26 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "after_span" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"afterSpan") - y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) + 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)) + "term" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"term") 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) + "before_span" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"beforeSpan") y x) + 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) + "after_span" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"afterSpan") 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) "MergedTerm" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"term") _x in - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "MergedTerm" - buildMessage - = (\ _x -> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"term") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (case - Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'beforeSpan") - _x - of - (Prelude.Nothing) -> Data.Monoid.mempty - Prelude.Just _v -> (Data.ProtoLens.Encoding.Bytes.putVarInt 18) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - (case - Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'afterSpan") - _x - of - (Prelude.Nothing) -> Data.Monoid.mempty - Prelude.Just _v -> (Data.ProtoLens.Encoding.Bytes.putVarInt 26) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData MergedTerm where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_MergedTerm'_unknownFields x__) - (Control.DeepSeq.deepseq (_MergedTerm'term x__) - (Control.DeepSeq.deepseq (_MergedTerm'beforeSpan x__) - (Control.DeepSeq.deepseq (_MergedTerm'afterSpan x__) (()))))) -{- | Fields : - - * 'Proto.Semantic_Fields.error' @:: Lens' ParseError Data.Text.Text@ - -} -data ParseError = ParseError{_ParseError'error :: !Data.Text.Text, - _ParseError'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (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 _ - = (Lens.Family2.Unchecked.lens _ParseError'error - (\ x__ y__ -> x__{_ParseError'error = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message ParseError where - messageName _ = Data.Text.pack "github.semantic.ParseError" - 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{_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 - (("Missing required fields: ") Prelude.++ - 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 <- (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)) - Data.ProtoLens.Encoding.Bytes. "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 - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "ParseError" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"error") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - 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.path' @:: Lens' ParseTreeFileGraph Data.Text.Text@ - * 'Proto.Semantic_Fields.language' @:: Lens' ParseTreeFileGraph Data.Text.Text@ - * 'Proto.Semantic_Fields.vertices' @:: Lens' ParseTreeFileGraph [TermVertex]@ - * 'Proto.Semantic_Fields.vec'vertices' @:: Lens' ParseTreeFileGraph (Data.Vector.Vector TermVertex)@ - * 'Proto.Semantic_Fields.edges' @:: Lens' ParseTreeFileGraph [TermEdge]@ - * 'Proto.Semantic_Fields.vec'edges' @:: Lens' ParseTreeFileGraph (Data.Vector.Vector TermEdge)@ - * 'Proto.Semantic_Fields.errors' @:: Lens' ParseTreeFileGraph [ParseError]@ - * 'Proto.Semantic_Fields.vec'errors' @:: Lens' ParseTreeFileGraph (Data.Vector.Vector ParseError)@ - -} -data ParseTreeFileGraph = ParseTreeFileGraph{_ParseTreeFileGraph'path - :: !Data.Text.Text, - _ParseTreeFileGraph'language :: !Data.Text.Text, - _ParseTreeFileGraph'vertices :: - !(Data.Vector.Vector TermVertex), - _ParseTreeFileGraph'edges :: - !(Data.Vector.Vector TermEdge), - _ParseTreeFileGraph'errors :: - !(Data.Vector.Vector ParseError), - _ParseTreeFileGraph'_unknownFields :: - !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show ParseTreeFileGraph where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "path" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'path - (\ x__ y__ -> x__{_ParseTreeFileGraph'path = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField ParseTreeFileGraph - "language" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'language - (\ x__ y__ -> x__{_ParseTreeFileGraph'language = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField ParseTreeFileGraph - "vertices" - ([TermVertex]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'vertices - (\ x__ y__ -> x__{_ParseTreeFileGraph'vertices = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField ParseTreeFileGraph - "vec'vertices" - (Data.Vector.Vector TermVertex) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'vertices - (\ x__ y__ -> x__{_ParseTreeFileGraph'vertices = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "edges" - ([TermEdge]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'edges - (\ x__ y__ -> x__{_ParseTreeFileGraph'edges = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField ParseTreeFileGraph - "vec'edges" - (Data.Vector.Vector TermEdge) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'edges - (\ x__ y__ -> x__{_ParseTreeFileGraph'edges = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "errors" - ([ParseError]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'errors - (\ x__ y__ -> x__{_ParseTreeFileGraph'errors = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField ParseTreeFileGraph - "vec'errors" - (Data.Vector.Vector ParseError) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ParseTreeFileGraph'errors - (\ x__ y__ -> x__{_ParseTreeFileGraph'errors = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message ParseTreeFileGraph where - messageName _ = Data.Text.pack "github.semantic.ParseTreeFileGraph" - 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 ParseTreeFileGraph - 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 ParseTreeFileGraph - vertices__field_descriptor - = Data.ProtoLens.FieldDescriptor "vertices" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor TermVertex) - (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked - (Data.ProtoLens.Field.field @"vertices")) - :: Data.ProtoLens.FieldDescriptor ParseTreeFileGraph - edges__field_descriptor - = Data.ProtoLens.FieldDescriptor "edges" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor TermEdge) - (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked - (Data.ProtoLens.Field.field @"edges")) - :: Data.ProtoLens.FieldDescriptor ParseTreeFileGraph - 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 ParseTreeFileGraph - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, path__field_descriptor), - (Data.ProtoLens.Tag 2, language__field_descriptor), - (Data.ProtoLens.Tag 3, vertices__field_descriptor), - (Data.ProtoLens.Tag 4, edges__field_descriptor), - (Data.ProtoLens.Tag 5, errors__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _ParseTreeFileGraph'_unknownFields - (\ x__ y__ -> x__{_ParseTreeFileGraph'_unknownFields = y__}) - defMessage - = ParseTreeFileGraph{_ParseTreeFileGraph'path = - Data.ProtoLens.fieldDefault, - _ParseTreeFileGraph'language = Data.ProtoLens.fieldDefault, - _ParseTreeFileGraph'vertices = Data.Vector.Generic.empty, - _ParseTreeFileGraph'edges = Data.Vector.Generic.empty, - _ParseTreeFileGraph'errors = Data.Vector.Generic.empty, - _ParseTreeFileGraph'_unknownFields = ([])} - parseMessage - = let loop :: - ParseTreeFileGraph -> - Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector - Data.ProtoLens.Encoding.Growing.RealWorld - TermEdge - -> - 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 - TermVertex - -> Data.ProtoLens.Encoding.Bytes.Parser ParseTreeFileGraph - loop x mutable'edges mutable'errors mutable'vertices - = do end <- Data.ProtoLens.Encoding.Bytes.atEnd - if end then - do frozen'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.unsafeFreeze - mutable'edges) - frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.unsafeFreeze - mutable'errors) - frozen'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.unsafeFreeze - mutable'vertices) - let missing = [] in - if Prelude.null missing then Prelude.return () else - Prelude.fail - (("Missing required fields: ") Prelude.++ - 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'edges") - frozen'edges - (Lens.Family2.set (Data.ProtoLens.Field.field @"vec'errors") - frozen'errors - (Lens.Family2.set - (Data.ProtoLens.Field.field @"vec'vertices") - frozen'vertices - x)))) - else - do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt - case tag of - 10 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "path" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y - x) - mutable'edges - mutable'errors - mutable'vertices - 18 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "language" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"language") - y - x) - mutable'edges - mutable'errors - mutable'vertices - 26 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "vertices" - v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.append - mutable'vertices - y) - loop x mutable'edges mutable'errors v - 34 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "edges" - v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.append - mutable'edges - y) - loop x v mutable'errors mutable'vertices - 42 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "errors" - v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.append - mutable'errors - y) - loop x mutable'edges v mutable'vertices - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) - mutable'edges - mutable'errors - mutable'vertices - in - (do mutable'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - mutable'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - loop Data.ProtoLens.defMessage mutable'edges mutable'errors - mutable'vertices) - Data.ProtoLens.Encoding.Bytes. "ParseTreeFileGraph" - buildMessage - = (\ _x -> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'vertices") - _x)) - Data.Monoid.<> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 34) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'edges") _x)) - Data.Monoid.<> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 42) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'errors") _x)) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData ParseTreeFileGraph where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_ParseTreeFileGraph'_unknownFields x__) - (Control.DeepSeq.deepseq (_ParseTreeFileGraph'path x__) - (Control.DeepSeq.deepseq (_ParseTreeFileGraph'language x__) - (Control.DeepSeq.deepseq (_ParseTreeFileGraph'vertices x__) - (Control.DeepSeq.deepseq (_ParseTreeFileGraph'edges x__) - (Control.DeepSeq.deepseq (_ParseTreeFileGraph'errors x__) - (()))))))) -{- | Fields : - - * 'Proto.Semantic_Fields.files' @:: Lens' ParseTreeGraphResponse [ParseTreeFileGraph]@ - * 'Proto.Semantic_Fields.vec'files' @:: Lens' ParseTreeGraphResponse - (Data.Vector.Vector ParseTreeFileGraph)@ - -} -data ParseTreeGraphResponse = ParseTreeGraphResponse{_ParseTreeGraphResponse'files - :: !(Data.Vector.Vector ParseTreeFileGraph), - _ParseTreeGraphResponse'_unknownFields :: - !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show ParseTreeGraphResponse where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField ParseTreeGraphResponse - "files" - ([ParseTreeFileGraph]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ParseTreeGraphResponse'files - (\ x__ y__ -> x__{_ParseTreeGraphResponse'files = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField ParseTreeGraphResponse - "vec'files" - (Data.Vector.Vector ParseTreeFileGraph) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ParseTreeGraphResponse'files - (\ x__ y__ -> x__{_ParseTreeGraphResponse'files = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message ParseTreeGraphResponse where - messageName _ - = Data.Text.pack "github.semantic.ParseTreeGraphResponse" - fieldsByTag - = let files__field_descriptor - = Data.ProtoLens.FieldDescriptor "files" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor ParseTreeFileGraph) - (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked - (Data.ProtoLens.Field.field @"files")) - :: Data.ProtoLens.FieldDescriptor ParseTreeGraphResponse - in - Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens - _ParseTreeGraphResponse'_unknownFields - (\ x__ y__ -> x__{_ParseTreeGraphResponse'_unknownFields = y__}) - defMessage - = ParseTreeGraphResponse{_ParseTreeGraphResponse'files = - Data.Vector.Generic.empty, - _ParseTreeGraphResponse'_unknownFields = ([])} - parseMessage - = let loop :: - ParseTreeGraphResponse -> - Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector - Data.ProtoLens.Encoding.Growing.RealWorld - ParseTreeFileGraph - -> Data.ProtoLens.Encoding.Bytes.Parser ParseTreeGraphResponse - 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 - (("Missing required fields: ") Prelude.++ - 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 <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "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 - (do mutable'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - loop Data.ProtoLens.defMessage mutable'files) - Data.ProtoLens.Encoding.Bytes. "ParseTreeGraphResponse" - buildMessage - = (\ _x -> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'files") _x)) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData ParseTreeGraphResponse where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq - (_ParseTreeGraphResponse'_unknownFields x__) - (Control.DeepSeq.deepseq (_ParseTreeGraphResponse'files x__) (()))) -{- | Fields : - - * 'Proto.Semantic_Fields.blobs' @:: Lens' ParseTreeRequest [Blob]@ - * 'Proto.Semantic_Fields.vec'blobs' @:: Lens' ParseTreeRequest (Data.Vector.Vector Blob)@ - -} -data ParseTreeRequest = ParseTreeRequest{_ParseTreeRequest'blobs :: - !(Data.Vector.Vector Blob), - _ParseTreeRequest'_unknownFields :: - !Data.ProtoLens.FieldSet} - deriving (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 _ - = (Lens.Family2.Unchecked.lens _ParseTreeRequest'blobs - (\ x__ y__ -> x__{_ParseTreeRequest'blobs = y__})) - Prelude.. - 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 _ - = (Lens.Family2.Unchecked.lens _ParseTreeRequest'blobs - (\ x__ y__ -> x__{_ParseTreeRequest'blobs = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message ParseTreeRequest where - messageName _ = Data.Text.pack "github.semantic.ParseTreeRequest" - 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{_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 - (("Missing required fields: ") Prelude.++ - 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 <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "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 - (do mutable'blobs <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - loop Data.ProtoLens.defMessage mutable'blobs) - Data.ProtoLens.Encoding.Bytes. "ParseTreeRequest" - buildMessage - = (\ _x -> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'blobs") _x)) - Data.Monoid.<> - 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{_ParseTreeSymbolResponse'files - :: !(Data.Vector.Vector File), - _ParseTreeSymbolResponse'_unknownFields :: - !Data.ProtoLens.FieldSet} - deriving (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 _ - = (Lens.Family2.Unchecked.lens _ParseTreeSymbolResponse'files - (\ x__ y__ -> x__{_ParseTreeSymbolResponse'files = y__})) - Prelude.. - 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 _ - = (Lens.Family2.Unchecked.lens _ParseTreeSymbolResponse'files - (\ x__ y__ -> x__{_ParseTreeSymbolResponse'files = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message ParseTreeSymbolResponse where - messageName _ - = Data.Text.pack "github.semantic.ParseTreeSymbolResponse" - 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{_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 - (("Missing required fields: ") Prelude.++ - 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 <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "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 - (do mutable'files <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - loop Data.ProtoLens.defMessage mutable'files) - Data.ProtoLens.Encoding.Bytes. "ParseTreeSymbolResponse" - buildMessage - = (\ _x -> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'files") _x)) - Data.Monoid.<> - 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{_PingRequest'service :: - !Data.Text.Text, - _PingRequest'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (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 _ - = (Lens.Family2.Unchecked.lens _PingRequest'service - (\ x__ y__ -> x__{_PingRequest'service = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message PingRequest where - messageName _ = Data.Text.pack "github.semantic.PingRequest" - 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{_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 - (("Missing required fields: ") Prelude.++ - 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 <- (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)) - Data.ProtoLens.Encoding.Bytes. "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 - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "PingRequest" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"service") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - 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{_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 (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 _ - = (Lens.Family2.Unchecked.lens _PingResponse'status - (\ x__ y__ -> x__{_PingResponse'status = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField PingResponse "hostname" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _PingResponse'hostname - (\ x__ y__ -> x__{_PingResponse'hostname = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField PingResponse "timestamp" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _PingResponse'timestamp - (\ x__ y__ -> x__{_PingResponse'timestamp = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField PingResponse "sha" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _PingResponse'sha - (\ x__ y__ -> x__{_PingResponse'sha = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message PingResponse where - messageName _ = Data.Text.pack "github.semantic.PingResponse" - 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{_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 - (("Missing required fields: ") Prelude.++ - 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 <- (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)) - Data.ProtoLens.Encoding.Bytes. "status" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"status") - y - x) - 18 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "hostname" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"hostname") - y - x) - 26 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "timestamp" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"timestamp") - y - x) - 34 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "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 - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "PingResponse" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"status") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"hostname") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"timestamp") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"sha") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 34) Data.Monoid.<> - (((\ bs -> + 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.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - 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{_Position'line :: !Data.Int.Int32, - _Position'column :: !Data.Int.Int32, - _Position'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (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 _ - = (Lens.Family2.Unchecked.lens _Position'line - (\ x__ y__ -> x__{_Position'line = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField Position "column" - (Data.Int.Int32) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Position'column - (\ x__ y__ -> x__{_Position'column = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message Position where - messageName _ = Data.Text.pack "github.semantic.Position" - 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{_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 - (("Missing required fields: ") Prelude.++ - 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 <- (Prelude.fmap Prelude.fromIntegral - Data.ProtoLens.Encoding.Bytes.getVarInt) - Data.ProtoLens.Encoding.Bytes. "line" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"line") y - x) - 16 -> do y <- (Prelude.fmap Prelude.fromIntegral - Data.ProtoLens.Encoding.Bytes.getVarInt) - Data.ProtoLens.Encoding.Bytes. "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 - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "Position" - buildMessage - = (\ _x -> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"line") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 8) Data.Monoid.<> - ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude.. - Prelude.fromIntegral) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"column") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 16) Data.Monoid.<> - ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude.. - Prelude.fromIntegral) - _v) - Data.Monoid.<> - 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.beforeTerm' @:: Lens' ReplacedTerm Data.Text.Text@ - * 'Proto.Semantic_Fields.beforeSpan' @:: Lens' ReplacedTerm Span@ - * 'Proto.Semantic_Fields.maybe'beforeSpan' @:: Lens' ReplacedTerm (Prelude.Maybe Span)@ - * 'Proto.Semantic_Fields.afterTerm' @:: Lens' ReplacedTerm Data.Text.Text@ - * 'Proto.Semantic_Fields.afterSpan' @:: Lens' ReplacedTerm Span@ - * 'Proto.Semantic_Fields.maybe'afterSpan' @:: Lens' ReplacedTerm (Prelude.Maybe Span)@ - -} -data ReplacedTerm = ReplacedTerm{_ReplacedTerm'beforeTerm :: - !Data.Text.Text, - _ReplacedTerm'beforeSpan :: !(Prelude.Maybe Span), - _ReplacedTerm'afterTerm :: !Data.Text.Text, - _ReplacedTerm'afterSpan :: !(Prelude.Maybe Span), - _ReplacedTerm'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show ReplacedTerm where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField ReplacedTerm "beforeTerm" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ReplacedTerm'beforeTerm - (\ x__ y__ -> x__{_ReplacedTerm'beforeTerm = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField ReplacedTerm "beforeSpan" - (Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ReplacedTerm'beforeSpan - (\ x__ y__ -> x__{_ReplacedTerm'beforeSpan = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField ReplacedTerm - "maybe'beforeSpan" - (Prelude.Maybe Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ReplacedTerm'beforeSpan - (\ x__ y__ -> x__{_ReplacedTerm'beforeSpan = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField ReplacedTerm "afterTerm" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ReplacedTerm'afterTerm - (\ x__ y__ -> x__{_ReplacedTerm'afterTerm = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField ReplacedTerm "afterSpan" - (Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ReplacedTerm'afterSpan - (\ x__ y__ -> x__{_ReplacedTerm'afterSpan = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField ReplacedTerm - "maybe'afterSpan" - (Prelude.Maybe Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _ReplacedTerm'afterSpan - (\ x__ y__ -> x__{_ReplacedTerm'afterSpan = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message ReplacedTerm where - messageName _ = Data.Text.pack "github.semantic.ReplacedTerm" - fieldsByTag - = let beforeTerm__field_descriptor - = Data.ProtoLens.FieldDescriptor "before_term" - (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: - Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"beforeTerm")) - :: Data.ProtoLens.FieldDescriptor ReplacedTerm - beforeSpan__field_descriptor - = Data.ProtoLens.FieldDescriptor "before_span" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor Span) - (Data.ProtoLens.OptionalField - (Data.ProtoLens.Field.field @"maybe'beforeSpan")) - :: Data.ProtoLens.FieldDescriptor ReplacedTerm - afterTerm__field_descriptor - = Data.ProtoLens.FieldDescriptor "after_term" - (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: - Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"afterTerm")) - :: Data.ProtoLens.FieldDescriptor ReplacedTerm - afterSpan__field_descriptor - = Data.ProtoLens.FieldDescriptor "after_span" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor Span) - (Data.ProtoLens.OptionalField - (Data.ProtoLens.Field.field @"maybe'afterSpan")) - :: Data.ProtoLens.FieldDescriptor ReplacedTerm - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, beforeTerm__field_descriptor), - (Data.ProtoLens.Tag 2, beforeSpan__field_descriptor), - (Data.ProtoLens.Tag 3, afterTerm__field_descriptor), - (Data.ProtoLens.Tag 4, afterSpan__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _ReplacedTerm'_unknownFields - (\ x__ y__ -> x__{_ReplacedTerm'_unknownFields = y__}) - defMessage - = ReplacedTerm{_ReplacedTerm'beforeTerm = - Data.ProtoLens.fieldDefault, - _ReplacedTerm'beforeSpan = Prelude.Nothing, - _ReplacedTerm'afterTerm = Data.ProtoLens.fieldDefault, - _ReplacedTerm'afterSpan = Prelude.Nothing, - _ReplacedTerm'_unknownFields = ([])} - parseMessage - = let loop :: - ReplacedTerm -> Data.ProtoLens.Encoding.Bytes.Parser ReplacedTerm - 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 - (("Missing required fields: ") Prelude.++ - 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 <- (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)) - Data.ProtoLens.Encoding.Bytes. "before_term" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"beforeTerm") - y - x) - 18 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "before_span" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"beforeSpan") - y - x) - 26 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "after_term" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"afterTerm") - y - x) - 34 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "after_span" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"afterSpan") - y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) - in - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "ReplacedTerm" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"beforeTerm") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (case - Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'beforeSpan") - _x - of - (Prelude.Nothing) -> Data.Monoid.mempty - Prelude.Just _v -> (Data.ProtoLens.Encoding.Bytes.putVarInt 18) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"afterTerm") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (case - Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'afterSpan") - _x - of - (Prelude.Nothing) -> Data.Monoid.mempty - Prelude.Just _v -> (Data.ProtoLens.Encoding.Bytes.putVarInt 34) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData ReplacedTerm where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_ReplacedTerm'_unknownFields x__) - (Control.DeepSeq.deepseq (_ReplacedTerm'beforeTerm x__) - (Control.DeepSeq.deepseq (_ReplacedTerm'beforeSpan x__) - (Control.DeepSeq.deepseq (_ReplacedTerm'afterTerm x__) - (Control.DeepSeq.deepseq (_ReplacedTerm'afterSpan 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{_Span'start :: !(Prelude.Maybe Position), - _Span'end :: !(Prelude.Maybe Position), - _Span'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (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 _ - = (Lens.Family2.Unchecked.lens _Span'start - (\ x__ y__ -> x__{_Span'start = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField Span "maybe'start" - (Prelude.Maybe Position) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Span'start - (\ x__ y__ -> x__{_Span'start = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField Span "end" (Position) where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Span'end - (\ x__ y__ -> x__{_Span'end = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField Span "maybe'end" - (Prelude.Maybe Position) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Span'end - (\ x__ y__ -> x__{_Span'end = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message Span where - messageName _ = Data.Text.pack "github.semantic.Span" - 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{_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 - (("Missing required fields: ") Prelude.++ - 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 <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "start" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"start") y - x) - 18 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "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 - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "Span" - buildMessage - = (\ _x -> - (case - Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'start") _x of - (Prelude.Nothing) -> Data.Monoid.mempty - Prelude.Just _v -> (Data.ProtoLens.Encoding.Bytes.putVarInt 10) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. 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.ProtoLens.Encoding.Bytes.putVarInt 18) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - 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.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)@ - -} -data Symbol = Symbol{_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'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (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 _ - = (Lens.Family2.Unchecked.lens _Symbol'symbol - (\ x__ y__ -> x__{_Symbol'symbol = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField Symbol "kind" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Symbol'kind - (\ x__ y__ -> x__{_Symbol'kind = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField Symbol "line" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Symbol'line - (\ x__ y__ -> x__{_Symbol'line = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField Symbol "span" (Span) where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Symbol'span - (\ x__ y__ -> x__{_Symbol'span = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField Symbol "maybe'span" - (Prelude.Maybe Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Symbol'span - (\ x__ y__ -> x__{_Symbol'span = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField Symbol "docs" (Docstring) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Symbol'docs - (\ x__ y__ -> x__{_Symbol'docs = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField Symbol "maybe'docs" - (Prelude.Maybe Docstring) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _Symbol'docs - (\ x__ y__ -> x__{_Symbol'docs = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message Symbol where - messageName _ = Data.Text.pack "github.semantic.Symbol" - 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 - 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)] - unknownFields - = Lens.Family2.Unchecked.lens _Symbol'_unknownFields - (\ x__ y__ -> x__{_Symbol'_unknownFields = y__}) - defMessage - = Symbol{_Symbol'symbol = Data.ProtoLens.fieldDefault, - _Symbol'kind = Data.ProtoLens.fieldDefault, - _Symbol'line = Data.ProtoLens.fieldDefault, - _Symbol'span = Prelude.Nothing, _Symbol'docs = 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 - (("Missing required fields: ") Prelude.++ - 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 <- (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)) - Data.ProtoLens.Encoding.Bytes. "symbol" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"symbol") - y - x) - 18 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "kind" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"kind") y - x) - 26 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "line" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"line") y - x) - 34 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "span" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"span") y - x) - 42 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "docs" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"docs") y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) - in - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "Symbol" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"symbol") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"kind") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"line") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. 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.ProtoLens.Encoding.Bytes.putVarInt 34) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. 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.ProtoLens.Encoding.Bytes.putVarInt 42) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - 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__) (()))))))) -{- | Fields : - - * 'Proto.Semantic_Fields.category' @:: Lens' TOCSummaryChange Data.Text.Text@ - * 'Proto.Semantic_Fields.term' @:: Lens' TOCSummaryChange Data.Text.Text@ - * 'Proto.Semantic_Fields.span' @:: Lens' TOCSummaryChange Span@ - * 'Proto.Semantic_Fields.maybe'span' @:: Lens' TOCSummaryChange (Prelude.Maybe Span)@ - * 'Proto.Semantic_Fields.changeType' @:: Lens' TOCSummaryChange ChangeType@ - -} -data TOCSummaryChange = TOCSummaryChange{_TOCSummaryChange'category - :: !Data.Text.Text, - _TOCSummaryChange'term :: !Data.Text.Text, - _TOCSummaryChange'span :: !(Prelude.Maybe Span), - _TOCSummaryChange'changeType :: !ChangeType, - _TOCSummaryChange'_unknownFields :: - !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show TOCSummaryChange where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField TOCSummaryChange "category" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryChange'category - (\ x__ y__ -> x__{_TOCSummaryChange'category = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField TOCSummaryChange "term" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryChange'term - (\ x__ y__ -> x__{_TOCSummaryChange'term = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField TOCSummaryChange "span" - (Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryChange'span - (\ x__ y__ -> x__{_TOCSummaryChange'span = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField TOCSummaryChange - "maybe'span" - (Prelude.Maybe Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryChange'span - (\ x__ y__ -> x__{_TOCSummaryChange'span = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField TOCSummaryChange - "changeType" - (ChangeType) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryChange'changeType - (\ x__ y__ -> x__{_TOCSummaryChange'changeType = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message TOCSummaryChange where - messageName _ = Data.Text.pack "github.semantic.TOCSummaryChange" - fieldsByTag - = let category__field_descriptor - = Data.ProtoLens.FieldDescriptor "category" - (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: - Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"category")) - :: Data.ProtoLens.FieldDescriptor TOCSummaryChange - term__field_descriptor - = Data.ProtoLens.FieldDescriptor "term" - (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: - Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"term")) - :: Data.ProtoLens.FieldDescriptor TOCSummaryChange - 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 TOCSummaryChange - changeType__field_descriptor - = Data.ProtoLens.FieldDescriptor "change_type" - (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField :: - Data.ProtoLens.FieldTypeDescriptor ChangeType) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"changeType")) - :: Data.ProtoLens.FieldDescriptor TOCSummaryChange - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, category__field_descriptor), - (Data.ProtoLens.Tag 2, term__field_descriptor), - (Data.ProtoLens.Tag 3, span__field_descriptor), - (Data.ProtoLens.Tag 4, changeType__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _TOCSummaryChange'_unknownFields - (\ x__ y__ -> x__{_TOCSummaryChange'_unknownFields = y__}) - defMessage - = TOCSummaryChange{_TOCSummaryChange'category = - Data.ProtoLens.fieldDefault, - _TOCSummaryChange'term = Data.ProtoLens.fieldDefault, - _TOCSummaryChange'span = Prelude.Nothing, - _TOCSummaryChange'changeType = Data.ProtoLens.fieldDefault, - _TOCSummaryChange'_unknownFields = ([])} - parseMessage - = let loop :: - TOCSummaryChange -> - Data.ProtoLens.Encoding.Bytes.Parser TOCSummaryChange - 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 - (("Missing required fields: ") Prelude.++ - 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 <- (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)) - Data.ProtoLens.Encoding.Bytes. "category" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"category") - y - x) - 18 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "term" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"term") y - x) - 26 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "span" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"span") y - x) - 32 -> do y <- (Prelude.fmap Prelude.toEnum - (Prelude.fmap Prelude.fromIntegral - Data.ProtoLens.Encoding.Bytes.getVarInt)) - Data.ProtoLens.Encoding.Bytes. "change_type" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"changeType") - y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) - in - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "TOCSummaryChange" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"category") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"term") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> + (Data.ProtoLens.Encoding.Bytes.putBytes bs)) + Data.Text.Encoding.encodeUtf8 + _v)) + ((Data.Monoid.<>) + (case + Lens.Family2.view + (Data.ProtoLens.Field.field @"maybe'beforeSpan") _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.Monoid.<>) (case - Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'span") _x of - (Prelude.Nothing) -> Data.Monoid.mempty - Prelude.Just _v -> (Data.ProtoLens.Encoding.Bytes.putVarInt 26) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"changeType") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 32) Data.Monoid.<> - (((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude.. - Prelude.fromIntegral) - Prelude.. Prelude.fromEnum) - _v) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData TOCSummaryChange where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_TOCSummaryChange'_unknownFields x__) - (Control.DeepSeq.deepseq (_TOCSummaryChange'category x__) - (Control.DeepSeq.deepseq (_TOCSummaryChange'term x__) - (Control.DeepSeq.deepseq (_TOCSummaryChange'span x__) - (Control.DeepSeq.deepseq (_TOCSummaryChange'changeType x__) - (())))))) + Lens.Family2.view + (Data.ProtoLens.Field.field @"maybe'afterSpan") _x + of + Prelude.Nothing -> Data.Monoid.mempty + (Prelude.Just _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)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)))) +instance Control.DeepSeq.NFData MergedTerm where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_MergedTerm'_unknownFields x__) + (Control.DeepSeq.deepseq + (_MergedTerm'term x__) + (Control.DeepSeq.deepseq + (_MergedTerm'beforeSpan x__) + (Control.DeepSeq.deepseq (_MergedTerm'afterSpan x__) ()))) {- | Fields : - - * 'Proto.Semantic_Fields.error' @:: Lens' TOCSummaryError Data.Text.Text@ - * 'Proto.Semantic_Fields.span' @:: Lens' TOCSummaryError Span@ - * 'Proto.Semantic_Fields.maybe'span' @:: Lens' TOCSummaryError (Prelude.Maybe Span)@ - -} -data TOCSummaryError = TOCSummaryError{_TOCSummaryError'error :: - !Data.Text.Text, - _TOCSummaryError'span :: !(Prelude.Maybe Span), - _TOCSummaryError'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show TOCSummaryError where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField TOCSummaryError "error" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryError'error - (\ x__ y__ -> x__{_TOCSummaryError'error = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField TOCSummaryError "span" - (Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryError'span - (\ x__ y__ -> x__{_TOCSummaryError'span = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField TOCSummaryError "maybe'span" - (Prelude.Maybe Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryError'span - (\ x__ y__ -> x__{_TOCSummaryError'span = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message TOCSummaryError where - messageName _ = Data.Text.pack "github.semantic.TOCSummaryError" - 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 TOCSummaryError - 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 TOCSummaryError - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, error__field_descriptor), - (Data.ProtoLens.Tag 2, span__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _TOCSummaryError'_unknownFields - (\ x__ y__ -> x__{_TOCSummaryError'_unknownFields = y__}) - defMessage - = TOCSummaryError{_TOCSummaryError'error = - Data.ProtoLens.fieldDefault, - _TOCSummaryError'span = Prelude.Nothing, - _TOCSummaryError'_unknownFields = ([])} - parseMessage - = let loop :: - TOCSummaryError -> - Data.ProtoLens.Encoding.Bytes.Parser TOCSummaryError - 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 - (("Missing required fields: ") Prelude.++ - Prelude.show (missing :: ([Prelude.String]))) - Prelude.return - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> Prelude.reverse t) - x) + + * 'Proto.Semantic_Fields.error' @:: Lens' ParseError Data.Text.Text@ -} +data ParseError + = ParseError'_constructor {_ParseError'error :: !Data.Text.Text, + _ParseError'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (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" + 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 - do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt - case tag of - 10 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "error" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"error") y - x) - 18 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "span" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"span") y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) + 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 - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "TOCSummaryError" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"error") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. 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.ProtoLens.Encoding.Bytes.putVarInt 18) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData TOCSummaryError where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_TOCSummaryError'_unknownFields x__) - (Control.DeepSeq.deepseq (_TOCSummaryError'error x__) - (Control.DeepSeq.deepseq (_TOCSummaryError'span x__) (())))) + 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.path' @:: Lens' TOCSummaryFile Data.Text.Text@ - * 'Proto.Semantic_Fields.language' @:: Lens' TOCSummaryFile Data.Text.Text@ - * 'Proto.Semantic_Fields.changes' @:: Lens' TOCSummaryFile [TOCSummaryChange]@ - * 'Proto.Semantic_Fields.vec'changes' @:: Lens' TOCSummaryFile (Data.Vector.Vector TOCSummaryChange)@ - * 'Proto.Semantic_Fields.errors' @:: Lens' TOCSummaryFile [TOCSummaryError]@ - * 'Proto.Semantic_Fields.vec'errors' @:: Lens' TOCSummaryFile (Data.Vector.Vector TOCSummaryError)@ - -} -data TOCSummaryFile = TOCSummaryFile{_TOCSummaryFile'path :: - !Data.Text.Text, - _TOCSummaryFile'language :: !Data.Text.Text, - _TOCSummaryFile'changes :: - !(Data.Vector.Vector TOCSummaryChange), - _TOCSummaryFile'errors :: - !(Data.Vector.Vector TOCSummaryError), - _TOCSummaryFile'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show TOCSummaryFile where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField TOCSummaryFile "path" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryFile'path - (\ x__ y__ -> x__{_TOCSummaryFile'path = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField TOCSummaryFile "language" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryFile'language - (\ x__ y__ -> x__{_TOCSummaryFile'language = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField TOCSummaryFile "changes" - ([TOCSummaryChange]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryFile'changes - (\ x__ y__ -> x__{_TOCSummaryFile'changes = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField TOCSummaryFile "vec'changes" - (Data.Vector.Vector TOCSummaryChange) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryFile'changes - (\ x__ y__ -> x__{_TOCSummaryFile'changes = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField TOCSummaryFile "errors" - ([TOCSummaryError]) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryFile'errors - (\ x__ y__ -> x__{_TOCSummaryFile'errors = y__})) - Prelude.. - Lens.Family2.Unchecked.lens Data.Vector.Generic.toList - (\ _ y__ -> Data.Vector.Generic.fromList y__) -instance Data.ProtoLens.Field.HasField TOCSummaryFile "vec'errors" - (Data.Vector.Vector TOCSummaryError) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TOCSummaryFile'errors - (\ x__ y__ -> x__{_TOCSummaryFile'errors = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message TOCSummaryFile where - messageName _ = Data.Text.pack "github.semantic.TOCSummaryFile" - 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 TOCSummaryFile - 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 TOCSummaryFile - changes__field_descriptor - = Data.ProtoLens.FieldDescriptor "changes" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor TOCSummaryChange) - (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked - (Data.ProtoLens.Field.field @"changes")) - :: Data.ProtoLens.FieldDescriptor TOCSummaryFile - errors__field_descriptor - = Data.ProtoLens.FieldDescriptor "errors" - (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: - Data.ProtoLens.FieldTypeDescriptor TOCSummaryError) - (Data.ProtoLens.RepeatedField Data.ProtoLens.Unpacked - (Data.ProtoLens.Field.field @"errors")) - :: Data.ProtoLens.FieldDescriptor TOCSummaryFile - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, path__field_descriptor), - (Data.ProtoLens.Tag 2, language__field_descriptor), - (Data.ProtoLens.Tag 3, changes__field_descriptor), - (Data.ProtoLens.Tag 4, errors__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _TOCSummaryFile'_unknownFields - (\ x__ y__ -> x__{_TOCSummaryFile'_unknownFields = y__}) - defMessage - = TOCSummaryFile{_TOCSummaryFile'path = - Data.ProtoLens.fieldDefault, - _TOCSummaryFile'language = Data.ProtoLens.fieldDefault, - _TOCSummaryFile'changes = Data.Vector.Generic.empty, - _TOCSummaryFile'errors = Data.Vector.Generic.empty, - _TOCSummaryFile'_unknownFields = ([])} - parseMessage - = let loop :: - TOCSummaryFile -> - Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector - Data.ProtoLens.Encoding.Growing.RealWorld - TOCSummaryChange - -> - Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector - Data.ProtoLens.Encoding.Growing.RealWorld - TOCSummaryError - -> Data.ProtoLens.Encoding.Bytes.Parser TOCSummaryFile - loop x mutable'changes mutable'errors - = do end <- Data.ProtoLens.Encoding.Bytes.atEnd - if end then - do frozen'changes <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.unsafeFreeze - mutable'changes) - frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.unsafeFreeze - mutable'errors) - let missing = [] in - if Prelude.null missing then Prelude.return () else - Prelude.fail - (("Missing required fields: ") Prelude.++ - 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'changes") - frozen'changes - (Lens.Family2.set (Data.ProtoLens.Field.field @"vec'errors") - frozen'errors - x))) + + * 'Proto.Semantic_Fields.path' @:: Lens' ParseTreeFileGraph Data.Text.Text@ + * 'Proto.Semantic_Fields.language' @:: Lens' ParseTreeFileGraph Data.Text.Text@ + * 'Proto.Semantic_Fields.vertices' @:: Lens' ParseTreeFileGraph [TermVertex]@ + * 'Proto.Semantic_Fields.vec'vertices' @:: Lens' ParseTreeFileGraph (Data.Vector.Vector TermVertex)@ + * 'Proto.Semantic_Fields.edges' @:: Lens' ParseTreeFileGraph [TermEdge]@ + * 'Proto.Semantic_Fields.vec'edges' @:: Lens' ParseTreeFileGraph (Data.Vector.Vector TermEdge)@ + * 'Proto.Semantic_Fields.errors' @:: Lens' ParseTreeFileGraph [ParseError]@ + * 'Proto.Semantic_Fields.vec'errors' @:: Lens' ParseTreeFileGraph (Data.Vector.Vector ParseError)@ -} +data ParseTreeFileGraph + = ParseTreeFileGraph'_constructor {_ParseTreeFileGraph'path :: !Data.Text.Text, + _ParseTreeFileGraph'language :: !Data.Text.Text, + _ParseTreeFileGraph'vertices :: !(Data.Vector.Vector TermVertex), + _ParseTreeFileGraph'edges :: !(Data.Vector.Vector TermEdge), + _ParseTreeFileGraph'errors :: !(Data.Vector.Vector ParseError), + _ParseTreeFileGraph'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ParseTreeFileGraph where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "path" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeFileGraph'path + (\ x__ y__ -> x__ {_ParseTreeFileGraph'path = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "language" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeFileGraph'language + (\ x__ y__ -> x__ {_ParseTreeFileGraph'language = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "vertices" [TermVertex] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeFileGraph'vertices + (\ x__ y__ -> x__ {_ParseTreeFileGraph'vertices = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "vec'vertices" (Data.Vector.Vector TermVertex) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeFileGraph'vertices + (\ x__ y__ -> x__ {_ParseTreeFileGraph'vertices = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "edges" [TermEdge] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeFileGraph'edges + (\ x__ y__ -> x__ {_ParseTreeFileGraph'edges = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "vec'edges" (Data.Vector.Vector TermEdge) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeFileGraph'edges + (\ x__ y__ -> x__ {_ParseTreeFileGraph'edges = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "errors" [ParseError] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeFileGraph'errors + (\ x__ y__ -> x__ {_ParseTreeFileGraph'errors = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField ParseTreeFileGraph "vec'errors" (Data.Vector.Vector ParseError) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeFileGraph'errors + (\ x__ y__ -> x__ {_ParseTreeFileGraph'errors = y__})) + Prelude.id +instance Data.ProtoLens.Message ParseTreeFileGraph where + messageName _ = Data.Text.pack "github.semantic.ParseTreeFileGraph" + 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 ParseTreeFileGraph + 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 ParseTreeFileGraph + vertices__field_descriptor + = Data.ProtoLens.FieldDescriptor + "vertices" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor TermVertex) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked + (Data.ProtoLens.Field.field @"vertices")) :: + Data.ProtoLens.FieldDescriptor ParseTreeFileGraph + edges__field_descriptor + = Data.ProtoLens.FieldDescriptor + "edges" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor TermEdge) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"edges")) :: + Data.ProtoLens.FieldDescriptor ParseTreeFileGraph + 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 ParseTreeFileGraph + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, path__field_descriptor), + (Data.ProtoLens.Tag 2, language__field_descriptor), + (Data.ProtoLens.Tag 3, vertices__field_descriptor), + (Data.ProtoLens.Tag 4, edges__field_descriptor), + (Data.ProtoLens.Tag 5, errors__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _ParseTreeFileGraph'_unknownFields + (\ x__ y__ -> x__ {_ParseTreeFileGraph'_unknownFields = y__}) + defMessage + = ParseTreeFileGraph'_constructor + {_ParseTreeFileGraph'path = Data.ProtoLens.fieldDefault, + _ParseTreeFileGraph'language = Data.ProtoLens.fieldDefault, + _ParseTreeFileGraph'vertices = Data.Vector.Generic.empty, + _ParseTreeFileGraph'edges = Data.Vector.Generic.empty, + _ParseTreeFileGraph'errors = Data.Vector.Generic.empty, + _ParseTreeFileGraph'_unknownFields = []} + parseMessage + = let + loop :: + ParseTreeFileGraph + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld TermEdge + -> 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 TermVertex + -> Data.ProtoLens.Encoding.Bytes.Parser ParseTreeFileGraph + loop x mutable'edges mutable'errors mutable'vertices + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze mutable'edges) + frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'errors) + frozen'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'vertices) + (let missing = [] + in + if Prelude.null missing then + Prelude.return () else - do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt - case tag of - 10 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "path" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"path") y - x) - mutable'changes - mutable'errors - 18 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "language" - loop - (Lens.Family2.set - (Data.ProtoLens.Field.field @"language") - y - x) - mutable'changes - mutable'errors - 26 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "changes" - v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.append - mutable'changes - y) - loop x v mutable'errors - 34 -> do !y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "errors" - v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - (Data.ProtoLens.Encoding.Growing.append - mutable'errors - y) - loop x mutable'changes v - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) - mutable'changes - mutable'errors + 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'edges") + frozen'edges + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'errors") + frozen'errors + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'vertices") + frozen'vertices + 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'edges + mutable'errors + mutable'vertices + 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'edges + mutable'errors + mutable'vertices + 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) + "vertices" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'vertices y) + loop x mutable'edges 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) + "edges" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'edges y) + loop x v mutable'errors mutable'vertices + 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 mutable'edges v mutable'vertices + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + mutable'edges + mutable'errors + mutable'vertices + in + (Data.ProtoLens.Encoding.Bytes.) + (do mutable'edges <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'vertices <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop + Data.ProtoLens.defMessage + mutable'edges + mutable'errors + mutable'vertices) + "ParseTreeFileGraph" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _x in - (do mutable'changes <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO - Data.ProtoLens.Encoding.Growing.new - loop Data.ProtoLens.defMessage mutable'changes mutable'errors) - Data.ProtoLens.Encoding.Bytes. "TOCSummaryFile" - buildMessage - = (\ _x -> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"path") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 10) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"language") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> + 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.ProtoLens.Encoding.Bytes.putVarInt 26) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'changes") _x)) - Data.Monoid.<> - (Data.ProtoLens.Encoding.Bytes.foldMapBuilder - (\ _v -> - (Data.ProtoLens.Encoding.Bytes.putVarInt 34) Data.Monoid.<> - (((\ bs -> + (\ _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'vertices") _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'edges") _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 ParseTreeFileGraph where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_ParseTreeFileGraph'_unknownFields x__) + (Control.DeepSeq.deepseq + (_ParseTreeFileGraph'path x__) + (Control.DeepSeq.deepseq + (_ParseTreeFileGraph'language x__) + (Control.DeepSeq.deepseq + (_ParseTreeFileGraph'vertices x__) + (Control.DeepSeq.deepseq + (_ParseTreeFileGraph'edges x__) + (Control.DeepSeq.deepseq (_ParseTreeFileGraph'errors x__) ()))))) +{- | Fields : + + * 'Proto.Semantic_Fields.files' @:: Lens' ParseTreeGraphResponse [ParseTreeFileGraph]@ + * 'Proto.Semantic_Fields.vec'files' @:: Lens' ParseTreeGraphResponse (Data.Vector.Vector ParseTreeFileGraph)@ -} +data ParseTreeGraphResponse + = ParseTreeGraphResponse'_constructor {_ParseTreeGraphResponse'files :: !(Data.Vector.Vector ParseTreeFileGraph), + _ParseTreeGraphResponse'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ParseTreeGraphResponse where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ParseTreeGraphResponse "files" [ParseTreeFileGraph] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeGraphResponse'files + (\ x__ y__ -> x__ {_ParseTreeGraphResponse'files = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField ParseTreeGraphResponse "vec'files" (Data.Vector.Vector ParseTreeFileGraph) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ParseTreeGraphResponse'files + (\ x__ y__ -> x__ {_ParseTreeGraphResponse'files = y__})) + Prelude.id +instance Data.ProtoLens.Message ParseTreeGraphResponse where + messageName _ + = Data.Text.pack "github.semantic.ParseTreeGraphResponse" + fieldsByTag + = let + files__field_descriptor + = Data.ProtoLens.FieldDescriptor + "files" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor ParseTreeFileGraph) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"files")) :: + Data.ProtoLens.FieldDescriptor ParseTreeGraphResponse + in + Data.Map.fromList [(Data.ProtoLens.Tag 1, files__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _ParseTreeGraphResponse'_unknownFields + (\ x__ y__ -> x__ {_ParseTreeGraphResponse'_unknownFields = y__}) + defMessage + = ParseTreeGraphResponse'_constructor + {_ParseTreeGraphResponse'files = Data.Vector.Generic.empty, + _ParseTreeGraphResponse'_unknownFields = []} + parseMessage + = let + loop :: + ParseTreeGraphResponse + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld ParseTreeFileGraph + -> Data.ProtoLens.Encoding.Bytes.Parser ParseTreeGraphResponse + 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) + "ParseTreeGraphResponse" + 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 ParseTreeGraphResponse where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_ParseTreeGraphResponse'_unknownFields x__) + (Control.DeepSeq.deepseq (_ParseTreeGraphResponse'files 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 (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" + 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 (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" + 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 (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" + 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 (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" + 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 (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" + 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.beforeTerm' @:: Lens' ReplacedTerm Data.Text.Text@ + * 'Proto.Semantic_Fields.beforeSpan' @:: Lens' ReplacedTerm Span@ + * 'Proto.Semantic_Fields.maybe'beforeSpan' @:: Lens' ReplacedTerm (Prelude.Maybe Span)@ + * 'Proto.Semantic_Fields.afterTerm' @:: Lens' ReplacedTerm Data.Text.Text@ + * 'Proto.Semantic_Fields.afterSpan' @:: Lens' ReplacedTerm Span@ + * 'Proto.Semantic_Fields.maybe'afterSpan' @:: Lens' ReplacedTerm (Prelude.Maybe Span)@ -} +data ReplacedTerm + = ReplacedTerm'_constructor {_ReplacedTerm'beforeTerm :: !Data.Text.Text, + _ReplacedTerm'beforeSpan :: !(Prelude.Maybe Span), + _ReplacedTerm'afterTerm :: !Data.Text.Text, + _ReplacedTerm'afterSpan :: !(Prelude.Maybe Span), + _ReplacedTerm'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show ReplacedTerm where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField ReplacedTerm "beforeTerm" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ReplacedTerm'beforeTerm + (\ x__ y__ -> x__ {_ReplacedTerm'beforeTerm = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField ReplacedTerm "beforeSpan" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ReplacedTerm'beforeSpan + (\ x__ y__ -> x__ {_ReplacedTerm'beforeSpan = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField ReplacedTerm "maybe'beforeSpan" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ReplacedTerm'beforeSpan + (\ x__ y__ -> x__ {_ReplacedTerm'beforeSpan = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField ReplacedTerm "afterTerm" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ReplacedTerm'afterTerm + (\ x__ y__ -> x__ {_ReplacedTerm'afterTerm = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField ReplacedTerm "afterSpan" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ReplacedTerm'afterSpan + (\ x__ y__ -> x__ {_ReplacedTerm'afterSpan = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField ReplacedTerm "maybe'afterSpan" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _ReplacedTerm'afterSpan + (\ x__ y__ -> x__ {_ReplacedTerm'afterSpan = y__})) + Prelude.id +instance Data.ProtoLens.Message ReplacedTerm where + messageName _ = Data.Text.pack "github.semantic.ReplacedTerm" + fieldsByTag + = let + beforeTerm__field_descriptor + = Data.ProtoLens.FieldDescriptor + "before_term" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"beforeTerm")) :: + Data.ProtoLens.FieldDescriptor ReplacedTerm + beforeSpan__field_descriptor + = Data.ProtoLens.FieldDescriptor + "before_span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'beforeSpan")) :: + Data.ProtoLens.FieldDescriptor ReplacedTerm + afterTerm__field_descriptor + = Data.ProtoLens.FieldDescriptor + "after_term" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"afterTerm")) :: + Data.ProtoLens.FieldDescriptor ReplacedTerm + afterSpan__field_descriptor + = Data.ProtoLens.FieldDescriptor + "after_span" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor Span) + (Data.ProtoLens.OptionalField + (Data.ProtoLens.Field.field @"maybe'afterSpan")) :: + Data.ProtoLens.FieldDescriptor ReplacedTerm + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, beforeTerm__field_descriptor), + (Data.ProtoLens.Tag 2, beforeSpan__field_descriptor), + (Data.ProtoLens.Tag 3, afterTerm__field_descriptor), + (Data.ProtoLens.Tag 4, afterSpan__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _ReplacedTerm'_unknownFields + (\ x__ y__ -> x__ {_ReplacedTerm'_unknownFields = y__}) + defMessage + = ReplacedTerm'_constructor + {_ReplacedTerm'beforeTerm = Data.ProtoLens.fieldDefault, + _ReplacedTerm'beforeSpan = Prelude.Nothing, + _ReplacedTerm'afterTerm = Data.ProtoLens.fieldDefault, + _ReplacedTerm'afterSpan = Prelude.Nothing, + _ReplacedTerm'_unknownFields = []} + parseMessage + = let + loop :: + ReplacedTerm -> Data.ProtoLens.Encoding.Bytes.Parser ReplacedTerm + 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)) + "before_term" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"beforeTerm") 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) + "before_span" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"beforeSpan") 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)) + "after_term" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"afterTerm") 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) + "after_span" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"afterSpan") 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) "ReplacedTerm" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"beforeTerm") _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.<>) + (case + Lens.Family2.view + (Data.ProtoLens.Field.field @"maybe'beforeSpan") _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.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"afterTerm") _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'afterSpan") _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.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x))))) +instance Control.DeepSeq.NFData ReplacedTerm where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_ReplacedTerm'_unknownFields x__) + (Control.DeepSeq.deepseq + (_ReplacedTerm'beforeTerm x__) + (Control.DeepSeq.deepseq + (_ReplacedTerm'beforeSpan x__) + (Control.DeepSeq.deepseq + (_ReplacedTerm'afterTerm x__) + (Control.DeepSeq.deepseq (_ReplacedTerm'afterSpan 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 (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" + 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.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - (Lens.Family2.view (Data.ProtoLens.Field.field @"vec'errors") _x)) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData TOCSummaryFile where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_TOCSummaryFile'_unknownFields x__) - (Control.DeepSeq.deepseq (_TOCSummaryFile'path x__) - (Control.DeepSeq.deepseq (_TOCSummaryFile'language x__) - (Control.DeepSeq.deepseq (_TOCSummaryFile'changes x__) - (Control.DeepSeq.deepseq (_TOCSummaryFile'errors x__) (())))))) + (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.source' @:: Lens' TermEdge Data.Int.Int32@ - * 'Proto.Semantic_Fields.target' @:: Lens' TermEdge Data.Int.Int32@ - -} -data TermEdge = TermEdge{_TermEdge'source :: !Data.Int.Int32, - _TermEdge'target :: !Data.Int.Int32, - _TermEdge'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) -instance Prelude.Show TermEdge where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField TermEdge "source" - (Data.Int.Int32) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TermEdge'source - (\ x__ y__ -> x__{_TermEdge'source = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField TermEdge "target" - (Data.Int.Int32) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TermEdge'target - (\ x__ y__ -> x__{_TermEdge'target = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Message TermEdge where - messageName _ = Data.Text.pack "github.semantic.TermEdge" - fieldsByTag - = let source__field_descriptor - = Data.ProtoLens.FieldDescriptor "source" - (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: - Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"source")) - :: Data.ProtoLens.FieldDescriptor TermEdge - target__field_descriptor - = Data.ProtoLens.FieldDescriptor "target" - (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: - Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"target")) - :: Data.ProtoLens.FieldDescriptor TermEdge - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, source__field_descriptor), - (Data.ProtoLens.Tag 2, target__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _TermEdge'_unknownFields - (\ x__ y__ -> x__{_TermEdge'_unknownFields = y__}) - defMessage - = TermEdge{_TermEdge'source = Data.ProtoLens.fieldDefault, - _TermEdge'target = Data.ProtoLens.fieldDefault, - _TermEdge'_unknownFields = ([])} - parseMessage - = let loop :: - TermEdge -> Data.ProtoLens.Encoding.Bytes.Parser TermEdge - 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 - (("Missing required fields: ") Prelude.++ - Prelude.show (missing :: ([Prelude.String]))) - Prelude.return - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> Prelude.reverse t) - x) + + * '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 (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" + 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 - do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt - case tag of - 8 -> do y <- (Prelude.fmap Prelude.fromIntegral - Data.ProtoLens.Encoding.Bytes.getVarInt) - Data.ProtoLens.Encoding.Bytes. "source" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"source") y - x) - 16 -> do y <- (Prelude.fmap Prelude.fromIntegral - Data.ProtoLens.Encoding.Bytes.getVarInt) - Data.ProtoLens.Encoding.Bytes. "target" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"target") - y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) + 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 - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "TermEdge" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"source") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 8) Data.Monoid.<> - ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude.. - Prelude.fromIntegral) - _v) - Data.Monoid.<> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"target") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 16) Data.Monoid.<> - ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude.. - Prelude.fromIntegral) - _v) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) -instance Control.DeepSeq.NFData TermEdge where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_TermEdge'_unknownFields x__) - (Control.DeepSeq.deepseq (_TermEdge'source x__) - (Control.DeepSeq.deepseq (_TermEdge'target x__) (())))) + 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.vertexId' @:: Lens' TermVertex Data.Int.Int32@ - * 'Proto.Semantic_Fields.term' @:: Lens' TermVertex Data.Text.Text@ - * 'Proto.Semantic_Fields.span' @:: Lens' TermVertex Span@ - * 'Proto.Semantic_Fields.maybe'span' @:: Lens' TermVertex (Prelude.Maybe Span)@ - -} -data TermVertex = TermVertex{_TermVertex'vertexId :: - !Data.Int.Int32, + + * '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.kind' @:: 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.nodeType' @:: Lens' StackGraphNode StackGraphNode'NodeType@ -} +data StackGraphNode + = StackGraphNode'_constructor {_StackGraphNode'id :: !Data.Int.Int64, + _StackGraphNode'name :: !Data.Text.Text, + _StackGraphNode'line :: !Data.Text.Text, + _StackGraphNode'kind :: !Data.Text.Text, + _StackGraphNode'span :: !(Prelude.Maybe Span), + _StackGraphNode'nodeType :: !StackGraphNode'NodeType, + _StackGraphNode'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (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 "kind" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _StackGraphNode'kind + (\ x__ y__ -> x__ {_StackGraphNode'kind = 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 "nodeType" StackGraphNode'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" + 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 + 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 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 + nodeType__field_descriptor + = Data.ProtoLens.FieldDescriptor + "node_type" + (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField :: + Data.ProtoLens.FieldTypeDescriptor StackGraphNode'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, kind__field_descriptor), + (Data.ProtoLens.Tag 5, span__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'kind = Data.ProtoLens.fieldDefault, + _StackGraphNode'span = Prelude.Nothing, + _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 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) + 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) + "span" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"span") 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.<>) + (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 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.<>) + (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 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.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'kind x__) + (Control.DeepSeq.deepseq + (_StackGraphNode'span x__) + (Control.DeepSeq.deepseq (_StackGraphNode'nodeType x__) ())))))) +newtype StackGraphNode'NodeType'UnrecognizedValue + = StackGraphNode'NodeType'UnrecognizedValue Data.Int.Int32 + deriving (Prelude.Eq, Prelude.Ord, Prelude.Show) +data StackGraphNode'NodeType + = StackGraphNode'ROOT_SCOPE | + StackGraphNode'JUMP_TO_SCOPE | + StackGraphNode'EXPORTED_SCOPE | + StackGraphNode'DEFINITION | + StackGraphNode'REFERENCE | + StackGraphNode'NodeType'Unrecognized !StackGraphNode'NodeType'UnrecognizedValue + deriving (Prelude.Show, Prelude.Eq, Prelude.Ord) +instance Data.ProtoLens.MessageEnum StackGraphNode'NodeType where + maybeToEnum 0 = Prelude.Just StackGraphNode'ROOT_SCOPE + maybeToEnum 1 = Prelude.Just StackGraphNode'JUMP_TO_SCOPE + maybeToEnum 2 = Prelude.Just StackGraphNode'EXPORTED_SCOPE + maybeToEnum 3 = Prelude.Just StackGraphNode'DEFINITION + maybeToEnum 4 = Prelude.Just StackGraphNode'REFERENCE + maybeToEnum k + = Prelude.Just + (StackGraphNode'NodeType'Unrecognized + (StackGraphNode'NodeType'UnrecognizedValue + (Prelude.fromIntegral k))) + showEnum StackGraphNode'ROOT_SCOPE = "ROOT_SCOPE" + showEnum StackGraphNode'JUMP_TO_SCOPE = "JUMP_TO_SCOPE" + showEnum StackGraphNode'EXPORTED_SCOPE = "EXPORTED_SCOPE" + showEnum StackGraphNode'DEFINITION = "DEFINITION" + showEnum StackGraphNode'REFERENCE = "REFERENCE" + showEnum + (StackGraphNode'NodeType'Unrecognized (StackGraphNode'NodeType'UnrecognizedValue k)) + = Prelude.show k + readEnum k + | (Prelude.==) k "ROOT_SCOPE" + = Prelude.Just StackGraphNode'ROOT_SCOPE + | (Prelude.==) k "JUMP_TO_SCOPE" + = Prelude.Just StackGraphNode'JUMP_TO_SCOPE + | (Prelude.==) k "EXPORTED_SCOPE" + = Prelude.Just StackGraphNode'EXPORTED_SCOPE + | (Prelude.==) k "DEFINITION" + = Prelude.Just StackGraphNode'DEFINITION + | (Prelude.==) k "REFERENCE" + = Prelude.Just StackGraphNode'REFERENCE + | Prelude.otherwise + = (Prelude.>>=) (Text.Read.readMaybe k) Data.ProtoLens.maybeToEnum +instance Prelude.Bounded StackGraphNode'NodeType where + minBound = StackGraphNode'ROOT_SCOPE + maxBound = StackGraphNode'REFERENCE +instance Prelude.Enum StackGraphNode'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 StackGraphNode'ROOT_SCOPE = 0 + fromEnum StackGraphNode'JUMP_TO_SCOPE = 1 + fromEnum StackGraphNode'EXPORTED_SCOPE = 2 + fromEnum StackGraphNode'DEFINITION = 3 + fromEnum StackGraphNode'REFERENCE = 4 + fromEnum + (StackGraphNode'NodeType'Unrecognized (StackGraphNode'NodeType'UnrecognizedValue k)) + = Prelude.fromIntegral k + succ StackGraphNode'REFERENCE + = Prelude.error + "StackGraphNode'NodeType.succ: bad argument StackGraphNode'REFERENCE. This value would be out of bounds." + succ StackGraphNode'ROOT_SCOPE = StackGraphNode'JUMP_TO_SCOPE + succ StackGraphNode'JUMP_TO_SCOPE = StackGraphNode'EXPORTED_SCOPE + succ StackGraphNode'EXPORTED_SCOPE = StackGraphNode'DEFINITION + succ StackGraphNode'DEFINITION = StackGraphNode'REFERENCE + succ (StackGraphNode'NodeType'Unrecognized _) + = Prelude.error + "StackGraphNode'NodeType.succ: bad argument: unrecognized value" + pred StackGraphNode'ROOT_SCOPE + = Prelude.error + "StackGraphNode'NodeType.pred: bad argument StackGraphNode'ROOT_SCOPE. This value would be out of bounds." + pred StackGraphNode'JUMP_TO_SCOPE = StackGraphNode'ROOT_SCOPE + pred StackGraphNode'EXPORTED_SCOPE = StackGraphNode'JUMP_TO_SCOPE + pred StackGraphNode'DEFINITION = StackGraphNode'EXPORTED_SCOPE + pred StackGraphNode'REFERENCE = StackGraphNode'DEFINITION + pred (StackGraphNode'NodeType'Unrecognized _) + = Prelude.error + "StackGraphNode'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 StackGraphNode'NodeType where + fieldDefault = StackGraphNode'ROOT_SCOPE +instance Control.DeepSeq.NFData StackGraphNode'NodeType where + rnf x__ = Prelude.seq 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 (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" + 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 (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" + 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 (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" + 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)@ -} +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'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (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.Message Symbol where + messageName _ = Data.Text.pack "github.semantic.Symbol" + 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 + 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)] + 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'_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) + 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.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__) ()))))) +{- | Fields : + + * 'Proto.Semantic_Fields.category' @:: Lens' TOCSummaryChange Data.Text.Text@ + * 'Proto.Semantic_Fields.term' @:: Lens' TOCSummaryChange Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' TOCSummaryChange Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' TOCSummaryChange (Prelude.Maybe Span)@ + * 'Proto.Semantic_Fields.changeType' @:: Lens' TOCSummaryChange ChangeType@ -} +data TOCSummaryChange + = TOCSummaryChange'_constructor {_TOCSummaryChange'category :: !Data.Text.Text, + _TOCSummaryChange'term :: !Data.Text.Text, + _TOCSummaryChange'span :: !(Prelude.Maybe Span), + _TOCSummaryChange'changeType :: !ChangeType, + _TOCSummaryChange'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show TOCSummaryChange where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField TOCSummaryChange "category" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryChange'category + (\ x__ y__ -> x__ {_TOCSummaryChange'category = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryChange "term" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryChange'term + (\ x__ y__ -> x__ {_TOCSummaryChange'term = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryChange "span" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryChange'span + (\ x__ y__ -> x__ {_TOCSummaryChange'span = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField TOCSummaryChange "maybe'span" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryChange'span + (\ x__ y__ -> x__ {_TOCSummaryChange'span = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryChange "changeType" ChangeType where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryChange'changeType + (\ x__ y__ -> x__ {_TOCSummaryChange'changeType = y__})) + Prelude.id +instance Data.ProtoLens.Message TOCSummaryChange where + messageName _ = Data.Text.pack "github.semantic.TOCSummaryChange" + fieldsByTag + = let + category__field_descriptor + = Data.ProtoLens.FieldDescriptor + "category" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"category")) :: + Data.ProtoLens.FieldDescriptor TOCSummaryChange + term__field_descriptor + = Data.ProtoLens.FieldDescriptor + "term" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"term")) :: + Data.ProtoLens.FieldDescriptor TOCSummaryChange + 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 TOCSummaryChange + changeType__field_descriptor + = Data.ProtoLens.FieldDescriptor + "change_type" + (Data.ProtoLens.ScalarField Data.ProtoLens.EnumField :: + Data.ProtoLens.FieldTypeDescriptor ChangeType) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"changeType")) :: + Data.ProtoLens.FieldDescriptor TOCSummaryChange + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, category__field_descriptor), + (Data.ProtoLens.Tag 2, term__field_descriptor), + (Data.ProtoLens.Tag 3, span__field_descriptor), + (Data.ProtoLens.Tag 4, changeType__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _TOCSummaryChange'_unknownFields + (\ x__ y__ -> x__ {_TOCSummaryChange'_unknownFields = y__}) + defMessage + = TOCSummaryChange'_constructor + {_TOCSummaryChange'category = Data.ProtoLens.fieldDefault, + _TOCSummaryChange'term = Data.ProtoLens.fieldDefault, + _TOCSummaryChange'span = Prelude.Nothing, + _TOCSummaryChange'changeType = Data.ProtoLens.fieldDefault, + _TOCSummaryChange'_unknownFields = []} + parseMessage + = let + loop :: + TOCSummaryChange + -> Data.ProtoLens.Encoding.Bytes.Parser TOCSummaryChange + 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)) + "category" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"category") 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)) + "term" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"term") y x) + 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) + "span" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"span") y x) + 32 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.toEnum + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt)) + "change_type" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"changeType") 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) "TOCSummaryChange" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"category") _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 @"term") _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.<>) + (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 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)) + ((Data.Monoid.<>) + (let + _v + = Lens.Family2.view (Data.ProtoLens.Field.field @"changeType") _x + in + if (Prelude.==) _v Data.ProtoLens.fieldDefault then + Data.Monoid.mempty + else + (Data.Monoid.<>) + (Data.ProtoLens.Encoding.Bytes.putVarInt 32) + ((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 TOCSummaryChange where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_TOCSummaryChange'_unknownFields x__) + (Control.DeepSeq.deepseq + (_TOCSummaryChange'category x__) + (Control.DeepSeq.deepseq + (_TOCSummaryChange'term x__) + (Control.DeepSeq.deepseq + (_TOCSummaryChange'span x__) + (Control.DeepSeq.deepseq (_TOCSummaryChange'changeType x__) ())))) +{- | Fields : + + * 'Proto.Semantic_Fields.error' @:: Lens' TOCSummaryError Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' TOCSummaryError Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' TOCSummaryError (Prelude.Maybe Span)@ -} +data TOCSummaryError + = TOCSummaryError'_constructor {_TOCSummaryError'error :: !Data.Text.Text, + _TOCSummaryError'span :: !(Prelude.Maybe Span), + _TOCSummaryError'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show TOCSummaryError where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField TOCSummaryError "error" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryError'error + (\ x__ y__ -> x__ {_TOCSummaryError'error = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryError "span" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryError'span + (\ x__ y__ -> x__ {_TOCSummaryError'span = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField TOCSummaryError "maybe'span" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryError'span + (\ x__ y__ -> x__ {_TOCSummaryError'span = y__})) + Prelude.id +instance Data.ProtoLens.Message TOCSummaryError where + messageName _ = Data.Text.pack "github.semantic.TOCSummaryError" + 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 TOCSummaryError + 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 TOCSummaryError + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, error__field_descriptor), + (Data.ProtoLens.Tag 2, span__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _TOCSummaryError'_unknownFields + (\ x__ y__ -> x__ {_TOCSummaryError'_unknownFields = y__}) + defMessage + = TOCSummaryError'_constructor + {_TOCSummaryError'error = Data.ProtoLens.fieldDefault, + _TOCSummaryError'span = Prelude.Nothing, + _TOCSummaryError'_unknownFields = []} + parseMessage + = let + loop :: + TOCSummaryError + -> Data.ProtoLens.Encoding.Bytes.Parser TOCSummaryError + 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) + 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) + "span" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"span") 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) "TOCSummaryError" + 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.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 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 TOCSummaryError where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_TOCSummaryError'_unknownFields x__) + (Control.DeepSeq.deepseq + (_TOCSummaryError'error x__) + (Control.DeepSeq.deepseq (_TOCSummaryError'span x__) ())) +{- | Fields : + + * 'Proto.Semantic_Fields.path' @:: Lens' TOCSummaryFile Data.Text.Text@ + * 'Proto.Semantic_Fields.language' @:: Lens' TOCSummaryFile Data.Text.Text@ + * 'Proto.Semantic_Fields.changes' @:: Lens' TOCSummaryFile [TOCSummaryChange]@ + * 'Proto.Semantic_Fields.vec'changes' @:: Lens' TOCSummaryFile (Data.Vector.Vector TOCSummaryChange)@ + * 'Proto.Semantic_Fields.errors' @:: Lens' TOCSummaryFile [TOCSummaryError]@ + * 'Proto.Semantic_Fields.vec'errors' @:: Lens' TOCSummaryFile (Data.Vector.Vector TOCSummaryError)@ -} +data TOCSummaryFile + = TOCSummaryFile'_constructor {_TOCSummaryFile'path :: !Data.Text.Text, + _TOCSummaryFile'language :: !Data.Text.Text, + _TOCSummaryFile'changes :: !(Data.Vector.Vector TOCSummaryChange), + _TOCSummaryFile'errors :: !(Data.Vector.Vector TOCSummaryError), + _TOCSummaryFile'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show TOCSummaryFile where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField TOCSummaryFile "path" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryFile'path + (\ x__ y__ -> x__ {_TOCSummaryFile'path = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryFile "language" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryFile'language + (\ x__ y__ -> x__ {_TOCSummaryFile'language = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryFile "changes" [TOCSummaryChange] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryFile'changes + (\ x__ y__ -> x__ {_TOCSummaryFile'changes = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField TOCSummaryFile "vec'changes" (Data.Vector.Vector TOCSummaryChange) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryFile'changes + (\ x__ y__ -> x__ {_TOCSummaryFile'changes = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField TOCSummaryFile "errors" [TOCSummaryError] where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryFile'errors + (\ x__ y__ -> x__ {_TOCSummaryFile'errors = y__})) + (Lens.Family2.Unchecked.lens + Data.Vector.Generic.toList + (\ _ y__ -> Data.Vector.Generic.fromList y__)) +instance Data.ProtoLens.Field.HasField TOCSummaryFile "vec'errors" (Data.Vector.Vector TOCSummaryError) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TOCSummaryFile'errors + (\ x__ y__ -> x__ {_TOCSummaryFile'errors = y__})) + Prelude.id +instance Data.ProtoLens.Message TOCSummaryFile where + messageName _ = Data.Text.pack "github.semantic.TOCSummaryFile" + 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 TOCSummaryFile + 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 TOCSummaryFile + changes__field_descriptor + = Data.ProtoLens.FieldDescriptor + "changes" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor TOCSummaryChange) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"changes")) :: + Data.ProtoLens.FieldDescriptor TOCSummaryFile + errors__field_descriptor + = Data.ProtoLens.FieldDescriptor + "errors" + (Data.ProtoLens.MessageField Data.ProtoLens.MessageType :: + Data.ProtoLens.FieldTypeDescriptor TOCSummaryError) + (Data.ProtoLens.RepeatedField + Data.ProtoLens.Unpacked (Data.ProtoLens.Field.field @"errors")) :: + Data.ProtoLens.FieldDescriptor TOCSummaryFile + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, path__field_descriptor), + (Data.ProtoLens.Tag 2, language__field_descriptor), + (Data.ProtoLens.Tag 3, changes__field_descriptor), + (Data.ProtoLens.Tag 4, errors__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _TOCSummaryFile'_unknownFields + (\ x__ y__ -> x__ {_TOCSummaryFile'_unknownFields = y__}) + defMessage + = TOCSummaryFile'_constructor + {_TOCSummaryFile'path = Data.ProtoLens.fieldDefault, + _TOCSummaryFile'language = Data.ProtoLens.fieldDefault, + _TOCSummaryFile'changes = Data.Vector.Generic.empty, + _TOCSummaryFile'errors = Data.Vector.Generic.empty, + _TOCSummaryFile'_unknownFields = []} + parseMessage + = let + loop :: + TOCSummaryFile + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld TOCSummaryChange + -> Data.ProtoLens.Encoding.Growing.Growing Data.Vector.Vector Data.ProtoLens.Encoding.Growing.RealWorld TOCSummaryError + -> Data.ProtoLens.Encoding.Bytes.Parser TOCSummaryFile + loop x mutable'changes mutable'errors + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do frozen'changes <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'changes) + frozen'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.unsafeFreeze + mutable'errors) + (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'changes") + frozen'changes + (Lens.Family2.set + (Data.ProtoLens.Field.field @"vec'errors") frozen'errors 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'changes + mutable'errors + 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'changes + mutable'errors + 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) + "changes" + v <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + (Data.ProtoLens.Encoding.Growing.append mutable'changes y) + loop x v mutable'errors + 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 mutable'changes v + wire + -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire + wire + loop + (Lens.Family2.over + Data.ProtoLens.unknownFields (\ !t -> (:) y t) x) + mutable'changes + mutable'errors + in + (Data.ProtoLens.Encoding.Bytes.) + (do mutable'changes <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + mutable'errors <- Data.ProtoLens.Encoding.Parser.Unsafe.unsafeLiftIO + Data.ProtoLens.Encoding.Growing.new + loop Data.ProtoLens.defMessage mutable'changes mutable'errors) + "TOCSummaryFile" + 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'changes") _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.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x))))) +instance Control.DeepSeq.NFData TOCSummaryFile where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_TOCSummaryFile'_unknownFields x__) + (Control.DeepSeq.deepseq + (_TOCSummaryFile'path x__) + (Control.DeepSeq.deepseq + (_TOCSummaryFile'language x__) + (Control.DeepSeq.deepseq + (_TOCSummaryFile'changes x__) + (Control.DeepSeq.deepseq (_TOCSummaryFile'errors x__) ())))) +{- | Fields : + + * 'Proto.Semantic_Fields.source' @:: Lens' TermEdge Data.Int.Int32@ + * 'Proto.Semantic_Fields.target' @:: Lens' TermEdge Data.Int.Int32@ -} +data TermEdge + = TermEdge'_constructor {_TermEdge'source :: !Data.Int.Int32, + _TermEdge'target :: !Data.Int.Int32, + _TermEdge'_unknownFields :: !Data.ProtoLens.FieldSet} + deriving (Prelude.Eq, Prelude.Ord) +instance Prelude.Show TermEdge where + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField TermEdge "source" Data.Int.Int32 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TermEdge'source (\ x__ y__ -> x__ {_TermEdge'source = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField TermEdge "target" Data.Int.Int32 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TermEdge'target (\ x__ y__ -> x__ {_TermEdge'target = y__})) + Prelude.id +instance Data.ProtoLens.Message TermEdge where + messageName _ = Data.Text.pack "github.semantic.TermEdge" + fieldsByTag + = let + source__field_descriptor + = Data.ProtoLens.FieldDescriptor + "source" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"source")) :: + Data.ProtoLens.FieldDescriptor TermEdge + target__field_descriptor + = Data.ProtoLens.FieldDescriptor + "target" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"target")) :: + Data.ProtoLens.FieldDescriptor TermEdge + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, source__field_descriptor), + (Data.ProtoLens.Tag 2, target__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _TermEdge'_unknownFields + (\ x__ y__ -> x__ {_TermEdge'_unknownFields = y__}) + defMessage + = TermEdge'_constructor + {_TermEdge'source = Data.ProtoLens.fieldDefault, + _TermEdge'target = Data.ProtoLens.fieldDefault, + _TermEdge'_unknownFields = []} + parseMessage + = let + loop :: TermEdge -> Data.ProtoLens.Encoding.Bytes.Parser TermEdge + 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) + "source" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"source") y x) + 16 + -> do y <- (Data.ProtoLens.Encoding.Bytes.) + (Prelude.fmap + Prelude.fromIntegral + Data.ProtoLens.Encoding.Bytes.getVarInt) + "target" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"target") 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) "TermEdge" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"source") _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 @"target") _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 TermEdge where + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_TermEdge'_unknownFields x__) + (Control.DeepSeq.deepseq + (_TermEdge'source x__) + (Control.DeepSeq.deepseq (_TermEdge'target x__) ())) +{- | Fields : + + * 'Proto.Semantic_Fields.vertexId' @:: Lens' TermVertex Data.Int.Int32@ + * 'Proto.Semantic_Fields.term' @:: Lens' TermVertex Data.Text.Text@ + * 'Proto.Semantic_Fields.span' @:: Lens' TermVertex Span@ + * 'Proto.Semantic_Fields.maybe'span' @:: Lens' TermVertex (Prelude.Maybe Span)@ -} +data TermVertex + = TermVertex'_constructor {_TermVertex'vertexId :: !Data.Int.Int32, _TermVertex'term :: !Data.Text.Text, _TermVertex'span :: !(Prelude.Maybe Span), _TermVertex'_unknownFields :: !Data.ProtoLens.FieldSet} - deriving (Prelude.Eq, Prelude.Ord) + deriving (Prelude.Eq, Prelude.Ord) instance Prelude.Show TermVertex where - showsPrec _ __x __s - = Prelude.showChar '{' - (Prelude.showString (Data.ProtoLens.showMessageShort __x) - (Prelude.showChar '}' __s)) -instance Data.ProtoLens.Field.HasField TermVertex "vertexId" - (Data.Int.Int32) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TermVertex'vertexId - (\ x__ y__ -> x__{_TermVertex'vertexId = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField TermVertex "term" - (Data.Text.Text) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TermVertex'term - (\ x__ y__ -> x__{_TermVertex'term = y__})) - Prelude.. Prelude.id -instance Data.ProtoLens.Field.HasField TermVertex "span" (Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TermVertex'span - (\ x__ y__ -> x__{_TermVertex'span = y__})) - Prelude.. Data.ProtoLens.maybeLens Data.ProtoLens.defMessage -instance Data.ProtoLens.Field.HasField TermVertex "maybe'span" - (Prelude.Maybe Span) - where - fieldOf _ - = (Lens.Family2.Unchecked.lens _TermVertex'span - (\ x__ y__ -> x__{_TermVertex'span = y__})) - Prelude.. Prelude.id + showsPrec _ __x __s + = Prelude.showChar + '{' + (Prelude.showString + (Data.ProtoLens.showMessageShort __x) (Prelude.showChar '}' __s)) +instance Data.ProtoLens.Field.HasField TermVertex "vertexId" Data.Int.Int32 where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TermVertex'vertexId + (\ x__ y__ -> x__ {_TermVertex'vertexId = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField TermVertex "term" Data.Text.Text where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TermVertex'term (\ x__ y__ -> x__ {_TermVertex'term = y__})) + Prelude.id +instance Data.ProtoLens.Field.HasField TermVertex "span" Span where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TermVertex'span (\ x__ y__ -> x__ {_TermVertex'span = y__})) + (Data.ProtoLens.maybeLens Data.ProtoLens.defMessage) +instance Data.ProtoLens.Field.HasField TermVertex "maybe'span" (Prelude.Maybe Span) where + fieldOf _ + = (Prelude..) + (Lens.Family2.Unchecked.lens + _TermVertex'span (\ x__ y__ -> x__ {_TermVertex'span = y__})) + Prelude.id instance Data.ProtoLens.Message TermVertex where - messageName _ = Data.Text.pack "github.semantic.TermVertex" - fieldsByTag - = let vertexId__field_descriptor - = Data.ProtoLens.FieldDescriptor "vertex_id" - (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: - Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"vertexId")) - :: Data.ProtoLens.FieldDescriptor TermVertex - term__field_descriptor - = Data.ProtoLens.FieldDescriptor "term" - (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: - Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) - (Data.ProtoLens.PlainField Data.ProtoLens.Optional - (Data.ProtoLens.Field.field @"term")) - :: Data.ProtoLens.FieldDescriptor TermVertex - 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 TermVertex - in - Data.Map.fromList - [(Data.ProtoLens.Tag 1, vertexId__field_descriptor), - (Data.ProtoLens.Tag 2, term__field_descriptor), - (Data.ProtoLens.Tag 3, span__field_descriptor)] - unknownFields - = Lens.Family2.Unchecked.lens _TermVertex'_unknownFields - (\ x__ y__ -> x__{_TermVertex'_unknownFields = y__}) - defMessage - = TermVertex{_TermVertex'vertexId = Data.ProtoLens.fieldDefault, - _TermVertex'term = Data.ProtoLens.fieldDefault, - _TermVertex'span = Prelude.Nothing, - _TermVertex'_unknownFields = ([])} - parseMessage - = let loop :: - TermVertex -> Data.ProtoLens.Encoding.Bytes.Parser TermVertex - 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 - (("Missing required fields: ") Prelude.++ - Prelude.show (missing :: ([Prelude.String]))) - Prelude.return - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> Prelude.reverse t) - x) + messageName _ = Data.Text.pack "github.semantic.TermVertex" + fieldsByTag + = let + vertexId__field_descriptor + = Data.ProtoLens.FieldDescriptor + "vertex_id" + (Data.ProtoLens.ScalarField Data.ProtoLens.Int32Field :: + Data.ProtoLens.FieldTypeDescriptor Data.Int.Int32) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional + (Data.ProtoLens.Field.field @"vertexId")) :: + Data.ProtoLens.FieldDescriptor TermVertex + term__field_descriptor + = Data.ProtoLens.FieldDescriptor + "term" + (Data.ProtoLens.ScalarField Data.ProtoLens.StringField :: + Data.ProtoLens.FieldTypeDescriptor Data.Text.Text) + (Data.ProtoLens.PlainField + Data.ProtoLens.Optional (Data.ProtoLens.Field.field @"term")) :: + Data.ProtoLens.FieldDescriptor TermVertex + 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 TermVertex + in + Data.Map.fromList + [(Data.ProtoLens.Tag 1, vertexId__field_descriptor), + (Data.ProtoLens.Tag 2, term__field_descriptor), + (Data.ProtoLens.Tag 3, span__field_descriptor)] + unknownFields + = Lens.Family2.Unchecked.lens + _TermVertex'_unknownFields + (\ x__ y__ -> x__ {_TermVertex'_unknownFields = y__}) + defMessage + = TermVertex'_constructor + {_TermVertex'vertexId = Data.ProtoLens.fieldDefault, + _TermVertex'term = Data.ProtoLens.fieldDefault, + _TermVertex'span = Prelude.Nothing, + _TermVertex'_unknownFields = []} + parseMessage + = let + loop :: + TermVertex -> Data.ProtoLens.Encoding.Bytes.Parser TermVertex + loop x + = do end <- Data.ProtoLens.Encoding.Bytes.atEnd + if end then + do (let missing = [] + in + if Prelude.null missing then + Prelude.return () else - do tag <- Data.ProtoLens.Encoding.Bytes.getVarInt - case tag of - 8 -> do y <- (Prelude.fmap Prelude.fromIntegral - Data.ProtoLens.Encoding.Bytes.getVarInt) - Data.ProtoLens.Encoding.Bytes. "vertex_id" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"vertexId") - y - x) - 18 -> do y <- (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)) - Data.ProtoLens.Encoding.Bytes. "term" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"term") y - x) - 26 -> do y <- (do len <- Data.ProtoLens.Encoding.Bytes.getVarInt - Data.ProtoLens.Encoding.Bytes.isolate - (Prelude.fromIntegral len) - Data.ProtoLens.parseMessage) - Data.ProtoLens.Encoding.Bytes. "span" - loop - (Lens.Family2.set (Data.ProtoLens.Field.field @"span") y - x) - wire -> do !y <- Data.ProtoLens.Encoding.Wire.parseTaggedValueFromWire - wire - loop - (Lens.Family2.over Data.ProtoLens.unknownFields - (\ !t -> (:) y t) - x) + 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) + "vertex_id" + loop + (Lens.Family2.set (Data.ProtoLens.Field.field @"vertexId") 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)) + "term" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"term") y x) + 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) + "span" + loop (Lens.Family2.set (Data.ProtoLens.Field.field @"span") 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) "TermVertex" + buildMessage + = \ _x + -> (Data.Monoid.<>) + (let + _v = Lens.Family2.view (Data.ProtoLens.Field.field @"vertexId") _x in - (do loop Data.ProtoLens.defMessage) - Data.ProtoLens.Encoding.Bytes. "TermVertex" - buildMessage - = (\ _x -> - (let _v - = Lens.Family2.view (Data.ProtoLens.Field.field @"vertexId") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 8) Data.Monoid.<> - ((Data.ProtoLens.Encoding.Bytes.putVarInt) Prelude.. - Prelude.fromIntegral) - _v) - Data.Monoid.<> - (let _v = Lens.Family2.view (Data.ProtoLens.Field.field @"term") _x - in - if (_v) Prelude.== Data.ProtoLens.fieldDefault then - Data.Monoid.mempty else - (Data.ProtoLens.Encoding.Bytes.putVarInt 18) Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral (Data.ByteString.length bs))) - Data.Monoid.<> Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.Text.Encoding.encodeUtf8) - _v) - Data.Monoid.<> + 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 @"term") _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.<>) (case - Lens.Family2.view (Data.ProtoLens.Field.field @"maybe'span") _x of - (Prelude.Nothing) -> Data.Monoid.mempty - Prelude.Just _v -> (Data.ProtoLens.Encoding.Bytes.putVarInt 26) - Data.Monoid.<> - (((\ bs -> - (Data.ProtoLens.Encoding.Bytes.putVarInt - (Prelude.fromIntegral - (Data.ByteString.length bs))) - Data.Monoid.<> - Data.ProtoLens.Encoding.Bytes.putBytes bs)) - Prelude.. Data.ProtoLens.encodeMessage) - _v) - Data.Monoid.<> - Data.ProtoLens.Encoding.Wire.buildFieldSet - (Lens.Family2.view Data.ProtoLens.unknownFields _x)) + 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 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)) + (Data.ProtoLens.Encoding.Wire.buildFieldSet + (Lens.Family2.view Data.ProtoLens.unknownFields _x)))) instance Control.DeepSeq.NFData TermVertex where - rnf - = (\ x__ -> - Control.DeepSeq.deepseq (_TermVertex'_unknownFields x__) - (Control.DeepSeq.deepseq (_TermVertex'vertexId x__) - (Control.DeepSeq.deepseq (_TermVertex'term x__) - (Control.DeepSeq.deepseq (_TermVertex'span x__) (()))))) \ No newline at end of file + rnf + = \ x__ + -> Control.DeepSeq.deepseq + (_TermVertex'_unknownFields x__) + (Control.DeepSeq.deepseq + (_TermVertex'vertexId x__) + (Control.DeepSeq.deepseq + (_TermVertex'term x__) + (Control.DeepSeq.deepseq (_TermVertex'span x__) ()))) \ No newline at end of file diff --git a/src/Proto/Semantic_Fields.hs b/src/Proto/Semantic_Fields.hs index bac7dd69c..6113d8667 100644 --- a/src/Proto/Semantic_Fields.hs +++ b/src/Proto/Semantic_Fields.hs @@ -1,404 +1,475 @@ {- 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 #-} -{-# OPTIONS_GHC -fno-warn-unused-imports#-} +{-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies, UndecidableInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, PatternSynonyms, MagicHash, NoImplicitPrelude, DataKinds, BangPatterns, TypeApplications#-} +{-# OPTIONS_GHC -Wno-unused-imports#-} {-# OPTIONS_GHC -Wno-missing-export-lists #-} -- Manually added for semantic's project settings -{-# OPTIONS_GHC -fno-warn-duplicate-exports#-} +{-# 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.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.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.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 - after :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "after" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "after" a) => + Lens.Family2.LensLike' f s a after = Data.ProtoLens.Field.field @"after" afterSpan :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "afterSpan" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "afterSpan" a) => + Lens.Family2.LensLike' f s a afterSpan = Data.ProtoLens.Field.field @"afterSpan" afterTerm :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "afterTerm" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "afterTerm" a) => + Lens.Family2.LensLike' f s a afterTerm = Data.ProtoLens.Field.field @"afterTerm" before :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "before" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "before" a) => + Lens.Family2.LensLike' f s a before = Data.ProtoLens.Field.field @"before" beforeSpan :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "beforeSpan" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "beforeSpan" a) => + Lens.Family2.LensLike' f s a beforeSpan = Data.ProtoLens.Field.field @"beforeSpan" beforeTerm :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "beforeTerm" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "beforeTerm" a) => + Lens.Family2.LensLike' f s a beforeTerm = Data.ProtoLens.Field.field @"beforeTerm" blobOid :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "blobOid" a) => - Lens.Family2.LensLike' f s a + 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 + 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" category :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "category" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "category" a) => + Lens.Family2.LensLike' f s a category = Data.ProtoLens.Field.field @"category" changeType :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "changeType" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "changeType" a) => + Lens.Family2.LensLike' f s a changeType = Data.ProtoLens.Field.field @"changeType" changes :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "changes" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "changes" a) => + Lens.Family2.LensLike' f s a changes = Data.ProtoLens.Field.field @"changes" column :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "column" a) => - Lens.Family2.LensLike' f s a + 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 + 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" deleted :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "deleted" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "deleted" a) => + Lens.Family2.LensLike' f s a deleted = Data.ProtoLens.Field.field @"deleted" diffVertexId :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "diffVertexId" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "diffVertexId" a) => + Lens.Family2.LensLike' f s a diffVertexId = Data.ProtoLens.Field.field @"diffVertexId" docs :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "docs" a) => - Lens.Family2.LensLike' f s a + 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 + 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 + 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 + 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 + 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 + 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 + 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 + 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" inserted :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "inserted" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "inserted" a) => + Lens.Family2.LensLike' f s a inserted = Data.ProtoLens.Field.field @"inserted" kind :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "kind" a) => - Lens.Family2.LensLike' f s a + 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 + 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 + 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'after :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "maybe'after" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'after" a) => + Lens.Family2.LensLike' f s a maybe'after = Data.ProtoLens.Field.field @"maybe'after" maybe'afterSpan :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "maybe'afterSpan" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'afterSpan" a) => + Lens.Family2.LensLike' f s a maybe'afterSpan = Data.ProtoLens.Field.field @"maybe'afterSpan" maybe'before :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "maybe'before" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'before" a) => + Lens.Family2.LensLike' f s a maybe'before = Data.ProtoLens.Field.field @"maybe'before" maybe'beforeSpan :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "maybe'beforeSpan" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'beforeSpan" a) => + Lens.Family2.LensLike' f s a maybe'beforeSpan = Data.ProtoLens.Field.field @"maybe'beforeSpan" maybe'deleted :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "maybe'deleted" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'deleted" a) => + Lens.Family2.LensLike' f s a maybe'deleted = Data.ProtoLens.Field.field @"maybe'deleted" maybe'diffTerm :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "maybe'diffTerm" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'diffTerm" a) => + Lens.Family2.LensLike' f s a maybe'diffTerm = Data.ProtoLens.Field.field @"maybe'diffTerm" maybe'docs :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "maybe'docs" a) => - Lens.Family2.LensLike' f s a + 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 + 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'inserted :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "maybe'inserted" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'inserted" a) => + Lens.Family2.LensLike' f s a maybe'inserted = Data.ProtoLens.Field.field @"maybe'inserted" maybe'merged :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "maybe'merged" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'merged" a) => + Lens.Family2.LensLike' f s a maybe'merged = Data.ProtoLens.Field.field @"maybe'merged" maybe'replaced :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "maybe'replaced" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "maybe'replaced" a) => + Lens.Family2.LensLike' f s a maybe'replaced = Data.ProtoLens.Field.field @"maybe'replaced" maybe'span :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "maybe'span" a) => - Lens.Family2.LensLike' f s a + 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 + 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" merged :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "merged" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "merged" a) => + Lens.Family2.LensLike' f s a merged = Data.ProtoLens.Field.field @"merged" +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 + 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" replaced :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "replaced" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "replaced" a) => + Lens.Family2.LensLike' f s a replaced = Data.ProtoLens.Field.field @"replaced" service :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "service" a) => - Lens.Family2.LensLike' f s a + 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 + 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" source :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "source" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "source" a) => + Lens.Family2.LensLike' f s a source = Data.ProtoLens.Field.field @"source" span :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "span" a) => - Lens.Family2.LensLike' f s a + 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 + 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 + 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 + 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 + 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" target :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "target" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "target" a) => + Lens.Family2.LensLike' f s a target = Data.ProtoLens.Field.field @"target" term :: - forall f s a . - (Prelude.Functor f, Data.ProtoLens.Field.HasField s "term" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, Data.ProtoLens.Field.HasField s "term" a) => + Lens.Family2.LensLike' f s a term = Data.ProtoLens.Field.field @"term" timestamp :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "timestamp" a) => - Lens.Family2.LensLike' f s a + 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" vec'blobs :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "vec'blobs" a) => - Lens.Family2.LensLike' f s a + 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'changes :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "vec'changes" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'changes" a) => + Lens.Family2.LensLike' f s a vec'changes = Data.ProtoLens.Field.field @"vec'changes" vec'edges :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "vec'edges" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'edges" a) => + Lens.Family2.LensLike' f s a vec'edges = Data.ProtoLens.Field.field @"vec'edges" +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 + 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 + 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 + 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" vec'vertices :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "vec'vertices" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vec'vertices" a) => + Lens.Family2.LensLike' f s a vec'vertices = Data.ProtoLens.Field.field @"vec'vertices" vertexId :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "vertexId" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vertexId" a) => + Lens.Family2.LensLike' f s a vertexId = Data.ProtoLens.Field.field @"vertexId" vertices :: - forall f s a . - (Prelude.Functor f, - Data.ProtoLens.Field.HasField s "vertices" a) => - Lens.Family2.LensLike' f s a + forall f s a. + (Prelude.Functor f, + Data.ProtoLens.Field.HasField s "vertices" a) => + Lens.Family2.LensLike' f s a vertices = Data.ProtoLens.Field.field @"vertices" diff --git a/src/Proto/Semantic_JSON.hs b/src/Proto/Semantic_JSON.hs index c71613ff6..00b190655 100644 --- a/src/Proto/Semantic_JSON.hs +++ b/src/Proto/Semantic_JSON.hs @@ -134,6 +134,48 @@ instance ToJSON ParseTreeGraphResponse 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 ParseTreeFileGraph where parseJSONPB = withObject "ParseTreeFileGraph" $ \obj -> do path' <- obj .: "path" @@ -824,6 +866,148 @@ instance ToJSON Span 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" + kind' <- obj .: "kind" + span' <- obj A..:? "span" + nodeType' <- obj .: "nodeType" + pure $ defMessage + & P.id .~ id' + & P.name .~ name' + & P.line .~ line' + & P.kind .~ kind' + & P.maybe'span .~ span' + & P.nodeType .~ nodeType' + +instance ToJSONPB StackGraphNode where + toJSONPB x = object + [ "id" .= (x^.id) + , "name" .= (x^.name) + , "line" .= (x^.line) + , "kind" .= (x^.kind) + , "span" .= (x^.maybe'span) + , "nodeType" .= (x^.nodeType) + ] + toEncodingPB x = pairs + [ "id" .= (x^.id) + , "name" .= (x^.name) + , "line" .= (x^.line) + , "kind" .= (x^.kind) + , "span" .= (x^.maybe'span) + , "nodeType" .= (x^.nodeType) + ] + +instance FromJSON StackGraphNode where + parseJSON = parseJSONPB + +instance ToJSON StackGraphNode where + toJSON = toAesonValue + toEncoding = toAesonEncoding + +instance FromJSONPB StackGraphNode'NodeType where + parseJSONPB (JSONPB.String "ROOT_SCOPE") = pure StackGraphNode'ROOT_SCOPE + parseJSONPB (JSONPB.String "JUMP_TO_SCOPE") = pure StackGraphNode'JUMP_TO_SCOPE + parseJSONPB (JSONPB.String "EXPORTED_SCOPE") = pure StackGraphNode'EXPORTED_SCOPE + parseJSONPB (JSONPB.String "DEFINITION") = pure StackGraphNode'DEFINITION + parseJSONPB (JSONPB.String "REFERENCE") = pure StackGraphNode'REFERENCE + parseJSONPB x = typeMismatch "NodeType" x + +instance ToJSONPB StackGraphNode'NodeType where + toJSONPB x _ = A.String . T.toUpper . T.pack $ show x + toEncodingPB x _ = E.text . T.toUpper . T.pack $ show x + +instance FromJSON StackGraphNode'NodeType where + parseJSON = parseJSONPB + +instance ToJSON StackGraphNode'NodeType 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 ChangeType where parseJSONPB (JSONPB.String "NONE") = pure NONE parseJSONPB (JSONPB.String "ADDED") = pure ADDED diff --git a/src/Rendering/JSON.hs b/src/Rendering/JSON.hs index 1afb844ac..7f7b0f74a 100644 --- a/src/Rendering/JSON.hs +++ b/src/Rendering/JSON.hs @@ -112,7 +112,7 @@ renderJSONError blob e = JSON [ renderError blob e ] renderError :: ToJSON a => Blob -> a -> SomeJSON renderError b e = SomeJSON $ object [ "error" .= e - , "path" .= blobPath b + , "path" .= blobFilePath b , "language" .= blobLanguage b ] diff --git a/src/Semantic/Api.hs b/src/Semantic/Api.hs index 546dcc92e..f449fa748 100644 --- a/src/Semantic/Api.hs +++ b/src/Semantic/Api.hs @@ -2,6 +2,7 @@ module Semantic.Api ( module DiffsAPI , module SymbolsAPI + , module StackGraphAPI , module TermsAPI , module TOCSummariesAPI , module Types @@ -9,6 +10,7 @@ module Semantic.Api import Semantic.Api.Diffs as DiffsAPI import Semantic.Api.Symbols as SymbolsAPI +import Semantic.Api.StackGraph as StackGraphAPI import Semantic.Api.Terms as TermsAPI import Semantic.Api.TOCSummaries as TOCSummariesAPI import Proto.Semantic as Types diff --git a/src/Semantic/Api/Bridge.hs b/src/Semantic/Api/Bridge.hs index 904ab86b1..36462af33 100644 --- a/src/Semantic/Api/Bridge.hs +++ b/src/Semantic/Api/Bridge.hs @@ -18,7 +18,7 @@ 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 +import Proto.Semantic_Fields as P hiding (to) import qualified Semantic.Api.LegacyTypes as Legacy import qualified Source.Source as Source (fromText, toText, totalSpan) import qualified Source.Span as Source @@ -81,7 +81,7 @@ instance APIBridge API.Blob Data.Blob where blobToApiBlob b = defMessage & P.content .~ Source.toText (Data.blobSource b) - & P.path .~ T.pack (Data.blobPath b) + & P.path .~ T.pack (Data.blobFilePath b) & P.language .~ (bridging # Data.blobLanguage b) apiBlobToBlob blob = let src = blob^.content.to Source.fromText diff --git a/src/Semantic/Api/Diffs.hs b/src/Semantic/Api/Diffs.hs index 3fdc570cb..2521e3ba0 100644 --- a/src/Semantic/Api/Diffs.hs +++ b/src/Semantic/Api/Diffs.hs @@ -50,6 +50,7 @@ import Semantic.Telemetry as Stat import Serializing.Format hiding (JSON) import qualified Serializing.Format as Format import Source.Loc +import qualified System.Path as Path data DiffOutputFormat = DiffJSONTree @@ -87,7 +88,7 @@ diffGraph blobs = do & P.edges .~ mempty & P.errors .~ [defMessage & P.error .~ T.pack (show e)] where - path = T.pack $ pathForBlobPair blobPair + path = T.pack . Path.toString $ pathForBlobPair blobPair lang = bridging # languageForBlobPair blobPair @@ -107,7 +108,7 @@ instance (DiffTerms term, ConstructorName (Syntax term), Foldable (Syntax term), let blobPair = bimap fst fst terms graph = renderTreeGraph diff toEdge (Edge (a, b)) = defMessage & P.source .~ a^.diffVertexId & P.target .~ b^.diffVertexId - path = T.pack $ pathForBlobPair blobPair + path = T.pack . Path.toString $ pathForBlobPair blobPair lang = bridging # languageForBlobPair blobPair pure $! defMessage & P.path .~ path diff --git a/src/Semantic/Api/StackGraph.hs b/src/Semantic/Api/StackGraph.hs new file mode 100644 index 000000000..a796110dd --- /dev/null +++ b/src/Semantic/Api/StackGraph.hs @@ -0,0 +1,140 @@ +{-# 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.Int +import Data.Map.Strict (Map) +import Data.Language +import Data.Foldable +import Data.ProtoLens (defMessage) +import Semantic.Api.Bridge +import Proto.Semantic as P hiding (Blob, BlobPair) +import Proto.Semantic_Fields as P +import Proto.Semantic_JSON () +import Data.Text (Text, pack) +import Source.Loc as Loc +import Semantic.Task +import qualified Parsing.Parser as Parser + +parseStackGraph :: ( Has (Error SomeException) sig m + , Has Distribute sig m + , Has Parse sig m + , Traversable t + ) + => t Blob + -> m StackGraphResponse +parseStackGraph blobs = do + terms <- distributeFor blobs go + 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.kind .~ nodeKind node + & P.maybe'span ?~ converting # nodeSpan node + & P.nodeType .~ nodeTypeToNodeType (Semantic.Api.StackGraph.nodeType 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 + + nodeTypeToNodeType :: SGNodeType -> StackGraphNode'NodeType + nodeTypeToNodeType = \case + RootScope -> P.StackGraphNode'ROOT_SCOPE + JumpToScope -> P.StackGraphNode'JUMP_TO_SCOPE + ExportedScope -> P.StackGraphNode'EXPORTED_SCOPE + Definition -> P.StackGraphNode'DEFINITION + Reference -> P.StackGraphNode'REFERENCE + +-- 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 + , nodeKind :: Text + , nodeSpan :: Loc.Span + , nodeType :: SGNodeType + } + deriving (Eq, Show) + +data SGNodeType = RootScope | JumpToScope | ExportedScope | Definition | Reference + 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/src/Semantic/Api/Symbols.hs b/src/Semantic/Api/Symbols.hs index cbc0e5285..8911688e8 100644 --- a/src/Semantic/Api/Symbols.hs +++ b/src/Semantic/Api/Symbols.hs @@ -61,7 +61,7 @@ legacyParseSymbols blobs = Legacy.ParseTreeSymbolResponse <$> distributeFoldMap renderToSymbols = pure . tagsToFile . tags symbolsToSummarize blob tagsToFile :: [Tag] -> Legacy.File - tagsToFile tags = Legacy.File (pack (blobPath blob)) (pack (show (blobLanguage blob))) (fmap tagToSymbol tags) + tagsToFile tags = Legacy.File (pack (blobFilePath blob)) (pack (show (blobLanguage blob))) (fmap tagToSymbol tags) tagToSymbol :: Tag -> Legacy.Symbol tagToSymbol Tag{..} @@ -85,7 +85,7 @@ parseSymbols blobs = do where catching m = m `catchError` (\(SomeException e) -> pure $ errorFile (show e)) blobLanguage' = blobLanguage blob - blobPath' = pack $ blobPath blob + blobPath' = pack $ blobFilePath blob errorFile e = defMessage & P.path .~ blobPath' & P.language .~ (bridging # blobLanguage') diff --git a/src/Semantic/Api/TOCSummaries.hs b/src/Semantic/Api/TOCSummaries.hs index 13b1c59b5..767b231a5 100644 --- a/src/Semantic/Api/TOCSummaries.hs +++ b/src/Semantic/Api/TOCSummaries.hs @@ -1,4 +1,15 @@ -{-# LANGUAGE AllowAmbiguousTypes, DataKinds, FlexibleContexts, FlexibleInstances, LambdaCase, MultiParamTypeClasses, RecordWildCards, ScopedTypeVariables, TupleSections, TypeApplications, TypeFamilies, UndecidableInstances #-} +{-# LANGUAGE AllowAmbiguousTypes #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TupleSections #-} +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableInstances #-} module Semantic.Api.TOCSummaries ( diffSummary , legacyDiffSummary @@ -8,7 +19,7 @@ module Semantic.Api.TOCSummaries ) where import Analysis.Decorator (decoratorWithAlgebra) -import Analysis.TOCSummary (Declaration(..), HasDeclaration, Kind(..), declarationAlgebra, formatKind) +import Analysis.TOCSummary (Declaration (..), HasDeclaration, Kind (..), declarationAlgebra, formatKind) import Control.Applicative (liftA2) import Control.Effect.Error import Control.Effect.Parse @@ -22,13 +33,12 @@ import Data.Edit import Data.Either (partitionEithers) import Data.Function (on) import Data.Functor.Foldable (Base, Recursive) -import Data.Language (Language, LanguageMode(..), PerLanguageModes) +import Data.Language (Language, LanguageMode (..), PerLanguageModes) import Data.Map (Map) import qualified Data.Map.Monoidal as Map import Data.Maybe (mapMaybe) import Data.ProtoLens (defMessage) -import Data.Semilattice.Lower -import Data.Term (IsTerm(..), TermF) +import Data.Term (IsTerm (..), TermF) import qualified Data.Text as T import qualified Diffing.Algorithm.SES as SES import Diffing.Interpreter (DiffTerms) @@ -43,6 +53,7 @@ import Semantic.Task as Task import Serializing.Format import Source.Loc as Loc import Source.Source as Source +import Source.Span import qualified Tags.Tag as Tag import qualified Tags.Tagging.Precise as Tagging @@ -55,7 +66,7 @@ legacyDiffSummary = distributeFoldMap go go :: (Has (Error SomeException) sig m, Has Parse sig m, Has (Reader PerLanguageModes) sig m, Has Telemetry sig m, MonadIO m) => BlobPair -> m Summaries go blobPair = asks summarizeTermParsers >>= \ p -> parsePairWith p (fmap (uncurry (flip Summaries) . bimap toMap toMap . partitionEithers) . summarizeTerms) blobPair `catchError` \(SomeException e) -> - pure $ Summaries mempty (toMap [ErrorSummary (T.pack (show e)) lowerBound lang]) + pure $ Summaries mempty (toMap [ErrorSummary (T.pack (show e)) (point (Pos 1 1)) lang]) where path = T.pack $ pathKeyForBlobPair blobPair lang = languageForBlobPair blobPair diff --git a/src/Semantic/Api/Terms.hs b/src/Semantic/Api/Terms.hs index 05410ad20..25593d2d2 100644 --- a/src/Semantic/Api/Terms.hs +++ b/src/Semantic/Api/Terms.hs @@ -78,7 +78,7 @@ termGraph blobs = do & P.edges .~ mempty & P.errors .~ [defMessage & P.error .~ T.pack (show e)] where - path = T.pack $ blobPath blob + path = T.pack $ blobFilePath blob lang = bridging # blobLanguage blob data TermOutputFormat @@ -111,7 +111,7 @@ quietTerm blob = showTiming blob <$> time' ( asks showTermParsers >>= \ parsers 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") + in stringUtf8 (status <> "\t" <> show (blobLanguage blob) <> "\t" <> blobFilePath blob <> "\t" <> show duration <> " ms\n") showTermParsers :: PerLanguageModes -> Map Language (SomeParser ShowTerm Loc) @@ -224,7 +224,7 @@ instance (Recursive (term Loc), ToTreeGraph TermVertex (Base (term Loc))) => JSO jsonGraphTerm blob t = let graph = renderTreeGraph t toEdge (Edge (a, b)) = defMessage & P.source .~ a^.vertexId & P.target .~ b^.vertexId - path = T.pack $ blobPath blob + path = T.pack $ blobFilePath blob lang = bridging # blobLanguage blob in defMessage & P.path .~ path diff --git a/src/Semantic/CLI.hs b/src/Semantic/CLI.hs index 78f42c5b1..967a14b18 100644 --- a/src/Semantic/CLI.hs +++ b/src/Semantic/CLI.hs @@ -157,8 +157,8 @@ graphCommand = command "graph" (info graphArgumentsParser (progDesc "Compute a g let paths = rights (Path.parse <$> strPaths) blobs <- traverse readBlobFromPath paths case paths of - (x:_) -> pure $! Project (Path.toString (Path.takeDirectory x)) blobs (Language.forPath x) mempty - _ -> pure $! Project "/" mempty Language.Unknown mempty + (x:_) -> pure $! Project (Path.takeDirectory x) blobs (Language.forPath x) mempty + _ -> pure $! Project (Path.toAbsRel Path.rootDir) mempty Language.Unknown mempty allLanguages = intercalate "|" . fmap show $ [Language.Go .. maxBound] readProjectRecursively = makeReadProjectRecursivelyTask diff --git a/src/Semantic/Graph.hs b/src/Semantic/Graph.hs index 2e9ada0de..577dfb903 100644 --- a/src/Semantic/Graph.hs +++ b/src/Semantic/Graph.hs @@ -83,12 +83,20 @@ import Semantic.Analysis import Semantic.Task as Task import Source.Loc as Loc import Source.Span -import System.FilePath.Posix (takeDirectory, ()) import qualified System.Path as Path import Text.Show.Pretty (ppShow) +-- TODO: this should be zero-indexed (https://github.com/github/semantic/issues/263) +initialSpan :: Span +initialSpan = point (Pos 1 1) + data GraphType = ImportGraph | CallGraph +isPathPrefixOf :: Path.AbsRelDir -> Path.AbsRelFile -> Bool +isPathPrefixOf a b = ra == rb && isPrefixOf a' b' where + (ra, a', _) = Path.splitPath a + (rb, b', _) = Path.splitPath b + -- | Constraints required to analyze a term. class ( AccessControls (term Loc) @@ -188,8 +196,8 @@ runCallGraph lang includePackages modules package . resumingResolutionError . resumingAddressError . raiseHandler (runReader (packageInfo package)) - . raiseHandler (runReader (lowerBound @Span)) - . raiseHandler (runState (lowerBound @Span)) + . raiseHandler (runReader initialSpan) + . raiseHandler (runState initialSpan) . raiseHandler (runReader (lowerBound @ControlFlowVertex)) . providingLiveSet . runModuleTable @@ -251,8 +259,8 @@ runImportGraph lang package f . runModuleTable . runModules (ModuleTable.modulePaths (packageModules package)) . raiseHandler (runReader (packageInfo package)) - . raiseHandler (runState (lowerBound @Span)) - . raiseHandler (runReader (lowerBound @Span)) + . raiseHandler (runState initialSpan) + . raiseHandler (runReader initialSpan) . raiseHandler (runState (lowerBound @(ScopeGraph (Hole (Maybe Name) Precise)))) . runAllocator $ evaluate lang (graphingModuleInfo (runDomainEffects (evalTerm id))) (snd <$> ModuleTable.toPairs (packageModules package)) @@ -314,12 +322,12 @@ parsePythonPackage parser project = do . runModuleTable . runModules lowerBound . raiseHandler (runReader (PackageInfo (Data.Abstract.Evaluatable.name "setup") lowerBound)) - . raiseHandler (runState (lowerBound @Span)) - . raiseHandler (runReader (lowerBound @Span)) + . raiseHandler (runState initialSpan) + . raiseHandler (runReader initialSpan) . raiseHandler (runState (lowerBound @(ScopeGraph (Hole (Maybe Name) Precise)))) . runAllocator - strat <- case find (\b -> blobPath b == (projectRootDir project "setup.py")) (projectBlobs project) of + strat <- case find (\b -> blobPath b == (projectRootDir project Path. Path.relFile "setup.py")) (projectBlobs project) of Just setupFile -> do setupModule <- fmap snd <$> parseModule project parser setupFile fst <$> runAnalysis (evaluate (Proxy @'Language.Python) (runDomainEffects (runPythonPackaging . evalTerm id)) [ setupModule ]) @@ -332,17 +340,17 @@ parsePythonPackage parser project = do PythonPackage.Packages dirs -> packageFromProject project [ blob | dir <- dirs , blob <- projectBlobs project - , packageDir <- [projectRootDir project unpack dir] - , packageDir `isPrefixOf` blobPath blob + , packageDir <- [projectRootDir project Path. Path.relDir (unpack dir) ] + , packageDir `isPathPrefixOf` blobPath blob ] PythonPackage.FindPackages excludeDirs -> do trace "In Graph.FindPackages" let initFiles = filter (isInit . filePath) (projectFiles project) isInit = (== Path.relFile "__init__.py") . Path.takeFileName - packageDirs = filter (`notElem` ((projectRootDir project ) . unpack <$> excludeDirs)) (takeDirectory . Path.toString . filePath <$> initFiles) + packageDirs = filter (`notElem` ((projectRootDir project Path.) . Path.relDir . unpack <$> excludeDirs)) (Path.takeDirectory . filePath <$> initFiles) packageFromProject project [ blob | dir <- packageDirs , blob <- projectBlobs project - , dir `isPrefixOf` blobPath blob + , dir `isPathPrefixOf` blobPath blob ] where packageFromProject project filteredBlobs = do @@ -356,7 +364,7 @@ parseModule :: Has Parse sig m -> Parser term -> Blob -> m (Module (Blob, term)) -parseModule proj parser blob = moduleForBlob (Just (projectRootDir proj)) blob . (,) blob <$> parse parser blob +parseModule proj parser blob = moduleForBlob (Just (Path.toString $ projectRootDir proj)) blob . (,) blob <$> parse parser blob withTermSpans :: ( Has (Reader Span) sig m , Has (State Span) sig m -- last evaluated child's span @@ -375,8 +383,8 @@ resumingResolutionError :: ( Has Trace sig m resumingResolutionError = runResolutionErrorWith $ \ baseError -> do traceError "ResolutionError" baseError case baseErrorException baseError of - NotFoundError nameToResolve _ _ -> pure nameToResolve - GoImportError pathToResolve -> pure [pathToResolve] + NotFoundError nameToResolve _ _ -> pure $ Path.absRel nameToResolve + GoImportError pathToResolve -> pure [Path.absRel pathToResolve] resumingLoadError :: ( Has Trace sig m , AbstractHole value diff --git a/src/Semantic/IO.hs b/src/Semantic/IO.hs index ab87c2ef7..5ef24ab7a 100644 --- a/src/Semantic/IO.hs +++ b/src/Semantic/IO.hs @@ -4,23 +4,18 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module Semantic.IO - ( isDirectory - , findFilesInDir + ( findFilesInDir ) where import Prelude hiding (readFile) import Control.Monad.IO.Class -import System.Directory (doesDirectoryExist) import System.Directory.Tree (AnchoredDirTree (..)) import qualified System.Directory.Tree as Tree import System.FilePath import qualified System.Path as Path import qualified System.Path.PartClass as Path.PartClass -isDirectory :: MonadIO m => FilePath -> m Bool -isDirectory path = liftIO (doesDirectoryExist path) - pathIsMinified :: FilePath -> Bool pathIsMinified = isExtensionOf ".min.js" diff --git a/src/Semantic/Resolution.hs b/src/Semantic/Resolution.hs index ef1200a14..91de7c4c1 100644 --- a/src/Semantic/Resolution.hs +++ b/src/Semantic/Resolution.hs @@ -38,20 +38,19 @@ import qualified Source.Source as Source import System.FilePath.Posix import qualified System.Path as Path - -nodeJSResolutionMap :: Has Files sig m => FilePath -> Text -> [FilePath] -> m (Map FilePath FilePath) +nodeJSResolutionMap :: Has Files sig m => Path.AbsRelDir -> Text -> [Path.AbsRelDir] -> m (Map FilePath FilePath) nodeJSResolutionMap rootDir prop excludeDirs = do - files <- findFiles (Path.absRel rootDir) [".json"] (fmap Path.absRel excludeDirs) + files <- findFiles rootDir [".json"] excludeDirs let packageFiles = File.fromPath <$> filter ((==) (Path.relFile "package.json") . Path.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 (Source.bytes blobSource) >>= lookupProp (blobPath b) k + lookup k b@Blob{..} = decodeStrict (Source.bytes blobSource) >>= lookupProp (blobFilePath 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 + where relPkgDotJSONPath = makeRelative (Path.toString rootDir) path relEntryPath x = takeDirectory relPkgDotJSONPath x resolutionMap :: Has Resolution sig m => Project -> m (Map FilePath FilePath) @@ -61,7 +60,7 @@ resolutionMap Project{..} = case projectLanguage of _ -> send (NoResolution pure) data Resolution (m :: * -> *) k - = NodeJSResolution FilePath Text [FilePath] (Map FilePath FilePath -> m k) + = NodeJSResolution Path.AbsRelDir Text [Path.AbsRelDir] (Map FilePath FilePath -> m k) | NoResolution (Map FilePath FilePath -> m k) deriving (Functor, Generic1) diff --git a/src/Semantic/Task.hs b/src/Semantic/Task.hs index 724205bf9..67a482f36 100644 --- a/src/Semantic/Task.hs +++ b/src/Semantic/Task.hs @@ -68,7 +68,6 @@ import Semantic.Distribute import Semantic.Resolution import qualified Semantic.Task.Files as Files import Semantic.Telemetry -import Semantic.Timeout 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' @@ -80,9 +79,8 @@ type TaskC ( TraceInTelemetryC ( TelemetryC ( ErrorC SomeException - ( TimeoutC ( DistributeC - ( LiftC IO))))))))) + ( LiftC IO)))))))) serialize :: Has (Reader Config) sig m => Format input @@ -109,7 +107,6 @@ runTask taskSession@TaskSession{..} task = do run = runM . withDistribute - . withTimeout . runError . runTelemetry logger statter . runTraceInTelemetry diff --git a/src/Semantic/Task/Files.hs b/src/Semantic/Task/Files.hs index ae82f8802..c106553dd 100644 --- a/src/Semantic/Task/Files.hs +++ b/src/Semantic/Task/Files.hs @@ -47,7 +47,6 @@ import qualified System.Path.IO as IO (withBinaryFile) data Source blob where FromPath :: File Language -> Source Blob FromHandle :: Handle 'IO.ReadMode -> Source [Blob] - FromDir :: Path.AbsRelDir -> Source [Blob] FromPathPair :: File Language -> File Language -> Source BlobPair FromPairHandle :: Handle 'IO.ReadMode -> Source [BlobPair] @@ -86,7 +85,6 @@ instance (Has (Error SomeException) sig m, MonadFail m, MonadIO m) => Algebra (F alg (L op) = case op of Read (FromPath path) k -> readBlobFromFile' path >>= k Read (FromHandle handle) k -> readBlobsFromHandle handle >>= k - Read (FromDir dir) k -> readBlobsFromDir dir >>= k Read (FromPathPair p1 p2) k -> readFilePair p1 p2 >>= k Read (FromPairHandle handle) k -> readBlobPairsFromHandle handle >>= k ReadProject rootDir dir language excludeDirs k -> readProjectFromPaths rootDir dir language excludeDirs >>= k diff --git a/src/Semantic/Timeout.hs b/src/Semantic/Timeout.hs deleted file mode 100644 index 5e9ce3b9e..000000000 --- a/src/Semantic/Timeout.hs +++ /dev/null @@ -1,66 +0,0 @@ -{-# LANGUAGE DeriveFunctor, ExistentialQuantification, FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, StandaloneDeriving, TypeOperators, RankNTypes, UndecidableInstances #-} -module Semantic.Timeout -( timeout -, Timeout -, runTimeout -, withTimeout -, TimeoutC(..) -, Duration(..) -) where - -import Control.Algebra -import Control.Carrier.Reader -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 :: Has Timeout 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 -> m k) - -deriving instance Functor m => Functor (Timeout m) - -instance HFunctor Timeout where - hmap f (Timeout n task k) = Timeout n (f task) (f . k) - -instance Effect Timeout where - thread 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, MonadFail, MonadIO) - -instance MonadUnliftIO m => MonadUnliftIO (TimeoutC m) where - askUnliftIO = TimeoutC . ReaderC $ \(Handler h) -> - withUnliftIO $ \u -> pure (UnliftIO $ \r -> unliftIO u (runTimeout h r)) - -instance (Algebra sig m, MonadIO m) => Algebra (Timeout :+: sig) (TimeoutC m) where - alg (L (Timeout n task k)) = do - handler <- TimeoutC ask - liftIO (System.timeout (toMicroseconds n) (runHandler handler task)) >>= k - alg (R other) = TimeoutC (alg (R (handleCoercible other))) diff --git a/src/Semantic/Util.hs b/src/Semantic/Util.hs index 9fff492b1..7365222b8 100644 --- a/src/Semantic/Util.hs +++ b/src/Semantic/Util.hs @@ -41,14 +41,13 @@ import Data.Graph.Algebraic (topologicalSort) import qualified Data.Language as Language import Data.List (uncons) import Data.Maybe -import Data.Semilattice.Lower import Data.Sum import Parsing.Parser import Semantic.Analysis import Semantic.Config import Semantic.Graph import Semantic.Task -import Source.Span (HasSpan (..)) +import Source.Span (HasSpan (..), Pos (..), point) import System.Exit (die) import System.FilePath.Posix (takeDirectory) import qualified System.Path as Path @@ -80,16 +79,17 @@ evaluateProject' session proxy parser paths = do let lang = Language.reflect proxy res <- runTask session $ asks configTreeSitterParseTimeout >>= \ timeout -> runParse timeout $ do blobs <- catMaybes <$> traverse readBlobFromFile (fileForPath <$> paths) - package <- fmap snd <$> parsePackage parser (Project (takeDirectory (maybe "/" fst (uncons paths))) blobs lang []) + package <- fmap snd <$> parsePackage parser (Project (Path.absRel $ takeDirectory (maybe "/" fst (uncons paths))) blobs lang []) modules <- topologicalSort <$> runImportGraphToModules proxy package trace $ "evaluating with load order: " <> show (map (modulePath . moduleInfo) modules) pure (package, modules) (package, modules) <- either (die . displayException) pure res + let initialSpan = point (Pos 1 1) pure (runModuleTable (runModules (ModuleTable.modulePaths (packageModules package)) (raiseHandler (runReader (packageInfo package)) - (raiseHandler (evalState (lowerBound @Span)) - (raiseHandler (runReader (lowerBound @Span)) + (raiseHandler (evalState initialSpan) + (raiseHandler (runReader initialSpan) (evaluate proxy (runDomainEffects (evalTerm (withTermSpans (^. span_)))) modules)))))) parseFile, parseFileQuiet :: Parser term -> FilePath -> IO term @@ -97,7 +97,7 @@ parseFile parser = runTask' . (parse parser <=< readBlob . fileForPath) parseFileQuiet parser = runTaskQuiet . (parse parser <=< readBlob . fileForPath) fileForPath :: FilePath -> File Language.Language -fileForPath (Path.absRel -> p) = File p lowerBound (Language.forPath p) +fileForPath (Path.absRel -> p) = File 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 diff --git a/test/Analysis/Go/Spec.hs b/test/Analysis/Go/Spec.hs index 17342bc98..e9d3e9aee 100644 --- a/test/Analysis/Go/Spec.hs +++ b/test/Analysis/Go/Spec.hs @@ -2,19 +2,17 @@ {-# OPTIONS_GHC -O0 #-} module Analysis.Go.Spec (spec) where -import qualified Data.Abstract.ModuleTable as ModuleTable import qualified Data.Language as Language import qualified Language.Go.Term as Go import Source.Loc import SpecHelpers - spec :: (?session :: TaskSession) => Spec spec = 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 + case moduleLookup "main.go" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust SpecHelpers.lookupMembers "foo" Import scopeAndFrame heap scopeGraph `shouldBe` Just ["New"] @@ -25,7 +23,7 @@ spec = do 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 + case moduleLookup "main1.go" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do SpecHelpers.lookupDeclaration "f" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust SpecHelpers.lookupDeclaration "main" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust diff --git a/test/Analysis/PHP/Spec.hs b/test/Analysis/PHP/Spec.hs index 1b00a34bb..c6ab3ad62 100644 --- a/test/Analysis/PHP/Spec.hs +++ b/test/Analysis/PHP/Spec.hs @@ -2,7 +2,6 @@ {-# OPTIONS_GHC -O0 #-} module Analysis.PHP.Spec (spec) where -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.Term as PHP @@ -15,7 +14,7 @@ spec = 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 + case moduleLookup "main.php" <$> res of Right (Just (Module _ (scopeAndFrame, value))) -> do value `shouldBe` Value.Unit SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -24,7 +23,7 @@ spec = do 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 + case moduleLookup "main_once.php" <$> res of Right (Just (Module _ (scopeAndFrame, value))) -> do value `shouldBe` Value.Unit SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -33,7 +32,7 @@ spec = do xit "evaluates namespaces" $ do (scopeGraph, (heap, res)) <- evaluate ["namespaces.php"] - case ModuleTable.lookup "namespaces.php" <$> res of + case moduleLookup "namespaces.php" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do SpecHelpers.lookupDeclaration "Foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust SpecHelpers.lookupDeclaration "NS1" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust diff --git a/test/Analysis/Python/Spec.hs b/test/Analysis/Python/Spec.hs index a6662112a..71fb3848d 100644 --- a/test/Analysis/Python/Spec.hs +++ b/test/Analysis/Python/Spec.hs @@ -2,7 +2,6 @@ {-# OPTIONS_GHC -O0 #-} module Analysis.Python.Spec (spec) where -import qualified Data.Abstract.ModuleTable as ModuleTable import Data.Abstract.Value.Concrete import qualified Data.Language as Language import qualified Language.Python.Term as Python @@ -15,7 +14,7 @@ spec = 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 + case moduleLookup "main.py" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do SpecHelpers.lookupDeclaration "a" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -27,7 +26,7 @@ spec = do 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 + case moduleLookup "main1.py" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust SpecHelpers.lookupDeclaration "e" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -35,7 +34,7 @@ spec = do 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 + case moduleLookup "main2.py" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -46,7 +45,7 @@ spec = do 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 + case moduleLookup "main3.py" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do SpecHelpers.lookupDeclaration "utils" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust -- (lookupDeclaration "utils" heap >>= deNamespace heap) `shouldBe` Just ("utils", ["to_s"]) @@ -54,7 +53,7 @@ spec = do it "subclasses" $ do (scopeGraph, (heap, res)) <- evaluate ["subclass.py"] - case ModuleTable.lookup "subclass.py" <$> res of + case moduleLookup "subclass.py" <$> res of Right (Just (Module _ (scopeAndFrame, value))) -> do SpecHelpers.lookupDeclaration "Foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -64,7 +63,7 @@ spec = do it "handles multiple inheritance left-to-right" $ do (scopeGraph, (heap, res)) <- evaluate ["multiple_inheritance.py"] - case ModuleTable.lookup "multiple_inheritance.py" <$> res of + case moduleLookup "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!\"" diff --git a/test/Analysis/Ruby/Spec.hs b/test/Analysis/Ruby/Spec.hs index 8cfbd70c4..63518539b 100644 --- a/test/Analysis/Ruby/Spec.hs +++ b/test/Analysis/Ruby/Spec.hs @@ -8,7 +8,6 @@ module Analysis.Ruby.Spec (spec) where import Control.Abstract (Declaration (..), ScopeError (..)) import Control.Carrier.Resumable.Either (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 @@ -16,6 +15,8 @@ import Data.Sum import qualified Language.Ruby.Term as Ruby import Source.Loc import SpecHelpers +import qualified System.Path as Path + spec :: (?session :: TaskSession) => Spec @@ -23,7 +24,7 @@ spec = do describe "Ruby" $ do it "evaluates require_relative" $ do (scopeGraph, (heap, res)) <- evaluate ["main.rb", "foo.rb"] - case ModuleTable.lookup "main.rb" <$> res of + case moduleLookup "main.rb" <$> res of Right (Just (Module _ (scopeAndFrame, value))) -> do value `shouldBe` Value.Integer (Number.Integer 1) SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -31,7 +32,7 @@ spec = do it "evaluates load" $ do (scopeGraph, (heap, res)) <- evaluate ["load.rb", "foo.rb"] - case ModuleTable.lookup "load.rb" <$> res of + case moduleLookup "load.rb" <$> res of Right (Just (Module _ (scopeAndFrame, value))) -> do value `shouldBe` Value.Integer (Number.Integer 1) SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -39,11 +40,11 @@ spec = do 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" "Ruby" mempty) (Span (Pos 3 1) (Pos 3 7)) (LookupPathError (Declaration "foo"))))) + res `shouldBe` Left (SomeError (inject @(BaseError (ScopeError Precise)) (BaseError (ModuleInfo (Path.absRel "load-wrap.rb") "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 + case moduleLookup "subclass.rb" <$> res of Right (Just (Module _ (scopeAndFrame, value))) -> do value `shouldBe` String "\"\"" SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -53,50 +54,50 @@ spec = do it "evaluates modules" $ do (scopeGraph, (heap, res)) <- evaluate ["modules.rb"] - case ModuleTable.lookup "modules.rb" <$> res of + case moduleLookup "modules.rb" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do SpecHelpers.lookupDeclaration "Bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust other -> expectationFailure (show other) it "handles break correctly" $ do (_, (_, res)) <- evaluate ["break.rb"] - case ModuleTable.lookup "break.rb" <$> res of + case moduleLookup "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 + case moduleLookup "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 + case moduleLookup "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 + case moduleLookup "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 + case moduleLookup "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 + case moduleLookup "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 + case moduleLookup "puts.rb" <$> res of Right (Just (Module _ (scopeAndFrame, value))) -> do value `shouldBe` Unit SpecHelpers.lookupDeclaration "puts" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust diff --git a/test/Analysis/TypeScript/Spec.hs b/test/Analysis/TypeScript/Spec.hs index fe77c2b41..85d7d2812 100644 --- a/test/Analysis/TypeScript/Spec.hs +++ b/test/Analysis/TypeScript/Spec.hs @@ -10,7 +10,6 @@ import Control.Abstract.ScopeGraph hiding (AccessControl (..)) import Control.Carrier.Resumable.Either (SomeError (..)) import Data.Abstract.Evaluatable import qualified Data.Abstract.Heap as Heap -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 (AccessControl (..)) @@ -23,20 +22,21 @@ import Data.Text (pack) import qualified Language.TypeScript.Term as TypeScript import Source.Loc import SpecHelpers +import qualified System.Path as Path spec :: (?session :: TaskSession) => Spec spec = 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 + case moduleLookup "main6.ts" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust 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 + case moduleLookup "main.ts" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do SpecHelpers.lookupDeclaration "bar" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust SpecHelpers.lookupDeclaration "quz" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -45,7 +45,7 @@ spec = do it "imports with qualified names" $ do (scopeGraph, (heap, res)) <- evaluate ["main1.ts", "foo.ts", "a.ts"] - case ModuleTable.lookup "main1.ts" <$> res of + case moduleLookup "main1.ts" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do SpecHelpers.lookupDeclaration "b" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust SpecHelpers.lookupDeclaration "z" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -59,7 +59,7 @@ spec = do it "stores function declaration in scope graph" $ do (scopeGraph, (heap, res)) <- evaluate ["a.ts"] - case ModuleTable.lookup "a.ts" <$> res of + case moduleLookup "a.ts" <$> res of Right (Just (Module _ (scopeAndFrame, value))) -> do SpecHelpers.lookupDeclaration "baz" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust value `shouldBe` Unit @@ -67,7 +67,7 @@ spec = do it "imports functions" $ do (scopeGraph, (heap, res)) <- evaluate ["main4.ts", "foo.ts"] - case ModuleTable.lookup "main4.ts" <$> res of + case moduleLookup "main4.ts" <$> res of Right (Just (Module _ (scopeAndFrame, value))) -> do SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust value `shouldBe` String (pack "\"this is the foo function\"") @@ -75,7 +75,7 @@ spec = do it "side effect only imports dont expose exports" $ do (scopeGraph, (heap, res)) <- evaluate ["main3.ts", "a.ts"] - case ModuleTable.lookup "main3.ts" <$> res of + case moduleLookup "main3.ts" <$> res of Right (Just (Module _ (scopeAndFrame, value))) -> do SpecHelpers.lookupDeclaration "baz" scopeAndFrame heap scopeGraph `shouldBe` Nothing value `shouldBe` Unit @@ -84,31 +84,31 @@ spec = do 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" "TypeScript" mempty) (Span (Pos 2 1) (Pos 2 28)) ImportReferenceError))) + res `shouldBe` Left (SomeError (inject @(BaseError (ScopeError Precise)) (BaseError (ModuleInfo (Path.absRel "bad-export.ts") "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 + case moduleLookup "early-return.ts" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> SpecHelpers.lookupDeclaration "foo" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust other -> expectationFailure (show other) it "evaluates sequence expressions" $ do (scopeGraph, (heap, res)) <- evaluate ["sequence-expression.ts"] - case ModuleTable.lookup "sequence-expression.ts" <$> res of + case moduleLookup "sequence-expression.ts" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> 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 + case moduleLookup "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 + case moduleLookup "delete.ts" <$> res of Right (Just (Module _ (scopeAndFrame, value))) -> do value `shouldBe` Unit SpecHelpers.lookupDeclaration "x" scopeAndFrame heap scopeGraph `shouldBe` Nothing @@ -116,7 +116,7 @@ spec = do it "evaluates await" $ do (scopeGraph, (heap, res)) <- evaluate ["await.ts"] - case ModuleTable.lookup "await.ts" <$> res of + case moduleLookup "await.ts" <$> res of Right (Just (Module _ (scopeAndFrame, _))) -> do -- Test that f2 is in the scopegraph and heap. SpecHelpers.lookupDeclaration "f2" scopeAndFrame heap scopeGraph `shouldSatisfy` isJust @@ -126,59 +126,59 @@ spec = do it "evaluates BOr statements" $ do (_, (_, res)) <- evaluate ["bor.ts"] - case ModuleTable.lookup "bor.ts" <$> res of + case moduleLookup "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 + case moduleLookup "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 + case moduleLookup "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 + case moduleLookup "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 + case moduleLookup "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 + case moduleLookup "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 (_, (_, res)) <- evaluate ["class1.ts", "class2.ts"] - case ModuleTable.lookup "class1.ts" <$> res of + case moduleLookup "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" "TypeScript" mempty) (Span (Pos 4 1) (Pos 4 6)) (AccessControlError ("foo", ScopeGraph.Public) ("y", ScopeGraph.Private) (Concrete.Float (Decimal 2.0)))))) + let expected = Left (SomeError (inject @TypeScriptEvalError (BaseError (ModuleInfo (Path.absRel "private_field_definition.ts") "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" "TypeScript" mempty) (Span (Pos 3 1) (Pos 3 8)) (AccessControlError ("Adder", ScopeGraph.Public) ("z", ScopeGraph.Private) Unit)))) + let expected = Left (SomeError (inject @TypeScriptEvalError (BaseError (ModuleInfo (Path.absRel "private_static_field_definition.ts" )"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" "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" "TypeScript" mempty) (Just "private_add") Nothing [] (Right (TypeScript.Term (In (Loc (Range 146 148) (Span (Pos 7 27) (Pos 7 29))) (inject (StatementBlock []))))) (Precise 20) (Precise 18)))))) + let expected = Left (SomeError (inject @TypeScriptEvalError (BaseError (ModuleInfo (Path.absRel "private_method.ts" )"TypeScript" mempty) (Span (Pos 4 1) (Pos 4 16)) (AccessControlError ("foo", ScopeGraph.Public) ("private_add", ScopeGraph.Private) (Closure (PackageInfo "access_control" mempty) (ModuleInfo (Path.absRel "adder.ts") "TypeScript" mempty) (Just "private_add") Nothing [] (Right (TypeScript.Term (In (Loc (Range 146 148) (Span (Pos 7 27) (Pos 7 29))) (inject (StatementBlock []))))) (Precise 20) (Precise 18)))))) res `shouldBe` expected where diff --git a/test/Assigning/Assignment/Spec.hs b/test/Assigning/Assignment/Spec.hs index 90088c4bb..09f8d598c 100644 --- a/test/Assigning/Assignment/Spec.hs +++ b/test/Assigning/Assignment/Spec.hs @@ -134,10 +134,10 @@ spec = do describe "eof" $ do it "matches at the end of branches" $ - fst <$> runAssignment "" eof (makeState [] :: State [] Grammar) `shouldBe` Right () + 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 () + fst <$> runAssignment "magenta" eof (makeState [ node Magenta 0 7 [] ] :: State Grammar) `shouldBe` Right () describe "catchError" $ do it "catches failed committed choices" $ @@ -253,7 +253,7 @@ spec = do `shouldBe` Left [ "symbol" ] -node :: symbol -> Int -> Int -> [AST [] symbol] -> AST [] symbol +node :: symbol -> Int -> Int -> [AST symbol] -> AST symbol node symbol start end children = Term (Node symbol (Loc (Range start end) (Span (Pos 1 (succ start)) (Pos 1 (succ end)))) `In` children) data Grammar = Palette | Red | Green | Blue | Magenta @@ -266,14 +266,14 @@ instance Symbol Grammar where data Out = Out T.Text | OutError T.Text deriving (Eq, Show) -red :: HasCallStack => Assignment [] Grammar Out +red :: HasCallStack => Assignment Grammar Out red = Out <$ symbol Red <*> source -green :: HasCallStack => Assignment [] Grammar Out +green :: HasCallStack => Assignment Grammar Out green = Out <$ symbol Green <*> source -blue :: HasCallStack => Assignment [] Grammar Out +blue :: HasCallStack => Assignment Grammar Out blue = Out <$ symbol Blue <*> source -magenta :: HasCallStack => Assignment [] Grammar Out +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 index 10bc8cfec..e60ab8111 100644 --- a/test/Control/Abstract/Evaluator/Spec.hs +++ b/test/Control/Abstract/Evaluator/Spec.hs @@ -27,7 +27,7 @@ import qualified Data.Map.Strict as Map import Data.Sum import SpecHelpers hiding (reassociate) import System.IO.Unsafe (unsafePerformIO) - +import qualified System.Path as Path spec :: Spec spec = do it "constructs integers" $ do @@ -57,7 +57,7 @@ evaluate . fmap snd . runFresh 0 . runReader (PackageInfo (SpecHelpers.name "test") mempty) - . runReader (ModuleInfo "test/Control/Abstract/Evaluator/Spec.hs" "Haskell" mempty) + . runReader (ModuleInfo (Path.absRel "test/Control/Abstract/Evaluator/Spec.hs") "Haskell" mempty) . evalState (lowerBound @Span) . runReader (lowerBound @Span) . runEvaluator diff --git a/test/Data/Language/Spec.hs b/test/Data/Language/Spec.hs index 61e77ef00..ebd048b5b 100644 --- a/test/Data/Language/Spec.hs +++ b/test/Data/Language/Spec.hs @@ -7,13 +7,7 @@ import Test.Tasty.HUnit testTree :: TestTree testTree = testGroup "Data.Language" - [ testCase "supportedExts returns expected list" $ - supportedExts @=? [".go",".java",".rb",".builder",".eye",".fcgi",".gemspec",".god",".jbuilder",".mspec",".pluginspec",".podspec",".rabl",".rake",".rbuild",".rbw",".rbx",".ru",".ruby",".spec",".thor",".watchr",".py",".bzl",".cgi",".fcgi",".gyp",".gypi",".lmi",".py3",".pyde",".pyi",".pyp",".pyt",".pyw",".rpy",".spec",".tac",".wsgi",".xpy",".js","._js",".bones",".es",".es6",".frag",".gs",".jake",".jsb",".jscad",".jsfl",".jsm",".jss",".mjs",".njs",".pac",".sjs",".ssjs",".xsjs",".xsjslib",".ts",".php",".aw",".ctp",".fcgi",".inc",".php3",".php4",".php5",".phps",".phpt"] - - , testCase "codeNavLanguages returns expected list" $ - codeNavLanguages @=? [Go, Java, Ruby, Python, JavaScript, TypeScript, PHP] - - , testCase "languageForFilePath works for languages with ambiguous lingo extensions" $ do + [ testCase "languageForFilePath works for languages with ambiguous lingo extensions" $ do Language.forPath (Path.relFile "foo.php") @=? PHP Language.forPath (Path.relFile "foo.md" ) @=? Markdown Language.forPath (Path.relFile "foo.tsx") @=? TSX diff --git a/test/Examples.hs b/test/Examples.hs index 5b5e4428f..8414f12e7 100644 --- a/test/Examples.hs +++ b/test/Examples.hs @@ -52,7 +52,7 @@ le = LanguageExample examples :: [LanguageExample] examples = [ le "go" "**/*.go" goFileSkips goDirSkips - , le "python" "**/*.py" mempty mempty + , le "python" "**/*.py" pythonFileSkips mempty , le "ruby" "**/*.rb" rubySkips mempty , le "typescript" "**/*.[jt]s" typescriptSkips mempty , le "typescript" "**/*.[jt]sx" tsxSkips mempty @@ -100,6 +100,14 @@ goDirSkips = Path.relDir <$> , "go/test" ] +pythonFileSkips :: [Path.RelFile] +pythonFileSkips = Path.relPath <$> + [ + -- Assignment doesn't handle f-strings + "thealgorithms/analysis/compression_analysis/psnr.py" + , "thealgorithms/maths/greater_common_divisor.py" + ] + rubySkips :: [Path.RelFile] rubySkips = Path.relFile <$> [ diff --git a/test/Graphing/Calls/Spec.hs b/test/Graphing/Calls/Spec.hs index 7c2da7b5c..863201759 100644 --- a/test/Graphing/Calls/Spec.hs +++ b/test/Graphing/Calls/Spec.hs @@ -24,7 +24,7 @@ callGraphPythonProject path = runTaskOrDie $ do lang = Language.Python SomeParser parser <- pure . fromJust $! parserForLanguage analysisParsers Language.Python blob <- readBlobFromFile' (File.fromPath path) - package <- fmap snd <$> parsePackage parser (Project (Path.toString (Path.takeDirectory path)) [blob] lang []) + package <- fmap snd <$> parsePackage parser (Project (Path.toAbsRel (Path.takeDirectory path)) [blob] lang []) modules <- topologicalSort <$> runImportGraphToModules proxy package runCallGraph proxy False modules package diff --git a/test/Rendering/TOC/Spec.hs b/test/Rendering/TOC/Spec.hs index 5fb5c2cd6..d27e3bf06 100644 --- a/test/Rendering/TOC/Spec.hs +++ b/test/Rendering/TOC/Spec.hs @@ -139,7 +139,7 @@ spec = do let summary = TOCSummary (Method Nothing) "self.foo" (Span (Pos 1 1) (Pos 2 4)) Inserted encode summary `shouldBe` "{\"span\":{\"start\":[1,1],\"end\":[2,4]},\"category\":\"Method\",\"term\":\"self.foo\",\"changeType\":\"added\"}" - describe "diff with ToCDiffRenderer'" $ do + describe "diff with diffSummaryBuilder" $ do it "produces JSON output" $ do blobs <- blobsForPaths (Path.relFile "ruby/toc/methods.A.rb") (Path.relFile "ruby/toc/methods.B.rb") output <- runTaskOrDie (runReader aLaCarteLanguageModes (diffSummaryBuilder Format.JSON [blobs])) @@ -155,12 +155,6 @@ spec = do output <- runTaskOrDie (runReader aLaCarteLanguageModes (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 (Path.relFile "markdown/toc/headings.A.md") (Path.relFile "markdown/toc/headings.B.md") - output <- runTaskOrDie (runReader aLaCarteLanguageModes (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) diff --git a/test/Semantic/IO/Spec.hs b/test/Semantic/IO/Spec.hs index ea336fc2a..4d778fc41 100644 --- a/test/Semantic/IO/Spec.hs +++ b/test/Semantic/IO/Spec.hs @@ -15,7 +15,7 @@ spec = do describe "readFile" $ do it "returns a blob for extant files" $ do Just blob <- readBlobFromFile (File (Path.absRel "semantic.cabal") lowerBound Unknown) - blobPath blob `shouldBe` "semantic.cabal" + blobFilePath blob `shouldBe` "semantic.cabal" it "throws for absent files" $ do readBlobFromFile (File (Path.absRel "/dev/doesnotexist") lowerBound Unknown) `shouldThrow` anyIOException diff --git a/test/Semantic/Spec.hs b/test/Semantic/Spec.hs index 9ce5d447c..7465b3f0c 100644 --- a/test/Semantic/Spec.hs +++ b/test/Semantic/Spec.hs @@ -21,12 +21,12 @@ spec = do it "returns error if given an unknown language (json)" $ do output <- fmap runBuilder . runTaskOrDie . runReader defaultLanguageModes $ parseTermBuilder TermJSONTree [ setBlobLanguage Unknown methodsBlob ] - output `shouldBe` "{\"trees\":[{\"path\":\"methods.rb\",\"error\":\"NoLanguageForBlob \\\"methods.rb\\\"\",\"language\":\"Unknown\"}]}\n" + output `shouldBe` "{\"trees\":[{\"path\":\"methods.rb\",\"error\":\"NoLanguageForBlob (currentDir relPath \\\"methods.rb\\\")\",\"language\":\"Unknown\"}]}\n" it "throws if given an unknown language for sexpression output" $ do res <- runTaskWithOptions defaultOptions (runReader defaultLanguageModes (runParseWithConfig (parseTermBuilder TermSExpression [setBlobLanguage Unknown methodsBlob]))) case res of - Left exc -> fromException exc `shouldBe` Just (NoLanguageForBlob "methods.rb") + Left exc -> fromException exc `shouldBe` Just (NoLanguageForBlob $ Path.absRel "methods.rb") Right _bad -> fail "Expected parseTermBuilder to fail for an unknown language" it "renders with the specified renderer" $ do diff --git a/test/SpecHelpers.hs b/test/SpecHelpers.hs index 8d3ffe571..2e11e4c16 100644 --- a/test/SpecHelpers.hs +++ b/test/SpecHelpers.hs @@ -22,6 +22,7 @@ module SpecHelpers , TestEvaluatingResult , TestEvaluatingState , evaluateProject +, moduleLookup ) where import qualified Analysis.File as File @@ -43,6 +44,7 @@ import Data.Abstract.FreeVariables as X import qualified Data.Abstract.Heap as Heap import Data.Abstract.Module as X import Data.Abstract.ModuleTable as X hiding (lookup) +import qualified Data.Abstract.ModuleTable as ModuleTable import qualified Data.Abstract.ScopeGraph as ScopeGraph import Data.Abstract.Value.Concrete (Value (..), ValueError, runValueError) import Data.Blob as X @@ -74,6 +76,7 @@ import Semantic.Util 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 qualified System.Path as Path import Test.Hspec as X (Spec, SpecWith, around, context, describe, it, parallel, pendingWith, runIO, xit) @@ -82,6 +85,9 @@ import Test.Hspec.LeanCheck as X import Test.LeanCheck as X import Unsafe.Coerce (unsafeCoerce) +instance Lower X.Span where + lowerBound = Source.Span.point (Pos 1 1) + runBuilder :: Builder -> ByteString runBuilder = toStrict . toLazyByteString @@ -198,3 +204,6 @@ 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 + +moduleLookup :: FilePath -> ModuleTable a -> Maybe a +moduleLookup = ModuleTable.lookup . Path.absRel