diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000000..b8374276c1 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,19 @@ +# This workflow runs for every pull request +name: Java Format Check + +on: + pull_request: + +jobs: + check-java: + runs-on: ubuntu-latest + steps: + - name: Support longpaths + run: | + git config --global core.longpaths true + + - uses: actions/checkout@v4 + - name: Check format of Java, md and yaml + shell: bash + run: | + make format_java_misc-check diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml index faa08c77b2..495cc1697f 100644 --- a/.github/workflows/manual.yml +++ b/.github/workflows/manual.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: inputs: dafny: - description: 'The Dafny version to use' + description: "The Dafny version to use" required: true type: string @@ -27,4 +27,4 @@ jobs: manual-ci-rust: uses: ./.github/workflows/test_models_rust_tests.yml with: - dafny: ${{ inputs.dafny }} \ No newline at end of file + dafny: ${{ inputs.dafny }} diff --git a/.github/workflows/nightly_dafny.yml b/.github/workflows/nightly_dafny.yml index afa75db534..c686dec1df 100644 --- a/.github/workflows/nightly_dafny.yml +++ b/.github/workflows/nightly_dafny.yml @@ -16,26 +16,32 @@ jobs: if: github.event_name != 'schedule' || github.repository_owner == 'smithy-lang' uses: ./.github/workflows/test_models_dafny_verification.yml with: - dafny: 'nightly-latest' + dafny: "nightly-latest" dafny-nightly-java: if: github.event_name != 'schedule' || github.repository_owner == 'smithy-lang' uses: ./.github/workflows/test_models_java_tests.yml with: - dafny: 'nightly-latest' + dafny: "nightly-latest" dafny-nightly-net: if: github.event_name != 'schedule' || github.repository_owner == 'smithy-lang' uses: ./.github/workflows/test_models_net_tests.yml with: - dafny: 'nightly-latest' + dafny: "nightly-latest" dafny-nightly-rust: if: github.event_name != 'schedule' || github.repository_owner == 'smithy-lang' uses: ./.github/workflows/test_models_rust_tests.yml with: - dafny: 'nightly-latest' + dafny: "nightly-latest" cut-issue-on-failure: runs-on: ubuntu-latest - needs: [dafny-nightly-verification, dafny-nightly-java, dafny-nightly-net, dafny-nightly-rust] + needs: + [ + dafny-nightly-verification, + dafny-nightly-java, + dafny-nightly-net, + dafny-nightly-rust, + ] if: ${{ always() && contains(needs.*.result, 'failure') }} env: GH_TOKEN: ${{ secrets.CI_TOKEN }} diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index 630583a802..19d83a5c5a 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -8,12 +8,12 @@ jobs: pr-populate-dafny-versions: runs-on: ubuntu-latest steps: - - name: Populate Dafny versions list - id: populate-dafny-versions-list - run: echo "dafny-versions-list=['4.2.0', '4.4.0']" >> $GITHUB_OUTPUT + - name: Populate Dafny versions list + id: populate-dafny-versions-list + run: echo "dafny-versions-list=['4.2.0', '4.4.0']" >> $GITHUB_OUTPUT outputs: dafny-version-list: ${{ steps.populate-dafny-versions-list.outputs.dafny-versions-list }} - + pr-ci-verification: needs: pr-populate-dafny-versions strategy: diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6d6726f252..cb85dea6c8 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -4,18 +4,18 @@ name: Push CI on: push: branches: - - main-1.x + - main-1.x jobs: pr-populate-dafny-versions: runs-on: ubuntu-latest steps: - - name: Populate Dafny versions list - id: populate-dafny-versions-list - run: echo "dafny-versions-list=['4.2.0', '4.4.0']" >> $GITHUB_OUTPUT + - name: Populate Dafny versions list + id: populate-dafny-versions-list + run: echo "dafny-versions-list=['4.2.0', '4.4.0']" >> $GITHUB_OUTPUT outputs: dafny-version-list: ${{ steps.populate-dafny-versions-list.outputs.dafny-versions-list }} - + push-ci-verification: needs: pr-populate-dafny-versions strategy: @@ -54,4 +54,4 @@ jobs: - dafny-version: 4.2.0 uses: ./.github/workflows/test_models_rust_tests.yml with: - dafny: ${{ matrix.dafny-version }} \ No newline at end of file + dafny: ${{ matrix.dafny-version }} diff --git a/.github/workflows/smithy-dafny-conversion.yml b/.github/workflows/smithy-dafny-conversion.yml index 0ddd1b5fd8..e835e5a7a5 100644 --- a/.github/workflows/smithy-dafny-conversion.yml +++ b/.github/workflows/smithy-dafny-conversion.yml @@ -1,6 +1,6 @@ name: smithy-dafny-conversion workflows -on: +on: pull_request: push: branches: @@ -13,8 +13,8 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - distribution: 'corretto' - java-version: '8' + distribution: "corretto" + java-version: "8" - name: Setup Dafny uses: dafny-lang/setup-dafny-action@v1.6.1 diff --git a/.github/workflows/smithy-polymorph.yml b/.github/workflows/smithy-polymorph.yml index 1e67471c9e..842ee98c03 100644 --- a/.github/workflows/smithy-polymorph.yml +++ b/.github/workflows/smithy-polymorph.yml @@ -1,6 +1,6 @@ name: smithy-dafny-codegen-cli workflows -on: +on: pull_request: push: branches: @@ -13,18 +13,18 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: - distribution: 'corretto' - java-version: '17' + distribution: "corretto" + java-version: "17" - uses: actions/setup-java@v3 with: - distribution: 'corretto' - java-version: '17' + distribution: "corretto" + java-version: "17" - name: Setup Dafny uses: dafny-lang/setup-dafny-action@v1.7.0 with: # Matching the hard-coded version for the "2023" edition for now dafny-version: 4.1.0 - + - name: Execute smithy-dafny-codegen-cli tests uses: gradle/gradle-build-action@v2 with: diff --git a/.github/workflows/test_models_dafny_verification.yml b/.github/workflows/test_models_dafny_verification.yml index 0eb6c0851f..f6e349fac1 100644 --- a/.github/workflows/test_models_dafny_verification.yml +++ b/.github/workflows/test_models_dafny_verification.yml @@ -5,7 +5,7 @@ on: workflow_call: inputs: dafny: - description: 'The Dafny version to run' + description: "The Dafny version to run" required: true type: string @@ -14,44 +14,44 @@ jobs: strategy: fail-fast: false matrix: - dafny-version: + dafny-version: - ${{ inputs.dafny }} library: [ - TestModels/dafny-dependencies/StandardLibrary, # This stores current Polymorph dependencies that all TestModels depend on - TestModels/Aggregate, - TestModels/AggregateReferences, - TestModels/CodegenPatches, - TestModels/Constraints, - TestModels/Constructor, - TestModels/Dependencies, - TestModels/Errors, - TestModels/Extendable, - TestModels/Extern, - # TestModels/LanguageSpecificLogic, # requires >4.4.0 - TestModels/LocalService, - TestModels/MultipleModels, - TestModels/Refinement, - TestModels/Resource, - # TestModels/SimpleTypes/BigDecimal, - # TestModels/SimpleTypes/BigInteger, - TestModels/SimpleTypes/SimpleBlob, - TestModels/SimpleTypes/SimpleBoolean, - # TestModels/SimpleTypes/SimpleByte, - TestModels/SimpleTypes/SimpleDouble, - TestModels/SimpleTypes/SimpleEnum, - # TestModels/SimpleTypes/SimpleEnumV2, - # TestModels/SimpleTypes/SimpleFloat, - TestModels/SimpleTypes/SimpleInteger, - TestModels/SimpleTypes/SimpleLong, - # TestModels/SimpleTypes/SimpleShort, - TestModels/SimpleTypes/SimpleString, - # TestModels/SimpleTypes/SimpleTimestamp, - TestModels/Union, - TestModels/aws-sdks/ddb, - TestModels/aws-sdks/kms, - TestModels/aws-sdks/sqs-via-cli, - ] - os: [ ubuntu-latest ] + TestModels/dafny-dependencies/StandardLibrary, # This stores current Polymorph dependencies that all TestModels depend on + TestModels/Aggregate, + TestModels/AggregateReferences, + TestModels/CodegenPatches, + TestModels/Constraints, + TestModels/Constructor, + TestModels/Dependencies, + TestModels/Errors, + TestModels/Extendable, + TestModels/Extern, + # TestModels/LanguageSpecificLogic, # requires >4.4.0 + TestModels/LocalService, + TestModels/MultipleModels, + TestModels/Refinement, + TestModels/Resource, + # TestModels/SimpleTypes/BigDecimal, + # TestModels/SimpleTypes/BigInteger, + TestModels/SimpleTypes/SimpleBlob, + TestModels/SimpleTypes/SimpleBoolean, + # TestModels/SimpleTypes/SimpleByte, + TestModels/SimpleTypes/SimpleDouble, + TestModels/SimpleTypes/SimpleEnum, + # TestModels/SimpleTypes/SimpleEnumV2, + # TestModels/SimpleTypes/SimpleFloat, + TestModels/SimpleTypes/SimpleInteger, + TestModels/SimpleTypes/SimpleLong, + # TestModels/SimpleTypes/SimpleShort, + TestModels/SimpleTypes/SimpleString, + # TestModels/SimpleTypes/SimpleTimestamp, + TestModels/Union, + TestModels/aws-sdks/ddb, + TestModels/aws-sdks/kms, + TestModels/aws-sdks/sqs-via-cli, + ] + os: [ubuntu-latest] include: # One-offs until TestModels migrate to 4.4.0 - library: TestModels/LanguageSpecificLogic diff --git a/.github/workflows/test_models_java_tests.yml b/.github/workflows/test_models_java_tests.yml index 4c4be3d7b3..9fbdcf590a 100644 --- a/.github/workflows/test_models_java_tests.yml +++ b/.github/workflows/test_models_java_tests.yml @@ -5,7 +5,7 @@ on: workflow_call: inputs: dafny: - description: 'The Dafny version to run' + description: "The Dafny version to run" required: true type: string @@ -15,39 +15,39 @@ jobs: fail-fast: false matrix: library: [ - TestModels/dafny-dependencies/StandardLibrary, # This stores current Polymorph dependencies that all TestModels depend on - # TestModels/Aggregate, - # TestModels/AggregateReferences, - TestModels/CodegenPatches, - TestModels/Constraints, - # TestModels/Constructor, - # TestModels/Dependencies, - TestModels/Errors, - TestModels/Extendable, - # TestModels/Extern, - # TestModels/LanguageSpecificLogic, - TestModels/LocalService, - TestModels/MultipleModels, - # TestModels/Refinement, - TestModels/Resource, - # TestModels/SimpleTypes/BigDecimal, - # TestModels/SimpleTypes/BigInteger, - # TestModels/SimpleTypes/SimpleBlob, - # TestModels/SimpleTypes/SimpleBoolean, - # TestModels/SimpleTypes/SimpleByte, - # TestModels/SimpleTypes/SimpleDouble, - # TestModels/SimpleTypes/SimpleEnum, - # TestModels/SimpleTypes/SimpleEnumV2, - # TestModels/SimpleTypes/SimpleFloat, - # TestModels/SimpleTypes/SimpleInteger, - # TestModels/SimpleTypes/SimpleLong, - # TestModels/SimpleTypes/SimpleShort, - # TestModels/SimpleTypes/SimpleString, - # TestModels/SimpleTypes/SimpleTimestamp, - # TestModels/Union, - TestModels/aws-sdks/ddb, - TestModels/aws-sdks/kms, - ] + TestModels/dafny-dependencies/StandardLibrary, # This stores current Polymorph dependencies that all TestModels depend on + # TestModels/Aggregate, + # TestModels/AggregateReferences, + TestModels/CodegenPatches, + TestModels/Constraints, + # TestModels/Constructor, + # TestModels/Dependencies, + TestModels/Errors, + TestModels/Extendable, + # TestModels/Extern, + # TestModels/LanguageSpecificLogic, + TestModels/LocalService, + TestModels/MultipleModels, + # TestModels/Refinement, + TestModels/Resource, + # TestModels/SimpleTypes/BigDecimal, + # TestModels/SimpleTypes/BigInteger, + # TestModels/SimpleTypes/SimpleBlob, + # TestModels/SimpleTypes/SimpleBoolean, + # TestModels/SimpleTypes/SimpleByte, + # TestModels/SimpleTypes/SimpleDouble, + # TestModels/SimpleTypes/SimpleEnum, + # TestModels/SimpleTypes/SimpleEnumV2, + # TestModels/SimpleTypes/SimpleFloat, + # TestModels/SimpleTypes/SimpleInteger, + # TestModels/SimpleTypes/SimpleLong, + # TestModels/SimpleTypes/SimpleShort, + # TestModels/SimpleTypes/SimpleString, + # TestModels/SimpleTypes/SimpleTimestamp, + # TestModels/Union, + TestModels/aws-sdks/ddb, + TestModels/aws-sdks/kms, + ] runs-on: "ubuntu-latest" permissions: id-token: write @@ -74,10 +74,10 @@ jobs: with: dafny-version: ${{ inputs.dafny }} - - name: Setup Java + - name: Setup Java uses: actions/setup-java@v3 with: - distribution: 'corretto' + distribution: "corretto" java-version: 17 - name: Setup smithy-dafny-conversion @@ -89,14 +89,14 @@ jobs: - name: Setup Java 17 for codegen uses: actions/setup-java@v3 with: - distribution: 'corretto' - java-version: '17' + distribution: "corretto" + java-version: "17" - name: Setup dependencies working-directory: ./${{ matrix.library }} run: | make setup_prettier - + - name: Generate Polymorph Dafny and Java code shell: bash working-directory: ./${{ matrix.library }} @@ -108,8 +108,8 @@ jobs: - name: Setup Java 8 for running tests uses: actions/setup-java@v3 with: - distribution: 'corretto' - java-version: '8' + distribution: "corretto" + java-version: "8" - name: Compile ${{ matrix.library }} implementation shell: bash diff --git a/.github/workflows/test_models_net_tests.yml b/.github/workflows/test_models_net_tests.yml index 4679bff1d1..baab05ae91 100644 --- a/.github/workflows/test_models_net_tests.yml +++ b/.github/workflows/test_models_net_tests.yml @@ -5,7 +5,7 @@ on: workflow_call: inputs: dafny: - description: 'The Dafny version to run' + description: "The Dafny version to run" required: true type: string @@ -17,47 +17,47 @@ jobs: dafny-version: - ${{ inputs.dafny }} library: [ - TestModels/dafny-dependencies/StandardLibrary, # This stores current Polymorph dependencies that all TestModels depend on - TestModels/Aggregate, - # TestModels/AggregateReferences, - TestModels/CodegenPatches, - TestModels/Constraints, - TestModels/Constructor, - TestModels/Dependencies, - TestModels/Errors, - TestModels/Extendable, - TestModels/Extern, - # TestModels/LanguageSpecificLogic, # Tested only for 4.4.0 below - # TestModels/LocalService, - TestModels/MultipleModels, - TestModels/Refinement, - TestModels/Resource, - # TestModels/SimpleTypes/BigDecimal, - # TestModels/SimpleTypes/BigInteger, - TestModels/SimpleTypes/SimpleBlob, - TestModels/SimpleTypes/SimpleBoolean, - # TestModels/SimpleTypes/SimpleByte, - TestModels/SimpleTypes/SimpleDouble, - TestModels/SimpleTypes/SimpleEnum, - # TestModels/SimpleTypes/SimpleEnumV2, - # TestModels/SimpleTypes/SimpleFloat, - TestModels/SimpleTypes/SimpleInteger, - TestModels/SimpleTypes/SimpleLong, - # TestModels/SimpleTypes/SimpleShort, - TestModels/SimpleTypes/SimpleString, - # TestModels/SimpleTypes/SimpleTimestamp, - TestModels/Union, - TestModels/aws-sdks/ddb, - TestModels/aws-sdks/kms, - TestModels/aws-sdks/sqs-via-cli, - ] - dotnet-version: [ '6.0.x' ] - os: [ ubuntu-latest ] + TestModels/dafny-dependencies/StandardLibrary, # This stores current Polymorph dependencies that all TestModels depend on + TestModels/Aggregate, + # TestModels/AggregateReferences, + TestModels/CodegenPatches, + TestModels/Constraints, + TestModels/Constructor, + TestModels/Dependencies, + TestModels/Errors, + TestModels/Extendable, + TestModels/Extern, + # TestModels/LanguageSpecificLogic, # Tested only for 4.4.0 below + # TestModels/LocalService, + TestModels/MultipleModels, + TestModels/Refinement, + TestModels/Resource, + # TestModels/SimpleTypes/BigDecimal, + # TestModels/SimpleTypes/BigInteger, + TestModels/SimpleTypes/SimpleBlob, + TestModels/SimpleTypes/SimpleBoolean, + # TestModels/SimpleTypes/SimpleByte, + TestModels/SimpleTypes/SimpleDouble, + TestModels/SimpleTypes/SimpleEnum, + # TestModels/SimpleTypes/SimpleEnumV2, + # TestModels/SimpleTypes/SimpleFloat, + TestModels/SimpleTypes/SimpleInteger, + TestModels/SimpleTypes/SimpleLong, + # TestModels/SimpleTypes/SimpleShort, + TestModels/SimpleTypes/SimpleString, + # TestModels/SimpleTypes/SimpleTimestamp, + TestModels/Union, + TestModels/aws-sdks/ddb, + TestModels/aws-sdks/kms, + TestModels/aws-sdks/sqs-via-cli, + ] + dotnet-version: ["6.0.x"] + os: [ubuntu-latest] include: # One-off until TestModels migrate to 4.4.0 - library: TestModels/LanguageSpecificLogic dafny-version: 4.4.0 - dotnet-version: '6.0.x' + dotnet-version: "6.0.x" os: ubuntu-latest runs-on: ${{ matrix.os }} permissions: @@ -104,8 +104,8 @@ jobs: - name: Setup Java 17 for codegen uses: actions/setup-java@v3 with: - distribution: 'corretto' - java-version: '17' + distribution: "corretto" + java-version: "17" - name: Generate Polymorph Dafny and Dotnet code shell: bash diff --git a/.github/workflows/test_models_rust_tests.yml b/.github/workflows/test_models_rust_tests.yml index 1cb4f2e206..08d3181ef2 100644 --- a/.github/workflows/test_models_rust_tests.yml +++ b/.github/workflows/test_models_rust_tests.yml @@ -5,7 +5,7 @@ on: workflow_call: inputs: dafny: - description: 'The Dafny version to run' + description: "The Dafny version to run" required: true type: string @@ -15,39 +15,39 @@ jobs: fail-fast: false matrix: library: [ - TestModels/dafny-dependencies/StandardLibrary, # This stores current Polymorph dependencies that all TestModels depend on - # TestModels/Aggregate, - # TestModels/AggregateReferences, - # TestModels/CodegenPatches, - # TestModels/Constraints, - # TestModels/Constructor, - # TestModels/Dependencies, - # TestModels/Errors, - # TestModels/Extendable, - # TestModels/Extern, - # TestModels/LanguageSpecificLogic, - # TestModels/LocalService, - # TestModels/MultipleModels, - # TestModels/Refinement, - # TestModels/Resource, - # TestModels/SimpleTypes/BigDecimal, - # TestModels/SimpleTypes/BigInteger, - # TestModels/SimpleTypes/SimpleBlob, - # TestModels/SimpleTypes/SimpleBoolean, - # TestModels/SimpleTypes/SimpleByte, - # TestModels/SimpleTypes/SimpleDouble, - # TestModels/SimpleTypes/SimpleEnum, - # TestModels/SimpleTypes/SimpleEnumV2, - # TestModels/SimpleTypes/SimpleFloat, - # TestModels/SimpleTypes/SimpleInteger, - # TestModels/SimpleTypes/SimpleLong, - # TestModels/SimpleTypes/SimpleShort, - TestModels/SimpleTypes/SimpleString, - # TestModels/SimpleTypes/SimpleTimestamp, - # TestModels/Union, - # TestModels/aws-sdks/ddb, - # TestModels/aws-sdks/kms, - ] + TestModels/dafny-dependencies/StandardLibrary, # This stores current Polymorph dependencies that all TestModels depend on + # TestModels/Aggregate, + # TestModels/AggregateReferences, + # TestModels/CodegenPatches, + # TestModels/Constraints, + # TestModels/Constructor, + # TestModels/Dependencies, + # TestModels/Errors, + # TestModels/Extendable, + # TestModels/Extern, + # TestModels/LanguageSpecificLogic, + # TestModels/LocalService, + # TestModels/MultipleModels, + # TestModels/Refinement, + # TestModels/Resource, + # TestModels/SimpleTypes/BigDecimal, + # TestModels/SimpleTypes/BigInteger, + # TestModels/SimpleTypes/SimpleBlob, + # TestModels/SimpleTypes/SimpleBoolean, + # TestModels/SimpleTypes/SimpleByte, + # TestModels/SimpleTypes/SimpleDouble, + # TestModels/SimpleTypes/SimpleEnum, + # TestModels/SimpleTypes/SimpleEnumV2, + # TestModels/SimpleTypes/SimpleFloat, + # TestModels/SimpleTypes/SimpleInteger, + # TestModels/SimpleTypes/SimpleLong, + # TestModels/SimpleTypes/SimpleShort, + TestModels/SimpleTypes/SimpleString, + # TestModels/SimpleTypes/SimpleTimestamp, + # TestModels/Union, + # TestModels/aws-sdks/ddb, + # TestModels/aws-sdks/kms, + ] runs-on: "ubuntu-latest" permissions: id-token: write @@ -77,8 +77,8 @@ jobs: - name: Set up Rust uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: '1.74.1' - rustflags: '' + toolchain: "1.74.1" + rustflags: "" # TODO - not implemented yet # - name: Generate Polymorph Dafny and Rust code @@ -101,4 +101,4 @@ jobs: working-directory: ./${{ matrix.library }} shell: bash run: | - make test_rust \ No newline at end of file + make test_rust diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 5b627cfa60..ec98f2b76e 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,4 +1,5 @@ ## Code of Conduct + This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact opensource-codeofconduct@amazon.com with any additional questions or comments. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c4b6a1c508..d0649a77a2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,6 @@ documentation, we greatly value feedback and contributions from our community. Please read through this document before submitting any issues or pull requests to ensure we have all the necessary information to effectively respond to your bug report or contribution. - ## Reporting Bugs/Feature Requests We welcome you to use the GitHub issue tracker to report bugs or suggest features. @@ -14,16 +13,16 @@ We welcome you to use the GitHub issue tracker to report bugs or suggest feature When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: -* A reproducible test case or series of steps -* The version of our code being used -* Any modifications you've made relevant to the bug -* Anything unusual about your environment or deployment - +- A reproducible test case or series of steps +- The version of our code being used +- Any modifications you've made relevant to the bug +- Anything unusual about your environment or deployment ## Contributing via Pull Requests + Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: -1. You are working against the latest source on the *main* branch. +1. You are working against the latest source on the _main_ branch. 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. @@ -39,20 +38,19 @@ To send us a pull request, please: GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). - ## Finding contributions to work on -Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. +Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. ## Code of Conduct + This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact opensource-codeofconduct@amazon.com with any additional questions or comments. - ## Security issue notifications -If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. +If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. ## Licensing diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..58972c4b7e --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +# Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +# SPDX-License-Identifier: Apache-2.0 + +format_java_misc: setup_prettier + npx prettier --plugin=prettier-plugin-java . --write + +format_java_misc-check: setup_prettier + npx prettier --plugin=prettier-plugin-java . --check + +setup_prettier: + npm i --no-save prettier@3 prettier-plugin-java@2.5 diff --git a/README.md b/README.md index f2894c98d9..89d3e12650 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ will contain Dafny source code, Java source code, and a dependency on a Java artifact such as `software.amazon.awssdk:sqs`. This support is provided as a `dafny-client-codegen` Smithy build plugin -with a similar API to the other +with a similar API to the other [Smithy code generators](https://smithy.io/2.0/implementations.html#client-code-generators), -configured by entries in a `smithy-build.json` file. +configured by entries in a `smithy-build.json` file. See the [`codegen/smithy-dafny-codegen`](codegen/smithy-dafny-codegen) directory for further details and examples. @@ -47,9 +47,9 @@ We refer to this idea of producing multiple versions of a library with idiomatic Polymorphing is particularly useful for client-side libraries, as such libraries can make use of generated Dafny AWS SDK clients to build on top of various AWS services. -This use case is currently only implemented in the `smithy-dafny-codegen-cli` tool, +This use case is currently only implemented in the `smithy-dafny-codegen-cli` tool, which is not yet published anywhere outside of this repository. -We'd like to provide this functionality as another Smithy build plugin in the future, +We'd like to provide this functionality as another Smithy build plugin in the future, likely named something like `dafny-library-codegen`. If you're interested in this use case we'd love to hear from you - feel free to [cut us an issue](https://github.com/smithy-lang/smithy-dafny/issues/new)! @@ -65,7 +65,7 @@ or the related AWS traits specifications. Even for those that are supported, the implementation does not necessarily follow all of the recommendations in those specifications. -For example, [constraint traits](https://smithy.io/2.0/spec/constraint-traits.html) are intended to +For example, [constraint traits](https://smithy.io/2.0/spec/constraint-traits.html) are intended to be [validated in the service rather than in clients](https://smithy.io/2.0/guides/building-codegen/mapping-shapes-to-languages.html?highlight=client%20side%20validation#should-clients-enforce-constraint-traits). The above code generators, however, map these constraints to explicit Dafny specifications that are therefore statically checked by the Dafny verifier. @@ -76,7 +76,7 @@ However, it also means that future service changes that should be backwards-comp ### Runtime libraries -Like other Smithy-based code generators, these tools will emit references to +Like other Smithy-based code generators, these tools will emit references to [common runtime library code](https://smithy.io/2.0/guides/building-codegen/overview-and-concepts.html#runtime-libraries). However, at the time of writing this the Dafny ecosystem does not yet have mature package management features to support distributing and maintaining such libraries. diff --git a/TestModels/Aggregate/README.md b/TestModels/Aggregate/README.md index e94b78cd5d..80c966a52f 100644 --- a/TestModels/Aggregate/README.md +++ b/TestModels/Aggregate/README.md @@ -3,27 +3,33 @@ This project implements all the smithy [SimpleTypes](https://smithy.io/2.0/spec/simple-types.html) into an aggregated structure along with the associated operations in `dafny`. This is then transpiled to a target runtime, and each tests are executed - either as CI actions or manually. ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ -`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. \ No newline at end of file +`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/AggregateReferences/README.md b/TestModels/AggregateReferences/README.md index 81040622a1..94321e1362 100644 --- a/TestModels/AggregateReferences/README.md +++ b/TestModels/AggregateReferences/README.md @@ -18,18 +18,23 @@ as the unique code generation for this module is only Dafny code. It would be good to add runtime tests, but this is a lower priority. ## Build + ### Dafny + 1. Generate the Abstract Dafny code + ``` make polymorph_dafny ``` 2. Validate the manually written Dafny Code + ``` make verify ``` ## Development + 1. To add target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and Dafny transpilation. diff --git a/TestModels/CodegenPatches/README.md b/TestModels/CodegenPatches/README.md index ec7c1c20a8..601312ed8d 100644 --- a/TestModels/CodegenPatches/README.md +++ b/TestModels/CodegenPatches/README.md @@ -22,32 +22,39 @@ The easiest way to create these patches is the following workflow ## Build ### All target runtimes + 1. Generate Dafny code using `polymorph` + ``` make polymorph_dafny ``` ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ `--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/CodegenPatches/runtimes/java/src/main/java/Dafny/Simple/CodegenPatches/__default.java b/TestModels/CodegenPatches/runtimes/java/src/main/java/Dafny/Simple/CodegenPatches/__default.java index 3910b59560..eb8608d269 100644 --- a/TestModels/CodegenPatches/runtimes/java/src/main/java/Dafny/Simple/CodegenPatches/__default.java +++ b/TestModels/CodegenPatches/runtimes/java/src/main/java/Dafny/Simple/CodegenPatches/__default.java @@ -2,5 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 package simple.codegenpatches.internaldafny; -public class __default extends _ExternBase___default { -} +public class __default extends _ExternBase___default {} diff --git a/TestModels/CodegenPatches/runtimes/java/src/test/java/simple/codegenpatches/internaldafny/wrapped/__default.java b/TestModels/CodegenPatches/runtimes/java/src/test/java/simple/codegenpatches/internaldafny/wrapped/__default.java index 2ac63cdad2..8248a28488 100644 --- a/TestModels/CodegenPatches/runtimes/java/src/test/java/simple/codegenpatches/internaldafny/wrapped/__default.java +++ b/TestModels/CodegenPatches/runtimes/java/src/test/java/simple/codegenpatches/internaldafny/wrapped/__default.java @@ -2,20 +2,31 @@ // SPDX-License-Identifier: Apache-2.0 package simple.codegenpatches.internaldafny.wrapped; +import Wrappers_Compile.Result; import simple.codegenpatches.CodegenPatches; import simple.codegenpatches.ToNative; -import simple.codegenpatches.wrapped.TestCodegenPatches; - +import simple.codegenpatches.internaldafny.types.CodegenPatchesConfig; import simple.codegenpatches.internaldafny.types.Error; import simple.codegenpatches.internaldafny.types.ICodegenPatchesClient; -import simple.codegenpatches.internaldafny.types.CodegenPatchesConfig; -import Wrappers_Compile.Result; +import simple.codegenpatches.wrapped.TestCodegenPatches; public class __default extends _ExternBase___default { - public static Result WrappedCodegenPatches(CodegenPatchesConfig config) { - simple.codegenpatches.model.CodegenPatchesConfig wrappedConfig = ToNative.CodegenPatchesConfig(config); - simple.codegenpatches.CodegenPatches impl = CodegenPatches.builder().CodegenPatchesConfig(wrappedConfig).build(); - TestCodegenPatches wrappedClient = TestCodegenPatches.builder().impl(impl).build(); - return simple.codegenpatches.internaldafny.__default.CreateSuccessOfClient(wrappedClient); - } + + public static Result WrappedCodegenPatches( + CodegenPatchesConfig config + ) { + simple.codegenpatches.model.CodegenPatchesConfig wrappedConfig = + ToNative.CodegenPatchesConfig(config); + simple.codegenpatches.CodegenPatches impl = CodegenPatches + .builder() + .CodegenPatchesConfig(wrappedConfig) + .build(); + TestCodegenPatches wrappedClient = TestCodegenPatches + .builder() + .impl(impl) + .build(); + return simple.codegenpatches.internaldafny.__default.CreateSuccessOfClient( + wrappedClient + ); + } } diff --git a/TestModels/Constraints/README.md b/TestModels/Constraints/README.md index 244ee5dc0d..64b4cb8dc4 100644 --- a/TestModels/Constraints/README.md +++ b/TestModels/Constraints/README.md @@ -1,40 +1,47 @@ # SimpleConstraints -This project will implements Smithy 1.0 [constraints](https://smithy.io/1.0/spec/core/constraint-traits.html#) in `dafny`. This is then transpiled to a target runtime, and each tests are executed - either as CI actions or manually. +This project will implements Smithy 1.0 [constraints](https://smithy.io/1.0/spec/core/constraint-traits.html#) in `dafny`. This is then transpiled to a target runtime, and each tests are executed - either as CI actions or manually. -Right now, this project tests none of the 8 Smithy 1.0 constraint traits. `smithy-dotnet` currently does not generate validation code for any traits other than the `@required` trait. +Right now, this project tests none of the 8 Smithy 1.0 constraint traits. `smithy-dotnet` currently does not generate validation code for any traits other than the `@required` trait. Once `smithy-dotnet` adds generation for other traits, we should extend this project to test the other traits. ## Build ### All target runtimes + 1. Generate Dafny code using `polymorph` + ``` make polymorph_dafny ``` ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ `--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/Constraints/runtimes/java/src/main/java/simple/constraints/internaldafny/__default.java b/TestModels/Constraints/runtimes/java/src/main/java/simple/constraints/internaldafny/__default.java index de26963e15..9b63cbc48c 100644 --- a/TestModels/Constraints/runtimes/java/src/main/java/simple/constraints/internaldafny/__default.java +++ b/TestModels/Constraints/runtimes/java/src/main/java/simple/constraints/internaldafny/__default.java @@ -2,5 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 package simple.constraints.internaldafny; -public class __default extends _ExternBase___default{ -} +public class __default extends _ExternBase___default {} diff --git a/TestModels/Constraints/runtimes/java/src/main/java/simple/constraints/internaldafny/types/__default.java b/TestModels/Constraints/runtimes/java/src/main/java/simple/constraints/internaldafny/types/__default.java index ed7397a02a..1100632e4b 100644 --- a/TestModels/Constraints/runtimes/java/src/main/java/simple/constraints/internaldafny/types/__default.java +++ b/TestModels/Constraints/runtimes/java/src/main/java/simple/constraints/internaldafny/types/__default.java @@ -2,5 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 package simple.constraints.internaldafny.types; -public class __default extends _ExternBase___default { -} +public class __default extends _ExternBase___default {} diff --git a/TestModels/Constraints/runtimes/java/src/test/java/simple/constraints/internaldafny/wrapped/__default.java b/TestModels/Constraints/runtimes/java/src/test/java/simple/constraints/internaldafny/wrapped/__default.java index d3f1b383a5..2f3a939471 100644 --- a/TestModels/Constraints/runtimes/java/src/test/java/simple/constraints/internaldafny/wrapped/__default.java +++ b/TestModels/Constraints/runtimes/java/src/test/java/simple/constraints/internaldafny/wrapped/__default.java @@ -2,20 +2,32 @@ // SPDX-License-Identifier: Apache-2.0 package simple.constraints.internaldafny.wrapped; +import Wrappers_Compile.Result; import simple.constraints.SimpleConstraints; import simple.constraints.ToNative; -import simple.constraints.wrapped.TestSimpleConstraints; - +import simple.constraints.internaldafny.types.Error; import simple.constraints.internaldafny.types.ISimpleConstraintsClient; import simple.constraints.internaldafny.types.SimpleConstraintsConfig; -import simple.constraints.internaldafny.types.Error; -import Wrappers_Compile.Result; +import simple.constraints.wrapped.TestSimpleConstraints; public class __default extends _ExternBase___default { - public static Result WrappedSimpleConstraints(SimpleConstraintsConfig config) { - simple.constraints.model.SimpleConstraintsConfig wrappedConfig = ToNative.SimpleConstraintsConfig(config); - simple.constraints.SimpleConstraints impl = SimpleConstraints.builder().SimpleConstraintsConfig(wrappedConfig).build(); - TestSimpleConstraints wrappedClient = TestSimpleConstraints.builder().impl(impl).build(); - return simple.constraints.internaldafny.__default.CreateSuccessOfClient(wrappedClient); - } + + public static Result< + ISimpleConstraintsClient, + Error + > WrappedSimpleConstraints(SimpleConstraintsConfig config) { + simple.constraints.model.SimpleConstraintsConfig wrappedConfig = + ToNative.SimpleConstraintsConfig(config); + simple.constraints.SimpleConstraints impl = SimpleConstraints + .builder() + .SimpleConstraintsConfig(wrappedConfig) + .build(); + TestSimpleConstraints wrappedClient = TestSimpleConstraints + .builder() + .impl(impl) + .build(); + return simple.constraints.internaldafny.__default.CreateSuccessOfClient( + wrappedClient + ); + } } diff --git a/TestModels/Constructor/README.md b/TestModels/Constructor/README.md index c12a8dcc1e..1cf0ae78a3 100644 --- a/TestModels/Constructor/README.md +++ b/TestModels/Constructor/README.md @@ -2,36 +2,42 @@ This project utilizes the polymorph's localService `Config` structure in smithy to pass around values to a `Constructor` in dafny. This tests the close-to-production scenario where a client might be initilized with a set of config, and the behvior of the client is based on these values passed to the constructor. - ## Build ### All target runtimes + 1. Generate Dafny code using `polymorph` + ``` make polymorph_dafny ``` ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ `--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/Dependencies/README.md b/TestModels/Dependencies/README.md index d7702f03de..8e122d4e74 100644 --- a/TestModels/Dependencies/README.md +++ b/TestModels/Dependencies/README.md @@ -1,6 +1,6 @@ # Dependencies -This project tests [smithy-dafny's](../../codegen/smithy-dafny-codegen-cli) support +This project tests [smithy-dafny's](../../codegen/smithy-dafny-codegen-cli) support for creating and using dependency projects. It explicitly tests using dependency local resources and local services, as well as errors thrown by any dependency namespace. @@ -8,20 +8,23 @@ These tests are written in `dafny` and transpiled to the target runtimes for exe ## What is under test? -1. **A module can create and use an externally-defined resource** - +1. **A module can create and use an externally-defined resource** + This test takes in a SimpleResource config, creates a local SimpleResource, and tests basic operations on that resource. + 2. **A module can use a reference to an externally-created dependency resource** This test takes in a local ExtendableResourceReference and tests basic operations on resource. The ExtendableResourceReference is defined in the ExtendableResource module. It is expected to be an ExtendableResource type tagged with a `aws.polymorph#reference` trait. + 3. **A module can locally create and use - a reference to an externally-defined local service** + a reference to an externally-defined local service** This test takes in a SimpleConstraints service and tests basic operations on service. The SimpleConstraints service is defined in the SimpleConstraints module. However, the reference trait is added locally, inside the Dependencies module. + 4. **A module can wrap native exceptions from a dependency namespace as a native exception from this module** @@ -29,36 +32,45 @@ These tests are written in `dafny` and transpiled to the target runtimes for exe This test validates that these errors will be caught and wrapped by a SimpleDependencies exception. ## Build + ### Dafny + 1. Generate the Abstract Dafny code + ``` make polymorph_dafny ``` 2. Validate the manually written Dafny Code + ``` make verify ``` ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make setup_net format_net test_net ``` ## Development + 1. To add another target runtime support, - edit the `Makefile` and add the appropriate recipe to + edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and Dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. diff --git a/TestModels/Errors/runtimes/java/src/main/java/Dafny/Simple/Errors/__default.java b/TestModels/Errors/runtimes/java/src/main/java/Dafny/Simple/Errors/__default.java index 0e25ac259a..bca9ae9dba 100644 --- a/TestModels/Errors/runtimes/java/src/main/java/Dafny/Simple/Errors/__default.java +++ b/TestModels/Errors/runtimes/java/src/main/java/Dafny/Simple/Errors/__default.java @@ -2,5 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 package simple.errors.internaldafny; -public class __default extends _ExternBase___default { -} +public class __default extends _ExternBase___default {} diff --git a/TestModels/Errors/runtimes/java/src/test/java/simple/errors/internaldafny/wrapped/__default.java b/TestModels/Errors/runtimes/java/src/test/java/simple/errors/internaldafny/wrapped/__default.java index eaa10a3523..3c148b6b37 100644 --- a/TestModels/Errors/runtimes/java/src/test/java/simple/errors/internaldafny/wrapped/__default.java +++ b/TestModels/Errors/runtimes/java/src/test/java/simple/errors/internaldafny/wrapped/__default.java @@ -2,20 +2,31 @@ // SPDX-License-Identifier: Apache-2.0 package simple.errors.internaldafny.wrapped; +import Wrappers_Compile.Result; import simple.errors.SimpleErrors; import simple.errors.ToNative; -import simple.errors.wrapped.TestSimpleErrors; - import simple.errors.internaldafny.types.Error; import simple.errors.internaldafny.types.ISimpleErrorsClient; import simple.errors.internaldafny.types.SimpleErrorsConfig; -import Wrappers_Compile.Result; +import simple.errors.wrapped.TestSimpleErrors; public class __default extends _ExternBase___default { - public static Result WrappedSimpleErrors(SimpleErrorsConfig config) { - simple.errors.model.SimpleErrorsConfig wrappedConfig = ToNative.SimpleErrorsConfig(config); - simple.errors.SimpleErrors impl = SimpleErrors.builder().SimpleErrorsConfig(wrappedConfig).build(); - TestSimpleErrors wrappedClient = TestSimpleErrors.builder().impl(impl).build(); - return simple.errors.internaldafny.__default.CreateSuccessOfClient(wrappedClient); - } + + public static Result WrappedSimpleErrors( + SimpleErrorsConfig config + ) { + simple.errors.model.SimpleErrorsConfig wrappedConfig = + ToNative.SimpleErrorsConfig(config); + simple.errors.SimpleErrors impl = SimpleErrors + .builder() + .SimpleErrorsConfig(wrappedConfig) + .build(); + TestSimpleErrors wrappedClient = TestSimpleErrors + .builder() + .impl(impl) + .build(); + return simple.errors.internaldafny.__default.CreateSuccessOfClient( + wrappedClient + ); + } } diff --git a/TestModels/Extendable/README.md b/TestModels/Extendable/README.md index c19d042cf8..09ccf8e002 100644 --- a/TestModels/Extendable/README.md +++ b/TestModels/Extendable/README.md @@ -1,8 +1,8 @@ # Extendable -This project tests [smithy-dafny's](../../codegen/smithy-dafny-codegen-cli) support -for the custom smithy trait -[extendable](https://github.com/awslabs/polymorph/blob/main-1.x/TestModels/dafny-dependencies/Model/traits.smithy#L54-L58) +This project tests [smithy-dafny's](../../codegen/smithy-dafny-codegen-cli) support +for the custom smithy trait +[extendable](https://github.com/awslabs/polymorph/blob/main-1.x/TestModels/dafny-dependencies/Model/traits.smithy#L54-L58) and the associated operations in `dafny` and `.NET`. The nature of `extendable` requires "native code" to fully test it. @@ -13,24 +13,26 @@ it requires both Dafny Source and Native Code to test it. The `extendable` trait causes smithy-dafny to generate a Native Wrapper such that a Resource implemented in Dafny can instead be implemented -in a Native Runtime while still respecting the conditions Dafny +in a Native Runtime while still respecting the conditions Dafny imposes on the formally verified Dafny implementation. The `extendable` trait is tested in two ways via this project. + 1. As a customer would use the library, via a runtime native implementation that extends from the runtime base type. 2. Via nothing but Dafny and Smithy generated code, by the `localServiceWrapper` test utility. - + Either of these tests would be sufficient to test the `extendable` trait alone. However, providing both tests let's us: + 1. Explicitly test the feature as the customer would use it. 2. Ensures that `localServiceWrapper` works correctly. -(2.) has great merit, +(2.) has great merit, as we will have to implement `localServiceWrapper` in every langauge `smithy-dafny` supports. @@ -40,36 +42,45 @@ correct. This `TestModel` provides some evidence of that. ## Build + ### Dafny + 1. Generate the Abstract Dafny code + ``` make polymorph_dafny ``` 2. Validate the manually written Dafny Code + ``` make verify ``` ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make setup_net format_net test_net ``` ## Development + 1. To add another target runtime support, - edit the `Makefile` and add the appropriate recipe to + edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and Dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. diff --git a/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/NativeResource.java b/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/NativeResource.java index e4a54f2bbf..a3c433d770 100644 --- a/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/NativeResource.java +++ b/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/NativeResource.java @@ -2,6 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package simple.extendable.resources; +import ExtendableResource_Compile.ExtendableResource; +import java.util.Objects; import simple.extendable.resources.IExtendableResource; import simple.extendable.resources.ToNative; import simple.extendable.resources.model.GetExtendableResourceDataInput; @@ -9,44 +11,49 @@ import simple.extendable.resources.model.GetExtendableResourceErrorsInput; import simple.extendable.resources.model.GetExtendableResourceErrorsOutput; -import java.util.Objects; - -import ExtendableResource_Compile.ExtendableResource; - public class NativeResource implements IExtendableResource { - private final IExtendableResource _impl; - - public NativeResource(final IExtendableResource impl) { - this._impl = impl; - } - - @Override - public GetExtendableResourceDataOutput GetExtendableResourceData(GetExtendableResourceDataInput nativeValue) { - return this._impl.GetExtendableResourceData(nativeValue); - } - - @Override - public GetExtendableResourceErrorsOutput AlwaysModeledError(GetExtendableResourceErrorsInput nativeValue) { - return this._impl.AlwaysModeledError(nativeValue); - } - - @Override - public GetExtendableResourceErrorsOutput AlwaysMultipleErrors(GetExtendableResourceErrorsInput nativeValue) { - return this._impl.AlwaysMultipleErrors(nativeValue); - } - - @Override - public GetExtendableResourceErrorsOutput AlwaysOpaqueError(GetExtendableResourceErrorsInput nativeValue) { - if (Objects.nonNull(nativeValue.value())) { - throw new RuntimeException("Java Hard Coded Exception"); - } - return this._impl.AlwaysOpaqueError(nativeValue); - } - public static NativeResource NativeFactory() { - ExtendableResource _nw2 = new ExtendableResource(); - _nw2.__ctor(); - IExtendableResource dafnyResource = ToNative.ExtendableResource(_nw2); - return new NativeResource(dafnyResource); + private final IExtendableResource _impl; + + public NativeResource(final IExtendableResource impl) { + this._impl = impl; + } + + @Override + public GetExtendableResourceDataOutput GetExtendableResourceData( + GetExtendableResourceDataInput nativeValue + ) { + return this._impl.GetExtendableResourceData(nativeValue); + } + + @Override + public GetExtendableResourceErrorsOutput AlwaysModeledError( + GetExtendableResourceErrorsInput nativeValue + ) { + return this._impl.AlwaysModeledError(nativeValue); + } + + @Override + public GetExtendableResourceErrorsOutput AlwaysMultipleErrors( + GetExtendableResourceErrorsInput nativeValue + ) { + return this._impl.AlwaysMultipleErrors(nativeValue); + } + + @Override + public GetExtendableResourceErrorsOutput AlwaysOpaqueError( + GetExtendableResourceErrorsInput nativeValue + ) { + if (Objects.nonNull(nativeValue.value())) { + throw new RuntimeException("Java Hard Coded Exception"); } + return this._impl.AlwaysOpaqueError(nativeValue); + } + + public static NativeResource NativeFactory() { + ExtendableResource _nw2 = new ExtendableResource(); + _nw2.__ctor(); + IExtendableResource dafnyResource = ToNative.ExtendableResource(_nw2); + return new NativeResource(dafnyResource); + } } diff --git a/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/internaldafny/__default.java b/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/internaldafny/__default.java index c4645e27d2..fafd1447e9 100644 --- a/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/internaldafny/__default.java +++ b/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/internaldafny/__default.java @@ -2,5 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 package simple.extendable.resources.internaldafny; -public class __default extends _ExternBase___default { -} +public class __default extends _ExternBase___default {} diff --git a/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/internaldafny/types/__default.java b/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/internaldafny/types/__default.java index 2a119d4d18..f3eae14b2d 100644 --- a/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/internaldafny/types/__default.java +++ b/TestModels/Extendable/runtimes/java/src/main/java/Simple/Extendable/Resources/internaldafny/types/__default.java @@ -2,5 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 package simple.extendable.resources.internaldafny.types; -public class __default extends _ExternBase___default { -} +public class __default extends _ExternBase___default {} diff --git a/TestModels/Extendable/runtimes/java/src/test/java/software/simple/extendable/resources/internaldafny/nativeresourcefactory/__default.java b/TestModels/Extendable/runtimes/java/src/test/java/software/simple/extendable/resources/internaldafny/nativeresourcefactory/__default.java index f2807436d8..a379ec72ad 100644 --- a/TestModels/Extendable/runtimes/java/src/test/java/software/simple/extendable/resources/internaldafny/nativeresourcefactory/__default.java +++ b/TestModels/Extendable/runtimes/java/src/test/java/software/simple/extendable/resources/internaldafny/nativeresourcefactory/__default.java @@ -2,13 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 package simple.extendable.resources.internaldafny.nativeresourcefactory; +import simple.extendable.resources.NativeResource; import simple.extendable.resources.ToDafny; - import simple.extendable.resources.internaldafny.types.IExtendableResource; -import simple.extendable.resources.NativeResource; public class __default { - public static IExtendableResource DafnyFactory() { - return ToDafny.ExtendableResource(NativeResource.NativeFactory()); - } + + public static IExtendableResource DafnyFactory() { + return ToDafny.ExtendableResource(NativeResource.NativeFactory()); + } } diff --git a/TestModels/Extendable/runtimes/java/src/test/java/software/simple/extendable/resources/internaldafny/wrapped/__default.java b/TestModels/Extendable/runtimes/java/src/test/java/software/simple/extendable/resources/internaldafny/wrapped/__default.java index 48539bd0e5..7f56b28c32 100644 --- a/TestModels/Extendable/runtimes/java/src/test/java/software/simple/extendable/resources/internaldafny/wrapped/__default.java +++ b/TestModels/Extendable/runtimes/java/src/test/java/software/simple/extendable/resources/internaldafny/wrapped/__default.java @@ -2,41 +2,55 @@ // SPDX-License-Identifier: Apache-2.0 package simple.extendable.resources.internaldafny.wrapped; +import static simple.extendable.resources.internaldafny.nativeresourcefactory.__default.DafnyFactory; + +import Wrappers_Compile.Result; +import simple.extendable.resources.NativeResource; import simple.extendable.resources.SimpleExtendableResources; import simple.extendable.resources.ToNative; -import simple.extendable.resources.wrapped.TestSimpleExtendableResources; - +import simple.extendable.resources.internaldafny.types.Error; import simple.extendable.resources.internaldafny.types.IExtendableResource; import simple.extendable.resources.internaldafny.types.ISimpleExtendableResourcesClient; -import simple.extendable.resources.internaldafny.types.Error; - import simple.extendable.resources.internaldafny.types.SimpleExtendableResourcesConfig; -import simple.extendable.resources.NativeResource; -import Wrappers_Compile.Result; - -import static simple.extendable.resources.internaldafny.nativeresourcefactory.__default.DafnyFactory; +import simple.extendable.resources.wrapped.TestSimpleExtendableResources; public class __default extends _ExternBase___default { - public static Result WrappedSimpleExtendableResources(SimpleExtendableResourcesConfig config) { - TestUnwrapExtendable(); - simple.extendable.resources.model.SimpleExtendableResourcesConfig wrappedConfig = ToNative.SimpleExtendableResourcesConfig(config); - simple.extendable.resources.SimpleExtendableResources impl = SimpleExtendableResources.builder().SimpleExtendableResourcesConfig(wrappedConfig).build(); - TestSimpleExtendableResources wrappedClient = TestSimpleExtendableResources.builder().impl(impl).build(); - return simple.extendable.resources.internaldafny.__default.CreateSuccessOfClient(wrappedClient); - } - /** - * We have not developed the ability to call ToNative from Dafny source code at this time. - * But we need to test this un-wrapping, so this is written in native code until we figure that out. - */ - public static void TestUnwrapExtendable() { - IExtendableResource dafnyWrappingNativeWrappingDafny = DafnyFactory(); - simple.extendable.resources.IExtendableResource nativeWrappingDafny = ToNative.ExtendableResource(dafnyWrappingNativeWrappingDafny); - if (!(nativeWrappingDafny instanceof NativeResource)) { - throw new AssertionError( - "Polymorph MUST generate conversion methods " + - "capable of wrapping & un-wrapping" + - "these native resources."); - } + public static Result< + ISimpleExtendableResourcesClient, + Error + > WrappedSimpleExtendableResources(SimpleExtendableResourcesConfig config) { + TestUnwrapExtendable(); + simple.extendable.resources.model.SimpleExtendableResourcesConfig wrappedConfig = + ToNative.SimpleExtendableResourcesConfig(config); + simple.extendable.resources.SimpleExtendableResources impl = + SimpleExtendableResources + .builder() + .SimpleExtendableResourcesConfig(wrappedConfig) + .build(); + TestSimpleExtendableResources wrappedClient = TestSimpleExtendableResources + .builder() + .impl(impl) + .build(); + return simple.extendable.resources.internaldafny.__default.CreateSuccessOfClient( + wrappedClient + ); + } + + /** + * We have not developed the ability to call ToNative from Dafny source code at this time. + * But we need to test this un-wrapping, so this is written in native code until we figure that out. + */ + public static void TestUnwrapExtendable() { + IExtendableResource dafnyWrappingNativeWrappingDafny = DafnyFactory(); + simple.extendable.resources.IExtendableResource nativeWrappingDafny = + ToNative.ExtendableResource(dafnyWrappingNativeWrappingDafny); + if (!(nativeWrappingDafny instanceof NativeResource)) { + throw new AssertionError( + "Polymorph MUST generate conversion methods " + + "capable of wrapping & un-wrapping" + + "these native resources." + ); } + } } diff --git a/TestModels/Extern/README.md b/TestModels/Extern/README.md index ae93b0bc04..d69880339e 100644 --- a/TestModels/Extern/README.md +++ b/TestModels/Extern/README.md @@ -7,27 +7,33 @@ This project tests a few simple scenarios of implementing a [dafny extern](https `UseClassExtern` lays down the paradigm on how to instantiate a class in the native runtime. It uses a static Build method to return any errors during the constructor throw in the native runtime (Dafny constructors aren't allowed to throw). ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dafny polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ `--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/LanguageSpecificLogic/README.md b/TestModels/LanguageSpecificLogic/README.md index 42c40d3e58..a71c9b0572 100644 --- a/TestModels/LanguageSpecificLogic/README.md +++ b/TestModels/LanguageSpecificLogic/README.md @@ -1,8 +1,8 @@ # LanguageSpecificLogic This project demonstrates generating target-language-specific code from Dafny. -This allows developers to write and **verify** Dafny code -that is only generated and run +This allows developers to write and **verify** Dafny code +that is only generated and run for a particular target language. This directory contains a basic project demonstrating how to do this. @@ -13,7 +13,7 @@ The output of this operation has two components: `language` and `runtime`. This code is only generated and run for a particular target language. This allows us to use Dafny verification (`requires`/`ensures` clauses) to validate that the `language` attribute contains some expected value. -`language` *could* also be set from `extern` code. +`language` _could_ also be set from `extern` code. However, this would prevent us from verifying its value with Dafny. `runtime` is a string set from `extern` code. @@ -34,27 +34,33 @@ and again inside the context of the module that `replaces` it. Developers can also add language-specific tests inside the replacing module. ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dafny polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ `--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/LocalService/README.md b/TestModels/LocalService/README.md index 14265e48e8..d1555559ee 100644 --- a/TestModels/LocalService/README.md +++ b/TestModels/LocalService/README.md @@ -1,8 +1,8 @@ # LocalService -This project tests [smithy-dafny's](../../codegen) support -for the smithy shape -[service](https://smithy.io/1.0/spec/core/model.html#service) +This project tests [smithy-dafny's](../../codegen) support +for the smithy shape +[service](https://smithy.io/1.0/spec/core/model.html#service) and the associated operations in `dafny` and `Java`. ## What is under test? @@ -17,7 +17,7 @@ that target service shapes. In particular, the `aws.polymorph#localService` trait introduces specific behavior -that is used by all the [Test Models](../../TestModels) +that is used by all the [Test Models](../../TestModels) other than those under [TestModels/aws-sdks](../../TestModels/aws-sdks). These other [Test Models](../../TestModels) do not cover all the @@ -29,29 +29,38 @@ explicitly test all the behaviors of the `aws.polymorph#localService` trait. ## Current state Right now, only the following is tested: -- Smithy-Dafny's generated Java + +- Smithy-Dafny's generated Java include converters for LocalServices ## TODO + Everything else part of the LocalService Trait. Particularly: -- Smithy-Dafny's generated Java references + +- Smithy-Dafny's generated Java references LocalServices correctly in Builders - + ## Build + ### Dafny + 1. Generate the Abstract Dafny code + ``` make polymorph_dafny ``` 2. Validate the manually written Dafny Code + ``` make verify ``` ### Java + 1. Generate the Java code + ``` make polymorph_java ``` @@ -59,23 +68,27 @@ make polymorph_java Then, either call: `make build_java test_java` or: 2. Transpile the Dafny to Java + ``` make transpile_java ``` 3. Compile the Smithy Generated, Dafny Generated, & Manually written Java together: + ``` gradle -p runtimes/java build ``` 4. Test the Java: `gradle -p runtimes/java javaTests` or: + ``` make test_java ``` ## Development + 1. To add another target runtime support, - edit the `Makefile` and add the appropriate recipe to + edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and Dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. diff --git a/TestModels/LocalService/runtimes/java/src/main/java/simple/localservice/internaldafny/__default.java b/TestModels/LocalService/runtimes/java/src/main/java/simple/localservice/internaldafny/__default.java index dbf4773055..7b2094d3ba 100644 --- a/TestModels/LocalService/runtimes/java/src/main/java/simple/localservice/internaldafny/__default.java +++ b/TestModels/LocalService/runtimes/java/src/main/java/simple/localservice/internaldafny/__default.java @@ -2,5 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 package simple.localservice.internaldafny; -public class __default extends _ExternBase___default { -} +public class __default extends _ExternBase___default {} diff --git a/TestModels/LocalService/runtimes/java/src/test/java/simple/localservice/internaldafny/wrapped/__default.java b/TestModels/LocalService/runtimes/java/src/test/java/simple/localservice/internaldafny/wrapped/__default.java index 8f85fc96ac..efc9ce2d55 100644 --- a/TestModels/LocalService/runtimes/java/src/test/java/simple/localservice/internaldafny/wrapped/__default.java +++ b/TestModels/LocalService/runtimes/java/src/test/java/simple/localservice/internaldafny/wrapped/__default.java @@ -2,33 +2,49 @@ // SPDX-License-Identifier: Apache-2.0 package simple.localservice.internaldafny.wrapped; +import Wrappers_Compile.Result; import simple.localservice.SimpleLocalService; import simple.localservice.ToDafny; import simple.localservice.ToNative; -import simple.localservice.wrapped.TestSimpleLocalService; - +import simple.localservice.internaldafny.types.Error; import simple.localservice.internaldafny.types.ISimpleLocalServiceClient; import simple.localservice.internaldafny.types.SimpleLocalServiceConfig; -import simple.localservice.internaldafny.types.Error; -import Wrappers_Compile.Result; +import simple.localservice.wrapped.TestSimpleLocalService; public class __default extends _ExternBase___default { - public static Result WrappedSimpleLocalService(SimpleLocalServiceConfig config) { - simple.localservice.model.SimpleLocalServiceConfig wrappedConfig = ToNative.SimpleLocalServiceConfig(config); - simple.localservice.SimpleLocalService impl = SimpleLocalService.builder().SimpleLocalServiceConfig(wrappedConfig).build(); - TestToNativeAndToDafnyLocalService(impl); - TestSimpleLocalService wrappedClient = TestSimpleLocalService.builder().impl(impl).build(); - return simple.localservice.internaldafny.__default.CreateSuccessOfClient(wrappedClient); - } - // TODO: Determine how to replace this test with Dafny Source Code - /** - * We have not developed the ability to call ToNative from Dafny source code at this time. - * But we need to test this un-wrapping, so this is written in native code until we figure that out. - */ - public static void TestToNativeAndToDafnyLocalService(SimpleLocalService nativeValue) { - simple.localservice.internaldafny.types.ISimpleLocalServiceClient dafnyValue = ToDafny.SimpleLocalService(nativeValue); - //noinspection unused - simple.localservice.SimpleLocalService recreateNativeValue = ToNative.SimpleLocalService(dafnyValue); - } + public static Result< + ISimpleLocalServiceClient, + Error + > WrappedSimpleLocalService(SimpleLocalServiceConfig config) { + simple.localservice.model.SimpleLocalServiceConfig wrappedConfig = + ToNative.SimpleLocalServiceConfig(config); + simple.localservice.SimpleLocalService impl = SimpleLocalService + .builder() + .SimpleLocalServiceConfig(wrappedConfig) + .build(); + TestToNativeAndToDafnyLocalService(impl); + TestSimpleLocalService wrappedClient = TestSimpleLocalService + .builder() + .impl(impl) + .build(); + return simple.localservice.internaldafny.__default.CreateSuccessOfClient( + wrappedClient + ); + } + + // TODO: Determine how to replace this test with Dafny Source Code + /** + * We have not developed the ability to call ToNative from Dafny source code at this time. + * But we need to test this un-wrapping, so this is written in native code until we figure that out. + */ + public static void TestToNativeAndToDafnyLocalService( + SimpleLocalService nativeValue + ) { + simple.localservice.internaldafny.types.ISimpleLocalServiceClient dafnyValue = + ToDafny.SimpleLocalService(nativeValue); + //noinspection unused + simple.localservice.SimpleLocalService recreateNativeValue = + ToNative.SimpleLocalService(dafnyValue); + } } diff --git a/TestModels/MultipleModels/README.md b/TestModels/MultipleModels/README.md index ea34a2341d..4c1b4449ec 100644 --- a/TestModels/MultipleModels/README.md +++ b/TestModels/MultipleModels/README.md @@ -30,6 +30,7 @@ Smithy-Dafny-generated projects are expected to be able to handle any number of If a single Smithy-Dafny project (ex. MyProject) has multiple subprojects (ex. SubProjects A, B, and C), then: + 1. Each subproject MUST have ONLY ONE single service shape under generation; and 2. The subprojects, their Smithy model(s), and their Dafny code MUST be laid out in this structure. 3. The project's Makefile MUST set the `DIR_STRUCTURE_V2` variable to a non-empty value. @@ -49,8 +50,11 @@ This TestModel requires the "Dependencies" TestModel as a prerequisite, as the two model files in this project have a dependency structure. ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dafny DAFNY_VERSION_OPTION="--dafny-version A.B.C" \ && make polymorph_dotnet DAFNY_VERSION_OPTION="--dafny-version A.B.C" \ @@ -58,16 +62,19 @@ make polymorph_dafny DAFNY_VERSION_OPTION="--dafny-version A.B.C" \ ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net && make transpile_java ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net && make test_java ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. diff --git a/TestModels/MultipleModels/runtimes/java/src/main/java/simple/multiplemodels/dependencyproject/internaldafny/__default.java b/TestModels/MultipleModels/runtimes/java/src/main/java/simple/multiplemodels/dependencyproject/internaldafny/__default.java index 816d0dbc43..124efb2446 100644 --- a/TestModels/MultipleModels/runtimes/java/src/main/java/simple/multiplemodels/dependencyproject/internaldafny/__default.java +++ b/TestModels/MultipleModels/runtimes/java/src/main/java/simple/multiplemodels/dependencyproject/internaldafny/__default.java @@ -2,5 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 package simple.multiplemodels.dependencyproject.internaldafny; -public class __default extends _ExternBase___default { -} +public class __default extends _ExternBase___default {} diff --git a/TestModels/MultipleModels/runtimes/java/src/main/java/simple/multiplemodels/primaryproject/internaldafny/__default.java b/TestModels/MultipleModels/runtimes/java/src/main/java/simple/multiplemodels/primaryproject/internaldafny/__default.java index e9059caac7..02220255fc 100644 --- a/TestModels/MultipleModels/runtimes/java/src/main/java/simple/multiplemodels/primaryproject/internaldafny/__default.java +++ b/TestModels/MultipleModels/runtimes/java/src/main/java/simple/multiplemodels/primaryproject/internaldafny/__default.java @@ -2,5 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 package simple.multiplemodels.primaryproject.internaldafny; -public class __default extends _ExternBase___default { -} +public class __default extends _ExternBase___default {} diff --git a/TestModels/MultipleModels/runtimes/java/src/test/java/software/simple/multiplemodels/dependencyproject/internaldafny/wrapped/__default.java b/TestModels/MultipleModels/runtimes/java/src/test/java/software/simple/multiplemodels/dependencyproject/internaldafny/wrapped/__default.java index 4b087dc5fe..85d5e35dc4 100644 --- a/TestModels/MultipleModels/runtimes/java/src/test/java/software/simple/multiplemodels/dependencyproject/internaldafny/wrapped/__default.java +++ b/TestModels/MultipleModels/runtimes/java/src/test/java/software/simple/multiplemodels/dependencyproject/internaldafny/wrapped/__default.java @@ -2,20 +2,33 @@ // SPDX-License-Identifier: Apache-2.0 package simple.multiplemodels.dependencyproject.internaldafny.wrapped; +import Wrappers_Compile.Result; import simple.multiplemodels.dependencyproject.DependencyProject; import simple.multiplemodels.dependencyproject.ToNative; -import simple.multiplemodels.dependencyproject.wrapped.TestDependencyProject; - -import simple.multiplemodels.dependencyproject.internaldafny.types.IDependencyProjectClient; import simple.multiplemodels.dependencyproject.internaldafny.types.DependencyProjectConfig; import simple.multiplemodels.dependencyproject.internaldafny.types.Error; -import Wrappers_Compile.Result; +import simple.multiplemodels.dependencyproject.internaldafny.types.IDependencyProjectClient; +import simple.multiplemodels.dependencyproject.wrapped.TestDependencyProject; public class __default extends _ExternBase___default { - public static Result WrappedDependencyProject(DependencyProjectConfig config) { - simple.multiplemodels.dependencyproject.model.DependencyProjectConfig wrappedConfig = ToNative.DependencyProjectConfig(config); - simple.multiplemodels.dependencyproject.DependencyProject impl = DependencyProject.builder().DependencyProjectConfig(wrappedConfig).build(); - TestDependencyProject wrappedClient = TestDependencyProject.builder().impl(impl).build(); - return simple.multiplemodels.dependencyproject.internaldafny.__default.CreateSuccessOfClient(wrappedClient); - } + + public static Result< + IDependencyProjectClient, + Error + > WrappedDependencyProject(DependencyProjectConfig config) { + simple.multiplemodels.dependencyproject.model.DependencyProjectConfig wrappedConfig = + ToNative.DependencyProjectConfig(config); + simple.multiplemodels.dependencyproject.DependencyProject impl = + DependencyProject + .builder() + .DependencyProjectConfig(wrappedConfig) + .build(); + TestDependencyProject wrappedClient = TestDependencyProject + .builder() + .impl(impl) + .build(); + return simple.multiplemodels.dependencyproject.internaldafny.__default.CreateSuccessOfClient( + wrappedClient + ); + } } diff --git a/TestModels/MultipleModels/runtimes/java/src/test/java/software/simple/multiplemodels/primaryproject/internaldafny/wrapped/__default.java b/TestModels/MultipleModels/runtimes/java/src/test/java/software/simple/multiplemodels/primaryproject/internaldafny/wrapped/__default.java index 21c9bc3abf..a49c850154 100644 --- a/TestModels/MultipleModels/runtimes/java/src/test/java/software/simple/multiplemodels/primaryproject/internaldafny/wrapped/__default.java +++ b/TestModels/MultipleModels/runtimes/java/src/test/java/software/simple/multiplemodels/primaryproject/internaldafny/wrapped/__default.java @@ -2,20 +2,31 @@ // SPDX-License-Identifier: Apache-2.0 package simple.multiplemodels.primaryproject.internaldafny.wrapped; +import Wrappers_Compile.Result; import simple.multiplemodels.primaryproject.PrimaryProject; import simple.multiplemodels.primaryproject.ToNative; -import simple.multiplemodels.primaryproject.wrapped.TestPrimaryProject; - +import simple.multiplemodels.primaryproject.internaldafny.types.Error; import simple.multiplemodels.primaryproject.internaldafny.types.IPrimaryProjectClient; import simple.multiplemodels.primaryproject.internaldafny.types.PrimaryProjectConfig; -import simple.multiplemodels.primaryproject.internaldafny.types.Error; -import Wrappers_Compile.Result; +import simple.multiplemodels.primaryproject.wrapped.TestPrimaryProject; public class __default extends _ExternBase___default { - public static Result WrappedPrimaryProject(PrimaryProjectConfig config) { - simple.multiplemodels.primaryproject.model.PrimaryProjectConfig wrappedConfig = ToNative.PrimaryProjectConfig(config); - simple.multiplemodels.primaryproject.PrimaryProject impl = PrimaryProject.builder().PrimaryProjectConfig(wrappedConfig).build(); - TestPrimaryProject wrappedClient = TestPrimaryProject.builder().impl(impl).build(); - return simple.multiplemodels.primaryproject.internaldafny.__default.CreateSuccessOfClient(wrappedClient); - } + + public static Result WrappedPrimaryProject( + PrimaryProjectConfig config + ) { + simple.multiplemodels.primaryproject.model.PrimaryProjectConfig wrappedConfig = + ToNative.PrimaryProjectConfig(config); + simple.multiplemodels.primaryproject.PrimaryProject impl = PrimaryProject + .builder() + .PrimaryProjectConfig(wrappedConfig) + .build(); + TestPrimaryProject wrappedClient = TestPrimaryProject + .builder() + .impl(impl) + .build(); + return simple.multiplemodels.primaryproject.internaldafny.__default.CreateSuccessOfClient( + wrappedClient + ); + } } diff --git a/TestModels/README.md b/TestModels/README.md index 32c2ee5e71..55b6339111 100644 --- a/TestModels/README.md +++ b/TestModels/README.md @@ -1,9 +1,10 @@ # TestModels - This package contains various groups of models which is used to form a Test Bed for Dafny-Polymorph-Native layer. - The idea is that we want an invariant test bed with `Write Once, Test Anywhere` - with the `Anyhwere` part targeting different runtimes that dafny supports. - This will give us confidence in our test cases across runtimes, - without writing native tests (and bugs) for each of those runtimes. + +This package contains various groups of models which is used to form a Test Bed for Dafny-Polymorph-Native layer. +The idea is that we want an invariant test bed with `Write Once, Test Anywhere` +with the `Anyhwere` part targeting different runtimes that dafny supports. +This will give us confidence in our test cases across runtimes, +without writing native tests (and bugs) for each of those runtimes. ## Structure @@ -20,7 +21,7 @@ Anything which is to be re-used across all projects will go inside the `TestMode ## Getting Started 1. Create your project directory under `TestModels`. -1. ```cd ``` +1. `cd ` 1. Create the `README.md`, `Makefile`, and `Model` directory. 1. Write your `*.smithy` model in the `Model` directory. 1. Use your `Makefile` recipe to execute polymorh the generate the appropriate stubbing for the runtime target. @@ -36,19 +37,19 @@ All Dafny produced by Dafny-Polymorph MUST be verified. This ensures the health of the Dafny code produced. As well as the Dafny implemented in individual projects. -* `polymorph-dafny` -- run polymorph on the project with the `--output-dafny` to generate the Dafny shell -* `verify` -- recursively gather up `*.dfy` in the project, both the generated and implemented code -* `dafny-reportgenerator` -- runs the reportgenerator to ensure [verification stability](http://dafny.org/dafny/DafnyRef/DafnyRef#2565-debugging-unstable-verification) +- `polymorph-dafny` -- run polymorph on the project with the `--output-dafny` to generate the Dafny shell +- `verify` -- recursively gather up `*.dfy` in the project, both the generated and implemented code +- `dafny-reportgenerator` -- runs the reportgenerator to ensure [verification stability](http://dafny.org/dafny/DafnyRef/DafnyRef#2565-debugging-unstable-verification) ### Runtime Each runtime needs its own set of targets. This example is written assuming that the runtime you are targeting is .NET. -* `polymorph_dotnet` -- run polymorph on the project with `--output-dafny` and `--output-dotnet` to generate the code -* `transpile_net` -- run `dafny` to produce the native code. Remember to output both the implementation and tests. -* `setup_net` -- run any required setup. For example downloading dependencies -* `test_net` -- run the tests +- `polymorph_dotnet` -- run polymorph on the project with `--output-dafny` and `--output-dotnet` to generate the code +- `transpile_net` -- run `dafny` to produce the native code. Remember to output both the implementation and tests. +- `setup_net` -- run any required setup. For example downloading dependencies +- `test_net` -- run the tests ## Testing Patterns @@ -60,7 +61,7 @@ It also serves to be referenced from testing files to avoid re-explaining the pu The `input` variable some `Get[Type]` functions are called with is not necessarily the same `input` that is referenced within this function. ex. The transpiled code may have copied `input` by value into this function, rather than passing it by reference. -This is runtime-dependent behavior. +This is runtime-dependent behavior. We cannot test the value of `input` from outside this function; it must be tested inside the implementation. In the example above, if the copy-by-value is incorrect, we would not know by testing it from outside of this function. @@ -91,4 +92,4 @@ However, if the Polymorph layer is incorrect, Polymorph may accidentally request The problem is there is no way to verify whether this has happened from within the Dafny layer. If Dafny has modelled itself correctly, but the error is only detectable from inside the runtime, Dafny does not understand how to interact with the generated code inside the runtime to verify the size of the blob (ByteSequence) is as expected. -The solution is to revisit noted test suites after writing externs: https://sim.amazon.com/issues/CrypTool-4911. We would write test suites using externs to validate the runtime code is behaving as expected. \ No newline at end of file +The solution is to revisit noted test suites after writing externs: https://sim.amazon.com/issues/CrypTool-4911. We would write test suites using externs to validate the runtime code is behaving as expected. diff --git a/TestModels/Refinement/README.md b/TestModels/Refinement/README.md index a74fe22f56..20379fe2ef 100644 --- a/TestModels/Refinement/README.md +++ b/TestModels/Refinement/README.md @@ -3,27 +3,33 @@ This project test the smithy behavior trait [readonly](https://smithy.io/1.0/spec/core/behavior-traits.html#readonly-trait) for the `polymorph_dafny` generated code. The `readonly` trait on a smithy operation that transalates to a `function method` in dafny. This means it can have only single expression. The project also tests `inputOnly`, `outputOnly` along with the base operation `getRefinement`. The project is then transpiled to a target runtime, and each tests are executed - either as CI actions or manually. ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dafny polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ `--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/Resource/README.md b/TestModels/Resource/README.md index 0d427446e1..30fbece169 100644 --- a/TestModels/Resource/README.md +++ b/TestModels/Resource/README.md @@ -1,8 +1,8 @@ # Resource -This project tests [smithy-dafny's](../../codegen/smithy-dafny-codegen-cli) support -for the smithy shape -[resource](https://smithy.io/1.0/spec/core/model.html#resource) +This project tests [smithy-dafny's](../../codegen/smithy-dafny-codegen-cli) support +for the smithy shape +[resource](https://smithy.io/1.0/spec/core/model.html#resource) and the associated operations in `dafny` and `.NET`. ## What is under test? @@ -19,8 +19,8 @@ Users than implement a Dafny class that extends this trait. The smithy-dafny expectation is that the behavior of this class will be entirely defined in the Dafny implementation. -(Even if this expectation is not true, any Native logic -would be referenced via a Dafny extern, +(Even if this expectation is not true, any Native logic +would be referenced via a Dafny extern, and still only exposed via the Dafny implementation). As such, the Non-Dafny generated classes are merely wrappers @@ -29,38 +29,46 @@ providing input validation, conversion of the input or output, and protecting the Dafny implementation from unknown exceptions that would violate Dafny's Formal Verification assumptions. - ## Build + ### Dafny + 1. Generate the Abstract Dafny code + ``` make polymorph_dafny ``` 2. Validate the manually written Dafny Code + ``` make verify ``` ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make setup_net format_net test_net ``` ## Development + 1. To add another target runtime support, - edit the `Makefile` and add the appropriate recipe to + edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and Dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. diff --git a/TestModels/Resource/runtimes/java/src/main/java/simple/resources/internaldafny/__default.java b/TestModels/Resource/runtimes/java/src/main/java/simple/resources/internaldafny/__default.java index 762ea896a7..3adfd60f65 100644 --- a/TestModels/Resource/runtimes/java/src/main/java/simple/resources/internaldafny/__default.java +++ b/TestModels/Resource/runtimes/java/src/main/java/simple/resources/internaldafny/__default.java @@ -2,5 +2,4 @@ // SPDX-License-Identifier: Apache-2.0 package simple.resources.internaldafny; -public class __default extends _ExternBase___default{ -} +public class __default extends _ExternBase___default {} diff --git a/TestModels/Resource/runtimes/java/src/test/java/simple/resources/internaldafny/wrapped/__default.java b/TestModels/Resource/runtimes/java/src/test/java/simple/resources/internaldafny/wrapped/__default.java index c6bcb7541a..7ff6d7c998 100644 --- a/TestModels/Resource/runtimes/java/src/test/java/simple/resources/internaldafny/wrapped/__default.java +++ b/TestModels/Resource/runtimes/java/src/test/java/simple/resources/internaldafny/wrapped/__default.java @@ -2,20 +2,31 @@ // SPDX-License-Identifier: Apache-2.0 package simple.resources.internaldafny.wrapped; +import Wrappers_Compile.Result; import simple.resources.SimpleResources; import simple.resources.ToNative; -import simple.resources.wrapped.TestSimpleResources; - import simple.resources.internaldafny.types.Error; import simple.resources.internaldafny.types.ISimpleResourcesClient; import simple.resources.internaldafny.types.SimpleResourcesConfig; -import Wrappers_Compile.Result; +import simple.resources.wrapped.TestSimpleResources; public class __default extends _ExternBase___default { - public static Result WrappedSimpleResources(SimpleResourcesConfig config) { - simple.resources.model.SimpleResourcesConfig wrappedConfig = ToNative.SimpleResourcesConfig(config); - simple.resources.SimpleResources impl = SimpleResources.builder().SimpleResourcesConfig(wrappedConfig).build(); - TestSimpleResources wrappedClient = TestSimpleResources.builder().impl(impl).build(); - return simple.resources.internaldafny.__default.CreateSuccessOfClient(wrappedClient); - } + + public static Result WrappedSimpleResources( + SimpleResourcesConfig config + ) { + simple.resources.model.SimpleResourcesConfig wrappedConfig = + ToNative.SimpleResourcesConfig(config); + simple.resources.SimpleResources impl = SimpleResources + .builder() + .SimpleResourcesConfig(wrappedConfig) + .build(); + TestSimpleResources wrappedClient = TestSimpleResources + .builder() + .impl(impl) + .build(); + return simple.resources.internaldafny.__default.CreateSuccessOfClient( + wrappedClient + ); + } } diff --git a/TestModels/SimpleTypes/BigDecimal/README.md b/TestModels/SimpleTypes/BigDecimal/README.md index f1d54096f7..319935a891 100644 --- a/TestModels/SimpleTypes/BigDecimal/README.md +++ b/TestModels/SimpleTypes/BigDecimal/README.md @@ -6,4 +6,4 @@ This project will implement the smithy type [bigDecimal](https://smithy.io/2.0/s This project does not build. Neither the `software.amazon.polymorph.smithydotnet` nor the `software.amazon.polymorph.smithydafny` projects support code generation for the "bigDecimal" shape. This project cannot be used to generate the BigDecimal type for either Dafny or Dotnet. -Once the Polymorph code generators supports code generation for this shape, these files should be extended to complete the type implementation. \ No newline at end of file +Once the Polymorph code generators supports code generation for this shape, these files should be extended to complete the type implementation. diff --git a/TestModels/SimpleTypes/BigInteger/README.md b/TestModels/SimpleTypes/BigInteger/README.md index 034e0eaf65..a1cf3c250c 100644 --- a/TestModels/SimpleTypes/BigInteger/README.md +++ b/TestModels/SimpleTypes/BigInteger/README.md @@ -6,4 +6,4 @@ This project will implement the smithy type [bigInteger](https://smithy.io/2.0/s This project does not build. Neither the `software.amazon.polymorph.smithydotnet` nor the `software.amazon.polymorph.smithydafny` projects support code generation for the "bigInteger" shape. This project cannot be used to generate the BigInteger type for either Dafny or Dotnet. -Once the Polymorph code generators supports code generation for this shape, these files should be extended to complete the type implementation. \ No newline at end of file +Once the Polymorph code generators supports code generation for this shape, these files should be extended to complete the type implementation. diff --git a/TestModels/SimpleTypes/README.md b/TestModels/SimpleTypes/README.md index 582579ea64..349b85eaae 100644 --- a/TestModels/SimpleTypes/README.md +++ b/TestModels/SimpleTypes/README.md @@ -1,6 +1,7 @@ # SimpleTypes - This package contains testbed code for Smithy [simple types](https://smithy.io/2.0/spec/simple-types.html). - Each Smithy simple type will be modelled as a directory in this package. This will provide an invariant test bed for Smithy simple types. + +This package contains testbed code for Smithy [simple types](https://smithy.io/2.0/spec/simple-types.html). +Each Smithy simple type will be modelled as a directory in this package. This will provide an invariant test bed for Smithy simple types. ## Structure diff --git a/TestModels/SimpleTypes/SimpleBlob/README.md b/TestModels/SimpleTypes/SimpleBlob/README.md index d0fd6d7551..1e00294dcb 100644 --- a/TestModels/SimpleTypes/SimpleBlob/README.md +++ b/TestModels/SimpleTypes/SimpleBlob/README.md @@ -3,27 +3,33 @@ This project implements the smithy type [blob](https://smithy.io/2.0/spec/simple-types.html#blob) and the associated operations in `dafny`. This is then transpiled to a target runtime, and each tests are executed - either as CI actions or manually. ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ `--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/SimpleTypes/SimpleBoolean/README.md b/TestModels/SimpleTypes/SimpleBoolean/README.md index a8e13a1952..d333e39576 100644 --- a/TestModels/SimpleTypes/SimpleBoolean/README.md +++ b/TestModels/SimpleTypes/SimpleBoolean/README.md @@ -3,27 +3,33 @@ This project implements the smithy type [boolean](https://smithy.io/2.0/spec/simple-types.html#boolean) and the associated operations in `dafny`. This is then transpiled to a target runtime, and each tests are executed - either as CI actions or manually. ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ `--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/SimpleTypes/SimpleByte/README.md b/TestModels/SimpleTypes/SimpleByte/README.md index eab4592b87..9b017263b4 100644 --- a/TestModels/SimpleTypes/SimpleByte/README.md +++ b/TestModels/SimpleTypes/SimpleByte/README.md @@ -6,4 +6,4 @@ This project will implement the smithy type [byte](https://smithy.io/2.0/spec/si This project does not build. Neither the `software.amazon.polymorph.smithydotnet` nor the `software.amazon.polymorph.smithydafny` projects support code generation for the "Byte" shape. This project cannot be used to generate the SimpleByte type for either Dafny or Dotnet. -Once the Polymorph code generators supports code generation for this shape, these files should be extended to complete the type implementation. \ No newline at end of file +Once the Polymorph code generators supports code generation for this shape, these files should be extended to complete the type implementation. diff --git a/TestModels/SimpleTypes/SimpleDouble/README.md b/TestModels/SimpleTypes/SimpleDouble/README.md index 254e6330e4..69b6490ec1 100644 --- a/TestModels/SimpleTypes/SimpleDouble/README.md +++ b/TestModels/SimpleTypes/SimpleDouble/README.md @@ -1,7 +1,7 @@ # SimpleDouble -This project tests [smithy-dafny's](../../codegen/smithy-dafny-codegen-cli) support -for the smithy shape +This project tests [smithy-dafny's](../../codegen/smithy-dafny-codegen-cli) support +for the smithy shape [double](https://smithy.io/2.0/spec/simple-types.html#double) and the associated operations in `dafny` and `.NET`. @@ -9,7 +9,7 @@ and the associated operations in `dafny` and `.NET`. Currently, the `double` shape should be treated as opaque in Dafny. In Dafny, smithy-dafny represesents Doubles as a -`seq` with a length of 8. +`seq` with a length of 8. This representation is NOT PORTABLE between runtimes/machines, as the Endianness is not considered. @@ -24,47 +24,58 @@ method that serializes a .NET `double` to a `seq`, and a ToNative conversion that deserializes a `seq` to `double`. ## Status + The test model is sufficent for a "local service", as long as NO operations are committed on the double via Dafny code. Once we: + 1. Implement a [Global Dafny Double defination](https://github.com/aws/private-aws-encryption-sdk-dafny-staging/issues/120) 2. Refactor the [Runtime serialization of Double's to Dafny Bytes such that they are all consistent](https://github.com/awslabs/polymorph/issues/123) 3. We can add a `GetDoubleKnownValueTest` operation to this test model, and verify that. ## Build + ### Dafny + 1. Generate the Abstract Dafny code + ``` make polymorph_dafny ``` 2. Validate the manually written Dafny Code + ``` make verify ``` ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make setup_net format_net test_net ``` ## Development + 1. To add another target runtime support, edit this `Makefile` (or the `SharedMakefile.mk`) and - add the appropriate recipe to + add the appropriate recipe to generate the `polymorph` wrappers, and Dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. diff --git a/TestModels/SimpleTypes/SimpleEnum/README.md b/TestModels/SimpleTypes/SimpleEnum/README.md index bcfa80fa01..dc9f21ec13 100644 --- a/TestModels/SimpleTypes/SimpleEnum/README.md +++ b/TestModels/SimpleTypes/SimpleEnum/README.md @@ -3,27 +3,33 @@ This project implements the smithy type [enum](https://smithy.io/2.0/spec/simple-types.html#blob) and the associated operations in `dafny`. This is then transpiled to a target runtime, and each tests are executed - either as CI actions or manually. ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ `--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/SimpleTypes/SimpleEnumV2/README.md b/TestModels/SimpleTypes/SimpleEnumV2/README.md index 29deb11878..575d47ec72 100644 --- a/TestModels/SimpleTypes/SimpleEnumV2/README.md +++ b/TestModels/SimpleTypes/SimpleEnumV2/README.md @@ -6,4 +6,4 @@ This project will implement the Smithy 2.0 type [enum](https://smithy.io/2.0/spe This project does not build. The `software.amazon.polymorph` project does not support Smithy version 2.0 models. -Once the project adds Smithy 2.0 support, these files should be extended to allow building EnumV2. \ No newline at end of file +Once the project adds Smithy 2.0 support, these files should be extended to allow building EnumV2. diff --git a/TestModels/SimpleTypes/SimpleFloat/README.md b/TestModels/SimpleTypes/SimpleFloat/README.md index 3ebb640b34..f3a2f5b5cd 100644 --- a/TestModels/SimpleTypes/SimpleFloat/README.md +++ b/TestModels/SimpleTypes/SimpleFloat/README.md @@ -6,4 +6,4 @@ This project will implement the smithy type [float](https://smithy.io/2.0/spec/s This project does not build. Neither the `software.amazon.polymorph.smithydotnet` nor the `software.amazon.polymorph.smithydafny` projects support code generation for the "Float" shape. This project cannot be used to generate the SimpleFloat type for either Dafny or Dotnet. -Once the Polymorph code generators supports code generation for this shape, these files should be extended to complete the type implementation. \ No newline at end of file +Once the Polymorph code generators supports code generation for this shape, these files should be extended to complete the type implementation. diff --git a/TestModels/SimpleTypes/SimpleInteger/README.md b/TestModels/SimpleTypes/SimpleInteger/README.md index 12b2a0dd3f..ea24ed08b8 100644 --- a/TestModels/SimpleTypes/SimpleInteger/README.md +++ b/TestModels/SimpleTypes/SimpleInteger/README.md @@ -3,27 +3,33 @@ This project implements the smithy type [integer](https://smithy.io/2.0/spec/simple-types.html#integer) and the associated operations in `dafny`. This is then transpiled to a target runtime, and each tests are executed - either as CI actions or manually. ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ -`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. \ No newline at end of file +`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/SimpleTypes/SimpleLong/README.md b/TestModels/SimpleTypes/SimpleLong/README.md index df0b70d017..e197ec4aab 100644 --- a/TestModels/SimpleTypes/SimpleLong/README.md +++ b/TestModels/SimpleTypes/SimpleLong/README.md @@ -3,27 +3,33 @@ This project implements the smithy type [long](https://smithy.io/2.0/spec/simple-types.html#long) and the associated operations in `dafny`. This is then transpiled to a target runtime, and each tests are executed - either as CI actions or manually. ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make generate_polymorph ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ -`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. \ No newline at end of file +`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/SimpleTypes/SimpleShort/README.md b/TestModels/SimpleTypes/SimpleShort/README.md index 717c319c5a..a88ec4c93b 100644 --- a/TestModels/SimpleTypes/SimpleShort/README.md +++ b/TestModels/SimpleTypes/SimpleShort/README.md @@ -6,4 +6,4 @@ This project will implement the smithy type [short](https://smithy.io/2.0/spec/s This project does not build. Neither the `software.amazon.polymorph.smithydotnet` nor the `software.amazon.polymorph.smithydafny` projects support code generation for the "Short" shape. This project cannot be used to generate the SimpleShort type for either Dafny or Dotnet. -Once the Polymorph code generators supports code generation for this shape, these files should be extended to complete the type implementation. \ No newline at end of file +Once the Polymorph code generators supports code generation for this shape, these files should be extended to complete the type implementation. diff --git a/TestModels/SimpleTypes/SimpleString/README.md b/TestModels/SimpleTypes/SimpleString/README.md index 2768e8f6bd..76f3ec831d 100644 --- a/TestModels/SimpleTypes/SimpleString/README.md +++ b/TestModels/SimpleTypes/SimpleString/README.md @@ -3,18 +3,23 @@ This project implements the smithy type [String](https://smithy.io/2.0/spec/simple-types.html#string) and the associated operations in `dafny`. This is then transpiled to a target runtime, and each tests are executed - either as CI actions or manually. ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` @@ -24,10 +29,11 @@ make test_net See [./runtimes/rust/README.md](./runtimes/rust/README.md) ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ -`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. \ No newline at end of file +`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/SimpleTypes/SimpleString/runtimes/rust/README.md b/TestModels/SimpleTypes/SimpleString/runtimes/rust/README.md index 65d21fdee3..eb60c9db72 100644 --- a/TestModels/SimpleTypes/SimpleString/runtimes/rust/README.md +++ b/TestModels/SimpleTypes/SimpleString/runtimes/rust/README.md @@ -1,4 +1,3 @@ - This directory is the code generation target for the SimpleString model when targetting Rust. Like the other targets, the crate is a combination of the output of three different components: @@ -7,7 +6,7 @@ Like the other targets, the crate is a combination of the output of three differ 2. The output of `smithy-dafny` shim/conversion generation for Rust (the `conversions` module) 3. The output of `smithy-rs` (all other files) -Most of the `smithy-rs` output is not modified, +Most of the `smithy-rs` output is not modified, only trimmed down to cut out components that aren't relevant for Polymorph libraries. The main exception is `client.rs` and the operation builders such as `operation/get_string.rs`, which instantiate the underlying Dafny client implementation and invoke operations on it, respectively, diff --git a/TestModels/SimpleTypes/SimpleTimestamp/README.md b/TestModels/SimpleTypes/SimpleTimestamp/README.md index dea403167f..e8694f03db 100644 --- a/TestModels/SimpleTypes/SimpleTimestamp/README.md +++ b/TestModels/SimpleTypes/SimpleTimestamp/README.md @@ -6,4 +6,4 @@ This project will implement the smithy type [timestamp](https://smithy.io/2.0/sp This project does not build. The `software.amazon.polymorph.smithydafny` project does not support code generation for the "Timestamp" shape. -Once the Polymorph code generator supports code generation for this shape, these files should be extended to complete the type implementation. \ No newline at end of file +Once the Polymorph code generator supports code generation for this shape, these files should be extended to complete the type implementation. diff --git a/TestModels/Union/README.md b/TestModels/Union/README.md index 5822ee1674..26dfd4199f 100644 --- a/TestModels/Union/README.md +++ b/TestModels/Union/README.md @@ -5,6 +5,7 @@ This project implements the smithy type [Union](https://smithy.io/2.0/spec/aggre NOTE: Union field names need to start with a capital letter. Otheriwse this causes a mismatch in the dafny generated method and polymorph generated calls in the .NET runtime. https://github.com/awslabs/polymorph/issues/145 Example: + ``` union MyUnion { IntegerValue: Integer, @@ -15,32 +16,39 @@ union MyUnion { ## Build ### All target runtimes + 1. Generate Dafny code using `polymorph` + ``` make polymorph_dafny ``` ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ `--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/aws-sdks/ddb/Model/model.json b/TestModels/aws-sdks/ddb/Model/model.json index e617ba5bfd..b45b0b438c 100644 --- a/TestModels/aws-sdks/ddb/Model/model.json +++ b/TestModels/aws-sdks/ddb/Model/model.json @@ -1,10131 +1,10127 @@ { "smithy": "1.0", "metadata": { - "suppressions": [ - { - "id": "HttpMethodSemantics", - "namespace": "*" - }, - { - "id": "HttpResponseCodeSemantics", - "namespace": "*" - }, - { - "id": "PaginatedTrait", - "namespace": "*" - }, + "suppressions": [ + { + "id": "HttpMethodSemantics", + "namespace": "*" + }, + { + "id": "HttpResponseCodeSemantics", + "namespace": "*" + }, + { + "id": "PaginatedTrait", + "namespace": "*" + }, + { + "id": "HttpHeaderTrait", + "namespace": "*" + }, + { + "id": "HttpUriConflict", + "namespace": "*" + }, + { + "id": "Service", + "namespace": "*" + } + ] + }, + "shapes": { + "com.amazonaws.dynamodb#ArchivalReason": { + "type": "string" + }, + "com.amazonaws.dynamodb#ArchivalSummary": { + "type": "structure", + "members": { + "ArchivalDateTime": { + "target": "com.amazonaws.dynamodb#Date", + "traits": { + "smithy.api#documentation": "

The date and time when table archival was initiated by DynamoDB, in UNIX epoch time\n format.

" + } + }, + "ArchivalReason": { + "target": "com.amazonaws.dynamodb#ArchivalReason", + "traits": { + "smithy.api#documentation": "

The reason DynamoDB archived the table. Currently, the only possible value is:

\n\n
    \n
  • \n

    \n INACCESSIBLE_ENCRYPTION_CREDENTIALS - The table was archived due\n to the table's KMS key being inaccessible for more than seven\n days. An On-Demand backup was created at the archival time.

    \n
  • \n
" + } + }, + "ArchivalBackupArn": { + "target": "com.amazonaws.dynamodb#BackupArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the backup the table was archived to, when\n applicable in the archival reason. If you wish to restore this backup to the same table\n name, you will need to delete the original table.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains details of a table archival operation.

" + } + }, + "com.amazonaws.dynamodb#AttributeAction": { + "type": "string", + "traits": { + "smithy.api#enum": [ { - "id": "HttpHeaderTrait", - "namespace": "*" + "value": "ADD", + "name": "ADD" }, { - "id": "HttpUriConflict", - "namespace": "*" + "value": "PUT", + "name": "PUT" }, { - "id": "Service", - "namespace": "*" + "value": "DELETE", + "name": "DELETE" } - ] - }, - "shapes": { - "com.amazonaws.dynamodb#ArchivalReason": { - "type": "string" - }, - "com.amazonaws.dynamodb#ArchivalSummary": { - "type": "structure", - "members": { - "ArchivalDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

The date and time when table archival was initiated by DynamoDB, in UNIX epoch time\n format.

" - } - }, - "ArchivalReason": { - "target": "com.amazonaws.dynamodb#ArchivalReason", - "traits": { - "smithy.api#documentation": "

The reason DynamoDB archived the table. Currently, the only possible value is:

\n\n
    \n
  • \n

    \n INACCESSIBLE_ENCRYPTION_CREDENTIALS - The table was archived due\n to the table's KMS key being inaccessible for more than seven\n days. An On-Demand backup was created at the archival time.

    \n
  • \n
" - } - }, - "ArchivalBackupArn": { - "target": "com.amazonaws.dynamodb#BackupArn", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the backup the table was archived to, when\n applicable in the archival reason. If you wish to restore this backup to the same table\n name, you will need to delete the original table.

" - } - } - }, + ] + } + }, + "com.amazonaws.dynamodb#AttributeDefinition": { + "type": "structure", + "members": { + "AttributeName": { + "target": "com.amazonaws.dynamodb#KeySchemaAttributeName", "traits": { - "smithy.api#documentation": "

Contains details of a table archival operation.

" + "smithy.api#documentation": "

A name for the attribute.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#AttributeAction": { - "type": "string", + }, + "AttributeType": { + "target": "com.amazonaws.dynamodb#ScalarAttributeType", "traits": { - "smithy.api#enum": [ - { - "value": "ADD", - "name": "ADD" - }, - { - "value": "PUT", - "name": "PUT" - }, - { - "value": "DELETE", - "name": "DELETE" - } - ] + "smithy.api#documentation": "

The data type for the attribute, where:

\n
    \n
  • \n

    \n S - the attribute is of type String

    \n
  • \n
  • \n

    \n N - the attribute is of type Number

    \n
  • \n
  • \n

    \n B - the attribute is of type Binary

    \n
  • \n
", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#AttributeDefinition": { - "type": "structure", - "members": { - "AttributeName": { - "target": "com.amazonaws.dynamodb#KeySchemaAttributeName", - "traits": { - "smithy.api#documentation": "

A name for the attribute.

", - "smithy.api#required": {} - } - }, - "AttributeType": { - "target": "com.amazonaws.dynamodb#ScalarAttributeType", - "traits": { - "smithy.api#documentation": "

The data type for the attribute, where:

\n
    \n
  • \n

    \n S - the attribute is of type String

    \n
  • \n
  • \n

    \n N - the attribute is of type Number

    \n
  • \n
  • \n

    \n B - the attribute is of type Binary

    \n
  • \n
", - "smithy.api#required": {} - } - } - }, - "traits": { - "smithy.api#documentation": "

Represents an attribute for describing the key schema for the table and\n indexes.

" - } + "traits": { + "smithy.api#documentation": "

Represents an attribute for describing the key schema for the table and\n indexes.

" + } + }, + "com.amazonaws.dynamodb#AttributeDefinitions": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#AttributeDefinition" + } + }, + "com.amazonaws.dynamodb#AttributeMap": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#AttributeName" }, - "com.amazonaws.dynamodb#AttributeDefinitions": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#AttributeDefinition" - } + "value": { + "target": "com.amazonaws.dynamodb#AttributeValue" + } + }, + "com.amazonaws.dynamodb#AttributeName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 0, + "max": 65535 + } + } + }, + "com.amazonaws.dynamodb#AttributeNameList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#AttributeName" + }, + "traits": { + "smithy.api#length": { + "min": 1 + } + } + }, + "com.amazonaws.dynamodb#AttributeUpdates": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#AttributeName" }, - "com.amazonaws.dynamodb#AttributeMap": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#AttributeName" - }, - "value": { - "target": "com.amazonaws.dynamodb#AttributeValue" + "value": { + "target": "com.amazonaws.dynamodb#AttributeValueUpdate" + } + }, + "com.amazonaws.dynamodb#AttributeValue": { + "type": "union", + "members": { + "S": { + "target": "com.amazonaws.dynamodb#StringAttributeValue", + "traits": { + "smithy.api#documentation": "

An attribute of type String. For example:

\n

\n \"S\": \"Hello\"\n

" } - }, - "com.amazonaws.dynamodb#AttributeName": { - "type": "string", + }, + "N": { + "target": "com.amazonaws.dynamodb#NumberAttributeValue", "traits": { - "smithy.api#length": { - "min": 0, - "max": 65535 - } + "smithy.api#documentation": "

An attribute of type Number. For example:

\n

\n \"N\": \"123.45\"\n

\n

Numbers are sent across the network to DynamoDB as strings, to maximize compatibility\n across languages and libraries. However, DynamoDB treats them as number type attributes\n for mathematical operations.

" } - }, - "com.amazonaws.dynamodb#AttributeNameList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#AttributeName" - }, + }, + "B": { + "target": "com.amazonaws.dynamodb#BinaryAttributeValue", "traits": { - "smithy.api#length": { - "min": 1 - } + "smithy.api#documentation": "

An attribute of type Binary. For example:

\n

\n \"B\": \"dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk\"\n

" } - }, - "com.amazonaws.dynamodb#AttributeUpdates": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#AttributeName" - }, - "value": { - "target": "com.amazonaws.dynamodb#AttributeValueUpdate" + }, + "SS": { + "target": "com.amazonaws.dynamodb#StringSetAttributeValue", + "traits": { + "smithy.api#documentation": "

An attribute of type String Set. For example:

\n

\n \"SS\": [\"Giraffe\", \"Hippo\" ,\"Zebra\"]\n

" } - }, - "com.amazonaws.dynamodb#AttributeValue": { - "type": "union", - "members": { - "S": { - "target": "com.amazonaws.dynamodb#StringAttributeValue", - "traits": { - "smithy.api#documentation": "

An attribute of type String. For example:

\n

\n \"S\": \"Hello\"\n

" - } - }, - "N": { - "target": "com.amazonaws.dynamodb#NumberAttributeValue", - "traits": { - "smithy.api#documentation": "

An attribute of type Number. For example:

\n

\n \"N\": \"123.45\"\n

\n

Numbers are sent across the network to DynamoDB as strings, to maximize compatibility\n across languages and libraries. However, DynamoDB treats them as number type attributes\n for mathematical operations.

" - } - }, - "B": { - "target": "com.amazonaws.dynamodb#BinaryAttributeValue", - "traits": { - "smithy.api#documentation": "

An attribute of type Binary. For example:

\n

\n \"B\": \"dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk\"\n

" - } - }, - "SS": { - "target": "com.amazonaws.dynamodb#StringSetAttributeValue", - "traits": { - "smithy.api#documentation": "

An attribute of type String Set. For example:

\n

\n \"SS\": [\"Giraffe\", \"Hippo\" ,\"Zebra\"]\n

" - } - }, - "NS": { - "target": "com.amazonaws.dynamodb#NumberSetAttributeValue", - "traits": { - "smithy.api#documentation": "

An attribute of type Number Set. For example:

\n

\n \"NS\": [\"42.2\", \"-19\", \"7.5\", \"3.14\"]\n

\n

Numbers are sent across the network to DynamoDB as strings, to maximize compatibility\n across languages and libraries. However, DynamoDB treats them as number type attributes\n for mathematical operations.

" - } - }, - "BS": { - "target": "com.amazonaws.dynamodb#BinarySetAttributeValue", - "traits": { - "smithy.api#documentation": "

An attribute of type Binary Set. For example:

\n

\n \"BS\": [\"U3Vubnk=\", \"UmFpbnk=\", \"U25vd3k=\"]\n

" - } - }, - "M": { - "target": "com.amazonaws.dynamodb#MapAttributeValue", - "traits": { - "smithy.api#documentation": "

An attribute of type Map. For example:

\n

\n \"M\": {\"Name\": {\"S\": \"Joe\"}, \"Age\": {\"N\": \"35\"}}\n

" - } - }, - "L": { - "target": "com.amazonaws.dynamodb#ListAttributeValue", - "traits": { - "smithy.api#documentation": "

An attribute of type List. For example:

\n

\n \"L\": [ {\"S\": \"Cookies\"} , {\"S\": \"Coffee\"}, {\"N\": \"3.14159\"}]\n

" - } - }, - "NULL": { - "target": "com.amazonaws.dynamodb#NullAttributeValue", - "traits": { - "smithy.api#documentation": "

An attribute of type Null. For example:

\n

\n \"NULL\": true\n

" - } - }, - "BOOL": { - "target": "com.amazonaws.dynamodb#BooleanAttributeValue", - "traits": { - "smithy.api#documentation": "

An attribute of type Boolean. For example:

\n

\n \"BOOL\": true\n

" - } - } - }, + }, + "NS": { + "target": "com.amazonaws.dynamodb#NumberSetAttributeValue", "traits": { - "smithy.api#documentation": "

Represents the data for an attribute.

\n

Each attribute value is described as a name-value pair. The name is the data type, and\n the value is the data itself.

\n

For more information, see Data Types in the Amazon DynamoDB Developer\n Guide.

" + "smithy.api#documentation": "

An attribute of type Number Set. For example:

\n

\n \"NS\": [\"42.2\", \"-19\", \"7.5\", \"3.14\"]\n

\n

Numbers are sent across the network to DynamoDB as strings, to maximize compatibility\n across languages and libraries. However, DynamoDB treats them as number type attributes\n for mathematical operations.

" } - }, - "com.amazonaws.dynamodb#AttributeValueList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#AttributeValue" + }, + "BS": { + "target": "com.amazonaws.dynamodb#BinarySetAttributeValue", + "traits": { + "smithy.api#documentation": "

An attribute of type Binary Set. For example:

\n

\n \"BS\": [\"U3Vubnk=\", \"UmFpbnk=\", \"U25vd3k=\"]\n

" } - }, - "com.amazonaws.dynamodb#AttributeValueUpdate": { - "type": "structure", - "members": { - "Value": { - "target": "com.amazonaws.dynamodb#AttributeValue", - "traits": { - "smithy.api#documentation": "

Represents the data for an attribute.

\n

Each attribute value is described as a name-value pair. The name is the data type, and\n the value is the data itself.

\n

For more information, see Data Types in the Amazon DynamoDB Developer Guide.\n

" - } - }, - "Action": { - "target": "com.amazonaws.dynamodb#AttributeAction", - "traits": { - "smithy.api#documentation": "

Specifies how to perform the update. Valid values are PUT (default),\n DELETE, and ADD. The behavior depends on whether the\n specified primary key already exists in the table.

\n\n

\n If an item with the specified Key is found in\n the table:\n

\n\n
    \n
  • \n

    \n PUT - Adds the specified attribute to the item. If the attribute\n already exists, it is replaced by the new value.

    \n
  • \n
  • \n

    \n DELETE - If no value is specified, the attribute and its value are\n removed from the item. The data type of the specified value must match the\n existing value's data type.

    \n

    If a set of values is specified, then those values are\n subtracted from the old set. For example, if the attribute value was the set\n [a,b,c] and the DELETE action specified\n [a,c], then the final attribute value would be\n [b]. Specifying an empty set is an error.

    \n
  • \n
  • \n

    \n ADD - If the attribute does not already exist, then the attribute\n and its values are added to the item. If the attribute does exist, then the\n behavior of ADD depends on the data type of the attribute:

    \n
      \n
    • \n

      If the existing attribute is a number, and if Value is\n also a number, then the Value is mathematically added to\n the existing attribute. If Value is a negative number, then\n it is subtracted from the existing attribute.

      \n \n

      If you use ADD to increment or decrement a number\n value for an item that doesn't exist before the update, DynamoDB\n uses 0 as the initial value.

      \n

      In addition, if you use ADD to update an existing\n item, and intend to increment or decrement an attribute value which\n does not yet exist, DynamoDB uses 0 as the initial\n value. For example, suppose that the item you want to update does\n not yet have an attribute named itemcount, but\n you decide to ADD the number 3 to this\n attribute anyway, even though it currently does not exist. DynamoDB\n will create the itemcount attribute, set its\n initial value to 0, and finally add 3 to\n it. The result will be a new itemcount\n attribute in the item, with a value of 3.

      \n
      \n
    • \n
    • \n

      If the existing data type is a set, and if the Value is\n also a set, then the Value is added to the existing set.\n (This is a set operation, not mathematical\n addition.) For example, if the attribute value was the set\n [1,2], and the ADD action specified\n [3], then the final attribute value would be\n [1,2,3]. An error occurs if an Add action is specified\n for a set attribute and the attribute type specified does not match the\n existing set type.

      \n

      Both sets must have the same primitive data type. For example, if the\n existing data type is a set of strings, the Value must also\n be a set of strings. The same holds true for number sets and binary\n sets.

      \n
    • \n
    \n

    This action is only valid for an existing attribute whose data type is number\n or is a set. Do not use ADD for any other data types.

    \n
  • \n
\n\n

\n If no item with the specified Key is\n found:\n

\n\n
    \n
  • \n

    \n PUT - DynamoDB creates a new item with the specified primary key,\n and then adds the attribute.

    \n
  • \n
  • \n

    \n DELETE - Nothing happens; there is no attribute to delete.

    \n
  • \n
  • \n

    \n ADD - DynamoDB creates a new item with the supplied primary key and\n number (or set) for the attribute value. The only data types allowed\n are number, number set, string set or binary set.

    \n
  • \n
" - } - } - }, + }, + "M": { + "target": "com.amazonaws.dynamodb#MapAttributeValue", "traits": { - "smithy.api#documentation": "

For the UpdateItem operation, represents the attributes to be modified,\n the action to perform on each, and the new value for each.

\n \n

You cannot use UpdateItem to update any primary key attributes.\n Instead, you will need to delete the item, and then use PutItem to\n create a new item with new attributes.

\n
\n

Attribute values cannot be null; string and binary type attributes must have lengths\n greater than zero; and set type attributes must not be empty. Requests with empty values\n will be rejected with a ValidationException exception.

" + "smithy.api#documentation": "

An attribute of type Map. For example:

\n

\n \"M\": {\"Name\": {\"S\": \"Joe\"}, \"Age\": {\"N\": \"35\"}}\n

" } - }, - "com.amazonaws.dynamodb#AutoScalingPolicyDescription": { - "type": "structure", - "members": { - "PolicyName": { - "target": "com.amazonaws.dynamodb#AutoScalingPolicyName", - "traits": { - "smithy.api#documentation": "

The name of the scaling policy.

" - } - }, - "TargetTrackingScalingPolicyConfiguration": { - "target": "com.amazonaws.dynamodb#AutoScalingTargetTrackingScalingPolicyConfigurationDescription", - "traits": { - "smithy.api#documentation": "

Represents a target tracking scaling policy configuration.

" - } - } - }, + }, + "L": { + "target": "com.amazonaws.dynamodb#ListAttributeValue", "traits": { - "smithy.api#documentation": "

Represents the properties of the scaling policy.

" + "smithy.api#documentation": "

An attribute of type List. For example:

\n

\n \"L\": [ {\"S\": \"Cookies\"} , {\"S\": \"Coffee\"}, {\"N\": \"3.14159\"}]\n

" } - }, - "com.amazonaws.dynamodb#AutoScalingPolicyDescriptionList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#AutoScalingPolicyDescription" + }, + "NULL": { + "target": "com.amazonaws.dynamodb#NullAttributeValue", + "traits": { + "smithy.api#documentation": "

An attribute of type Null. For example:

\n

\n \"NULL\": true\n

" } - }, - "com.amazonaws.dynamodb#AutoScalingPolicyName": { - "type": "string", + }, + "BOOL": { + "target": "com.amazonaws.dynamodb#BooleanAttributeValue", "traits": { - "smithy.api#length": { - "min": 1, - "max": 256 - }, - "smithy.api#pattern": "^\\p{Print}+$" + "smithy.api#documentation": "

An attribute of type Boolean. For example:

\n

\n \"BOOL\": true\n

" } + } }, - "com.amazonaws.dynamodb#AutoScalingPolicyUpdate": { - "type": "structure", - "members": { - "PolicyName": { - "target": "com.amazonaws.dynamodb#AutoScalingPolicyName", - "traits": { - "smithy.api#documentation": "

The name of the scaling policy.

" - } - }, - "TargetTrackingScalingPolicyConfiguration": { - "target": "com.amazonaws.dynamodb#AutoScalingTargetTrackingScalingPolicyConfigurationUpdate", - "traits": { - "smithy.api#documentation": "

Represents a target tracking scaling policy configuration.

", - "smithy.api#required": {} - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the data for an attribute.

\n

Each attribute value is described as a name-value pair. The name is the data type, and\n the value is the data itself.

\n

For more information, see Data Types in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "com.amazonaws.dynamodb#AttributeValueList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#AttributeValue" + } + }, + "com.amazonaws.dynamodb#AttributeValueUpdate": { + "type": "structure", + "members": { + "Value": { + "target": "com.amazonaws.dynamodb#AttributeValue", "traits": { - "smithy.api#documentation": "

Represents the auto scaling policy to be modified.

" + "smithy.api#documentation": "

Represents the data for an attribute.

\n

Each attribute value is described as a name-value pair. The name is the data type, and\n the value is the data itself.

\n

For more information, see Data Types in the Amazon DynamoDB Developer Guide.\n

" } - }, - "com.amazonaws.dynamodb#AutoScalingRoleArn": { - "type": "string", + }, + "Action": { + "target": "com.amazonaws.dynamodb#AttributeAction", "traits": { - "smithy.api#length": { - "min": 1, - "max": 1600 - }, - "smithy.api#pattern": "^[\\u0020-\\uD7FF\\uE000-\\uFFFD\\uD800\\uDC00-\\uDBFF\\uDFFF\\r\\n\\t]*$" + "smithy.api#documentation": "

Specifies how to perform the update. Valid values are PUT (default),\n DELETE, and ADD. The behavior depends on whether the\n specified primary key already exists in the table.

\n\n

\n If an item with the specified Key is found in\n the table:\n

\n\n
    \n
  • \n

    \n PUT - Adds the specified attribute to the item. If the attribute\n already exists, it is replaced by the new value.

    \n
  • \n
  • \n

    \n DELETE - If no value is specified, the attribute and its value are\n removed from the item. The data type of the specified value must match the\n existing value's data type.

    \n

    If a set of values is specified, then those values are\n subtracted from the old set. For example, if the attribute value was the set\n [a,b,c] and the DELETE action specified\n [a,c], then the final attribute value would be\n [b]. Specifying an empty set is an error.

    \n
  • \n
  • \n

    \n ADD - If the attribute does not already exist, then the attribute\n and its values are added to the item. If the attribute does exist, then the\n behavior of ADD depends on the data type of the attribute:

    \n
      \n
    • \n

      If the existing attribute is a number, and if Value is\n also a number, then the Value is mathematically added to\n the existing attribute. If Value is a negative number, then\n it is subtracted from the existing attribute.

      \n \n

      If you use ADD to increment or decrement a number\n value for an item that doesn't exist before the update, DynamoDB\n uses 0 as the initial value.

      \n

      In addition, if you use ADD to update an existing\n item, and intend to increment or decrement an attribute value which\n does not yet exist, DynamoDB uses 0 as the initial\n value. For example, suppose that the item you want to update does\n not yet have an attribute named itemcount, but\n you decide to ADD the number 3 to this\n attribute anyway, even though it currently does not exist. DynamoDB\n will create the itemcount attribute, set its\n initial value to 0, and finally add 3 to\n it. The result will be a new itemcount\n attribute in the item, with a value of 3.

      \n
      \n
    • \n
    • \n

      If the existing data type is a set, and if the Value is\n also a set, then the Value is added to the existing set.\n (This is a set operation, not mathematical\n addition.) For example, if the attribute value was the set\n [1,2], and the ADD action specified\n [3], then the final attribute value would be\n [1,2,3]. An error occurs if an Add action is specified\n for a set attribute and the attribute type specified does not match the\n existing set type.

      \n

      Both sets must have the same primitive data type. For example, if the\n existing data type is a set of strings, the Value must also\n be a set of strings. The same holds true for number sets and binary\n sets.

      \n
    • \n
    \n

    This action is only valid for an existing attribute whose data type is number\n or is a set. Do not use ADD for any other data types.

    \n
  • \n
\n\n

\n If no item with the specified Key is\n found:\n

\n\n
    \n
  • \n

    \n PUT - DynamoDB creates a new item with the specified primary key,\n and then adds the attribute.

    \n
  • \n
  • \n

    \n DELETE - Nothing happens; there is no attribute to delete.

    \n
  • \n
  • \n

    \n ADD - DynamoDB creates a new item with the supplied primary key and\n number (or set) for the attribute value. The only data types allowed\n are number, number set, string set or binary set.

    \n
  • \n
" } + } }, - "com.amazonaws.dynamodb#AutoScalingSettingsDescription": { - "type": "structure", - "members": { - "MinimumUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The minimum capacity units that a global table or global secondary index should be\n scaled down to.

" - } - }, - "MaximumUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum capacity units that a global table or global secondary index should be\n scaled up to.

" - } - }, - "AutoScalingDisabled": { - "target": "com.amazonaws.dynamodb#BooleanObject", - "traits": { - "smithy.api#documentation": "

Disabled auto scaling for this global table or global secondary index.

" - } - }, - "AutoScalingRoleArn": { - "target": "com.amazonaws.dynamodb#String", - "traits": { - "smithy.api#documentation": "

Role ARN used for configuring the auto scaling policy.

" - } - }, - "ScalingPolicies": { - "target": "com.amazonaws.dynamodb#AutoScalingPolicyDescriptionList", - "traits": { - "smithy.api#documentation": "

Information about the scaling policies.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

For the UpdateItem operation, represents the attributes to be modified,\n the action to perform on each, and the new value for each.

\n \n

You cannot use UpdateItem to update any primary key attributes.\n Instead, you will need to delete the item, and then use PutItem to\n create a new item with new attributes.

\n
\n

Attribute values cannot be null; string and binary type attributes must have lengths\n greater than zero; and set type attributes must not be empty. Requests with empty values\n will be rejected with a ValidationException exception.

" + } + }, + "com.amazonaws.dynamodb#AutoScalingPolicyDescription": { + "type": "structure", + "members": { + "PolicyName": { + "target": "com.amazonaws.dynamodb#AutoScalingPolicyName", "traits": { - "smithy.api#documentation": "

Represents the auto scaling settings for a global table or global secondary\n index.

" + "smithy.api#documentation": "

The name of the scaling policy.

" } - }, - "com.amazonaws.dynamodb#AutoScalingSettingsUpdate": { - "type": "structure", - "members": { - "MinimumUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The minimum capacity units that a global table or global secondary index should be\n scaled down to.

" - } - }, - "MaximumUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum capacity units that a global table or global secondary index should be\n scaled up to.

" - } - }, - "AutoScalingDisabled": { - "target": "com.amazonaws.dynamodb#BooleanObject", - "traits": { - "smithy.api#documentation": "

Disabled auto scaling for this global table or global secondary index.

" - } - }, - "AutoScalingRoleArn": { - "target": "com.amazonaws.dynamodb#AutoScalingRoleArn", - "traits": { - "smithy.api#documentation": "

Role ARN used for configuring auto scaling policy.

" - } - }, - "ScalingPolicyUpdate": { - "target": "com.amazonaws.dynamodb#AutoScalingPolicyUpdate", - "traits": { - "smithy.api#documentation": "

The scaling policy to apply for scaling target global table or global secondary index\n capacity units.

" - } - } - }, + }, + "TargetTrackingScalingPolicyConfiguration": { + "target": "com.amazonaws.dynamodb#AutoScalingTargetTrackingScalingPolicyConfigurationDescription", "traits": { - "smithy.api#documentation": "

Represents the auto scaling settings to be modified for a global table or global\n secondary index.

" + "smithy.api#documentation": "

Represents a target tracking scaling policy configuration.

" } + } }, - "com.amazonaws.dynamodb#AutoScalingTargetTrackingScalingPolicyConfigurationDescription": { - "type": "structure", - "members": { - "DisableScaleIn": { - "target": "com.amazonaws.dynamodb#BooleanObject", - "traits": { - "smithy.api#documentation": "

Indicates whether scale in by the target tracking policy is disabled. If the value is\n true, scale in is disabled and the target tracking policy won't remove capacity from the\n scalable resource. Otherwise, scale in is enabled and the target tracking policy can\n remove capacity from the scalable resource. The default value is false.

" - } - }, - "ScaleInCooldown": { - "target": "com.amazonaws.dynamodb#IntegerObject", - "traits": { - "smithy.api#documentation": "

The amount of time, in seconds, after a scale in activity completes before another\n scale in activity can start. The cooldown period is used to block subsequent scale in\n requests until it has expired. You should scale in conservatively to protect your\n application's availability. However, if another alarm triggers a scale out policy during\n the cooldown period after a scale-in, application auto scaling scales out your scalable\n target immediately.

" - } - }, - "ScaleOutCooldown": { - "target": "com.amazonaws.dynamodb#IntegerObject", - "traits": { - "smithy.api#documentation": "

The amount of time, in seconds, after a scale out activity completes before another\n scale out activity can start. While the cooldown period is in effect, the capacity that\n has been added by the previous scale out event that initiated the cooldown is calculated\n as part of the desired capacity for the next scale out. You should continuously (but not\n excessively) scale out.

" - } - }, - "TargetValue": { - "target": "com.amazonaws.dynamodb#Double", - "traits": { - "smithy.api#documentation": "

The target value for the metric. The range is 8.515920e-109 to 1.174271e+108 (Base 10)\n or 2e-360 to 2e360 (Base 2).

", - "smithy.api#required": {} - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the properties of the scaling policy.

" + } + }, + "com.amazonaws.dynamodb#AutoScalingPolicyDescriptionList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#AutoScalingPolicyDescription" + } + }, + "com.amazonaws.dynamodb#AutoScalingPolicyName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 256 + }, + "smithy.api#pattern": "^\\p{Print}+$" + } + }, + "com.amazonaws.dynamodb#AutoScalingPolicyUpdate": { + "type": "structure", + "members": { + "PolicyName": { + "target": "com.amazonaws.dynamodb#AutoScalingPolicyName", "traits": { - "smithy.api#documentation": "

Represents the properties of a target tracking scaling policy.

" + "smithy.api#documentation": "

The name of the scaling policy.

" } - }, - "com.amazonaws.dynamodb#AutoScalingTargetTrackingScalingPolicyConfigurationUpdate": { - "type": "structure", - "members": { - "DisableScaleIn": { - "target": "com.amazonaws.dynamodb#BooleanObject", - "traits": { - "smithy.api#documentation": "

Indicates whether scale in by the target tracking policy is disabled. If the value is\n true, scale in is disabled and the target tracking policy won't remove capacity from the\n scalable resource. Otherwise, scale in is enabled and the target tracking policy can\n remove capacity from the scalable resource. The default value is false.

" - } - }, - "ScaleInCooldown": { - "target": "com.amazonaws.dynamodb#IntegerObject", - "traits": { - "smithy.api#documentation": "

The amount of time, in seconds, after a scale in activity completes before another\n scale in activity can start. The cooldown period is used to block subsequent scale in\n requests until it has expired. You should scale in conservatively to protect your\n application's availability. However, if another alarm triggers a scale out policy during\n the cooldown period after a scale-in, application auto scaling scales out your scalable\n target immediately.

" - } - }, - "ScaleOutCooldown": { - "target": "com.amazonaws.dynamodb#IntegerObject", - "traits": { - "smithy.api#documentation": "

The amount of time, in seconds, after a scale out activity completes before another\n scale out activity can start. While the cooldown period is in effect, the capacity that\n has been added by the previous scale out event that initiated the cooldown is calculated\n as part of the desired capacity for the next scale out. You should continuously (but not\n excessively) scale out.

" - } - }, - "TargetValue": { - "target": "com.amazonaws.dynamodb#Double", - "traits": { - "smithy.api#documentation": "

The target value for the metric. The range is 8.515920e-109 to 1.174271e+108 (Base 10)\n or 2e-360 to 2e360 (Base 2).

", - "smithy.api#required": {} - } - } - }, + }, + "TargetTrackingScalingPolicyConfiguration": { + "target": "com.amazonaws.dynamodb#AutoScalingTargetTrackingScalingPolicyConfigurationUpdate", "traits": { - "smithy.api#documentation": "

Represents the settings of a target tracking scaling policy that will be\n modified.

" + "smithy.api#documentation": "

Represents a target tracking scaling policy configuration.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#Backfilling": { - "type": "boolean", + "traits": { + "smithy.api#documentation": "

Represents the auto scaling policy to be modified.

" + } + }, + "com.amazonaws.dynamodb#AutoScalingRoleArn": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 1600 + }, + "smithy.api#pattern": "^[\\u0020-\\uD7FF\\uE000-\\uFFFD\\uD800\\uDC00-\\uDBFF\\uDFFF\\r\\n\\t]*$" + } + }, + "com.amazonaws.dynamodb#AutoScalingSettingsDescription": { + "type": "structure", + "members": { + "MinimumUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

The minimum capacity units that a global table or global secondary index should be\n scaled down to.

" } - }, - "com.amazonaws.dynamodb#BackupArn": { - "type": "string", + }, + "MaximumUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", "traits": { - "smithy.api#length": { - "min": 37, - "max": 1024 - } + "smithy.api#documentation": "

The maximum capacity units that a global table or global secondary index should be\n scaled up to.

" } - }, - "com.amazonaws.dynamodb#BackupCreationDateTime": { - "type": "timestamp" - }, - "com.amazonaws.dynamodb#BackupDescription": { - "type": "structure", - "members": { - "BackupDetails": { - "target": "com.amazonaws.dynamodb#BackupDetails", - "traits": { - "smithy.api#documentation": "

Contains the details of the backup created for the table.

" - } - }, - "SourceTableDetails": { - "target": "com.amazonaws.dynamodb#SourceTableDetails", - "traits": { - "smithy.api#documentation": "

Contains the details of the table when the backup was created.

" - } - }, - "SourceTableFeatureDetails": { - "target": "com.amazonaws.dynamodb#SourceTableFeatureDetails", - "traits": { - "smithy.api#documentation": "

Contains the details of the features enabled on the table when the backup was created.\n For example, LSIs, GSIs, streams, TTL.

" - } - } - }, + }, + "AutoScalingDisabled": { + "target": "com.amazonaws.dynamodb#BooleanObject", "traits": { - "smithy.api#documentation": "

Contains the description of the backup created for the table.

" + "smithy.api#documentation": "

Disabled auto scaling for this global table or global secondary index.

" } - }, - "com.amazonaws.dynamodb#BackupDetails": { - "type": "structure", - "members": { - "BackupArn": { - "target": "com.amazonaws.dynamodb#BackupArn", - "traits": { - "smithy.api#documentation": "

ARN associated with the backup.

", - "smithy.api#required": {} - } - }, - "BackupName": { - "target": "com.amazonaws.dynamodb#BackupName", - "traits": { - "smithy.api#documentation": "

Name of the requested backup.

", - "smithy.api#required": {} - } - }, - "BackupSizeBytes": { - "target": "com.amazonaws.dynamodb#BackupSizeBytes", - "traits": { - "smithy.api#documentation": "

Size of the backup in bytes. DynamoDB updates this value approximately every six hours. \n Recent changes might not be reflected in this value.

" - } - }, - "BackupStatus": { - "target": "com.amazonaws.dynamodb#BackupStatus", - "traits": { - "smithy.api#documentation": "

Backup can be in one of the following states: CREATING, ACTIVE, DELETED.

", - "smithy.api#required": {} - } - }, - "BackupType": { - "target": "com.amazonaws.dynamodb#BackupType", - "traits": { - "smithy.api#documentation": "

BackupType:

\n
    \n
  • \n

    \n USER - You create and manage these using the on-demand backup\n feature.

    \n
  • \n
  • \n

    \n SYSTEM - If you delete a table with point-in-time recovery enabled,\n a SYSTEM backup is automatically created and is retained for 35\n days (at no additional cost). System backups allow you to restore the deleted\n table to the state it was in just before the point of deletion.

    \n
  • \n
  • \n

    \n AWS_BACKUP - On-demand backup created by you from Backup service.

    \n
  • \n
", - "smithy.api#required": {} - } - }, - "BackupCreationDateTime": { - "target": "com.amazonaws.dynamodb#BackupCreationDateTime", - "traits": { - "smithy.api#documentation": "

Time at which the backup was created. This is the request time of the backup.

", - "smithy.api#required": {} - } - }, - "BackupExpiryDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

Time at which the automatic on-demand backup created by DynamoDB will\n expire. This SYSTEM on-demand backup expires automatically 35 days after\n its creation.

" - } - } - }, + }, + "AutoScalingRoleArn": { + "target": "com.amazonaws.dynamodb#String", "traits": { - "smithy.api#documentation": "

Contains the details of the backup created for the table.

" + "smithy.api#documentation": "

Role ARN used for configuring the auto scaling policy.

" } - }, - "com.amazonaws.dynamodb#BackupInUseException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "ScalingPolicies": { + "target": "com.amazonaws.dynamodb#AutoScalingPolicyDescriptionList", "traits": { - "smithy.api#documentation": "

There is another ongoing conflicting backup control plane operation on the table.\n The backup is either being created, deleted or restored to a table.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

Information about the scaling policies.

" } + } }, - "com.amazonaws.dynamodb#BackupName": { - "type": "string", + "traits": { + "smithy.api#documentation": "

Represents the auto scaling settings for a global table or global secondary\n index.

" + } + }, + "com.amazonaws.dynamodb#AutoScalingSettingsUpdate": { + "type": "structure", + "members": { + "MinimumUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", "traits": { - "smithy.api#length": { - "min": 3, - "max": 255 - }, - "smithy.api#pattern": "^[a-zA-Z0-9_.-]+$" + "smithy.api#documentation": "

The minimum capacity units that a global table or global secondary index should be\n scaled down to.

" } - }, - "com.amazonaws.dynamodb#BackupNotFoundException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "MaximumUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", "traits": { - "smithy.api#documentation": "

Backup not found for the given BackupARN.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The maximum capacity units that a global table or global secondary index should be\n scaled up to.

" } - }, - "com.amazonaws.dynamodb#BackupSizeBytes": { - "type": "long", + }, + "AutoScalingDisabled": { + "target": "com.amazonaws.dynamodb#BooleanObject", "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 0 - } + "smithy.api#documentation": "

Disabled auto scaling for this global table or global secondary index.

" } - }, - "com.amazonaws.dynamodb#BackupStatus": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "CREATING", - "name": "CREATING" - }, - { - "value": "DELETED", - "name": "DELETED" - }, - { - "value": "AVAILABLE", - "name": "AVAILABLE" - } - ] + }, + "AutoScalingRoleArn": { + "target": "com.amazonaws.dynamodb#AutoScalingRoleArn", + "traits": { + "smithy.api#documentation": "

Role ARN used for configuring auto scaling policy.

" } - }, - "com.amazonaws.dynamodb#BackupSummaries": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#BackupSummary" + }, + "ScalingPolicyUpdate": { + "target": "com.amazonaws.dynamodb#AutoScalingPolicyUpdate", + "traits": { + "smithy.api#documentation": "

The scaling policy to apply for scaling target global table or global secondary index\n capacity units.

" } + } }, - "com.amazonaws.dynamodb#BackupSummary": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

Name of the table.

" - } - }, - "TableId": { - "target": "com.amazonaws.dynamodb#TableId", - "traits": { - "smithy.api#documentation": "

Unique identifier for the table.

" - } - }, - "TableArn": { - "target": "com.amazonaws.dynamodb#TableArn", - "traits": { - "smithy.api#documentation": "

ARN associated with the table.

" - } - }, - "BackupArn": { - "target": "com.amazonaws.dynamodb#BackupArn", - "traits": { - "smithy.api#documentation": "

ARN associated with the backup.

" - } - }, - "BackupName": { - "target": "com.amazonaws.dynamodb#BackupName", - "traits": { - "smithy.api#documentation": "

Name of the specified backup.

" - } - }, - "BackupCreationDateTime": { - "target": "com.amazonaws.dynamodb#BackupCreationDateTime", - "traits": { - "smithy.api#documentation": "

Time at which the backup was created.

" - } - }, - "BackupExpiryDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

Time at which the automatic on-demand backup created by DynamoDB will\n expire. This SYSTEM on-demand backup expires automatically 35 days after\n its creation.

" - } - }, - "BackupStatus": { - "target": "com.amazonaws.dynamodb#BackupStatus", - "traits": { - "smithy.api#documentation": "

Backup can be in one of the following states: CREATING, ACTIVE, DELETED.

" - } - }, - "BackupType": { - "target": "com.amazonaws.dynamodb#BackupType", - "traits": { - "smithy.api#documentation": "

BackupType:

\n
    \n
  • \n

    \n USER - You create and manage these using the on-demand backup\n feature.

    \n
  • \n
  • \n

    \n SYSTEM - If you delete a table with point-in-time recovery enabled,\n a SYSTEM backup is automatically created and is retained for 35\n days (at no additional cost). System backups allow you to restore the deleted\n table to the state it was in just before the point of deletion.

    \n
  • \n
  • \n

    \n AWS_BACKUP - On-demand backup created by you from Backup service.

    \n
  • \n
" - } - }, - "BackupSizeBytes": { - "target": "com.amazonaws.dynamodb#BackupSizeBytes", - "traits": { - "smithy.api#documentation": "

Size of the backup in bytes.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the auto scaling settings to be modified for a global table or global\n secondary index.

" + } + }, + "com.amazonaws.dynamodb#AutoScalingTargetTrackingScalingPolicyConfigurationDescription": { + "type": "structure", + "members": { + "DisableScaleIn": { + "target": "com.amazonaws.dynamodb#BooleanObject", "traits": { - "smithy.api#documentation": "

Contains details for the backup.

" + "smithy.api#documentation": "

Indicates whether scale in by the target tracking policy is disabled. If the value is\n true, scale in is disabled and the target tracking policy won't remove capacity from the\n scalable resource. Otherwise, scale in is enabled and the target tracking policy can\n remove capacity from the scalable resource. The default value is false.

" } - }, - "com.amazonaws.dynamodb#BackupType": { - "type": "string", + }, + "ScaleInCooldown": { + "target": "com.amazonaws.dynamodb#IntegerObject", "traits": { - "smithy.api#enum": [ - { - "value": "USER", - "name": "USER" - }, - { - "value": "SYSTEM", - "name": "SYSTEM" - }, - { - "value": "AWS_BACKUP", - "name": "AWS_BACKUP" - } - ] - } - }, - "com.amazonaws.dynamodb#BackupTypeFilter": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "USER", - "name": "USER" - }, - { - "value": "SYSTEM", - "name": "SYSTEM" - }, - { - "value": "AWS_BACKUP", - "name": "AWS_BACKUP" - }, - { - "value": "ALL", - "name": "ALL" - } - ] + "smithy.api#documentation": "

The amount of time, in seconds, after a scale in activity completes before another\n scale in activity can start. The cooldown period is used to block subsequent scale in\n requests until it has expired. You should scale in conservatively to protect your\n application's availability. However, if another alarm triggers a scale out policy during\n the cooldown period after a scale-in, application auto scaling scales out your scalable\n target immediately.

" } - }, - "com.amazonaws.dynamodb#BackupsInputLimit": { - "type": "integer", + }, + "ScaleOutCooldown": { + "target": "com.amazonaws.dynamodb#IntegerObject", "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 1, - "max": 100 - } + "smithy.api#documentation": "

The amount of time, in seconds, after a scale out activity completes before another\n scale out activity can start. While the cooldown period is in effect, the capacity that\n has been added by the previous scale out event that initiated the cooldown is calculated\n as part of the desired capacity for the next scale out. You should continuously (but not\n excessively) scale out.

" } - }, - "com.amazonaws.dynamodb#BatchExecuteStatement": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#BatchExecuteStatementInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#BatchExecuteStatementOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - } - ], + }, + "TargetValue": { + "target": "com.amazonaws.dynamodb#Double", "traits": { - "smithy.api#documentation": "

This operation allows you to perform batch reads or writes on data stored in DynamoDB,\n using PartiQL. Each read statement in a BatchExecuteStatement must specify an equality\n condition on all key attributes. This enforces that each SELECT statement in a\n batch returns at most a single item.

\n \n

The entire batch must consist of either read statements or write statements, you\n cannot mix both in one batch.

\n
\n \n

A HTTP 200 response does not mean that all statements in the BatchExecuteStatement\n succeeded. Error details for individual statements can be found under the Error field of the BatchStatementResponse for each\n statement.

\n
" - } - }, - "com.amazonaws.dynamodb#BatchExecuteStatementInput": { - "type": "structure", - "members": { - "Statements": { - "target": "com.amazonaws.dynamodb#PartiQLBatchRequest", - "traits": { - "smithy.api#documentation": "

The list of PartiQL statements representing the batch to run.

", - "smithy.api#required": {} - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" - } - } - }, - "com.amazonaws.dynamodb#BatchExecuteStatementOutput": { - "type": "structure", - "members": { - "Responses": { - "target": "com.amazonaws.dynamodb#PartiQLBatchResponse", - "traits": { - "smithy.api#documentation": "

The response to each PartiQL statement in the batch.

" - } - }, - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", - "traits": { - "smithy.api#documentation": "

The capacity units consumed by the entire operation. The values of the list are\n ordered according to the ordering of the statements.

" - } - } + "smithy.api#documentation": "

The target value for the metric. The range is 8.515920e-109 to 1.174271e+108 (Base 10)\n or 2e-360 to 2e360 (Base 2).

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#BatchGetItem": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#BatchGetItemInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#BatchGetItemOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + "traits": { + "smithy.api#documentation": "

Represents the properties of a target tracking scaling policy.

" + } + }, + "com.amazonaws.dynamodb#AutoScalingTargetTrackingScalingPolicyConfigurationUpdate": { + "type": "structure", + "members": { + "DisableScaleIn": { + "target": "com.amazonaws.dynamodb#BooleanObject", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

The BatchGetItem operation returns the attributes of one or more items\n from one or more tables. You identify requested items by primary key.

\n

A single operation can retrieve up to 16 MB of data, which can contain as many as 100\n items. BatchGetItem returns a partial result if the response size limit is\n exceeded, the table's provisioned throughput is exceeded, or an internal processing\n failure occurs. If a partial result is returned, the operation returns a value for\n UnprocessedKeys. You can use this value to retry the operation starting\n with the next item to get.

\n \n

If you request more than 100 items, BatchGetItem returns a\n ValidationException with the message \"Too many items requested for\n the BatchGetItem call.\"

\n
\n

For example, if you ask to retrieve 100 items, but each individual item is 300 KB in\n size, the system returns 52 items (so as not to exceed the 16 MB limit). It also returns\n an appropriate UnprocessedKeys value so you can get the next page of\n results. If desired, your application can include its own logic to assemble the pages of\n results into one dataset.

\n

If none of the items can be processed due to insufficient\n provisioned throughput on all of the tables in the request, then\n BatchGetItem returns a\n ProvisionedThroughputExceededException. If at least\n one of the items is successfully processed, then\n BatchGetItem completes successfully, while returning the keys of the\n unread items in UnprocessedKeys.

\n \n

If DynamoDB returns any unprocessed items, you should retry the batch operation on\n those items. However, we strongly recommend that you use an exponential\n backoff algorithm. If you retry the batch operation immediately, the\n underlying read or write requests can still fail due to throttling on the individual\n tables. If you delay the batch operation using exponential backoff, the individual\n requests in the batch are much more likely to succeed.

\n

For more information, see Batch Operations and Error Handling in the Amazon DynamoDB\n Developer Guide.

\n
\n

By default, BatchGetItem performs eventually consistent reads on every\n table in the request. If you want strongly consistent reads instead, you can set\n ConsistentRead to true for any or all tables.

\n

In order to minimize response latency, BatchGetItem retrieves items in\n parallel.

\n

When designing your application, keep in mind that DynamoDB does not return items in\n any particular order. To help parse the response by item, include the primary key values\n for the items in your request in the ProjectionExpression parameter.

\n

If a requested item does not exist, it is not returned in the result. Requests for\n nonexistent items consume the minimum read capacity units according to the type of read.\n For more information, see Working with Tables in the Amazon DynamoDB Developer\n Guide.

" + "smithy.api#documentation": "

Indicates whether scale in by the target tracking policy is disabled. If the value is\n true, scale in is disabled and the target tracking policy won't remove capacity from the\n scalable resource. Otherwise, scale in is enabled and the target tracking policy can\n remove capacity from the scalable resource. The default value is false.

" } - }, - "com.amazonaws.dynamodb#BatchGetItemInput": { - "type": "structure", - "members": { - "RequestItems": { - "target": "com.amazonaws.dynamodb#BatchGetRequestMap", - "traits": { - "smithy.api#documentation": "

A map of one or more table names and, for each table, a map that describes one or more\n items to retrieve from that table. Each table name can be used only once per\n BatchGetItem request.

\n

Each element in the map of items to retrieve consists of the following:

\n
    \n
  • \n

    \n ConsistentRead - If true, a strongly consistent read\n is used; if false (the default), an eventually consistent read is\n used.

    \n
  • \n
  • \n

    \n ExpressionAttributeNames - One or more substitution tokens for\n attribute names in the ProjectionExpression parameter. The\n following are some use cases for using\n ExpressionAttributeNames:

    \n
      \n
    • \n

      To access an attribute whose name conflicts with a DynamoDB reserved\n word.

      \n
    • \n
    • \n

      To create a placeholder for repeating occurrences of an attribute name\n in an expression.

      \n
    • \n
    • \n

      To prevent special characters in an attribute name from being\n misinterpreted in an expression.

      \n
    • \n
    \n

    Use the # character in an expression to\n dereference an attribute name. For example, consider the following attribute\n name:

    \n
      \n
    • \n

      \n Percentile\n

      \n
    • \n
    \n

    The name of this attribute conflicts with a reserved word, so it cannot be\n used directly in an expression. (For the complete list of reserved words, see\n Reserved\n Words in the Amazon DynamoDB Developer Guide).\n To work around this, you could specify the following for\n ExpressionAttributeNames:

    \n
      \n
    • \n

      \n {\"#P\":\"Percentile\"}\n

      \n
    • \n
    \n

    You could then use this substitution in an expression, as in this\n example:

    \n
      \n
    • \n

      \n #P = :val\n

      \n
    • \n
    \n \n

    Tokens that begin with the : character\n are expression attribute values, which are placeholders\n for the actual value at runtime.

    \n
    \n

    For more information about expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB\n Developer Guide.

    \n
  • \n
  • \n

    \n Keys - An array of primary key attribute values that define\n specific items in the table. For each primary key, you must provide\n all of the key attributes. For example, with a simple\n primary key, you only need to provide the partition key value. For a composite\n key, you must provide both the partition key value and the\n sort key value.

    \n
  • \n
  • \n

    \n ProjectionExpression - A string that identifies one or more\n attributes to retrieve from the table. These attributes can include scalars,\n sets, or elements of a JSON document. The attributes in the expression must be\n separated by commas.

    \n

    If no attribute names are specified, then all attributes are returned. If any\n of the requested attributes are not found, they do not appear in the\n result.

    \n

    For more information, see Accessing Item Attributes in the Amazon DynamoDB\n Developer Guide.

    \n
  • \n
  • \n

    \n AttributesToGet - This is a legacy parameter. Use\n ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer\n Guide.

    \n\n
  • \n
", - "smithy.api#required": {} - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" - } - }, + }, + "ScaleInCooldown": { + "target": "com.amazonaws.dynamodb#IntegerObject", "traits": { - "smithy.api#documentation": "

Represents the input of a BatchGetItem operation.

" + "smithy.api#documentation": "

The amount of time, in seconds, after a scale in activity completes before another\n scale in activity can start. The cooldown period is used to block subsequent scale in\n requests until it has expired. You should scale in conservatively to protect your\n application's availability. However, if another alarm triggers a scale out policy during\n the cooldown period after a scale-in, application auto scaling scales out your scalable\n target immediately.

" } - }, - "com.amazonaws.dynamodb#BatchGetItemOutput": { - "type": "structure", - "members": { - "Responses": { - "target": "com.amazonaws.dynamodb#BatchGetResponseMap", - "traits": { - "smithy.api#documentation": "

A map of table name to a list of items. Each object in Responses consists\n of a table name, along with a map of attribute data consisting of the data type and\n attribute value.

" - } - }, - "UnprocessedKeys": { - "target": "com.amazonaws.dynamodb#BatchGetRequestMap", - "traits": { - "smithy.api#documentation": "

A map of tables and their respective keys that were not processed with the current\n response. The UnprocessedKeys value is in the same form as\n RequestItems, so the value can be provided directly to a subsequent\n BatchGetItem operation. For more information, see\n RequestItems in the Request Parameters section.

\n

Each element consists of:

\n
    \n
  • \n

    \n Keys - An array of primary key attribute values that define\n specific items in the table.

    \n
  • \n
  • \n

    \n ProjectionExpression - One or more attributes to be retrieved from\n the table or index. By default, all attributes are returned. If a requested\n attribute is not found, it does not appear in the result.

    \n
  • \n
  • \n

    \n ConsistentRead - The consistency of a read operation. If set to\n true, then a strongly consistent read is used; otherwise, an\n eventually consistent read is used.

    \n
  • \n
\n

If there are no unprocessed keys remaining, the response contains an empty\n UnprocessedKeys map.

" - } - }, - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", - "traits": { - "smithy.api#documentation": "

The read capacity units consumed by the entire BatchGetItem\n operation.

\n

Each element consists of:

\n
    \n
  • \n

    \n TableName - The table that consumed the provisioned\n throughput.

    \n
  • \n
  • \n

    \n CapacityUnits - The total number of capacity units consumed.

    \n
  • \n
" - } - } - }, + }, + "ScaleOutCooldown": { + "target": "com.amazonaws.dynamodb#IntegerObject", "traits": { - "smithy.api#documentation": "

Represents the output of a BatchGetItem operation.

" + "smithy.api#documentation": "

The amount of time, in seconds, after a scale out activity completes before another\n scale out activity can start. While the cooldown period is in effect, the capacity that\n has been added by the previous scale out event that initiated the cooldown is calculated\n as part of the desired capacity for the next scale out. You should continuously (but not\n excessively) scale out.

" } - }, - "com.amazonaws.dynamodb#BatchGetRequestMap": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#TableName" - }, - "value": { - "target": "com.amazonaws.dynamodb#KeysAndAttributes" - }, + }, + "TargetValue": { + "target": "com.amazonaws.dynamodb#Double", "traits": { - "smithy.api#length": { - "min": 1, - "max": 100 - } + "smithy.api#documentation": "

The target value for the metric. The range is 8.515920e-109 to 1.174271e+108 (Base 10)\n or 2e-360 to 2e360 (Base 2).

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#BatchGetResponseMap": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#TableName" - }, - "value": { - "target": "com.amazonaws.dynamodb#ItemList" + "traits": { + "smithy.api#documentation": "

Represents the settings of a target tracking scaling policy that will be\n modified.

" + } + }, + "com.amazonaws.dynamodb#Backfilling": { + "type": "boolean", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#BackupArn": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 37, + "max": 1024 + } + } + }, + "com.amazonaws.dynamodb#BackupCreationDateTime": { + "type": "timestamp" + }, + "com.amazonaws.dynamodb#BackupDescription": { + "type": "structure", + "members": { + "BackupDetails": { + "target": "com.amazonaws.dynamodb#BackupDetails", + "traits": { + "smithy.api#documentation": "

Contains the details of the backup created for the table.

" } - }, - "com.amazonaws.dynamodb#BatchStatementError": { - "type": "structure", - "members": { - "Code": { - "target": "com.amazonaws.dynamodb#BatchStatementErrorCodeEnum", - "traits": { - "smithy.api#documentation": "

The error code associated with the failed PartiQL batch statement.

" - } - }, - "Message": { - "target": "com.amazonaws.dynamodb#String", - "traits": { - "smithy.api#documentation": "

The error message associated with the PartiQL batch response.

" - } - } - }, + }, + "SourceTableDetails": { + "target": "com.amazonaws.dynamodb#SourceTableDetails", "traits": { - "smithy.api#documentation": "

An error associated with a statement in a PartiQL batch that was run.

" - } - }, - "com.amazonaws.dynamodb#BatchStatementErrorCodeEnum": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "ConditionalCheckFailed", - "name": "ConditionalCheckFailed" - }, - { - "value": "ItemCollectionSizeLimitExceeded", - "name": "ItemCollectionSizeLimitExceeded" - }, - { - "value": "RequestLimitExceeded", - "name": "RequestLimitExceeded" - }, - { - "value": "ValidationError", - "name": "ValidationError" - }, - { - "value": "ProvisionedThroughputExceeded", - "name": "ProvisionedThroughputExceeded" - }, - { - "value": "TransactionConflict", - "name": "TransactionConflict" - }, - { - "value": "ThrottlingError", - "name": "ThrottlingError" - }, - { - "value": "InternalServerError", - "name": "InternalServerError" - }, - { - "value": "ResourceNotFound", - "name": "ResourceNotFound" - }, - { - "value": "AccessDenied", - "name": "AccessDenied" - }, - { - "value": "DuplicateItem", - "name": "DuplicateItem" - } - ] + "smithy.api#documentation": "

Contains the details of the table when the backup was created.

" } - }, - "com.amazonaws.dynamodb#BatchStatementRequest": { - "type": "structure", - "members": { - "Statement": { - "target": "com.amazonaws.dynamodb#PartiQLStatement", - "traits": { - "smithy.api#documentation": "

A valid PartiQL statement.

", - "smithy.api#required": {} - } - }, - "Parameters": { - "target": "com.amazonaws.dynamodb#PreparedStatementParameters", - "traits": { - "smithy.api#documentation": "

The parameters associated with a PartiQL statement in the batch request.

" - } - }, - "ConsistentRead": { - "target": "com.amazonaws.dynamodb#ConsistentRead", - "traits": { - "smithy.api#documentation": "

The read consistency of the PartiQL batch request.

" - } - } - }, + }, + "SourceTableFeatureDetails": { + "target": "com.amazonaws.dynamodb#SourceTableFeatureDetails", "traits": { - "smithy.api#documentation": "

A PartiQL batch statement request.

" + "smithy.api#documentation": "

Contains the details of the features enabled on the table when the backup was created.\n For example, LSIs, GSIs, streams, TTL.

" } + } }, - "com.amazonaws.dynamodb#BatchStatementResponse": { - "type": "structure", - "members": { - "Error": { - "target": "com.amazonaws.dynamodb#BatchStatementError", - "traits": { - "smithy.api#documentation": "

The error associated with a failed PartiQL batch statement.

" - } - }, - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The table name associated with a failed PartiQL batch statement.

" - } - }, - "Item": { - "target": "com.amazonaws.dynamodb#AttributeMap", - "traits": { - "smithy.api#documentation": "

A DynamoDB item associated with a BatchStatementResponse

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Contains the description of the backup created for the table.

" + } + }, + "com.amazonaws.dynamodb#BackupDetails": { + "type": "structure", + "members": { + "BackupArn": { + "target": "com.amazonaws.dynamodb#BackupArn", "traits": { - "smithy.api#documentation": "

A PartiQL batch statement response..

" + "smithy.api#documentation": "

ARN associated with the backup.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#BatchWriteItem": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#BatchWriteItemInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#BatchWriteItemOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "BackupName": { + "target": "com.amazonaws.dynamodb#BackupName", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

The BatchWriteItem operation puts or deletes multiple items in one or\n more tables. A single call to BatchWriteItem can transmit up to 16MB of\n data over the network, consisting of up to 25 item put or delete operations. While\n individual items can be up to 400 KB once stored, it's important to note that an item's\n representation might be greater than 400KB while being sent in DynamoDB's JSON format\n for the API call. For more details on this distinction, see Naming Rules and Data Types.

\n \n

\n BatchWriteItem cannot update items. To update items, use the\n UpdateItem action.

\n
\n

The individual PutItem and DeleteItem operations specified\n in BatchWriteItem are atomic; however BatchWriteItem as a\n whole is not. If any requested operations fail because the table's provisioned\n throughput is exceeded or an internal processing failure occurs, the failed operations\n are returned in the UnprocessedItems response parameter. You can\n investigate and optionally resend the requests. Typically, you would call\n BatchWriteItem in a loop. Each iteration would check for unprocessed\n items and submit a new BatchWriteItem request with those unprocessed items\n until all items have been processed.

\n

If none of the items can be processed due to insufficient\n provisioned throughput on all of the tables in the request, then\n BatchWriteItem returns a\n ProvisionedThroughputExceededException.

\n \n

If DynamoDB returns any unprocessed items, you should retry the batch operation on\n those items. However, we strongly recommend that you use an exponential\n backoff algorithm. If you retry the batch operation immediately, the\n underlying read or write requests can still fail due to throttling on the individual\n tables. If you delay the batch operation using exponential backoff, the individual\n requests in the batch are much more likely to succeed.

\n

For more information, see Batch Operations and Error Handling in the Amazon DynamoDB\n Developer Guide.

\n
\n\n

With BatchWriteItem, you can efficiently write or delete large amounts of\n data, such as from Amazon EMR, or copy data from another database into DynamoDB. In\n order to improve performance with these large-scale operations,\n BatchWriteItem does not behave in the same way as individual\n PutItem and DeleteItem calls would. For example, you\n cannot specify conditions on individual put and delete requests, and\n BatchWriteItem does not return deleted items in the response.

\n

If you use a programming language that supports concurrency, you can use threads to\n write items in parallel. Your application must include the necessary logic to manage the\n threads. With languages that don't support threading, you must update or delete the\n specified items one at a time. In both situations, BatchWriteItem performs\n the specified put and delete operations in parallel, giving you the power of the thread\n pool approach without having to introduce complexity into your application.

\n

Parallel processing reduces latency, but each specified put and delete request\n consumes the same number of write capacity units whether it is processed in parallel or\n not. Delete operations on nonexistent items consume one write capacity unit.

\n

If one or more of the following is true, DynamoDB rejects the entire batch write\n operation:

\n
    \n
  • \n

    One or more tables specified in the BatchWriteItem request does\n not exist.

    \n
  • \n
  • \n

    Primary key attributes specified on an item in the request do not match those\n in the corresponding table's primary key schema.

    \n
  • \n
  • \n

    You try to perform multiple operations on the same item in the same\n BatchWriteItem request. For example, you cannot put and delete\n the same item in the same BatchWriteItem request.

    \n
  • \n
  • \n

    Your request contains at least two items with identical hash and range keys\n (which essentially is two put operations).

    \n
  • \n
  • \n

    There are more than 25 requests in the batch.

    \n
  • \n
  • \n

    Any individual item in a batch exceeds 400 KB.

    \n
  • \n
  • \n

    The total request size exceeds 16 MB.

    \n
  • \n
" + "smithy.api#documentation": "

Name of the requested backup.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#BatchWriteItemInput": { - "type": "structure", - "members": { - "RequestItems": { - "target": "com.amazonaws.dynamodb#BatchWriteItemRequestMap", - "traits": { - "smithy.api#documentation": "

A map of one or more table names and, for each table, a list of operations to be\n performed (DeleteRequest or PutRequest). Each element in the\n map consists of the following:

\n
    \n
  • \n

    \n DeleteRequest - Perform a DeleteItem operation on the\n specified item. The item to be deleted is identified by a Key\n subelement:

    \n
      \n
    • \n

      \n Key - A map of primary key attribute values that uniquely\n identify the item. Each entry in this map consists of an attribute name\n and an attribute value. For each primary key, you must provide\n all of the key attributes. For example, with a\n simple primary key, you only need to provide a value for the partition\n key. For a composite primary key, you must provide values for\n both the partition key and the sort key.

      \n
    • \n
    \n
  • \n
  • \n

    \n PutRequest - Perform a PutItem operation on the\n specified item. The item to be put is identified by an Item\n subelement:

    \n
      \n
    • \n

      \n Item - A map of attributes and their values. Each entry in\n this map consists of an attribute name and an attribute value. Attribute\n values must not be null; string and binary type attributes must have\n lengths greater than zero; and set type attributes must not be empty.\n Requests that contain empty values are rejected with a\n ValidationException exception.

      \n

      If you specify any attributes that are part of an index key, then the\n data types for those attributes must match those of the schema in the\n table's attribute definition.

      \n
    • \n
    \n
  • \n
", - "smithy.api#required": {} - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" - }, - "ReturnItemCollectionMetrics": { - "target": "com.amazonaws.dynamodb#ReturnItemCollectionMetrics", - "traits": { - "smithy.api#documentation": "

Determines whether item collection metrics are returned. If set to SIZE,\n the response includes statistics about item collections, if any, that were modified\n during the operation are returned in the response. If set to NONE (the\n default), no statistics are returned.

" - } - } - }, + }, + "BackupSizeBytes": { + "target": "com.amazonaws.dynamodb#BackupSizeBytes", "traits": { - "smithy.api#documentation": "

Represents the input of a BatchWriteItem operation.

" + "smithy.api#documentation": "

Size of the backup in bytes. DynamoDB updates this value approximately every six hours. \n Recent changes might not be reflected in this value.

" } - }, - "com.amazonaws.dynamodb#BatchWriteItemOutput": { - "type": "structure", - "members": { - "UnprocessedItems": { - "target": "com.amazonaws.dynamodb#BatchWriteItemRequestMap", - "traits": { - "smithy.api#documentation": "

A map of tables and requests against those tables that were not processed. The\n UnprocessedItems value is in the same form as\n RequestItems, so you can provide this value directly to a subsequent\n BatchGetItem operation. For more information, see\n RequestItems in the Request Parameters section.

\n

Each UnprocessedItems entry consists of a table name and, for that table,\n a list of operations to perform (DeleteRequest or\n PutRequest).

\n
    \n
  • \n

    \n DeleteRequest - Perform a DeleteItem operation on the\n specified item. The item to be deleted is identified by a Key\n subelement:

    \n
      \n
    • \n

      \n Key - A map of primary key attribute values that uniquely\n identify the item. Each entry in this map consists of an attribute name\n and an attribute value.

      \n
    • \n
    \n
  • \n
  • \n

    \n PutRequest - Perform a PutItem operation on the\n specified item. The item to be put is identified by an Item\n subelement:

    \n
      \n
    • \n

      \n Item - A map of attributes and their values. Each entry in\n this map consists of an attribute name and an attribute value. Attribute\n values must not be null; string and binary type attributes must have\n lengths greater than zero; and set type attributes must not be empty.\n Requests that contain empty values will be rejected with a\n ValidationException exception.

      \n

      If you specify any attributes that are part of an index key, then the\n data types for those attributes must match those of the schema in the\n table's attribute definition.

      \n
    • \n
    \n
  • \n
\n

If there are no unprocessed items remaining, the response contains an empty\n UnprocessedItems map.

" - } - }, - "ItemCollectionMetrics": { - "target": "com.amazonaws.dynamodb#ItemCollectionMetricsPerTable", - "traits": { - "smithy.api#documentation": "

A list of tables that were processed by BatchWriteItem and, for each\n table, information about any item collections that were affected by individual\n DeleteItem or PutItem operations.

\n

Each entry consists of the following subelements:

\n
    \n
  • \n

    \n ItemCollectionKey - The partition key value of the item collection.\n This is the same as the partition key value of the item.

    \n
  • \n
  • \n

    \n SizeEstimateRangeGB - An estimate of item collection size,\n expressed in GB. This is a two-element array containing a lower bound and an\n upper bound for the estimate. The estimate includes the size of all the items in\n the table, plus the size of all attributes projected into all of the local\n secondary indexes on the table. Use this estimate to measure whether a local\n secondary index is approaching its size limit.

    \n

    The estimate is subject to change over time; therefore, do not rely on the\n precision or accuracy of the estimate.

    \n
  • \n
" - } - }, - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", - "traits": { - "smithy.api#documentation": "

The capacity units consumed by the entire BatchWriteItem\n operation.

\n

Each element consists of:

\n
    \n
  • \n

    \n TableName - The table that consumed the provisioned\n throughput.

    \n
  • \n
  • \n

    \n CapacityUnits - The total number of capacity units consumed.

    \n
  • \n
" - } - } - }, + }, + "BackupStatus": { + "target": "com.amazonaws.dynamodb#BackupStatus", "traits": { - "smithy.api#documentation": "

Represents the output of a BatchWriteItem operation.

" + "smithy.api#documentation": "

Backup can be in one of the following states: CREATING, ACTIVE, DELETED.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#BatchWriteItemRequestMap": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#TableName" - }, - "value": { - "target": "com.amazonaws.dynamodb#WriteRequests" - }, + }, + "BackupType": { + "target": "com.amazonaws.dynamodb#BackupType", "traits": { - "smithy.api#length": { - "min": 1, - "max": 25 - } + "smithy.api#documentation": "

BackupType:

\n
    \n
  • \n

    \n USER - You create and manage these using the on-demand backup\n feature.

    \n
  • \n
  • \n

    \n SYSTEM - If you delete a table with point-in-time recovery enabled,\n a SYSTEM backup is automatically created and is retained for 35\n days (at no additional cost). System backups allow you to restore the deleted\n table to the state it was in just before the point of deletion.

    \n
  • \n
  • \n

    \n AWS_BACKUP - On-demand backup created by you from Backup service.

    \n
  • \n
", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#BilledSizeBytes": { - "type": "long", + }, + "BackupCreationDateTime": { + "target": "com.amazonaws.dynamodb#BackupCreationDateTime", "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 0 - } + "smithy.api#documentation": "

Time at which the backup was created. This is the request time of the backup.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#BillingMode": { - "type": "string", + }, + "BackupExpiryDateTime": { + "target": "com.amazonaws.dynamodb#Date", "traits": { - "smithy.api#enum": [ - { - "value": "PROVISIONED", - "name": "PROVISIONED" - }, - { - "value": "PAY_PER_REQUEST", - "name": "PAY_PER_REQUEST" - } - ] + "smithy.api#documentation": "

Time at which the automatic on-demand backup created by DynamoDB will\n expire. This SYSTEM on-demand backup expires automatically 35 days after\n its creation.

" } + } }, - "com.amazonaws.dynamodb#BillingModeSummary": { - "type": "structure", - "members": { - "BillingMode": { - "target": "com.amazonaws.dynamodb#BillingMode", - "traits": { - "smithy.api#documentation": "

Controls how you are charged for read and write throughput and how you manage\n capacity. This setting can be changed later.

\n
    \n
  • \n

    \n PROVISIONED - Sets the read/write capacity mode to\n PROVISIONED. We recommend using PROVISIONED for\n predictable workloads.

    \n
  • \n
  • \n

    \n PAY_PER_REQUEST - Sets the read/write capacity mode to\n PAY_PER_REQUEST. We recommend using\n PAY_PER_REQUEST for unpredictable workloads.

    \n
  • \n
" - } - }, - "LastUpdateToPayPerRequestDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

Represents the time when PAY_PER_REQUEST was last set as the read/write\n capacity mode.

" - } - } + "traits": { + "smithy.api#documentation": "

Contains the details of the backup created for the table.

" + } + }, + "com.amazonaws.dynamodb#BackupInUseException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

There is another ongoing conflicting backup control plane operation on the table.\n The backup is either being created, deleted or restored to a table.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#BackupName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 3, + "max": 255 + }, + "smithy.api#pattern": "^[a-zA-Z0-9_.-]+$" + } + }, + "com.amazonaws.dynamodb#BackupNotFoundException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

Backup not found for the given BackupARN.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#BackupSizeBytes": { + "type": "long", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 0 + } + } + }, + "com.amazonaws.dynamodb#BackupStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "CREATING", + "name": "CREATING" }, + { + "value": "DELETED", + "name": "DELETED" + }, + { + "value": "AVAILABLE", + "name": "AVAILABLE" + } + ] + } + }, + "com.amazonaws.dynamodb#BackupSummaries": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#BackupSummary" + } + }, + "com.amazonaws.dynamodb#BackupSummary": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

Contains the details for the read/write capacity mode.

" + "smithy.api#documentation": "

Name of the table.

" } - }, - "com.amazonaws.dynamodb#BinaryAttributeValue": { - "type": "blob" - }, - "com.amazonaws.dynamodb#BinarySetAttributeValue": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#BinaryAttributeValue" + }, + "TableId": { + "target": "com.amazonaws.dynamodb#TableId", + "traits": { + "smithy.api#documentation": "

Unique identifier for the table.

" } - }, - "com.amazonaws.dynamodb#BooleanAttributeValue": { - "type": "boolean", + }, + "TableArn": { + "target": "com.amazonaws.dynamodb#TableArn", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

ARN associated with the table.

" } - }, - "com.amazonaws.dynamodb#BooleanObject": { - "type": "boolean", + }, + "BackupArn": { + "target": "com.amazonaws.dynamodb#BackupArn", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

ARN associated with the backup.

" } - }, - "com.amazonaws.dynamodb#CancellationReason": { - "type": "structure", - "members": { - "Item": { - "target": "com.amazonaws.dynamodb#AttributeMap", - "traits": { - "smithy.api#documentation": "

Item in the request which caused the transaction to get cancelled.

" - } - }, - "Code": { - "target": "com.amazonaws.dynamodb#Code", - "traits": { - "smithy.api#documentation": "

Status code for the result of the cancelled transaction.

" - } - }, - "Message": { - "target": "com.amazonaws.dynamodb#ErrorMessage", - "traits": { - "smithy.api#documentation": "

Cancellation reason message description.

" - } - } - }, + }, + "BackupName": { + "target": "com.amazonaws.dynamodb#BackupName", "traits": { - "smithy.api#documentation": "

An ordered list of errors for each item in the request which caused the transaction to\n get cancelled. The values of the list are ordered according to the ordering of the\n TransactWriteItems request parameter. If no error occurred for the\n associated item an error with a Null code and Null message will be present.

" + "smithy.api#documentation": "

Name of the specified backup.

" } - }, - "com.amazonaws.dynamodb#CancellationReasonList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#CancellationReason" - }, + }, + "BackupCreationDateTime": { + "target": "com.amazonaws.dynamodb#BackupCreationDateTime", "traits": { - "smithy.api#length": { - "min": 1, - "max": 25 - } + "smithy.api#documentation": "

Time at which the backup was created.

" } - }, - "com.amazonaws.dynamodb#Capacity": { - "type": "structure", - "members": { - "ReadCapacityUnits": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", - "traits": { - "smithy.api#documentation": "

The total number of read capacity units consumed on a table or an index.

" - } - }, - "WriteCapacityUnits": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", - "traits": { - "smithy.api#documentation": "

The total number of write capacity units consumed on a table or an index.

" - } - }, - "CapacityUnits": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", - "traits": { - "smithy.api#documentation": "

The total number of capacity units consumed on a table or an index.

" - } - } - }, + }, + "BackupExpiryDateTime": { + "target": "com.amazonaws.dynamodb#Date", "traits": { - "smithy.api#documentation": "

Represents the amount of provisioned throughput capacity consumed on a table or an\n index.

" + "smithy.api#documentation": "

Time at which the automatic on-demand backup created by DynamoDB will\n expire. This SYSTEM on-demand backup expires automatically 35 days after\n its creation.

" } - }, - "com.amazonaws.dynamodb#ClientRequestToken": { - "type": "string", + }, + "BackupStatus": { + "target": "com.amazonaws.dynamodb#BackupStatus", "traits": { - "smithy.api#length": { - "min": 1, - "max": 36 - } + "smithy.api#documentation": "

Backup can be in one of the following states: CREATING, ACTIVE, DELETED.

" } - }, - "com.amazonaws.dynamodb#ClientToken": { - "type": "string", + }, + "BackupType": { + "target": "com.amazonaws.dynamodb#BackupType", "traits": { - "smithy.api#pattern": "^[^\\$]+$" + "smithy.api#documentation": "

BackupType:

\n
    \n
  • \n

    \n USER - You create and manage these using the on-demand backup\n feature.

    \n
  • \n
  • \n

    \n SYSTEM - If you delete a table with point-in-time recovery enabled,\n a SYSTEM backup is automatically created and is retained for 35\n days (at no additional cost). System backups allow you to restore the deleted\n table to the state it was in just before the point of deletion.

    \n
  • \n
  • \n

    \n AWS_BACKUP - On-demand backup created by you from Backup service.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#CloudWatchLogGroupArn": { - "type": "string", + }, + "BackupSizeBytes": { + "target": "com.amazonaws.dynamodb#BackupSizeBytes", "traits": { - "smithy.api#length": { - "min": 1, - "max": 1024 - } + "smithy.api#documentation": "

Size of the backup in bytes.

" } + } }, - "com.amazonaws.dynamodb#Code": { - "type": "string" - }, - "com.amazonaws.dynamodb#ComparisonOperator": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "EQ", - "name": "EQ" - }, - { - "value": "NE", - "name": "NE" - }, - { - "value": "IN", - "name": "IN" - }, - { - "value": "LE", - "name": "LE" - }, - { - "value": "LT", - "name": "LT" - }, - { - "value": "GE", - "name": "GE" - }, - { - "value": "GT", - "name": "GT" - }, - { - "value": "BETWEEN", - "name": "BETWEEN" - }, - { - "value": "NOT_NULL", - "name": "NOT_NULL" - }, - { - "value": "NULL", - "name": "NULL" - }, - { - "value": "CONTAINS", - "name": "CONTAINS" - }, - { - "value": "NOT_CONTAINS", - "name": "NOT_CONTAINS" - }, - { - "value": "BEGINS_WITH", - "name": "BEGINS_WITH" - } - ] + "traits": { + "smithy.api#documentation": "

Contains details for the backup.

" + } + }, + "com.amazonaws.dynamodb#BackupType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "USER", + "name": "USER" + }, + { + "value": "SYSTEM", + "name": "SYSTEM" + }, + { + "value": "AWS_BACKUP", + "name": "AWS_BACKUP" } - }, - "com.amazonaws.dynamodb#Condition": { - "type": "structure", - "members": { - "AttributeValueList": { - "target": "com.amazonaws.dynamodb#AttributeValueList", - "traits": { - "smithy.api#documentation": "

One or more values to evaluate against the supplied attribute. The number of values in\n the list depends on the ComparisonOperator being used.

\n

For type Number, value comparisons are numeric.

\n

String value comparisons for greater than, equals, or less than are based on ASCII\n character code values. For example, a is greater than A, and\n a is greater than B. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.

\n

For Binary, DynamoDB treats each byte of the binary data as unsigned when it\n compares binary values.

" - } - }, - "ComparisonOperator": { - "target": "com.amazonaws.dynamodb#ComparisonOperator", - "traits": { - "smithy.api#documentation": "

A comparator for evaluating attributes. For example, equals, greater than, less than,\n etc.

\n

The following comparison operators are available:

\n

\n EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS |\n BEGINS_WITH | IN | BETWEEN\n

\n

The following are descriptions of each comparison operator.

\n
    \n
  • \n

    \n EQ : Equal. EQ is supported for all data types,\n including lists and maps.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, Binary, String Set, Number Set, or Binary Set.\n If an item contains an AttributeValue element of a different type\n than the one provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not equal {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n NE : Not equal. NE is supported for all data types,\n including lists and maps.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String, Number, Binary, String Set, Number Set, or Binary Set. If an\n item contains an AttributeValue of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not equal {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n LE : Less than or equal.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n LT : Less than.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String, Number, or Binary (not a set type). If an item contains an\n AttributeValue element of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not compare to {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n GE : Greater than or equal.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n GT : Greater than.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n NOT_NULL : The attribute exists. NOT_NULL is supported\n for all data types, including lists and maps.

    \n \n

    This operator tests for the existence of an attribute, not its data type.\n If the data type of attribute \"a\" is null, and you evaluate it\n using NOT_NULL, the result is a Boolean true. This\n result is because the attribute \"a\" exists; its data type is\n not relevant to the NOT_NULL comparison operator.

    \n
    \n
  • \n
  • \n

    \n NULL : The attribute does not exist. NULL is supported\n for all data types, including lists and maps.

    \n \n

    This operator tests for the nonexistence of an attribute, not its data\n type. If the data type of attribute \"a\" is null, and you\n evaluate it using NULL, the result is a Boolean\n false. This is because the attribute \"a\"\n exists; its data type is not relevant to the NULL comparison\n operator.

    \n
    \n
  • \n
  • \n

    \n CONTAINS : Checks for a subsequence, or value in a set.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If the target\n attribute of the comparison is of type String, then the operator checks for a\n substring match. If the target attribute of the comparison is of type Binary,\n then the operator looks for a subsequence of the target that matches the input.\n If the target attribute of the comparison is a set (\"SS\",\n \"NS\", or \"BS\"), then the operator evaluates to\n true if it finds an exact match with any member of the set.

    \n

    CONTAINS is supported for lists: When evaluating \"a CONTAINS b\",\n \"a\" can be a list; however, \"b\" cannot be a set, a\n map, or a list.

    \n
  • \n
  • \n

    \n NOT_CONTAINS : Checks for absence of a subsequence, or absence of a\n value in a set.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If the target\n attribute of the comparison is a String, then the operator checks for the\n absence of a substring match. If the target attribute of the comparison is\n Binary, then the operator checks for the absence of a subsequence of the target\n that matches the input. If the target attribute of the comparison is a set\n (\"SS\", \"NS\", or \"BS\"), then the\n operator evaluates to true if it does not find an exact\n match with any member of the set.

    \n

    NOT_CONTAINS is supported for lists: When evaluating \"a NOT CONTAINS\n b\", \"a\" can be a list; however, \"b\" cannot\n be a set, a map, or a list.

    \n
  • \n
  • \n

    \n BEGINS_WITH : Checks for a prefix.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String or Binary (not a Number or a set type). The target attribute of\n the comparison must be of type String or Binary (not a Number or a set\n type).

    \n

    \n
  • \n
  • \n

    \n IN : Checks for matching elements in a list.

    \n

    \n AttributeValueList can contain one or more\n AttributeValue elements of type String, Number, or Binary.\n These attributes are compared against an existing attribute of an item. If any\n elements of the input are equal to the item attribute, the expression evaluates\n to true.

    \n
  • \n
  • \n

    \n BETWEEN : Greater than or equal to the first value, and less than\n or equal to the second value.

    \n

    \n AttributeValueList must contain two AttributeValue\n elements of the same type, either String, Number, or Binary (not a set type). A\n target attribute matches if the target value is greater than, or equal to, the\n first element and less than, or equal to, the second element. If an item\n contains an AttributeValue element of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not compare to {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not compare to {\"NS\":[\"6\", \"2\",\n \"1\"]}\n

    \n
  • \n
\n

For usage examples of AttributeValueList and\n ComparisonOperator, see Legacy\n Conditional Parameters in the Amazon DynamoDB Developer\n Guide.

", - "smithy.api#required": {} - } - } + ] + } + }, + "com.amazonaws.dynamodb#BackupTypeFilter": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "USER", + "name": "USER" + }, + { + "value": "SYSTEM", + "name": "SYSTEM" }, + { + "value": "AWS_BACKUP", + "name": "AWS_BACKUP" + }, + { + "value": "ALL", + "name": "ALL" + } + ] + } + }, + "com.amazonaws.dynamodb#BackupsInputLimit": { + "type": "integer", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 1, + "max": 100 + } + } + }, + "com.amazonaws.dynamodb#BatchExecuteStatement": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#BatchExecuteStatementInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#BatchExecuteStatementOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + } + ], + "traits": { + "smithy.api#documentation": "

This operation allows you to perform batch reads or writes on data stored in DynamoDB,\n using PartiQL. Each read statement in a BatchExecuteStatement must specify an equality\n condition on all key attributes. This enforces that each SELECT statement in a\n batch returns at most a single item.

\n \n

The entire batch must consist of either read statements or write statements, you\n cannot mix both in one batch.

\n
\n \n

A HTTP 200 response does not mean that all statements in the BatchExecuteStatement\n succeeded. Error details for individual statements can be found under the Error field of the BatchStatementResponse for each\n statement.

\n
" + } + }, + "com.amazonaws.dynamodb#BatchExecuteStatementInput": { + "type": "structure", + "members": { + "Statements": { + "target": "com.amazonaws.dynamodb#PartiQLBatchRequest", + "traits": { + "smithy.api#documentation": "

The list of PartiQL statements representing the batch to run.

", + "smithy.api#required": {} + } + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" + } + } + }, + "com.amazonaws.dynamodb#BatchExecuteStatementOutput": { + "type": "structure", + "members": { + "Responses": { + "target": "com.amazonaws.dynamodb#PartiQLBatchResponse", "traits": { - "smithy.api#documentation": "

Represents the selection criteria for a Query or Scan\n operation:

\n
    \n
  • \n

    For a Query operation, Condition is used for\n specifying the KeyConditions to use when querying a table or an\n index. For KeyConditions, only the following comparison operators\n are supported:

    \n

    \n EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN\n

    \n

    \n Condition is also used in a QueryFilter, which\n evaluates the query results and returns only the desired values.

    \n
  • \n
  • \n

    For a Scan operation, Condition is used in a\n ScanFilter, which evaluates the scan results and returns only\n the desired values.

    \n
  • \n
" + "smithy.api#documentation": "

The response to each PartiQL statement in the batch.

" } - }, - "com.amazonaws.dynamodb#ConditionCheck": { - "type": "structure", - "members": { - "Key": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

The primary key of the item to be checked. Each element consists of an attribute name\n and a value for that attribute.

", - "smithy.api#required": {} - } - }, - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

Name of the table for the check item request.

", - "smithy.api#required": {} - } - }, - "ConditionExpression": { - "target": "com.amazonaws.dynamodb#ConditionExpression", - "traits": { - "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional update to\n succeed.

", - "smithy.api#required": {} - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression.

" - } - }, - "ExpressionAttributeValues": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", - "traits": { - "smithy.api#documentation": "

One or more values that can be substituted in an expression.

" - } - }, - "ReturnValuesOnConditionCheckFailure": { - "target": "com.amazonaws.dynamodb#ReturnValuesOnConditionCheckFailure", - "traits": { - "smithy.api#documentation": "

Use ReturnValuesOnConditionCheckFailure to get the item attributes if the\n ConditionCheck condition fails. For\n ReturnValuesOnConditionCheckFailure, the valid values are: NONE and\n ALL_OLD.

" - } - } - }, + }, + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", "traits": { - "smithy.api#documentation": "

Represents a request to perform a check that an item exists or to check the condition\n of specific attributes of the item.

" + "smithy.api#documentation": "

The capacity units consumed by the entire operation. The values of the list are\n ordered according to the ordering of the statements.

" } + } + } + }, + "com.amazonaws.dynamodb#BatchGetItem": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#BatchGetItemInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#BatchGetItemOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

The BatchGetItem operation returns the attributes of one or more items\n from one or more tables. You identify requested items by primary key.

\n

A single operation can retrieve up to 16 MB of data, which can contain as many as 100\n items. BatchGetItem returns a partial result if the response size limit is\n exceeded, the table's provisioned throughput is exceeded, or an internal processing\n failure occurs. If a partial result is returned, the operation returns a value for\n UnprocessedKeys. You can use this value to retry the operation starting\n with the next item to get.

\n \n

If you request more than 100 items, BatchGetItem returns a\n ValidationException with the message \"Too many items requested for\n the BatchGetItem call.\"

\n
\n

For example, if you ask to retrieve 100 items, but each individual item is 300 KB in\n size, the system returns 52 items (so as not to exceed the 16 MB limit). It also returns\n an appropriate UnprocessedKeys value so you can get the next page of\n results. If desired, your application can include its own logic to assemble the pages of\n results into one dataset.

\n

If none of the items can be processed due to insufficient\n provisioned throughput on all of the tables in the request, then\n BatchGetItem returns a\n ProvisionedThroughputExceededException. If at least\n one of the items is successfully processed, then\n BatchGetItem completes successfully, while returning the keys of the\n unread items in UnprocessedKeys.

\n \n

If DynamoDB returns any unprocessed items, you should retry the batch operation on\n those items. However, we strongly recommend that you use an exponential\n backoff algorithm. If you retry the batch operation immediately, the\n underlying read or write requests can still fail due to throttling on the individual\n tables. If you delay the batch operation using exponential backoff, the individual\n requests in the batch are much more likely to succeed.

\n

For more information, see Batch Operations and Error Handling in the Amazon DynamoDB\n Developer Guide.

\n
\n

By default, BatchGetItem performs eventually consistent reads on every\n table in the request. If you want strongly consistent reads instead, you can set\n ConsistentRead to true for any or all tables.

\n

In order to minimize response latency, BatchGetItem retrieves items in\n parallel.

\n

When designing your application, keep in mind that DynamoDB does not return items in\n any particular order. To help parse the response by item, include the primary key values\n for the items in your request in the ProjectionExpression parameter.

\n

If a requested item does not exist, it is not returned in the result. Requests for\n nonexistent items consume the minimum read capacity units according to the type of read.\n For more information, see Working with Tables in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "com.amazonaws.dynamodb#BatchGetItemInput": { + "type": "structure", + "members": { + "RequestItems": { + "target": "com.amazonaws.dynamodb#BatchGetRequestMap", + "traits": { + "smithy.api#documentation": "

A map of one or more table names and, for each table, a map that describes one or more\n items to retrieve from that table. Each table name can be used only once per\n BatchGetItem request.

\n

Each element in the map of items to retrieve consists of the following:

\n
    \n
  • \n

    \n ConsistentRead - If true, a strongly consistent read\n is used; if false (the default), an eventually consistent read is\n used.

    \n
  • \n
  • \n

    \n ExpressionAttributeNames - One or more substitution tokens for\n attribute names in the ProjectionExpression parameter. The\n following are some use cases for using\n ExpressionAttributeNames:

    \n
      \n
    • \n

      To access an attribute whose name conflicts with a DynamoDB reserved\n word.

      \n
    • \n
    • \n

      To create a placeholder for repeating occurrences of an attribute name\n in an expression.

      \n
    • \n
    • \n

      To prevent special characters in an attribute name from being\n misinterpreted in an expression.

      \n
    • \n
    \n

    Use the # character in an expression to\n dereference an attribute name. For example, consider the following attribute\n name:

    \n
      \n
    • \n

      \n Percentile\n

      \n
    • \n
    \n

    The name of this attribute conflicts with a reserved word, so it cannot be\n used directly in an expression. (For the complete list of reserved words, see\n Reserved\n Words in the Amazon DynamoDB Developer Guide).\n To work around this, you could specify the following for\n ExpressionAttributeNames:

    \n
      \n
    • \n

      \n {\"#P\":\"Percentile\"}\n

      \n
    • \n
    \n

    You could then use this substitution in an expression, as in this\n example:

    \n
      \n
    • \n

      \n #P = :val\n

      \n
    • \n
    \n \n

    Tokens that begin with the : character\n are expression attribute values, which are placeholders\n for the actual value at runtime.

    \n
    \n

    For more information about expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB\n Developer Guide.

    \n
  • \n
  • \n

    \n Keys - An array of primary key attribute values that define\n specific items in the table. For each primary key, you must provide\n all of the key attributes. For example, with a simple\n primary key, you only need to provide the partition key value. For a composite\n key, you must provide both the partition key value and the\n sort key value.

    \n
  • \n
  • \n

    \n ProjectionExpression - A string that identifies one or more\n attributes to retrieve from the table. These attributes can include scalars,\n sets, or elements of a JSON document. The attributes in the expression must be\n separated by commas.

    \n

    If no attribute names are specified, then all attributes are returned. If any\n of the requested attributes are not found, they do not appear in the\n result.

    \n

    For more information, see Accessing Item Attributes in the Amazon DynamoDB\n Developer Guide.

    \n
  • \n
  • \n

    \n AttributesToGet - This is a legacy parameter. Use\n ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer\n Guide.

    \n\n
  • \n
", + "smithy.api#required": {} + } + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" + } }, - "com.amazonaws.dynamodb#ConditionExpression": { - "type": "string" - }, - "com.amazonaws.dynamodb#ConditionalCheckFailedException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage", - "traits": { - "smithy.api#documentation": "

The conditional request failed.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the input of a BatchGetItem operation.

" + } + }, + "com.amazonaws.dynamodb#BatchGetItemOutput": { + "type": "structure", + "members": { + "Responses": { + "target": "com.amazonaws.dynamodb#BatchGetResponseMap", "traits": { - "smithy.api#documentation": "

A condition specified in the operation could not be evaluated.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

A map of table name to a list of items. Each object in Responses consists\n of a table name, along with a map of attribute data consisting of the data type and\n attribute value.

" } - }, - "com.amazonaws.dynamodb#ConditionalOperator": { - "type": "string", + }, + "UnprocessedKeys": { + "target": "com.amazonaws.dynamodb#BatchGetRequestMap", "traits": { - "smithy.api#enum": [ - { - "value": "AND", - "name": "AND" - }, - { - "value": "OR", - "name": "OR" - } - ] + "smithy.api#documentation": "

A map of tables and their respective keys that were not processed with the current\n response. The UnprocessedKeys value is in the same form as\n RequestItems, so the value can be provided directly to a subsequent\n BatchGetItem operation. For more information, see\n RequestItems in the Request Parameters section.

\n

Each element consists of:

\n
    \n
  • \n

    \n Keys - An array of primary key attribute values that define\n specific items in the table.

    \n
  • \n
  • \n

    \n ProjectionExpression - One or more attributes to be retrieved from\n the table or index. By default, all attributes are returned. If a requested\n attribute is not found, it does not appear in the result.

    \n
  • \n
  • \n

    \n ConsistentRead - The consistency of a read operation. If set to\n true, then a strongly consistent read is used; otherwise, an\n eventually consistent read is used.

    \n
  • \n
\n

If there are no unprocessed keys remaining, the response contains an empty\n UnprocessedKeys map.

" } + }, + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", + "traits": { + "smithy.api#documentation": "

The read capacity units consumed by the entire BatchGetItem\n operation.

\n

Each element consists of:

\n
    \n
  • \n

    \n TableName - The table that consumed the provisioned\n throughput.

    \n
  • \n
  • \n

    \n CapacityUnits - The total number of capacity units consumed.

    \n
  • \n
" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the output of a BatchGetItem operation.

" + } + }, + "com.amazonaws.dynamodb#BatchGetRequestMap": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#TableName" + }, + "value": { + "target": "com.amazonaws.dynamodb#KeysAndAttributes" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 100 + } + } + }, + "com.amazonaws.dynamodb#BatchGetResponseMap": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#TableName" }, - "com.amazonaws.dynamodb#ConsistentRead": { - "type": "boolean", + "value": { + "target": "com.amazonaws.dynamodb#ItemList" + } + }, + "com.amazonaws.dynamodb#BatchStatementError": { + "type": "structure", + "members": { + "Code": { + "target": "com.amazonaws.dynamodb#BatchStatementErrorCodeEnum", + "traits": { + "smithy.api#documentation": "

The error code associated with the failed PartiQL batch statement.

" + } + }, + "Message": { + "target": "com.amazonaws.dynamodb#String", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

The error message associated with the PartiQL batch response.

" } + } }, - "com.amazonaws.dynamodb#ConsumedCapacity": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table that was affected by the operation.

" - } - }, - "CapacityUnits": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", - "traits": { - "smithy.api#documentation": "

The total number of capacity units consumed by the operation.

" - } - }, - "ReadCapacityUnits": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", - "traits": { - "smithy.api#documentation": "

The total number of read capacity units consumed by the operation.

" - } - }, - "WriteCapacityUnits": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", - "traits": { - "smithy.api#documentation": "

The total number of write capacity units consumed by the operation.

" - } - }, - "Table": { - "target": "com.amazonaws.dynamodb#Capacity", - "traits": { - "smithy.api#documentation": "

The amount of throughput consumed on the table affected by the operation.

" - } - }, - "LocalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#SecondaryIndexesCapacityMap", - "traits": { - "smithy.api#documentation": "

The amount of throughput consumed on each local index affected by the\n operation.

" - } - }, - "GlobalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#SecondaryIndexesCapacityMap", - "traits": { - "smithy.api#documentation": "

The amount of throughput consumed on each global index affected by the\n operation.

" - } - } + "traits": { + "smithy.api#documentation": "

An error associated with a statement in a PartiQL batch that was run.

" + } + }, + "com.amazonaws.dynamodb#BatchStatementErrorCodeEnum": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "ConditionalCheckFailed", + "name": "ConditionalCheckFailed" }, - "traits": { - "smithy.api#documentation": "

The capacity units consumed by an operation. The data returned includes the total\n provisioned throughput consumed, along with statistics for the table and any indexes\n involved in the operation. ConsumedCapacity is only returned if the request\n asked for it. For more information, see Provisioned Throughput in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "com.amazonaws.dynamodb#ConsumedCapacityMultiple": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ConsumedCapacity" + { + "value": "ItemCollectionSizeLimitExceeded", + "name": "ItemCollectionSizeLimitExceeded" + }, + { + "value": "RequestLimitExceeded", + "name": "RequestLimitExceeded" + }, + { + "value": "ValidationError", + "name": "ValidationError" + }, + { + "value": "ProvisionedThroughputExceeded", + "name": "ProvisionedThroughputExceeded" + }, + { + "value": "TransactionConflict", + "name": "TransactionConflict" + }, + { + "value": "ThrottlingError", + "name": "ThrottlingError" + }, + { + "value": "InternalServerError", + "name": "InternalServerError" + }, + { + "value": "ResourceNotFound", + "name": "ResourceNotFound" + }, + { + "value": "AccessDenied", + "name": "AccessDenied" + }, + { + "value": "DuplicateItem", + "name": "DuplicateItem" } - }, - "com.amazonaws.dynamodb#ConsumedCapacityUnits": { - "type": "double", + ] + } + }, + "com.amazonaws.dynamodb#BatchStatementRequest": { + "type": "structure", + "members": { + "Statement": { + "target": "com.amazonaws.dynamodb#PartiQLStatement", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

A valid PartiQL statement.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ContinuousBackupsDescription": { - "type": "structure", - "members": { - "ContinuousBackupsStatus": { - "target": "com.amazonaws.dynamodb#ContinuousBackupsStatus", - "traits": { - "smithy.api#documentation": "

\n ContinuousBackupsStatus can be one of the following states: ENABLED,\n DISABLED

", - "smithy.api#required": {} - } - }, - "PointInTimeRecoveryDescription": { - "target": "com.amazonaws.dynamodb#PointInTimeRecoveryDescription", - "traits": { - "smithy.api#documentation": "

The description of the point in time recovery settings applied to the table.

" - } - } - }, + }, + "Parameters": { + "target": "com.amazonaws.dynamodb#PreparedStatementParameters", "traits": { - "smithy.api#documentation": "

Represents the continuous backups and point in time recovery settings on the\n table.

" + "smithy.api#documentation": "

The parameters associated with a PartiQL statement in the batch request.

" } - }, - "com.amazonaws.dynamodb#ContinuousBackupsStatus": { - "type": "string", + }, + "ConsistentRead": { + "target": "com.amazonaws.dynamodb#ConsistentRead", "traits": { - "smithy.api#enum": [ - { - "value": "ENABLED", - "name": "ENABLED" - }, - { - "value": "DISABLED", - "name": "DISABLED" - } - ] + "smithy.api#documentation": "

The read consistency of the PartiQL batch request.

" } + } }, - "com.amazonaws.dynamodb#ContinuousBackupsUnavailableException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + "traits": { + "smithy.api#documentation": "

A PartiQL batch statement request.

" + } + }, + "com.amazonaws.dynamodb#BatchStatementResponse": { + "type": "structure", + "members": { + "Error": { + "target": "com.amazonaws.dynamodb#BatchStatementError", "traits": { - "smithy.api#documentation": "

Backups have not yet been enabled for this table.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The error associated with a failed PartiQL batch statement.

" } - }, - "com.amazonaws.dynamodb#ContributorInsightsAction": { - "type": "string", + }, + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#enum": [ - { - "value": "ENABLE", - "name": "ENABLE" - }, - { - "value": "DISABLE", - "name": "DISABLE" - } - ] - } - }, - "com.amazonaws.dynamodb#ContributorInsightsRule": { - "type": "string", - "traits": { - "smithy.api#pattern": "^[A-Za-z0-9][A-Za-z0-9\\-\\_\\.]{0,126}[A-Za-z0-9]$" - } - }, - "com.amazonaws.dynamodb#ContributorInsightsRuleList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ContributorInsightsRule" - } - }, - "com.amazonaws.dynamodb#ContributorInsightsStatus": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "ENABLING", - "name": "ENABLING" - }, - { - "value": "ENABLED", - "name": "ENABLED" - }, - { - "value": "DISABLING", - "name": "DISABLING" - }, - { - "value": "DISABLED", - "name": "DISABLED" - }, - { - "value": "FAILED", - "name": "FAILED" - } - ] + "smithy.api#documentation": "

The table name associated with a failed PartiQL batch statement.

" } - }, - "com.amazonaws.dynamodb#ContributorInsightsSummaries": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ContributorInsightsSummary" - } - }, - "com.amazonaws.dynamodb#ContributorInsightsSummary": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

Name of the table associated with the summary.

" - } - }, - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

Name of the index associated with the summary, if any.

" - } - }, - "ContributorInsightsStatus": { - "target": "com.amazonaws.dynamodb#ContributorInsightsStatus", - "traits": { - "smithy.api#documentation": "

Describes the current status for contributor insights for the given table and index,\n if applicable.

" - } - } - }, + }, + "Item": { + "target": "com.amazonaws.dynamodb#AttributeMap", "traits": { - "smithy.api#documentation": "

Represents a Contributor Insights summary entry.

" + "smithy.api#documentation": "

A DynamoDB item associated with a BatchStatementResponse

" } + } }, - "com.amazonaws.dynamodb#CreateBackup": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#CreateBackupInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#CreateBackupOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#BackupInUseException" - }, - { - "target": "com.amazonaws.dynamodb#ContinuousBackupsUnavailableException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#TableInUseException" - }, - { - "target": "com.amazonaws.dynamodb#TableNotFoundException" - } - ], + "traits": { + "smithy.api#documentation": "

A PartiQL batch statement response..

" + } + }, + "com.amazonaws.dynamodb#BatchWriteItem": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#BatchWriteItemInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#BatchWriteItemOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

The BatchWriteItem operation puts or deletes multiple items in one or\n more tables. A single call to BatchWriteItem can transmit up to 16MB of\n data over the network, consisting of up to 25 item put or delete operations. While\n individual items can be up to 400 KB once stored, it's important to note that an item's\n representation might be greater than 400KB while being sent in DynamoDB's JSON format\n for the API call. For more details on this distinction, see Naming Rules and Data Types.

\n \n

\n BatchWriteItem cannot update items. To update items, use the\n UpdateItem action.

\n
\n

The individual PutItem and DeleteItem operations specified\n in BatchWriteItem are atomic; however BatchWriteItem as a\n whole is not. If any requested operations fail because the table's provisioned\n throughput is exceeded or an internal processing failure occurs, the failed operations\n are returned in the UnprocessedItems response parameter. You can\n investigate and optionally resend the requests. Typically, you would call\n BatchWriteItem in a loop. Each iteration would check for unprocessed\n items and submit a new BatchWriteItem request with those unprocessed items\n until all items have been processed.

\n

If none of the items can be processed due to insufficient\n provisioned throughput on all of the tables in the request, then\n BatchWriteItem returns a\n ProvisionedThroughputExceededException.

\n \n

If DynamoDB returns any unprocessed items, you should retry the batch operation on\n those items. However, we strongly recommend that you use an exponential\n backoff algorithm. If you retry the batch operation immediately, the\n underlying read or write requests can still fail due to throttling on the individual\n tables. If you delay the batch operation using exponential backoff, the individual\n requests in the batch are much more likely to succeed.

\n

For more information, see Batch Operations and Error Handling in the Amazon DynamoDB\n Developer Guide.

\n
\n\n

With BatchWriteItem, you can efficiently write or delete large amounts of\n data, such as from Amazon EMR, or copy data from another database into DynamoDB. In\n order to improve performance with these large-scale operations,\n BatchWriteItem does not behave in the same way as individual\n PutItem and DeleteItem calls would. For example, you\n cannot specify conditions on individual put and delete requests, and\n BatchWriteItem does not return deleted items in the response.

\n

If you use a programming language that supports concurrency, you can use threads to\n write items in parallel. Your application must include the necessary logic to manage the\n threads. With languages that don't support threading, you must update or delete the\n specified items one at a time. In both situations, BatchWriteItem performs\n the specified put and delete operations in parallel, giving you the power of the thread\n pool approach without having to introduce complexity into your application.

\n

Parallel processing reduces latency, but each specified put and delete request\n consumes the same number of write capacity units whether it is processed in parallel or\n not. Delete operations on nonexistent items consume one write capacity unit.

\n

If one or more of the following is true, DynamoDB rejects the entire batch write\n operation:

\n
    \n
  • \n

    One or more tables specified in the BatchWriteItem request does\n not exist.

    \n
  • \n
  • \n

    Primary key attributes specified on an item in the request do not match those\n in the corresponding table's primary key schema.

    \n
  • \n
  • \n

    You try to perform multiple operations on the same item in the same\n BatchWriteItem request. For example, you cannot put and delete\n the same item in the same BatchWriteItem request.

    \n
  • \n
  • \n

    Your request contains at least two items with identical hash and range keys\n (which essentially is two put operations).

    \n
  • \n
  • \n

    There are more than 25 requests in the batch.

    \n
  • \n
  • \n

    Any individual item in a batch exceeds 400 KB.

    \n
  • \n
  • \n

    The total request size exceeds 16 MB.

    \n
  • \n
" + } + }, + "com.amazonaws.dynamodb#BatchWriteItemInput": { + "type": "structure", + "members": { + "RequestItems": { + "target": "com.amazonaws.dynamodb#BatchWriteItemRequestMap", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Creates a backup for an existing table.

\n

Each time you create an on-demand backup, the entire table data is backed up. There\n is no limit to the number of on-demand backups that can be taken.

\n

When you create an on-demand backup, a time marker of the request is cataloged, and\n the backup is created asynchronously, by applying all changes until the time of the\n request to the last full table snapshot. Backup requests are processed instantaneously\n and become available for restore within minutes.

\n

You can call CreateBackup at a maximum rate of 50 times per\n second.

\n

All backups in DynamoDB work without consuming any provisioned throughput on the\n table.

\n

If you submit a backup request on 2018-12-14 at 14:25:00, the backup is guaranteed to\n contain all data committed to the table up to 14:24:00, and data committed after\n 14:26:00 will not be. The backup might contain data modifications made between 14:24:00\n and 14:26:00. On-demand backup does not support causal consistency.

\n

Along with data, the following are also included on the backups:

\n
    \n
  • \n

    Global secondary indexes (GSIs)

    \n
  • \n
  • \n

    Local secondary indexes (LSIs)

    \n
  • \n
  • \n

    Streams

    \n
  • \n
  • \n

    Provisioned read and write capacity

    \n
  • \n
" - } - }, - "com.amazonaws.dynamodb#CreateBackupInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table.

", - "smithy.api#required": {} - } - }, - "BackupName": { - "target": "com.amazonaws.dynamodb#BackupName", - "traits": { - "smithy.api#documentation": "

Specified name for the backup.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.dynamodb#CreateBackupOutput": { - "type": "structure", - "members": { - "BackupDetails": { - "target": "com.amazonaws.dynamodb#BackupDetails", - "traits": { - "smithy.api#documentation": "

Contains the details of the backup created for the table.

" - } - } + "smithy.api#documentation": "

A map of one or more table names and, for each table, a list of operations to be\n performed (DeleteRequest or PutRequest). Each element in the\n map consists of the following:

\n
    \n
  • \n

    \n DeleteRequest - Perform a DeleteItem operation on the\n specified item. The item to be deleted is identified by a Key\n subelement:

    \n
      \n
    • \n

      \n Key - A map of primary key attribute values that uniquely\n identify the item. Each entry in this map consists of an attribute name\n and an attribute value. For each primary key, you must provide\n all of the key attributes. For example, with a\n simple primary key, you only need to provide a value for the partition\n key. For a composite primary key, you must provide values for\n both the partition key and the sort key.

      \n
    • \n
    \n
  • \n
  • \n

    \n PutRequest - Perform a PutItem operation on the\n specified item. The item to be put is identified by an Item\n subelement:

    \n
      \n
    • \n

      \n Item - A map of attributes and their values. Each entry in\n this map consists of an attribute name and an attribute value. Attribute\n values must not be null; string and binary type attributes must have\n lengths greater than zero; and set type attributes must not be empty.\n Requests that contain empty values are rejected with a\n ValidationException exception.

      \n

      If you specify any attributes that are part of an index key, then the\n data types for those attributes must match those of the schema in the\n table's attribute definition.

      \n
    • \n
    \n
  • \n
", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#CreateGlobalSecondaryIndexAction": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index to be created.

", - "smithy.api#required": {} - } - }, - "KeySchema": { - "target": "com.amazonaws.dynamodb#KeySchema", - "traits": { - "smithy.api#documentation": "

The key schema for the global secondary index.

", - "smithy.api#required": {} - } - }, - "Projection": { - "target": "com.amazonaws.dynamodb#Projection", - "traits": { - "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into an index. These\n are in addition to the primary key attributes and index key attributes, which are\n automatically projected.

", - "smithy.api#required": {} - } - }, - "ProvisionedThroughput": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughput", - "traits": { - "smithy.api#documentation": "

Represents the provisioned throughput settings for the specified global secondary\n index.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" - } - } - }, + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" + }, + "ReturnItemCollectionMetrics": { + "target": "com.amazonaws.dynamodb#ReturnItemCollectionMetrics", "traits": { - "smithy.api#documentation": "

Represents a new global secondary index to be added to an existing table.

" + "smithy.api#documentation": "

Determines whether item collection metrics are returned. If set to SIZE,\n the response includes statistics about item collections, if any, that were modified\n during the operation are returned in the response. If set to NONE (the\n default), no statistics are returned.

" } + } }, - "com.amazonaws.dynamodb#CreateGlobalTable": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#CreateGlobalTableInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#CreateGlobalTableOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#GlobalTableAlreadyExistsException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#TableNotFoundException" - } - ], + "traits": { + "smithy.api#documentation": "

Represents the input of a BatchWriteItem operation.

" + } + }, + "com.amazonaws.dynamodb#BatchWriteItemOutput": { + "type": "structure", + "members": { + "UnprocessedItems": { + "target": "com.amazonaws.dynamodb#BatchWriteItemRequestMap", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Creates a global table from an existing table. A global table creates a replication\n relationship between two or more DynamoDB tables with the same table name in the\n provided Regions.

\n \n

This operation only applies to Version\n 2017.11.29 of global tables.

\n
\n\n

If you want to add a new replica table to a global table, each of the following\n conditions must be true:

\n
    \n
  • \n

    The table must have the same primary key as all of the other replicas.

    \n
  • \n
  • \n

    The table must have the same name as all of the other replicas.

    \n
  • \n
  • \n

    The table must have DynamoDB Streams enabled, with the stream containing both\n the new and the old images of the item.

    \n
  • \n
  • \n

    None of the replica tables in the global table can contain any data.

    \n
  • \n
\n

If global secondary indexes are specified, then the following conditions must also be\n met:

\n
    \n
  • \n

    The global secondary indexes must have the same name.

    \n
  • \n
  • \n

    The global secondary indexes must have the same hash key and sort key (if\n present).

    \n
  • \n
\n

If local secondary indexes are specified, then the following conditions must also be\n met:

\n
    \n
  • \n

    The local secondary indexes must have the same name.

    \n
  • \n
  • \n

    The local secondary indexes must have the same hash key and sort key (if\n present).

    \n
  • \n
\n\n \n

Write capacity settings should be set consistently across your replica tables and\n secondary indexes. DynamoDB strongly recommends enabling auto scaling to manage the\n write capacity settings for all of your global tables replicas and indexes.

\n

If you prefer to manage write capacity settings manually, you should provision\n equal replicated write capacity units to your replica tables. You should also\n provision equal replicated write capacity units to matching secondary indexes across\n your global table.

\n
" - } - }, - "com.amazonaws.dynamodb#CreateGlobalTableInput": { - "type": "structure", - "members": { - "GlobalTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The global table name.

", - "smithy.api#required": {} - } - }, - "ReplicationGroup": { - "target": "com.amazonaws.dynamodb#ReplicaList", - "traits": { - "smithy.api#documentation": "

The Regions where the global table needs to be created.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.dynamodb#CreateGlobalTableOutput": { - "type": "structure", - "members": { - "GlobalTableDescription": { - "target": "com.amazonaws.dynamodb#GlobalTableDescription", - "traits": { - "smithy.api#documentation": "

Contains the details of the global table.

" - } - } + "smithy.api#documentation": "

A map of tables and requests against those tables that were not processed. The\n UnprocessedItems value is in the same form as\n RequestItems, so you can provide this value directly to a subsequent\n BatchGetItem operation. For more information, see\n RequestItems in the Request Parameters section.

\n

Each UnprocessedItems entry consists of a table name and, for that table,\n a list of operations to perform (DeleteRequest or\n PutRequest).

\n
    \n
  • \n

    \n DeleteRequest - Perform a DeleteItem operation on the\n specified item. The item to be deleted is identified by a Key\n subelement:

    \n
      \n
    • \n

      \n Key - A map of primary key attribute values that uniquely\n identify the item. Each entry in this map consists of an attribute name\n and an attribute value.

      \n
    • \n
    \n
  • \n
  • \n

    \n PutRequest - Perform a PutItem operation on the\n specified item. The item to be put is identified by an Item\n subelement:

    \n
      \n
    • \n

      \n Item - A map of attributes and their values. Each entry in\n this map consists of an attribute name and an attribute value. Attribute\n values must not be null; string and binary type attributes must have\n lengths greater than zero; and set type attributes must not be empty.\n Requests that contain empty values will be rejected with a\n ValidationException exception.

      \n

      If you specify any attributes that are part of an index key, then the\n data types for those attributes must match those of the schema in the\n table's attribute definition.

      \n
    • \n
    \n
  • \n
\n

If there are no unprocessed items remaining, the response contains an empty\n UnprocessedItems map.

" } - }, - "com.amazonaws.dynamodb#CreateReplicaAction": { - "type": "structure", - "members": { - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

The Region of the replica to be added.

", - "smithy.api#required": {} - } - } - }, + }, + "ItemCollectionMetrics": { + "target": "com.amazonaws.dynamodb#ItemCollectionMetricsPerTable", "traits": { - "smithy.api#documentation": "

Represents a replica to be added.

" + "smithy.api#documentation": "

A list of tables that were processed by BatchWriteItem and, for each\n table, information about any item collections that were affected by individual\n DeleteItem or PutItem operations.

\n

Each entry consists of the following subelements:

\n
    \n
  • \n

    \n ItemCollectionKey - The partition key value of the item collection.\n This is the same as the partition key value of the item.

    \n
  • \n
  • \n

    \n SizeEstimateRangeGB - An estimate of item collection size,\n expressed in GB. This is a two-element array containing a lower bound and an\n upper bound for the estimate. The estimate includes the size of all the items in\n the table, plus the size of all attributes projected into all of the local\n secondary indexes on the table. Use this estimate to measure whether a local\n secondary index is approaching its size limit.

    \n

    The estimate is subject to change over time; therefore, do not rely on the\n precision or accuracy of the estimate.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#CreateReplicationGroupMemberAction": { - "type": "structure", - "members": { - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

The Region where the new replica will be created.

", - "smithy.api#required": {} - } - }, - "KMSMasterKeyId": { - "target": "com.amazonaws.dynamodb#KMSMasterKeyId", - "traits": { - "smithy.api#documentation": "

The KMS key that should be used for KMS encryption in\n the new replica. To specify a key, use its key ID, Amazon Resource Name (ARN), alias\n name, or alias ARN. Note that you should only provide this parameter if the key is\n different from the default DynamoDB KMS key\n alias/aws/dynamodb.

" - } - }, - "ProvisionedThroughputOverride": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputOverride", - "traits": { - "smithy.api#documentation": "

Replica-specific provisioned throughput. If not specified, uses the source table's\n provisioned throughput settings.

" - } - }, - "GlobalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexList", - "traits": { - "smithy.api#documentation": "

Replica-specific global secondary index settings.

" - } - }, - "TableClassOverride": { - "target": "com.amazonaws.dynamodb#TableClass", - "traits": { - "smithy.api#documentation": "

Replica-specific table class. If not specified, uses the source table's\n table class.

" - } - } - }, + }, + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", "traits": { - "smithy.api#documentation": "

Represents a replica to be created.

" + "smithy.api#documentation": "

The capacity units consumed by the entire BatchWriteItem\n operation.

\n

Each element consists of:

\n
    \n
  • \n

    \n TableName - The table that consumed the provisioned\n throughput.

    \n
  • \n
  • \n

    \n CapacityUnits - The total number of capacity units consumed.

    \n
  • \n
" } + } }, - "com.amazonaws.dynamodb#CreateTable": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#CreateTableInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#CreateTableOutput" + "traits": { + "smithy.api#documentation": "

Represents the output of a BatchWriteItem operation.

" + } + }, + "com.amazonaws.dynamodb#BatchWriteItemRequestMap": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#TableName" + }, + "value": { + "target": "com.amazonaws.dynamodb#WriteRequests" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 25 + } + } + }, + "com.amazonaws.dynamodb#BilledSizeBytes": { + "type": "long", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 0 + } + } + }, + "com.amazonaws.dynamodb#BillingMode": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "PROVISIONED", + "name": "PROVISIONED" }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceInUseException" - } - ], + { + "value": "PAY_PER_REQUEST", + "name": "PAY_PER_REQUEST" + } + ] + } + }, + "com.amazonaws.dynamodb#BillingModeSummary": { + "type": "structure", + "members": { + "BillingMode": { + "target": "com.amazonaws.dynamodb#BillingMode", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

The CreateTable operation adds a new table to your account. In an Amazon Web Services account, table names must be unique within each Region. That is, you can\n have two tables with same name if you create the tables in different Regions.

\n

\n CreateTable is an asynchronous operation. Upon receiving a\n CreateTable request, DynamoDB immediately returns a response with a\n TableStatus of CREATING. After the table is created,\n DynamoDB sets the TableStatus to ACTIVE. You can perform read\n and write operations only on an ACTIVE table.

\n

You can optionally define secondary indexes on the new table, as part of the\n CreateTable operation. If you want to create multiple tables with\n secondary indexes on them, you must create the tables sequentially. Only one table with\n secondary indexes can be in the CREATING state at any given time.

\n

You can use the DescribeTable action to check the table status.

" + "smithy.api#documentation": "

Controls how you are charged for read and write throughput and how you manage\n capacity. This setting can be changed later.

\n
    \n
  • \n

    \n PROVISIONED - Sets the read/write capacity mode to\n PROVISIONED. We recommend using PROVISIONED for\n predictable workloads.

    \n
  • \n
  • \n

    \n PAY_PER_REQUEST - Sets the read/write capacity mode to\n PAY_PER_REQUEST. We recommend using\n PAY_PER_REQUEST for unpredictable workloads.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#CreateTableInput": { - "type": "structure", - "members": { - "AttributeDefinitions": { - "target": "com.amazonaws.dynamodb#AttributeDefinitions", - "traits": { - "smithy.api#documentation": "

An array of attributes that describe the key schema for the table and indexes.

", - "smithy.api#required": {} - } - }, - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table to create.

", - "smithy.api#required": {} - } - }, - "KeySchema": { - "target": "com.amazonaws.dynamodb#KeySchema", - "traits": { - "smithy.api#documentation": "

Specifies the attributes that make up the primary key for a table or an index. The\n attributes in KeySchema must also be defined in the\n AttributeDefinitions array. For more information, see Data\n Model in the Amazon DynamoDB Developer Guide.

\n

Each KeySchemaElement in the array is composed of:

\n
    \n
  • \n

    \n AttributeName - The name of this key attribute.

    \n
  • \n
  • \n

    \n KeyType - The role that the key attribute will assume:

    \n
      \n
    • \n

      \n HASH - partition key

      \n
    • \n
    • \n

      \n RANGE - sort key

      \n
    • \n
    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from the DynamoDB usage\n of an internal hash function to evenly distribute data items across partitions,\n based on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with the same\n partition key physically close together, in sorted order by the sort key\n value.

\n
\n\n

For a simple primary key (partition key), you must provide exactly one element with a\n KeyType of HASH.

\n

For a composite primary key (partition key and sort key), you must provide exactly two\n elements, in this order: The first element must have a KeyType of\n HASH, and the second element must have a KeyType of\n RANGE.

\n

For more information, see Working with Tables in the Amazon DynamoDB Developer\n Guide.

", - "smithy.api#required": {} - } - }, - "LocalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#LocalSecondaryIndexList", - "traits": { - "smithy.api#documentation": "

One or more local secondary indexes (the maximum is 5) to be created on the table.\n Each index is scoped to a given partition key value. There is a 10 GB size limit per\n partition key value; otherwise, the size of a local secondary index is\n unconstrained.

\n

Each local secondary index in the array includes the following:

\n
    \n
  • \n

    \n IndexName - The name of the local secondary index. Must be unique\n only for this table.

    \n

    \n
  • \n
  • \n

    \n KeySchema - Specifies the key schema for the local secondary index.\n The key schema must begin with the same partition key as the table.

    \n
  • \n
  • \n

    \n Projection - Specifies attributes that are copied (projected) from\n the table into the index. These are in addition to the primary key attributes\n and index key attributes, which are automatically projected. Each attribute\n specification is composed of:

    \n
      \n
    • \n

      \n ProjectionType - One of the following:

      \n
        \n
      • \n

        \n KEYS_ONLY - Only the index and primary keys are\n projected into the index.

        \n
      • \n
      • \n

        \n INCLUDE - Only the specified table attributes are\n projected into the index. The list of projected attributes is in\n NonKeyAttributes.

        \n
      • \n
      • \n

        \n ALL - All of the table attributes are projected\n into the index.

        \n
      • \n
      \n
    • \n
    • \n

      \n NonKeyAttributes - A list of one or more non-key attribute\n names that are projected into the secondary index. The total count of\n attributes provided in NonKeyAttributes, summed across all\n of the secondary indexes, must not exceed 100. If you project the same\n attribute into two different indexes, this counts as two distinct\n attributes when determining the total.

      \n
    • \n
    \n
  • \n
" - } - }, - "GlobalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexList", - "traits": { - "smithy.api#documentation": "

One or more global secondary indexes (the maximum is 20) to be created on the table.\n Each global secondary index in the array includes the following:

\n
    \n
  • \n

    \n IndexName - The name of the global secondary index. Must be unique\n only for this table.

    \n

    \n
  • \n
  • \n

    \n KeySchema - Specifies the key schema for the global secondary\n index.

    \n
  • \n
  • \n

    \n Projection - Specifies attributes that are copied (projected) from\n the table into the index. These are in addition to the primary key attributes\n and index key attributes, which are automatically projected. Each attribute\n specification is composed of:

    \n
      \n
    • \n

      \n ProjectionType - One of the following:

      \n
        \n
      • \n

        \n KEYS_ONLY - Only the index and primary keys are\n projected into the index.

        \n
      • \n
      • \n

        \n INCLUDE - Only the specified table attributes are\n projected into the index. The list of projected attributes is in\n NonKeyAttributes.

        \n
      • \n
      • \n

        \n ALL - All of the table attributes are projected\n into the index.

        \n
      • \n
      \n
    • \n
    • \n

      \n NonKeyAttributes - A list of one or more non-key attribute\n names that are projected into the secondary index. The total count of\n attributes provided in NonKeyAttributes, summed across all\n of the secondary indexes, must not exceed 100. If you project the same\n attribute into two different indexes, this counts as two distinct\n attributes when determining the total.

      \n
    • \n
    \n
  • \n
  • \n

    \n ProvisionedThroughput - The provisioned throughput settings for the\n global secondary index, consisting of read and write capacity units.

    \n
  • \n
" - } - }, - "BillingMode": { - "target": "com.amazonaws.dynamodb#BillingMode", - "traits": { - "smithy.api#documentation": "

Controls how you are charged for read and write throughput and how you manage\n capacity. This setting can be changed later.

\n
    \n
  • \n

    \n PROVISIONED - We recommend using PROVISIONED for\n predictable workloads. PROVISIONED sets the billing mode to Provisioned Mode.

    \n
  • \n
  • \n

    \n PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST\n for unpredictable workloads. PAY_PER_REQUEST sets the billing mode\n to On-Demand Mode.

    \n
  • \n
" - } - }, - "ProvisionedThroughput": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughput", - "traits": { - "smithy.api#documentation": "

Represents the provisioned throughput settings for a specified table or index. The\n settings can be modified using the UpdateTable operation.

\n

If you set BillingMode as PROVISIONED, you must specify this property.\n If you set BillingMode as PAY_PER_REQUEST, you cannot specify this\n property.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "StreamSpecification": { - "target": "com.amazonaws.dynamodb#StreamSpecification", - "traits": { - "smithy.api#documentation": "

The settings for DynamoDB Streams on the table. These settings consist of:

\n
    \n
  • \n

    \n StreamEnabled - Indicates whether DynamoDB Streams is to be enabled\n (true) or disabled (false).

    \n
  • \n
  • \n

    \n StreamViewType - When an item in the table is modified,\n StreamViewType determines what information is written to the\n table's stream. Valid values for StreamViewType are:

    \n
      \n
    • \n

      \n KEYS_ONLY - Only the key attributes of the modified item\n are written to the stream.

      \n
    • \n
    • \n

      \n NEW_IMAGE - The entire item, as it appears after it was\n modified, is written to the stream.

      \n
    • \n
    • \n

      \n OLD_IMAGE - The entire item, as it appeared before it was\n modified, is written to the stream.

      \n
    • \n
    • \n

      \n NEW_AND_OLD_IMAGES - Both the new and the old item images\n of the item are written to the stream.

      \n
    • \n
    \n
  • \n
" - } - }, - "SSESpecification": { - "target": "com.amazonaws.dynamodb#SSESpecification", - "traits": { - "smithy.api#documentation": "

Represents the settings used to enable server-side encryption.

" - } - }, - "Tags": { - "target": "com.amazonaws.dynamodb#TagList", - "traits": { - "smithy.api#documentation": "

A list of key-value pairs to label the table. For more information, see Tagging\n for DynamoDB.

" - } - }, - "TableClass": { - "target": "com.amazonaws.dynamodb#TableClass", - "traits": { - "smithy.api#documentation": "

The table class of the new table. Valid values are STANDARD and\n STANDARD_INFREQUENT_ACCESS.

" - } - } - }, + }, + "LastUpdateToPayPerRequestDateTime": { + "target": "com.amazonaws.dynamodb#Date", "traits": { - "smithy.api#documentation": "

Represents the input of a CreateTable operation.

" + "smithy.api#documentation": "

Represents the time when PAY_PER_REQUEST was last set as the read/write\n capacity mode.

" } + } }, - "com.amazonaws.dynamodb#CreateTableOutput": { - "type": "structure", - "members": { - "TableDescription": { - "target": "com.amazonaws.dynamodb#TableDescription", - "traits": { - "smithy.api#documentation": "

Represents the properties of the table.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Contains the details for the read/write capacity mode.

" + } + }, + "com.amazonaws.dynamodb#BinaryAttributeValue": { + "type": "blob" + }, + "com.amazonaws.dynamodb#BinarySetAttributeValue": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#BinaryAttributeValue" + } + }, + "com.amazonaws.dynamodb#BooleanAttributeValue": { + "type": "boolean", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#BooleanObject": { + "type": "boolean", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#CancellationReason": { + "type": "structure", + "members": { + "Item": { + "target": "com.amazonaws.dynamodb#AttributeMap", "traits": { - "smithy.api#documentation": "

Represents the output of a CreateTable operation.

" + "smithy.api#documentation": "

Item in the request which caused the transaction to get cancelled.

" } - }, - "com.amazonaws.dynamodb#CsvDelimiter": { - "type": "string", + }, + "Code": { + "target": "com.amazonaws.dynamodb#Code", "traits": { - "smithy.api#length": { - "min": 1, - "max": 1 - }, - "smithy.api#pattern": "^[,;:|\\t ]$" + "smithy.api#documentation": "

Status code for the result of the cancelled transaction.

" } - }, - "com.amazonaws.dynamodb#CsvHeader": { - "type": "string", + }, + "Message": { + "target": "com.amazonaws.dynamodb#ErrorMessage", "traits": { - "smithy.api#length": { - "min": 1, - "max": 65536 - }, - "smithy.api#pattern": "^[\\x20-\\x21\\x23-\\x2B\\x2D-\\x7E]*$" + "smithy.api#documentation": "

Cancellation reason message description.

" } + } }, - "com.amazonaws.dynamodb#CsvHeaderList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#CsvHeader" - }, + "traits": { + "smithy.api#documentation": "

An ordered list of errors for each item in the request which caused the transaction to\n get cancelled. The values of the list are ordered according to the ordering of the\n TransactWriteItems request parameter. If no error occurred for the\n associated item an error with a Null code and Null message will be present.

" + } + }, + "com.amazonaws.dynamodb#CancellationReasonList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#CancellationReason" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 25 + } + } + }, + "com.amazonaws.dynamodb#Capacity": { + "type": "structure", + "members": { + "ReadCapacityUnits": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", "traits": { - "smithy.api#length": { - "min": 1, - "max": 255 - } + "smithy.api#documentation": "

The total number of read capacity units consumed on a table or an index.

" } - }, - "com.amazonaws.dynamodb#CsvOptions": { - "type": "structure", - "members": { - "Delimiter": { - "target": "com.amazonaws.dynamodb#CsvDelimiter", - "traits": { - "smithy.api#documentation": "

\n The delimiter used for separating items in the CSV file being imported.\n

" - } - }, - "HeaderList": { - "target": "com.amazonaws.dynamodb#CsvHeaderList", - "traits": { - "smithy.api#documentation": "

List of the headers used to specify a common header for all source CSV files being\n imported. If this field is specified then the first line of each CSV file is treated as\n data instead of the header. If this field is not specified the the first line of each\n CSV file is treated as the header. \n

" - } - } - }, + }, + "WriteCapacityUnits": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", "traits": { - "smithy.api#documentation": "

\n Processing options for the CSV file being imported.\n

" + "smithy.api#documentation": "

The total number of write capacity units consumed on a table or an index.

" } - }, - "com.amazonaws.dynamodb#Date": { - "type": "timestamp" - }, - "com.amazonaws.dynamodb#Delete": { - "type": "structure", - "members": { - "Key": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

The primary key of the item to be deleted. Each element consists of an attribute name\n and a value for that attribute.

", - "smithy.api#required": {} - } - }, - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

Name of the table in which the item to be deleted resides.

", - "smithy.api#required": {} - } - }, - "ConditionExpression": { - "target": "com.amazonaws.dynamodb#ConditionExpression", - "traits": { - "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional delete to\n succeed.

" - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression.

" - } - }, - "ExpressionAttributeValues": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", - "traits": { - "smithy.api#documentation": "

One or more values that can be substituted in an expression.

" - } - }, - "ReturnValuesOnConditionCheckFailure": { - "target": "com.amazonaws.dynamodb#ReturnValuesOnConditionCheckFailure", - "traits": { - "smithy.api#documentation": "

Use ReturnValuesOnConditionCheckFailure to get the item attributes if the\n Delete condition fails. For\n ReturnValuesOnConditionCheckFailure, the valid values are: NONE and\n ALL_OLD.

" - } - } - }, + }, + "CapacityUnits": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", "traits": { - "smithy.api#documentation": "

Represents a request to perform a DeleteItem operation.

" + "smithy.api#documentation": "

The total number of capacity units consumed on a table or an index.

" } + } }, - "com.amazonaws.dynamodb#DeleteBackup": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DeleteBackupInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DeleteBackupOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#BackupInUseException" - }, - { - "target": "com.amazonaws.dynamodb#BackupNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - } - ], + "traits": { + "smithy.api#documentation": "

Represents the amount of provisioned throughput capacity consumed on a table or an\n index.

" + } + }, + "com.amazonaws.dynamodb#ClientRequestToken": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 36 + } + } + }, + "com.amazonaws.dynamodb#ClientToken": { + "type": "string", + "traits": { + "smithy.api#pattern": "^[^\\$]+$" + } + }, + "com.amazonaws.dynamodb#CloudWatchLogGroupArn": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 1024 + } + } + }, + "com.amazonaws.dynamodb#Code": { + "type": "string" + }, + "com.amazonaws.dynamodb#ComparisonOperator": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "EQ", + "name": "EQ" + }, + { + "value": "NE", + "name": "NE" + }, + { + "value": "IN", + "name": "IN" + }, + { + "value": "LE", + "name": "LE" + }, + { + "value": "LT", + "name": "LT" + }, + { + "value": "GE", + "name": "GE" + }, + { + "value": "GT", + "name": "GT" + }, + { + "value": "BETWEEN", + "name": "BETWEEN" + }, + { + "value": "NOT_NULL", + "name": "NOT_NULL" + }, + { + "value": "NULL", + "name": "NULL" + }, + { + "value": "CONTAINS", + "name": "CONTAINS" + }, + { + "value": "NOT_CONTAINS", + "name": "NOT_CONTAINS" + }, + { + "value": "BEGINS_WITH", + "name": "BEGINS_WITH" + } + ] + } + }, + "com.amazonaws.dynamodb#Condition": { + "type": "structure", + "members": { + "AttributeValueList": { + "target": "com.amazonaws.dynamodb#AttributeValueList", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Deletes an existing backup of a table.

\n

You can call DeleteBackup at a maximum rate of 10 times per\n second.

" + "smithy.api#documentation": "

One or more values to evaluate against the supplied attribute. The number of values in\n the list depends on the ComparisonOperator being used.

\n

For type Number, value comparisons are numeric.

\n

String value comparisons for greater than, equals, or less than are based on ASCII\n character code values. For example, a is greater than A, and\n a is greater than B. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.

\n

For Binary, DynamoDB treats each byte of the binary data as unsigned when it\n compares binary values.

" } - }, - "com.amazonaws.dynamodb#DeleteBackupInput": { - "type": "structure", - "members": { - "BackupArn": { - "target": "com.amazonaws.dynamodb#BackupArn", - "traits": { - "smithy.api#documentation": "

The ARN associated with the backup.

", - "smithy.api#required": {} - } - } + }, + "ComparisonOperator": { + "target": "com.amazonaws.dynamodb#ComparisonOperator", + "traits": { + "smithy.api#documentation": "

A comparator for evaluating attributes. For example, equals, greater than, less than,\n etc.

\n

The following comparison operators are available:

\n

\n EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS |\n BEGINS_WITH | IN | BETWEEN\n

\n

The following are descriptions of each comparison operator.

\n
    \n
  • \n

    \n EQ : Equal. EQ is supported for all data types,\n including lists and maps.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, Binary, String Set, Number Set, or Binary Set.\n If an item contains an AttributeValue element of a different type\n than the one provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not equal {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n NE : Not equal. NE is supported for all data types,\n including lists and maps.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String, Number, Binary, String Set, Number Set, or Binary Set. If an\n item contains an AttributeValue of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not equal {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n LE : Less than or equal.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n LT : Less than.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String, Number, or Binary (not a set type). If an item contains an\n AttributeValue element of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not compare to {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n GE : Greater than or equal.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n GT : Greater than.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n NOT_NULL : The attribute exists. NOT_NULL is supported\n for all data types, including lists and maps.

    \n \n

    This operator tests for the existence of an attribute, not its data type.\n If the data type of attribute \"a\" is null, and you evaluate it\n using NOT_NULL, the result is a Boolean true. This\n result is because the attribute \"a\" exists; its data type is\n not relevant to the NOT_NULL comparison operator.

    \n
    \n
  • \n
  • \n

    \n NULL : The attribute does not exist. NULL is supported\n for all data types, including lists and maps.

    \n \n

    This operator tests for the nonexistence of an attribute, not its data\n type. If the data type of attribute \"a\" is null, and you\n evaluate it using NULL, the result is a Boolean\n false. This is because the attribute \"a\"\n exists; its data type is not relevant to the NULL comparison\n operator.

    \n
    \n
  • \n
  • \n

    \n CONTAINS : Checks for a subsequence, or value in a set.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If the target\n attribute of the comparison is of type String, then the operator checks for a\n substring match. If the target attribute of the comparison is of type Binary,\n then the operator looks for a subsequence of the target that matches the input.\n If the target attribute of the comparison is a set (\"SS\",\n \"NS\", or \"BS\"), then the operator evaluates to\n true if it finds an exact match with any member of the set.

    \n

    CONTAINS is supported for lists: When evaluating \"a CONTAINS b\",\n \"a\" can be a list; however, \"b\" cannot be a set, a\n map, or a list.

    \n
  • \n
  • \n

    \n NOT_CONTAINS : Checks for absence of a subsequence, or absence of a\n value in a set.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If the target\n attribute of the comparison is a String, then the operator checks for the\n absence of a substring match. If the target attribute of the comparison is\n Binary, then the operator checks for the absence of a subsequence of the target\n that matches the input. If the target attribute of the comparison is a set\n (\"SS\", \"NS\", or \"BS\"), then the\n operator evaluates to true if it does not find an exact\n match with any member of the set.

    \n

    NOT_CONTAINS is supported for lists: When evaluating \"a NOT CONTAINS\n b\", \"a\" can be a list; however, \"b\" cannot\n be a set, a map, or a list.

    \n
  • \n
  • \n

    \n BEGINS_WITH : Checks for a prefix.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String or Binary (not a Number or a set type). The target attribute of\n the comparison must be of type String or Binary (not a Number or a set\n type).

    \n

    \n
  • \n
  • \n

    \n IN : Checks for matching elements in a list.

    \n

    \n AttributeValueList can contain one or more\n AttributeValue elements of type String, Number, or Binary.\n These attributes are compared against an existing attribute of an item. If any\n elements of the input are equal to the item attribute, the expression evaluates\n to true.

    \n
  • \n
  • \n

    \n BETWEEN : Greater than or equal to the first value, and less than\n or equal to the second value.

    \n

    \n AttributeValueList must contain two AttributeValue\n elements of the same type, either String, Number, or Binary (not a set type). A\n target attribute matches if the target value is greater than, or equal to, the\n first element and less than, or equal to, the second element. If an item\n contains an AttributeValue element of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not compare to {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not compare to {\"NS\":[\"6\", \"2\",\n \"1\"]}\n

    \n
  • \n
\n

For usage examples of AttributeValueList and\n ComparisonOperator, see Legacy\n Conditional Parameters in the Amazon DynamoDB Developer\n Guide.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#DeleteBackupOutput": { - "type": "structure", - "members": { - "BackupDescription": { - "target": "com.amazonaws.dynamodb#BackupDescription", - "traits": { - "smithy.api#documentation": "

Contains the description of the backup created for the table.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents the selection criteria for a Query or Scan\n operation:

\n
    \n
  • \n

    For a Query operation, Condition is used for\n specifying the KeyConditions to use when querying a table or an\n index. For KeyConditions, only the following comparison operators\n are supported:

    \n

    \n EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN\n

    \n

    \n Condition is also used in a QueryFilter, which\n evaluates the query results and returns only the desired values.

    \n
  • \n
  • \n

    For a Scan operation, Condition is used in a\n ScanFilter, which evaluates the scan results and returns only\n the desired values.

    \n
  • \n
" + } + }, + "com.amazonaws.dynamodb#ConditionCheck": { + "type": "structure", + "members": { + "Key": { + "target": "com.amazonaws.dynamodb#Key", + "traits": { + "smithy.api#documentation": "

The primary key of the item to be checked. Each element consists of an attribute name\n and a value for that attribute.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DeleteGlobalSecondaryIndexAction": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index to be deleted.

", - "smithy.api#required": {} - } - } - }, + }, + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

Represents a global secondary index to be deleted from an existing table.

" + "smithy.api#documentation": "

Name of the table for the check item request.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DeleteItem": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DeleteItemInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DeleteItemOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#ConditionalCheckFailedException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#TransactionConflictException" - } - ], + }, + "ConditionExpression": { + "target": "com.amazonaws.dynamodb#ConditionExpression", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Deletes a single item in a table by primary key. You can perform a conditional delete\n operation that deletes the item if it exists, or if it has an expected attribute\n value.

\n

In addition to deleting an item, you can also return the item's attribute values in\n the same operation, using the ReturnValues parameter.

\n

Unless you specify conditions, the DeleteItem is an idempotent operation;\n running it multiple times on the same item or attribute does not\n result in an error response.

\n

Conditional deletes are useful for deleting items only if specific conditions are met.\n If those conditions are met, DynamoDB performs the delete. Otherwise, the item is not\n deleted.

" + "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional update to\n succeed.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DeleteItemInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table from which to delete the item.

", - "smithy.api#required": {} - } - }, - "Key": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

A map of attribute names to AttributeValue objects, representing the\n primary key of the item to delete.

\n

For the primary key, you must provide all of the attributes. For example, with a\n simple primary key, you only need to provide a value for the partition key. For a\n composite primary key, you must provide values for both the partition key and the sort\n key.

", - "smithy.api#required": {} - } - }, - "Expected": { - "target": "com.amazonaws.dynamodb#ExpectedAttributeMap", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see Expected in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ConditionalOperator": { - "target": "com.amazonaws.dynamodb#ConditionalOperator", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see ConditionalOperator in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ReturnValues": { - "target": "com.amazonaws.dynamodb#ReturnValue", - "traits": { - "smithy.api#documentation": "

Use ReturnValues if you want to get the item attributes as they appeared\n before they were deleted. For DeleteItem, the valid values are:

\n
    \n
  • \n

    \n NONE - If ReturnValues is not specified, or if its\n value is NONE, then nothing is returned. (This setting is the\n default for ReturnValues.)

    \n
  • \n
  • \n

    \n ALL_OLD - The content of the old item is returned.

    \n
  • \n
\n

There is no additional cost associated with requesting a return value aside from the small \n network and processing overhead of receiving a larger response. No read capacity units are \n consumed.

\n \n

The ReturnValues parameter is used by several DynamoDB operations;\n however, DeleteItem does not recognize any values other than\n NONE or ALL_OLD.

\n
" - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" - }, - "ReturnItemCollectionMetrics": { - "target": "com.amazonaws.dynamodb#ReturnItemCollectionMetrics", - "traits": { - "smithy.api#documentation": "

Determines whether item collection metrics are returned. If set to SIZE,\n the response includes statistics about item collections, if any, that were modified\n during the operation are returned in the response. If set to NONE (the\n default), no statistics are returned.

" - } - }, - "ConditionExpression": { - "target": "com.amazonaws.dynamodb#ConditionExpression", - "traits": { - "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional DeleteItem\n to succeed.

\n

An expression can contain any of the following:

\n
    \n
  • \n

    Functions: attribute_exists | attribute_not_exists | attribute_type |\n contains | begins_with | size\n

    \n

    These function names are case-sensitive.

    \n
  • \n
  • \n

    Comparison operators: = | <> |\n < | > | <= | >= |\n BETWEEN | IN \n

    \n
  • \n
  • \n

    Logical operators: AND | OR | NOT\n

    \n
  • \n
\n

For more information about condition expressions, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExpressionAttributeValues": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", - "traits": { - "smithy.api#documentation": "

One or more values that can be substituted in an expression.

\n

Use the : (colon) character in an expression to\n dereference an attribute value. For example, suppose that you wanted to check whether\n the value of the ProductStatus attribute was one of the following:

\n

\n Available | Backordered | Discontinued\n

\n

You would first need to specify ExpressionAttributeValues as\n follows:

\n

\n { \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"},\n \":disc\":{\"S\":\"Discontinued\"} }\n

\n

You could then use these values in an expression, such as this:

\n

\n ProductStatus IN (:avail, :back, :disc)\n

\n

For more information on expression attribute values, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" - } - } - }, + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", "traits": { - "smithy.api#documentation": "

Represents the input of a DeleteItem operation.

" + "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression.

" } - }, - "com.amazonaws.dynamodb#DeleteItemOutput": { - "type": "structure", - "members": { - "Attributes": { - "target": "com.amazonaws.dynamodb#AttributeMap", - "traits": { - "smithy.api#documentation": "

A map of attribute names to AttributeValue objects, representing the item\n as it appeared before the DeleteItem operation. This map appears in the\n response only if ReturnValues was specified as ALL_OLD in the\n request.

" - } - }, - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacity", - "traits": { - "smithy.api#documentation": "

The capacity units consumed by the DeleteItem operation. The data\n returned includes the total provisioned throughput consumed, along with statistics for\n the table and any indexes involved in the operation. ConsumedCapacity is\n only returned if the ReturnConsumedCapacity parameter was specified. For\n more information, see Provisioned Mode in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ItemCollectionMetrics": { - "target": "com.amazonaws.dynamodb#ItemCollectionMetrics", - "traits": { - "smithy.api#documentation": "

Information about item collections, if any, that were affected by the\n DeleteItem operation. ItemCollectionMetrics is only\n returned if the ReturnItemCollectionMetrics parameter was specified. If the\n table does not have any local secondary indexes, this information is not returned in the\n response.

\n

Each ItemCollectionMetrics element consists of:

\n
    \n
  • \n

    \n ItemCollectionKey - The partition key value of the item collection.\n This is the same as the partition key value of the item itself.

    \n
  • \n
  • \n

    \n SizeEstimateRangeGB - An estimate of item collection size, in\n gigabytes. This value is a two-element array containing a lower bound and an\n upper bound for the estimate. The estimate includes the size of all the items in\n the table, plus the size of all attributes projected into all of the local\n secondary indexes on that table. Use this estimate to measure whether a local\n secondary index is approaching its size limit.

    \n

    The estimate is subject to change over time; therefore, do not rely on the\n precision or accuracy of the estimate.

    \n
  • \n
" - } - } - }, + }, + "ExpressionAttributeValues": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", "traits": { - "smithy.api#documentation": "

Represents the output of a DeleteItem operation.

" + "smithy.api#documentation": "

One or more values that can be substituted in an expression.

" } - }, - "com.amazonaws.dynamodb#DeleteReplicaAction": { - "type": "structure", - "members": { - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

The Region of the replica to be removed.

", - "smithy.api#required": {} - } - } - }, + }, + "ReturnValuesOnConditionCheckFailure": { + "target": "com.amazonaws.dynamodb#ReturnValuesOnConditionCheckFailure", "traits": { - "smithy.api#documentation": "

Represents a replica to be removed.

" + "smithy.api#documentation": "

Use ReturnValuesOnConditionCheckFailure to get the item attributes if the\n ConditionCheck condition fails. For\n ReturnValuesOnConditionCheckFailure, the valid values are: NONE and\n ALL_OLD.

" } + } }, - "com.amazonaws.dynamodb#DeleteReplicationGroupMemberAction": { - "type": "structure", - "members": { - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

The Region where the replica exists.

", - "smithy.api#required": {} - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents a request to perform a check that an item exists or to check the condition\n of specific attributes of the item.

" + } + }, + "com.amazonaws.dynamodb#ConditionExpression": { + "type": "string" + }, + "com.amazonaws.dynamodb#ConditionalCheckFailedException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage", "traits": { - "smithy.api#documentation": "

Represents a replica to be deleted.

" + "smithy.api#documentation": "

The conditional request failed.

" } + } }, - "com.amazonaws.dynamodb#DeleteRequest": { - "type": "structure", - "members": { - "Key": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

A map of attribute name to attribute values, representing the primary key of the item\n to delete. All of the table's primary key attributes must be specified, and their data\n types must match those of the table's key schema.

", - "smithy.api#required": {} - } - } + "traits": { + "smithy.api#documentation": "

A condition specified in the operation could not be evaluated.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ConditionalOperator": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "AND", + "name": "AND" }, + { + "value": "OR", + "name": "OR" + } + ] + } + }, + "com.amazonaws.dynamodb#ConsistentRead": { + "type": "boolean", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#ConsumedCapacity": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

Represents a request to perform a DeleteItem operation on an item.

" + "smithy.api#documentation": "

The name of the table that was affected by the operation.

" } - }, - "com.amazonaws.dynamodb#DeleteTable": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DeleteTableInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DeleteTableOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceInUseException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "CapacityUnits": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

The DeleteTable operation deletes a table and all of its items. After a\n DeleteTable request, the specified table is in the\n DELETING state until DynamoDB completes the deletion. If the table is\n in the ACTIVE state, you can delete it. If a table is in\n CREATING or UPDATING states, then DynamoDB returns a\n ResourceInUseException. If the specified table does not exist, DynamoDB\n returns a ResourceNotFoundException. If table is already in the\n DELETING state, no error is returned.

\n \n

DynamoDB might continue to accept data read and write operations, such as\n GetItem and PutItem, on a table in the\n DELETING state until the table deletion is complete.

\n
\n

When you delete a table, any indexes on that table are also deleted.

\n

If you have DynamoDB Streams enabled on the table, then the corresponding stream on\n that table goes into the DISABLED state, and the stream is automatically\n deleted after 24 hours.

\n\n

Use the DescribeTable action to check the status of the table.

" + "smithy.api#documentation": "

The total number of capacity units consumed by the operation.

" } - }, - "com.amazonaws.dynamodb#DeleteTableInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table to delete.

", - "smithy.api#required": {} - } - } - }, + }, + "ReadCapacityUnits": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", "traits": { - "smithy.api#documentation": "

Represents the input of a DeleteTable operation.

" + "smithy.api#documentation": "

The total number of read capacity units consumed by the operation.

" } - }, - "com.amazonaws.dynamodb#DeleteTableOutput": { - "type": "structure", - "members": { - "TableDescription": { - "target": "com.amazonaws.dynamodb#TableDescription", - "traits": { - "smithy.api#documentation": "

Represents the properties of a table.

" - } - } - }, + }, + "WriteCapacityUnits": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityUnits", "traits": { - "smithy.api#documentation": "

Represents the output of a DeleteTable operation.

" + "smithy.api#documentation": "

The total number of write capacity units consumed by the operation.

" } - }, - "com.amazonaws.dynamodb#DescribeBackup": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeBackupInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeBackupOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#BackupNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - } - ], + }, + "Table": { + "target": "com.amazonaws.dynamodb#Capacity", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Describes an existing backup of a table.

\n

You can call DescribeBackup at a maximum rate of 10 times per\n second.

" + "smithy.api#documentation": "

The amount of throughput consumed on the table affected by the operation.

" } - }, - "com.amazonaws.dynamodb#DescribeBackupInput": { - "type": "structure", - "members": { - "BackupArn": { - "target": "com.amazonaws.dynamodb#BackupArn", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) associated with the backup.

", - "smithy.api#required": {} - } - } + }, + "LocalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#SecondaryIndexesCapacityMap", + "traits": { + "smithy.api#documentation": "

The amount of throughput consumed on each local index affected by the\n operation.

" } - }, - "com.amazonaws.dynamodb#DescribeBackupOutput": { - "type": "structure", - "members": { - "BackupDescription": { - "target": "com.amazonaws.dynamodb#BackupDescription", - "traits": { - "smithy.api#documentation": "

Contains the description of the backup created for the table.

" - } - } + }, + "GlobalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#SecondaryIndexesCapacityMap", + "traits": { + "smithy.api#documentation": "

The amount of throughput consumed on each global index affected by the\n operation.

" } + } }, - "com.amazonaws.dynamodb#DescribeContinuousBackups": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeContinuousBackupsInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeContinuousBackupsOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#TableNotFoundException" - } - ], + "traits": { + "smithy.api#documentation": "

The capacity units consumed by an operation. The data returned includes the total\n provisioned throughput consumed, along with statistics for the table and any indexes\n involved in the operation. ConsumedCapacity is only returned if the request\n asked for it. For more information, see Provisioned Throughput in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "com.amazonaws.dynamodb#ConsumedCapacityMultiple": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ConsumedCapacity" + } + }, + "com.amazonaws.dynamodb#ConsumedCapacityUnits": { + "type": "double", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#ContinuousBackupsDescription": { + "type": "structure", + "members": { + "ContinuousBackupsStatus": { + "target": "com.amazonaws.dynamodb#ContinuousBackupsStatus", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Checks the status of continuous backups and point in time recovery on the specified\n table. Continuous backups are ENABLED on all tables at table creation. If\n point in time recovery is enabled, PointInTimeRecoveryStatus will be set to\n ENABLED.

\n

After continuous backups and point in time recovery are enabled, you can restore to\n any point in time within EarliestRestorableDateTime and\n LatestRestorableDateTime.

\n

\n LatestRestorableDateTime is typically 5 minutes before the current time.\n You can restore your table to any point in time during the last 35 days.

\n

You can call DescribeContinuousBackups at a maximum rate of 10 times per\n second.

" + "smithy.api#documentation": "

\n ContinuousBackupsStatus can be one of the following states: ENABLED,\n DISABLED

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeContinuousBackupsInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

Name of the table for which the customer wants to check the continuous backups and\n point in time recovery settings.

", - "smithy.api#required": {} - } - } + }, + "PointInTimeRecoveryDescription": { + "target": "com.amazonaws.dynamodb#PointInTimeRecoveryDescription", + "traits": { + "smithy.api#documentation": "

The description of the point in time recovery settings applied to the table.

" } + } }, - "com.amazonaws.dynamodb#DescribeContinuousBackupsOutput": { - "type": "structure", - "members": { - "ContinuousBackupsDescription": { - "target": "com.amazonaws.dynamodb#ContinuousBackupsDescription", - "traits": { - "smithy.api#documentation": "

Represents the continuous backups and point in time recovery settings on the\n table.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents the continuous backups and point in time recovery settings on the\n table.

" + } + }, + "com.amazonaws.dynamodb#ContinuousBackupsStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "ENABLED", + "name": "ENABLED" + }, + { + "value": "DISABLED", + "name": "DISABLED" } + ] + } + }, + "com.amazonaws.dynamodb#ContinuousBackupsUnavailableException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } }, - "com.amazonaws.dynamodb#DescribeContributorInsights": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeContributorInsightsInput" + "traits": { + "smithy.api#documentation": "

Backups have not yet been enabled for this table.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ContributorInsightsAction": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "ENABLE", + "name": "ENABLE" + }, + { + "value": "DISABLE", + "name": "DISABLE" + } + ] + } + }, + "com.amazonaws.dynamodb#ContributorInsightsRule": { + "type": "string", + "traits": { + "smithy.api#pattern": "^[A-Za-z0-9][A-Za-z0-9\\-\\_\\.]{0,126}[A-Za-z0-9]$" + } + }, + "com.amazonaws.dynamodb#ContributorInsightsRuleList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ContributorInsightsRule" + } + }, + "com.amazonaws.dynamodb#ContributorInsightsStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "ENABLING", + "name": "ENABLING" }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeContributorInsightsOutput" + { + "value": "ENABLED", + "name": "ENABLED" }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + { + "value": "DISABLING", + "name": "DISABLING" + }, + { + "value": "DISABLED", + "name": "DISABLED" + }, + { + "value": "FAILED", + "name": "FAILED" + } + ] + } + }, + "com.amazonaws.dynamodb#ContributorInsightsSummaries": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ContributorInsightsSummary" + } + }, + "com.amazonaws.dynamodb#ContributorInsightsSummary": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

Returns information about contributor insights, for a given table or global secondary\n index.

" + "smithy.api#documentation": "

Name of the table associated with the summary.

" } - }, - "com.amazonaws.dynamodb#DescribeContributorInsightsInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table to describe.

", - "smithy.api#required": {} - } - }, - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index to describe, if applicable.

" - } - } + }, + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

Name of the index associated with the summary, if any.

" } - }, - "com.amazonaws.dynamodb#DescribeContributorInsightsOutput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table being described.

" - } - }, - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index being described.

" - } - }, - "ContributorInsightsRuleList": { - "target": "com.amazonaws.dynamodb#ContributorInsightsRuleList", - "traits": { - "smithy.api#documentation": "

List of names of the associated contributor insights rules.

" - } - }, - "ContributorInsightsStatus": { - "target": "com.amazonaws.dynamodb#ContributorInsightsStatus", - "traits": { - "smithy.api#documentation": "

Current status of contributor insights.

" - } - }, - "LastUpdateDateTime": { - "target": "com.amazonaws.dynamodb#LastUpdateDateTime", - "traits": { - "smithy.api#documentation": "

Timestamp of the last time the status was changed.

" - } - }, - "FailureException": { - "target": "com.amazonaws.dynamodb#FailureException", - "traits": { - "smithy.api#documentation": "

Returns information about the last failure that was encountered.

\n

The most common exceptions for a FAILED status are:

\n
    \n
  • \n

    LimitExceededException - Per-account Amazon CloudWatch Contributor Insights\n rule limit reached. Please disable Contributor Insights for other tables/indexes\n OR disable Contributor Insights rules before retrying.

    \n
  • \n
  • \n

    AccessDeniedException - Amazon CloudWatch Contributor Insights rules cannot be\n modified due to insufficient permissions.

    \n
  • \n
  • \n

    AccessDeniedException - Failed to create service-linked role for Contributor\n Insights due to insufficient permissions.

    \n
  • \n
  • \n

    InternalServerError - Failed to create Amazon CloudWatch Contributor Insights\n rules. Please retry request.

    \n
  • \n
" - } - } + }, + "ContributorInsightsStatus": { + "target": "com.amazonaws.dynamodb#ContributorInsightsStatus", + "traits": { + "smithy.api#documentation": "

Describes the current status for contributor insights for the given table and index,\n if applicable.

" } + } }, - "com.amazonaws.dynamodb#DescribeEndpoints": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeEndpointsRequest" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeEndpointsResponse" - }, + "traits": { + "smithy.api#documentation": "

Represents a Contributor Insights summary entry.

" + } + }, + "com.amazonaws.dynamodb#CreateBackup": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#CreateBackupInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#CreateBackupOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#BackupInUseException" + }, + { + "target": "com.amazonaws.dynamodb#ContinuousBackupsUnavailableException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#TableInUseException" + }, + { + "target": "com.amazonaws.dynamodb#TableNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Creates a backup for an existing table.

\n

Each time you create an on-demand backup, the entire table data is backed up. There\n is no limit to the number of on-demand backups that can be taken.

\n

When you create an on-demand backup, a time marker of the request is cataloged, and\n the backup is created asynchronously, by applying all changes until the time of the\n request to the last full table snapshot. Backup requests are processed instantaneously\n and become available for restore within minutes.

\n

You can call CreateBackup at a maximum rate of 50 times per\n second.

\n

All backups in DynamoDB work without consuming any provisioned throughput on the\n table.

\n

If you submit a backup request on 2018-12-14 at 14:25:00, the backup is guaranteed to\n contain all data committed to the table up to 14:24:00, and data committed after\n 14:26:00 will not be. The backup might contain data modifications made between 14:24:00\n and 14:26:00. On-demand backup does not support causal consistency.

\n

Along with data, the following are also included on the backups:

\n
    \n
  • \n

    Global secondary indexes (GSIs)

    \n
  • \n
  • \n

    Local secondary indexes (LSIs)

    \n
  • \n
  • \n

    Streams

    \n
  • \n
  • \n

    Provisioned read and write capacity

    \n
  • \n
" + } + }, + "com.amazonaws.dynamodb#CreateBackupInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

Returns the regional endpoint information.

" + "smithy.api#documentation": "

The name of the table.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeEndpointsRequest": { - "type": "structure", - "members": {} - }, - "com.amazonaws.dynamodb#DescribeEndpointsResponse": { - "type": "structure", - "members": { - "Endpoints": { - "target": "com.amazonaws.dynamodb#Endpoints", - "traits": { - "smithy.api#documentation": "

List of endpoints.

", - "smithy.api#required": {} - } - } + }, + "BackupName": { + "target": "com.amazonaws.dynamodb#BackupName", + "traits": { + "smithy.api#documentation": "

Specified name for the backup.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeExport": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeExportInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeExportOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#ExportNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - } - ], + } + } + }, + "com.amazonaws.dynamodb#CreateBackupOutput": { + "type": "structure", + "members": { + "BackupDetails": { + "target": "com.amazonaws.dynamodb#BackupDetails", "traits": { - "smithy.api#documentation": "

Describes an existing table export.

" + "smithy.api#documentation": "

Contains the details of the backup created for the table.

" } - }, - "com.amazonaws.dynamodb#DescribeExportInput": { - "type": "structure", - "members": { - "ExportArn": { - "target": "com.amazonaws.dynamodb#ExportArn", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) associated with the export.

", - "smithy.api#required": {} - } - } + } + } + }, + "com.amazonaws.dynamodb#CreateGlobalSecondaryIndexAction": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index to be created.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeExportOutput": { - "type": "structure", - "members": { - "ExportDescription": { - "target": "com.amazonaws.dynamodb#ExportDescription", - "traits": { - "smithy.api#documentation": "

Represents the properties of the export.

" - } - } + }, + "KeySchema": { + "target": "com.amazonaws.dynamodb#KeySchema", + "traits": { + "smithy.api#documentation": "

The key schema for the global secondary index.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeGlobalTable": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeGlobalTableInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeGlobalTableOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#GlobalTableNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - } - ], + }, + "Projection": { + "target": "com.amazonaws.dynamodb#Projection", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Returns information about the specified global table.

\n \n

This operation only applies to Version\n 2017.11.29 of global tables. If you are using global tables Version\n 2019.11.21 you can use DescribeTable instead.

\n
" + "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into an index. These\n are in addition to the primary key attributes and index key attributes, which are\n automatically projected.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeGlobalTableInput": { - "type": "structure", - "members": { - "GlobalTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the global table.

", - "smithy.api#required": {} - } - } + }, + "ProvisionedThroughput": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughput", + "traits": { + "smithy.api#documentation": "

Represents the provisioned throughput settings for the specified global secondary\n index.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" } + } }, - "com.amazonaws.dynamodb#DescribeGlobalTableOutput": { - "type": "structure", - "members": { - "GlobalTableDescription": { - "target": "com.amazonaws.dynamodb#GlobalTableDescription", - "traits": { - "smithy.api#documentation": "

Contains the details of the global table.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents a new global secondary index to be added to an existing table.

" + } + }, + "com.amazonaws.dynamodb#CreateGlobalTable": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#CreateGlobalTableInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#CreateGlobalTableOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#GlobalTableAlreadyExistsException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#TableNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Creates a global table from an existing table. A global table creates a replication\n relationship between two or more DynamoDB tables with the same table name in the\n provided Regions.

\n \n

This operation only applies to Version\n 2017.11.29 of global tables.

\n
\n\n

If you want to add a new replica table to a global table, each of the following\n conditions must be true:

\n
    \n
  • \n

    The table must have the same primary key as all of the other replicas.

    \n
  • \n
  • \n

    The table must have the same name as all of the other replicas.

    \n
  • \n
  • \n

    The table must have DynamoDB Streams enabled, with the stream containing both\n the new and the old images of the item.

    \n
  • \n
  • \n

    None of the replica tables in the global table can contain any data.

    \n
  • \n
\n

If global secondary indexes are specified, then the following conditions must also be\n met:

\n
    \n
  • \n

    The global secondary indexes must have the same name.

    \n
  • \n
  • \n

    The global secondary indexes must have the same hash key and sort key (if\n present).

    \n
  • \n
\n

If local secondary indexes are specified, then the following conditions must also be\n met:

\n
    \n
  • \n

    The local secondary indexes must have the same name.

    \n
  • \n
  • \n

    The local secondary indexes must have the same hash key and sort key (if\n present).

    \n
  • \n
\n\n \n

Write capacity settings should be set consistently across your replica tables and\n secondary indexes. DynamoDB strongly recommends enabling auto scaling to manage the\n write capacity settings for all of your global tables replicas and indexes.

\n

If you prefer to manage write capacity settings manually, you should provision\n equal replicated write capacity units to your replica tables. You should also\n provision equal replicated write capacity units to matching secondary indexes across\n your global table.

\n
" + } + }, + "com.amazonaws.dynamodb#CreateGlobalTableInput": { + "type": "structure", + "members": { + "GlobalTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The global table name.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeGlobalTableSettings": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeGlobalTableSettingsInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeGlobalTableSettingsOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#GlobalTableNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - } - ], + }, + "ReplicationGroup": { + "target": "com.amazonaws.dynamodb#ReplicaList", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Describes Region-specific settings for a global table.

\n \n

This operation only applies to Version\n 2017.11.29 of global tables.

\n
" + "smithy.api#documentation": "

The Regions where the global table needs to be created.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeGlobalTableSettingsInput": { - "type": "structure", - "members": { - "GlobalTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the global table to describe.

", - "smithy.api#required": {} - } - } + } + } + }, + "com.amazonaws.dynamodb#CreateGlobalTableOutput": { + "type": "structure", + "members": { + "GlobalTableDescription": { + "target": "com.amazonaws.dynamodb#GlobalTableDescription", + "traits": { + "smithy.api#documentation": "

Contains the details of the global table.

" } - }, - "com.amazonaws.dynamodb#DescribeGlobalTableSettingsOutput": { - "type": "structure", - "members": { - "GlobalTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the global table.

" - } - }, - "ReplicaSettings": { - "target": "com.amazonaws.dynamodb#ReplicaSettingsDescriptionList", - "traits": { - "smithy.api#documentation": "

The Region-specific settings for the global table.

" - } - } + } + } + }, + "com.amazonaws.dynamodb#CreateReplicaAction": { + "type": "structure", + "members": { + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", + "traits": { + "smithy.api#documentation": "

The Region of the replica to be added.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#DescribeImport": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeImportInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeImportOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#ImportNotFoundException" - } - ], + "traits": { + "smithy.api#documentation": "

Represents a replica to be added.

" + } + }, + "com.amazonaws.dynamodb#CreateReplicationGroupMemberAction": { + "type": "structure", + "members": { + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", "traits": { - "smithy.api#documentation": "

\n Represents the properties of the import.\n

" + "smithy.api#documentation": "

The Region where the new replica will be created.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeImportInput": { - "type": "structure", - "members": { - "ImportArn": { - "target": "com.amazonaws.dynamodb#ImportArn", - "traits": { - "smithy.api#documentation": "

\n The Amazon Resource Name (ARN) associated with the table you're importing to.\n

", - "smithy.api#required": {} - } - } + }, + "KMSMasterKeyId": { + "target": "com.amazonaws.dynamodb#KMSMasterKeyId", + "traits": { + "smithy.api#documentation": "

The KMS key that should be used for KMS encryption in\n the new replica. To specify a key, use its key ID, Amazon Resource Name (ARN), alias\n name, or alias ARN. Note that you should only provide this parameter if the key is\n different from the default DynamoDB KMS key\n alias/aws/dynamodb.

" } - }, - "com.amazonaws.dynamodb#DescribeImportOutput": { - "type": "structure", - "members": { - "ImportTableDescription": { - "target": "com.amazonaws.dynamodb#ImportTableDescription", - "traits": { - "smithy.api#documentation": "

\n Represents the properties of the table created for the import, and parameters of \n the import. The import parameters include import status, how many items were processed, \n and how many errors were encountered.\n

", - "smithy.api#required": {} - } - } + }, + "ProvisionedThroughputOverride": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputOverride", + "traits": { + "smithy.api#documentation": "

Replica-specific provisioned throughput. If not specified, uses the source table's\n provisioned throughput settings.

" } - }, - "com.amazonaws.dynamodb#DescribeKinesisStreamingDestination": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeKinesisStreamingDestinationInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeKinesisStreamingDestinationOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "GlobalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexList", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Returns information about the status of Kinesis streaming.

" + "smithy.api#documentation": "

Replica-specific global secondary index settings.

" } - }, - "com.amazonaws.dynamodb#DescribeKinesisStreamingDestinationInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table being described.

", - "smithy.api#required": {} - } - } + }, + "TableClassOverride": { + "target": "com.amazonaws.dynamodb#TableClass", + "traits": { + "smithy.api#documentation": "

Replica-specific table class. If not specified, uses the source table's\n table class.

" } + } }, - "com.amazonaws.dynamodb#DescribeKinesisStreamingDestinationOutput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table being described.

" - } - }, - "KinesisDataStreamDestinations": { - "target": "com.amazonaws.dynamodb#KinesisDataStreamDestinations", - "traits": { - "smithy.api#documentation": "

The list of replica structures for the table being described.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents a replica to be created.

" + } + }, + "com.amazonaws.dynamodb#CreateTable": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#CreateTableInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#CreateTableOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceInUseException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

The CreateTable operation adds a new table to your account. In an Amazon Web Services account, table names must be unique within each Region. That is, you can\n have two tables with same name if you create the tables in different Regions.

\n

\n CreateTable is an asynchronous operation. Upon receiving a\n CreateTable request, DynamoDB immediately returns a response with a\n TableStatus of CREATING. After the table is created,\n DynamoDB sets the TableStatus to ACTIVE. You can perform read\n and write operations only on an ACTIVE table.

\n

You can optionally define secondary indexes on the new table, as part of the\n CreateTable operation. If you want to create multiple tables with\n secondary indexes on them, you must create the tables sequentially. Only one table with\n secondary indexes can be in the CREATING state at any given time.

\n

You can use the DescribeTable action to check the table status.

" + } + }, + "com.amazonaws.dynamodb#CreateTableInput": { + "type": "structure", + "members": { + "AttributeDefinitions": { + "target": "com.amazonaws.dynamodb#AttributeDefinitions", + "traits": { + "smithy.api#documentation": "

An array of attributes that describe the key schema for the table and indexes.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeLimits": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeLimitsInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeLimitsOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - } - ], + }, + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Returns the current provisioned-capacity quotas for your Amazon Web Services account in\n a Region, both for the Region as a whole and for any one DynamoDB table that you create\n there.

\n

When you establish an Amazon Web Services account, the account has initial quotas on\n the maximum read capacity units and write capacity units that you can provision across\n all of your DynamoDB tables in a given Region. Also, there are per-table\n quotas that apply when you create a table there. For more information, see Service,\n Account, and Table Quotas page in the Amazon DynamoDB\n Developer Guide.

\n\n

Although you can increase these quotas by filing a case at Amazon Web Services Support Center, obtaining the\n increase is not instantaneous. The DescribeLimits action lets you write\n code to compare the capacity you are currently using to those quotas imposed by your\n account so that you have enough time to apply for an increase before you hit a\n quota.

\n\n

For example, you could use one of the Amazon Web Services SDKs to do the\n following:

\n\n
    \n
  1. \n

    Call DescribeLimits for a particular Region to obtain your\n current account quotas on provisioned capacity there.

    \n
  2. \n
  3. \n

    Create a variable to hold the aggregate read capacity units provisioned for\n all your tables in that Region, and one to hold the aggregate write capacity\n units. Zero them both.

    \n
  4. \n
  5. \n

    Call ListTables to obtain a list of all your DynamoDB\n tables.

    \n
  6. \n
  7. \n

    For each table name listed by ListTables, do the\n following:

    \n
      \n
    • \n

      Call DescribeTable with the table name.

      \n
    • \n
    • \n

      Use the data returned by DescribeTable to add the read\n capacity units and write capacity units provisioned for the table itself\n to your variables.

      \n
    • \n
    • \n

      If the table has one or more global secondary indexes (GSIs), loop\n over these GSIs and add their provisioned capacity values to your\n variables as well.

      \n
    • \n
    \n
  8. \n
  9. \n

    Report the account quotas for that Region returned by\n DescribeLimits, along with the total current provisioned\n capacity levels you have calculated.

    \n
  10. \n
\n\n

This will let you see whether you are getting close to your account-level\n quotas.

\n

The per-table quotas apply only when you are creating a new table. They restrict the\n sum of the provisioned capacity of the new table itself and all its global secondary\n indexes.

\n

For existing tables and their GSIs, DynamoDB doesn't let you increase provisioned\n capacity extremely rapidly, but the only quota that applies is that the aggregate\n provisioned capacity over all your tables and GSIs cannot exceed either of the\n per-account quotas.

\n \n

\n DescribeLimits should only be called periodically. You can expect\n throttling errors if you call it more than once in a minute.

\n
\n

The DescribeLimits Request element has no content.

" + "smithy.api#documentation": "

The name of the table to create.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeLimitsInput": { - "type": "structure", - "members": {}, + }, + "KeySchema": { + "target": "com.amazonaws.dynamodb#KeySchema", "traits": { - "smithy.api#documentation": "

Represents the input of a DescribeLimits operation. Has no\n content.

" + "smithy.api#documentation": "

Specifies the attributes that make up the primary key for a table or an index. The\n attributes in KeySchema must also be defined in the\n AttributeDefinitions array. For more information, see Data\n Model in the Amazon DynamoDB Developer Guide.

\n

Each KeySchemaElement in the array is composed of:

\n
    \n
  • \n

    \n AttributeName - The name of this key attribute.

    \n
  • \n
  • \n

    \n KeyType - The role that the key attribute will assume:

    \n
      \n
    • \n

      \n HASH - partition key

      \n
    • \n
    • \n

      \n RANGE - sort key

      \n
    • \n
    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from the DynamoDB usage\n of an internal hash function to evenly distribute data items across partitions,\n based on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with the same\n partition key physically close together, in sorted order by the sort key\n value.

\n
\n\n

For a simple primary key (partition key), you must provide exactly one element with a\n KeyType of HASH.

\n

For a composite primary key (partition key and sort key), you must provide exactly two\n elements, in this order: The first element must have a KeyType of\n HASH, and the second element must have a KeyType of\n RANGE.

\n

For more information, see Working with Tables in the Amazon DynamoDB Developer\n Guide.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#DescribeLimitsOutput": { - "type": "structure", - "members": { - "AccountMaxReadCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum total read capacity units that your account allows you to provision across\n all of your tables in this Region.

" - } - }, - "AccountMaxWriteCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum total write capacity units that your account allows you to provision\n across all of your tables in this Region.

" - } - }, - "TableMaxReadCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum read capacity units that your account allows you to provision for a new\n table that you are creating in this Region, including the read capacity units\n provisioned for its global secondary indexes (GSIs).

" - } - }, - "TableMaxWriteCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum write capacity units that your account allows you to provision for a new\n table that you are creating in this Region, including the write capacity units\n provisioned for its global secondary indexes (GSIs).

" - } - } - }, + }, + "LocalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#LocalSecondaryIndexList", "traits": { - "smithy.api#documentation": "

Represents the output of a DescribeLimits operation.

" + "smithy.api#documentation": "

One or more local secondary indexes (the maximum is 5) to be created on the table.\n Each index is scoped to a given partition key value. There is a 10 GB size limit per\n partition key value; otherwise, the size of a local secondary index is\n unconstrained.

\n

Each local secondary index in the array includes the following:

\n
    \n
  • \n

    \n IndexName - The name of the local secondary index. Must be unique\n only for this table.

    \n

    \n
  • \n
  • \n

    \n KeySchema - Specifies the key schema for the local secondary index.\n The key schema must begin with the same partition key as the table.

    \n
  • \n
  • \n

    \n Projection - Specifies attributes that are copied (projected) from\n the table into the index. These are in addition to the primary key attributes\n and index key attributes, which are automatically projected. Each attribute\n specification is composed of:

    \n
      \n
    • \n

      \n ProjectionType - One of the following:

      \n
        \n
      • \n

        \n KEYS_ONLY - Only the index and primary keys are\n projected into the index.

        \n
      • \n
      • \n

        \n INCLUDE - Only the specified table attributes are\n projected into the index. The list of projected attributes is in\n NonKeyAttributes.

        \n
      • \n
      • \n

        \n ALL - All of the table attributes are projected\n into the index.

        \n
      • \n
      \n
    • \n
    • \n

      \n NonKeyAttributes - A list of one or more non-key attribute\n names that are projected into the secondary index. The total count of\n attributes provided in NonKeyAttributes, summed across all\n of the secondary indexes, must not exceed 100. If you project the same\n attribute into two different indexes, this counts as two distinct\n attributes when determining the total.

      \n
    • \n
    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#DescribeTable": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeTableInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeTableOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "GlobalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexList", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Returns information about the table, including the current status of the table, when\n it was created, the primary key schema, and any indexes on the table.

\n \n

If you issue a DescribeTable request immediately after a\n CreateTable request, DynamoDB might return a\n ResourceNotFoundException. This is because\n DescribeTable uses an eventually consistent query, and the metadata\n for your table might not be available at that moment. Wait for a few seconds, and\n then try the DescribeTable request again.

\n
", - "smithy.waiters#waitable": { - "TableExists": { - "acceptors": [ - { - "state": "success", - "matcher": { - "output": { - "path": "Table.TableStatus", - "expected": "ACTIVE", - "comparator": "stringEquals" - } - } - }, - { - "state": "retry", - "matcher": { - "errorType": "ResourceNotFoundException" - } - } - ], - "minDelay": 20 - }, - "TableNotExists": { - "acceptors": [ - { - "state": "success", - "matcher": { - "errorType": "ResourceNotFoundException" - } - } - ], - "minDelay": 20 - } - } + "smithy.api#documentation": "

One or more global secondary indexes (the maximum is 20) to be created on the table.\n Each global secondary index in the array includes the following:

\n
    \n
  • \n

    \n IndexName - The name of the global secondary index. Must be unique\n only for this table.

    \n

    \n
  • \n
  • \n

    \n KeySchema - Specifies the key schema for the global secondary\n index.

    \n
  • \n
  • \n

    \n Projection - Specifies attributes that are copied (projected) from\n the table into the index. These are in addition to the primary key attributes\n and index key attributes, which are automatically projected. Each attribute\n specification is composed of:

    \n
      \n
    • \n

      \n ProjectionType - One of the following:

      \n
        \n
      • \n

        \n KEYS_ONLY - Only the index and primary keys are\n projected into the index.

        \n
      • \n
      • \n

        \n INCLUDE - Only the specified table attributes are\n projected into the index. The list of projected attributes is in\n NonKeyAttributes.

        \n
      • \n
      • \n

        \n ALL - All of the table attributes are projected\n into the index.

        \n
      • \n
      \n
    • \n
    • \n

      \n NonKeyAttributes - A list of one or more non-key attribute\n names that are projected into the secondary index. The total count of\n attributes provided in NonKeyAttributes, summed across all\n of the secondary indexes, must not exceed 100. If you project the same\n attribute into two different indexes, this counts as two distinct\n attributes when determining the total.

      \n
    • \n
    \n
  • \n
  • \n

    \n ProvisionedThroughput - The provisioned throughput settings for the\n global secondary index, consisting of read and write capacity units.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#DescribeTableInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table to describe.

", - "smithy.api#required": {} - } - } - }, + }, + "BillingMode": { + "target": "com.amazonaws.dynamodb#BillingMode", "traits": { - "smithy.api#documentation": "

Represents the input of a DescribeTable operation.

" + "smithy.api#documentation": "

Controls how you are charged for read and write throughput and how you manage\n capacity. This setting can be changed later.

\n
    \n
  • \n

    \n PROVISIONED - We recommend using PROVISIONED for\n predictable workloads. PROVISIONED sets the billing mode to Provisioned Mode.

    \n
  • \n
  • \n

    \n PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST\n for unpredictable workloads. PAY_PER_REQUEST sets the billing mode\n to On-Demand Mode.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#DescribeTableOutput": { - "type": "structure", - "members": { - "Table": { - "target": "com.amazonaws.dynamodb#TableDescription", - "traits": { - "smithy.api#documentation": "

The properties of the table.

" - } - } - }, + }, + "ProvisionedThroughput": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughput", "traits": { - "smithy.api#documentation": "

Represents the output of a DescribeTable operation.

" + "smithy.api#documentation": "

Represents the provisioned throughput settings for a specified table or index. The\n settings can be modified using the UpdateTable operation.

\n

If you set BillingMode as PROVISIONED, you must specify this property.\n If you set BillingMode as PAY_PER_REQUEST, you cannot specify this\n property.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#DescribeTableReplicaAutoScaling": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeTableReplicaAutoScalingInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeTableReplicaAutoScalingOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "StreamSpecification": { + "target": "com.amazonaws.dynamodb#StreamSpecification", "traits": { - "smithy.api#documentation": "

Describes auto scaling settings across replicas of the global table at once.

\n \n

This operation only applies to Version\n 2019.11.21 of global tables.

\n
" + "smithy.api#documentation": "

The settings for DynamoDB Streams on the table. These settings consist of:

\n
    \n
  • \n

    \n StreamEnabled - Indicates whether DynamoDB Streams is to be enabled\n (true) or disabled (false).

    \n
  • \n
  • \n

    \n StreamViewType - When an item in the table is modified,\n StreamViewType determines what information is written to the\n table's stream. Valid values for StreamViewType are:

    \n
      \n
    • \n

      \n KEYS_ONLY - Only the key attributes of the modified item\n are written to the stream.

      \n
    • \n
    • \n

      \n NEW_IMAGE - The entire item, as it appears after it was\n modified, is written to the stream.

      \n
    • \n
    • \n

      \n OLD_IMAGE - The entire item, as it appeared before it was\n modified, is written to the stream.

      \n
    • \n
    • \n

      \n NEW_AND_OLD_IMAGES - Both the new and the old item images\n of the item are written to the stream.

      \n
    • \n
    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#DescribeTableReplicaAutoScalingInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table.

", - "smithy.api#required": {} - } - } + }, + "SSESpecification": { + "target": "com.amazonaws.dynamodb#SSESpecification", + "traits": { + "smithy.api#documentation": "

Represents the settings used to enable server-side encryption.

" } - }, - "com.amazonaws.dynamodb#DescribeTableReplicaAutoScalingOutput": { - "type": "structure", - "members": { - "TableAutoScalingDescription": { - "target": "com.amazonaws.dynamodb#TableAutoScalingDescription", - "traits": { - "smithy.api#documentation": "

Represents the auto scaling properties of the table.

" - } - } + }, + "Tags": { + "target": "com.amazonaws.dynamodb#TagList", + "traits": { + "smithy.api#documentation": "

A list of key-value pairs to label the table. For more information, see Tagging\n for DynamoDB.

" } - }, - "com.amazonaws.dynamodb#DescribeTimeToLive": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DescribeTimeToLiveInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DescribeTimeToLiveOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "TableClass": { + "target": "com.amazonaws.dynamodb#TableClass", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Gives a description of the Time to Live (TTL) status on the specified table.

" + "smithy.api#documentation": "

The table class of the new table. Valid values are STANDARD and\n STANDARD_INFREQUENT_ACCESS.

" } + } }, - "com.amazonaws.dynamodb#DescribeTimeToLiveInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table to be described.

", - "smithy.api#required": {} - } - } + "traits": { + "smithy.api#documentation": "

Represents the input of a CreateTable operation.

" + } + }, + "com.amazonaws.dynamodb#CreateTableOutput": { + "type": "structure", + "members": { + "TableDescription": { + "target": "com.amazonaws.dynamodb#TableDescription", + "traits": { + "smithy.api#documentation": "

Represents the properties of the table.

" } + } }, - "com.amazonaws.dynamodb#DescribeTimeToLiveOutput": { - "type": "structure", - "members": { - "TimeToLiveDescription": { - "target": "com.amazonaws.dynamodb#TimeToLiveDescription", - "traits": { - "smithy.api#documentation": "

" - } - } + "traits": { + "smithy.api#documentation": "

Represents the output of a CreateTable operation.

" + } + }, + "com.amazonaws.dynamodb#CsvDelimiter": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 1 + }, + "smithy.api#pattern": "^[,;:|\\t ]$" + } + }, + "com.amazonaws.dynamodb#CsvHeader": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 65536 + }, + "smithy.api#pattern": "^[\\x20-\\x21\\x23-\\x2B\\x2D-\\x7E]*$" + } + }, + "com.amazonaws.dynamodb#CsvHeaderList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#CsvHeader" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 255 + } + } + }, + "com.amazonaws.dynamodb#CsvOptions": { + "type": "structure", + "members": { + "Delimiter": { + "target": "com.amazonaws.dynamodb#CsvDelimiter", + "traits": { + "smithy.api#documentation": "

\n The delimiter used for separating items in the CSV file being imported.\n

" } - }, - "com.amazonaws.dynamodb#DestinationStatus": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "ENABLING", - "name": "ENABLING" - }, - { - "value": "ACTIVE", - "name": "ACTIVE" - }, - { - "value": "DISABLING", - "name": "DISABLING" - }, - { - "value": "DISABLED", - "name": "DISABLED" - }, - { - "value": "ENABLE_FAILED", - "name": "ENABLE_FAILED" - } - ] + }, + "HeaderList": { + "target": "com.amazonaws.dynamodb#CsvHeaderList", + "traits": { + "smithy.api#documentation": "

List of the headers used to specify a common header for all source CSV files being\n imported. If this field is specified then the first line of each CSV file is treated as\n data instead of the header. If this field is not specified the the first line of each\n CSV file is treated as the header. \n

" } + } }, - "com.amazonaws.dynamodb#DisableKinesisStreamingDestination": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#DisableKinesisStreamingDestinationInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#DisableKinesisStreamingDestinationOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceInUseException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + "traits": { + "smithy.api#documentation": "

\n Processing options for the CSV file being imported.\n

" + } + }, + "com.amazonaws.dynamodb#Date": { + "type": "timestamp" + }, + "com.amazonaws.dynamodb#Delete": { + "type": "structure", + "members": { + "Key": { + "target": "com.amazonaws.dynamodb#Key", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Stops replication from the DynamoDB table to the Kinesis data stream. This is done\n without deleting either of the resources.

" + "smithy.api#documentation": "

The primary key of the item to be deleted. Each element consists of an attribute name\n and a value for that attribute.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#Double": { - "type": "double", + }, + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

Name of the table in which the item to be deleted resides.

", + "smithy.api#required": {} + } + }, + "ConditionExpression": { + "target": "com.amazonaws.dynamodb#ConditionExpression", + "traits": { + "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional delete to\n succeed.

" + } + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression.

" } + }, + "ExpressionAttributeValues": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", + "traits": { + "smithy.api#documentation": "

One or more values that can be substituted in an expression.

" + } + }, + "ReturnValuesOnConditionCheckFailure": { + "target": "com.amazonaws.dynamodb#ReturnValuesOnConditionCheckFailure", + "traits": { + "smithy.api#documentation": "

Use ReturnValuesOnConditionCheckFailure to get the item attributes if the\n Delete condition fails. For\n ReturnValuesOnConditionCheckFailure, the valid values are: NONE and\n ALL_OLD.

" + } + } }, - "com.amazonaws.dynamodb#DuplicateItemException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + "traits": { + "smithy.api#documentation": "

Represents a request to perform a DeleteItem operation.

" + } + }, + "com.amazonaws.dynamodb#DeleteBackup": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DeleteBackupInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DeleteBackupOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#BackupInUseException" + }, + { + "target": "com.amazonaws.dynamodb#BackupNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Deletes an existing backup of a table.

\n

You can call DeleteBackup at a maximum rate of 10 times per\n second.

" + } + }, + "com.amazonaws.dynamodb#DeleteBackupInput": { + "type": "structure", + "members": { + "BackupArn": { + "target": "com.amazonaws.dynamodb#BackupArn", + "traits": { + "smithy.api#documentation": "

The ARN associated with the backup.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DeleteBackupOutput": { + "type": "structure", + "members": { + "BackupDescription": { + "target": "com.amazonaws.dynamodb#BackupDescription", + "traits": { + "smithy.api#documentation": "

Contains the description of the backup created for the table.

" + } + } + } + }, + "com.amazonaws.dynamodb#DeleteGlobalSecondaryIndexAction": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", "traits": { - "smithy.api#documentation": "

There was an attempt to insert an item with the same primary key as an item that\n already exists in the DynamoDB table.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The name of the global secondary index to be deleted.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#DynamoDB_20120810": { - "type": "service", + "traits": { + "smithy.api#documentation": "

Represents a global secondary index to be deleted from an existing table.

" + } + }, + "com.amazonaws.dynamodb#DeleteItem": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DeleteItemInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DeleteItemOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#ConditionalCheckFailedException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#TransactionConflictException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Deletes a single item in a table by primary key. You can perform a conditional delete\n operation that deletes the item if it exists, or if it has an expected attribute\n value.

\n

In addition to deleting an item, you can also return the item's attribute values in\n the same operation, using the ReturnValues parameter.

\n

Unless you specify conditions, the DeleteItem is an idempotent operation;\n running it multiple times on the same item or attribute does not\n result in an error response.

\n

Conditional deletes are useful for deleting items only if specific conditions are met.\n If those conditions are met, DynamoDB performs the delete. Otherwise, the item is not\n deleted.

" + } + }, + "com.amazonaws.dynamodb#DeleteItemInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "aws.api#clientEndpointDiscovery": { - "operation": "com.amazonaws.dynamodb#DescribeEndpoints", - "error": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - "aws.api#service": { - "sdkId": "DynamoDB", - "arnNamespace": "dynamodb", - "cloudFormationName": "DynamoDB", - "cloudTrailEventSource": "dynamodb.amazonaws.com", - "endpointPrefix": "dynamodb" - }, - "aws.auth#sigv4": { - "name": "dynamodb" - }, - "aws.protocols#awsJson1_0": {}, - "smithy.api#documentation": "Amazon DynamoDB\n\n

Amazon DynamoDB is a fully managed NoSQL database service that provides fast\n and predictable performance with seamless scalability. DynamoDB lets you\n offload the administrative burdens of operating and scaling a distributed database, so\n that you don't have to worry about hardware provisioning, setup and configuration,\n replication, software patching, or cluster scaling.

\n\n

With DynamoDB, you can create database tables that can store and retrieve\n any amount of data, and serve any level of request traffic. You can scale up or scale\n down your tables' throughput capacity without downtime or performance degradation, and\n use the Amazon Web Services Management Console to monitor resource utilization and performance\n metrics.

\n\n

DynamoDB automatically spreads the data and traffic for your tables over\n a sufficient number of servers to handle your throughput and storage requirements, while\n maintaining consistent and fast performance. All of your data is stored on solid state\n disks (SSDs) and automatically replicated across multiple Availability Zones in an\n Amazon Web Services Region, providing built-in high availability and data\n durability.

", - "smithy.api#title": "Amazon DynamoDB", - "smithy.api#xmlNamespace": { - "uri": "http://dynamodb.amazonaws.com/doc/2012-08-10/" - } - }, - "version": "2012-08-10", - "operations": [ - { - "target": "com.amazonaws.dynamodb#BatchExecuteStatement" - }, - { - "target": "com.amazonaws.dynamodb#BatchGetItem" - }, - { - "target": "com.amazonaws.dynamodb#BatchWriteItem" - }, - { - "target": "com.amazonaws.dynamodb#CreateBackup" - }, - { - "target": "com.amazonaws.dynamodb#CreateGlobalTable" - }, - { - "target": "com.amazonaws.dynamodb#CreateTable" - }, - { - "target": "com.amazonaws.dynamodb#DeleteBackup" - }, - { - "target": "com.amazonaws.dynamodb#DeleteItem" - }, - { - "target": "com.amazonaws.dynamodb#DeleteTable" - }, - { - "target": "com.amazonaws.dynamodb#DescribeBackup" - }, - { - "target": "com.amazonaws.dynamodb#DescribeContinuousBackups" - }, - { - "target": "com.amazonaws.dynamodb#DescribeContributorInsights" - }, - { - "target": "com.amazonaws.dynamodb#DescribeEndpoints" - }, - { - "target": "com.amazonaws.dynamodb#DescribeExport" - }, - { - "target": "com.amazonaws.dynamodb#DescribeGlobalTable" - }, - { - "target": "com.amazonaws.dynamodb#DescribeGlobalTableSettings" - }, - { - "target": "com.amazonaws.dynamodb#DescribeImport" - }, - { - "target": "com.amazonaws.dynamodb#DescribeKinesisStreamingDestination" - }, - { - "target": "com.amazonaws.dynamodb#DescribeLimits" - }, - { - "target": "com.amazonaws.dynamodb#DescribeTable" - }, - { - "target": "com.amazonaws.dynamodb#DescribeTableReplicaAutoScaling" - }, - { - "target": "com.amazonaws.dynamodb#DescribeTimeToLive" - }, - { - "target": "com.amazonaws.dynamodb#DisableKinesisStreamingDestination" - }, - { - "target": "com.amazonaws.dynamodb#EnableKinesisStreamingDestination" - }, - { - "target": "com.amazonaws.dynamodb#ExecuteStatement" - }, - { - "target": "com.amazonaws.dynamodb#ExecuteTransaction" - }, - { - "target": "com.amazonaws.dynamodb#ExportTableToPointInTime" - }, - { - "target": "com.amazonaws.dynamodb#GetItem" - }, - { - "target": "com.amazonaws.dynamodb#ImportTable" - }, - { - "target": "com.amazonaws.dynamodb#ListBackups" - }, - { - "target": "com.amazonaws.dynamodb#ListContributorInsights" - }, - { - "target": "com.amazonaws.dynamodb#ListExports" - }, - { - "target": "com.amazonaws.dynamodb#ListGlobalTables" - }, - { - "target": "com.amazonaws.dynamodb#ListImports" - }, - { - "target": "com.amazonaws.dynamodb#ListTables" - }, - { - "target": "com.amazonaws.dynamodb#ListTagsOfResource" - }, - { - "target": "com.amazonaws.dynamodb#PutItem" - }, - { - "target": "com.amazonaws.dynamodb#Query" - }, - { - "target": "com.amazonaws.dynamodb#RestoreTableFromBackup" - }, - { - "target": "com.amazonaws.dynamodb#RestoreTableToPointInTime" - }, - { - "target": "com.amazonaws.dynamodb#Scan" - }, - { - "target": "com.amazonaws.dynamodb#TagResource" - }, - { - "target": "com.amazonaws.dynamodb#TransactGetItems" - }, - { - "target": "com.amazonaws.dynamodb#TransactWriteItems" - }, - { - "target": "com.amazonaws.dynamodb#UntagResource" - }, - { - "target": "com.amazonaws.dynamodb#UpdateContinuousBackups" - }, - { - "target": "com.amazonaws.dynamodb#UpdateContributorInsights" - }, - { - "target": "com.amazonaws.dynamodb#UpdateGlobalTable" - }, - { - "target": "com.amazonaws.dynamodb#UpdateGlobalTableSettings" - }, - { - "target": "com.amazonaws.dynamodb#UpdateItem" - }, - { - "target": "com.amazonaws.dynamodb#UpdateTable" - }, - { - "target": "com.amazonaws.dynamodb#UpdateTableReplicaAutoScaling" - }, - { - "target": "com.amazonaws.dynamodb#UpdateTimeToLive" - } - ] - }, - "com.amazonaws.dynamodb#EnableKinesisStreamingDestination": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#EnableKinesisStreamingDestinationInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#EnableKinesisStreamingDestinationOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceInUseException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + "smithy.api#documentation": "

The name of the table from which to delete the item.

", + "smithy.api#required": {} + } + }, + "Key": { + "target": "com.amazonaws.dynamodb#Key", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Starts table data replication to the specified Kinesis data stream at a timestamp\n chosen during the enable workflow. If this operation doesn't return results immediately,\n use DescribeKinesisStreamingDestination to check if streaming to the Kinesis data stream\n is ACTIVE.

" + "smithy.api#documentation": "

A map of attribute names to AttributeValue objects, representing the\n primary key of the item to delete.

\n

For the primary key, you must provide all of the attributes. For example, with a\n simple primary key, you only need to provide a value for the partition key. For a\n composite primary key, you must provide values for both the partition key and the sort\n key.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#Endpoint": { - "type": "structure", - "members": { - "Address": { - "target": "com.amazonaws.dynamodb#String", - "traits": { - "smithy.api#documentation": "

IP address of the endpoint.

", - "smithy.api#required": {} - } - }, - "CachePeriodInMinutes": { - "target": "com.amazonaws.dynamodb#Long", - "traits": { - "smithy.api#documentation": "

Endpoint cache time to live (TTL) value.

", - "smithy.api#required": {} - } - } - }, + }, + "Expected": { + "target": "com.amazonaws.dynamodb#ExpectedAttributeMap", "traits": { - "smithy.api#documentation": "

An endpoint information details.

" + "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see Expected in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#Endpoints": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#Endpoint" + }, + "ConditionalOperator": { + "target": "com.amazonaws.dynamodb#ConditionalOperator", + "traits": { + "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see ConditionalOperator in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#ErrorCount": { - "type": "long", + }, + "ReturnValues": { + "target": "com.amazonaws.dynamodb#ReturnValue", "traits": { - "smithy.api#range": { - "min": 0 - } + "smithy.api#documentation": "

Use ReturnValues if you want to get the item attributes as they appeared\n before they were deleted. For DeleteItem, the valid values are:

\n
    \n
  • \n

    \n NONE - If ReturnValues is not specified, or if its\n value is NONE, then nothing is returned. (This setting is the\n default for ReturnValues.)

    \n
  • \n
  • \n

    \n ALL_OLD - The content of the old item is returned.

    \n
  • \n
\n

There is no additional cost associated with requesting a return value aside from the small \n network and processing overhead of receiving a larger response. No read capacity units are \n consumed.

\n \n

The ReturnValues parameter is used by several DynamoDB operations;\n however, DeleteItem does not recognize any values other than\n NONE or ALL_OLD.

\n
" } + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" + }, + "ReturnItemCollectionMetrics": { + "target": "com.amazonaws.dynamodb#ReturnItemCollectionMetrics", + "traits": { + "smithy.api#documentation": "

Determines whether item collection metrics are returned. If set to SIZE,\n the response includes statistics about item collections, if any, that were modified\n during the operation are returned in the response. If set to NONE (the\n default), no statistics are returned.

" + } + }, + "ConditionExpression": { + "target": "com.amazonaws.dynamodb#ConditionExpression", + "traits": { + "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional DeleteItem\n to succeed.

\n

An expression can contain any of the following:

\n
    \n
  • \n

    Functions: attribute_exists | attribute_not_exists | attribute_type |\n contains | begins_with | size\n

    \n

    These function names are case-sensitive.

    \n
  • \n
  • \n

    Comparison operators: = | <> |\n < | > | <= | >= |\n BETWEEN | IN \n

    \n
  • \n
  • \n

    Logical operators: AND | OR | NOT\n

    \n
  • \n
\n

For more information about condition expressions, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", + "traits": { + "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ExpressionAttributeValues": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", + "traits": { + "smithy.api#documentation": "

One or more values that can be substituted in an expression.

\n

Use the : (colon) character in an expression to\n dereference an attribute value. For example, suppose that you wanted to check whether\n the value of the ProductStatus attribute was one of the following:

\n

\n Available | Backordered | Discontinued\n

\n

You would first need to specify ExpressionAttributeValues as\n follows:

\n

\n { \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"},\n \":disc\":{\"S\":\"Discontinued\"} }\n

\n

You could then use these values in an expression, such as this:

\n

\n ProductStatus IN (:avail, :back, :disc)\n

\n

For more information on expression attribute values, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" + } + } }, - "com.amazonaws.dynamodb#ErrorMessage": { - "type": "string" - }, - "com.amazonaws.dynamodb#ExceptionDescription": { - "type": "string" - }, - "com.amazonaws.dynamodb#ExceptionName": { - "type": "string" - }, - "com.amazonaws.dynamodb#ExecuteStatement": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ExecuteStatementInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#ExecuteStatementOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#ConditionalCheckFailedException" - }, - { - "target": "com.amazonaws.dynamodb#DuplicateItemException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#TransactionConflictException" - } - ], + "traits": { + "smithy.api#documentation": "

Represents the input of a DeleteItem operation.

" + } + }, + "com.amazonaws.dynamodb#DeleteItemOutput": { + "type": "structure", + "members": { + "Attributes": { + "target": "com.amazonaws.dynamodb#AttributeMap", + "traits": { + "smithy.api#documentation": "

A map of attribute names to AttributeValue objects, representing the item\n as it appeared before the DeleteItem operation. This map appears in the\n response only if ReturnValues was specified as ALL_OLD in the\n request.

" + } + }, + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacity", + "traits": { + "smithy.api#documentation": "

The capacity units consumed by the DeleteItem operation. The data\n returned includes the total provisioned throughput consumed, along with statistics for\n the table and any indexes involved in the operation. ConsumedCapacity is\n only returned if the ReturnConsumedCapacity parameter was specified. For\n more information, see Provisioned Mode in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ItemCollectionMetrics": { + "target": "com.amazonaws.dynamodb#ItemCollectionMetrics", "traits": { - "smithy.api#documentation": "

This operation allows you to perform reads and singleton writes on data stored in\n DynamoDB, using PartiQL.

\n

For PartiQL reads (SELECT statement), if the total number of processed\n items exceeds the maximum dataset size limit of 1 MB, the read stops and results are\n returned to the user as a LastEvaluatedKey value to continue the read in a\n subsequent operation. If the filter criteria in WHERE clause does not match\n any data, the read will return an empty result set.

\n

A single SELECT statement response can return up to the maximum number of\n items (if using the Limit parameter) or a maximum of 1 MB of data (and then apply any\n filtering to the results using WHERE clause). If\n LastEvaluatedKey is present in the response, you need to paginate the\n result set.

" + "smithy.api#documentation": "

Information about item collections, if any, that were affected by the\n DeleteItem operation. ItemCollectionMetrics is only\n returned if the ReturnItemCollectionMetrics parameter was specified. If the\n table does not have any local secondary indexes, this information is not returned in the\n response.

\n

Each ItemCollectionMetrics element consists of:

\n
    \n
  • \n

    \n ItemCollectionKey - The partition key value of the item collection.\n This is the same as the partition key value of the item itself.

    \n
  • \n
  • \n

    \n SizeEstimateRangeGB - An estimate of item collection size, in\n gigabytes. This value is a two-element array containing a lower bound and an\n upper bound for the estimate. The estimate includes the size of all the items in\n the table, plus the size of all attributes projected into all of the local\n secondary indexes on that table. Use this estimate to measure whether a local\n secondary index is approaching its size limit.

    \n

    The estimate is subject to change over time; therefore, do not rely on the\n precision or accuracy of the estimate.

    \n
  • \n
" } + } }, - "com.amazonaws.dynamodb#ExecuteStatementInput": { - "type": "structure", - "members": { - "Statement": { - "target": "com.amazonaws.dynamodb#PartiQLStatement", - "traits": { - "smithy.api#documentation": "

The PartiQL statement representing the operation to run.

", - "smithy.api#required": {} - } - }, - "Parameters": { - "target": "com.amazonaws.dynamodb#PreparedStatementParameters", - "traits": { - "smithy.api#documentation": "

The parameters for the PartiQL statement, if any.

" - } - }, - "ConsistentRead": { - "target": "com.amazonaws.dynamodb#ConsistentRead", - "traits": { - "smithy.api#documentation": "

The consistency of a read operation. If set to true, then a strongly\n consistent read is used; otherwise, an eventually consistent read is used.

" - } - }, - "NextToken": { - "target": "com.amazonaws.dynamodb#PartiQLNextToken", - "traits": { - "smithy.api#documentation": "

Set this value to get remaining results, if NextToken was returned in the\n statement response.

" - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" - }, - "Limit": { - "target": "com.amazonaws.dynamodb#PositiveIntegerObject", - "traits": { - "smithy.api#documentation": "

The maximum number of items to evaluate (not necessarily the number of matching\n items). If DynamoDB processes the number of items up to the limit while processing the\n results, it stops the operation and returns the matching values up to that point, along\n with a key in LastEvaluatedKey to apply in a subsequent operation so you\n can pick up where you left off. Also, if the processed dataset size exceeds 1 MB before\n DynamoDB reaches this limit, it stops the operation and returns the matching values up\n to the limit, and a key in LastEvaluatedKey to apply in a subsequent\n operation to continue the operation.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents the output of a DeleteItem operation.

" + } + }, + "com.amazonaws.dynamodb#DeleteReplicaAction": { + "type": "structure", + "members": { + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", + "traits": { + "smithy.api#documentation": "

The Region of the replica to be removed.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#ExecuteStatementOutput": { - "type": "structure", - "members": { - "Items": { - "target": "com.amazonaws.dynamodb#ItemList", - "traits": { - "smithy.api#documentation": "

If a read operation was used, this property will contain the result of the read\n operation; a map of attribute names and their values. For the write operations this\n value will be empty.

" - } - }, - "NextToken": { - "target": "com.amazonaws.dynamodb#PartiQLNextToken", - "traits": { - "smithy.api#documentation": "

If the response of a read request exceeds the response payload limit DynamoDB will set\n this value in the response. If set, you can use that this value in the subsequent\n request to get the remaining results.

" - } - }, - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacity" - }, - "LastEvaluatedKey": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

The primary key of the item where the operation stopped, inclusive of the previous\n result set. Use this value to start a new operation, excluding this value in the new\n request. If LastEvaluatedKey is empty, then the \"last page\" of results has\n been processed and there is no more data to be retrieved. If\n LastEvaluatedKey is not empty, it does not necessarily mean that there\n is more data in the result set. The only way to know when you have reached the end of\n the result set is when LastEvaluatedKey is empty.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents a replica to be removed.

" + } + }, + "com.amazonaws.dynamodb#DeleteReplicationGroupMemberAction": { + "type": "structure", + "members": { + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", + "traits": { + "smithy.api#documentation": "

The Region where the replica exists.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#ExecuteTransaction": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ExecuteTransactionInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#ExecuteTransactionOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#IdempotentParameterMismatchException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#TransactionCanceledException" - }, - { - "target": "com.amazonaws.dynamodb#TransactionInProgressException" - } - ], + "traits": { + "smithy.api#documentation": "

Represents a replica to be deleted.

" + } + }, + "com.amazonaws.dynamodb#DeleteRequest": { + "type": "structure", + "members": { + "Key": { + "target": "com.amazonaws.dynamodb#Key", "traits": { - "smithy.api#documentation": "

This operation allows you to perform transactional reads or writes on data stored in\n DynamoDB, using PartiQL.

\n \n

The entire transaction must consist of either read statements or write statements,\n you cannot mix both in one transaction. The EXISTS function is an exception and can\n be used to check the condition of specific attributes of the item in a similar\n manner to ConditionCheck in the TransactWriteItems API.

\n
" + "smithy.api#documentation": "

A map of attribute name to attribute values, representing the primary key of the item\n to delete. All of the table's primary key attributes must be specified, and their data\n types must match those of the table's key schema.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#ExecuteTransactionInput": { - "type": "structure", - "members": { - "TransactStatements": { - "target": "com.amazonaws.dynamodb#ParameterizedStatements", - "traits": { - "smithy.api#documentation": "

The list of PartiQL statements representing the transaction to run.

", - "smithy.api#required": {} - } - }, - "ClientRequestToken": { - "target": "com.amazonaws.dynamodb#ClientRequestToken", - "traits": { - "smithy.api#documentation": "

Set this value to get remaining results, if NextToken was returned in the\n statement response.

", - "smithy.api#idempotencyToken": {} - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity", - "traits": { - "smithy.api#documentation": "

Determines the level of detail about either provisioned or on-demand throughput\n consumption that is returned in the response. For more information, see TransactGetItems and TransactWriteItems.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents a request to perform a DeleteItem operation on an item.

" + } + }, + "com.amazonaws.dynamodb#DeleteTable": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DeleteTableInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DeleteTableOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceInUseException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

The DeleteTable operation deletes a table and all of its items. After a\n DeleteTable request, the specified table is in the\n DELETING state until DynamoDB completes the deletion. If the table is\n in the ACTIVE state, you can delete it. If a table is in\n CREATING or UPDATING states, then DynamoDB returns a\n ResourceInUseException. If the specified table does not exist, DynamoDB\n returns a ResourceNotFoundException. If table is already in the\n DELETING state, no error is returned.

\n \n

DynamoDB might continue to accept data read and write operations, such as\n GetItem and PutItem, on a table in the\n DELETING state until the table deletion is complete.

\n
\n

When you delete a table, any indexes on that table are also deleted.

\n

If you have DynamoDB Streams enabled on the table, then the corresponding stream on\n that table goes into the DISABLED state, and the stream is automatically\n deleted after 24 hours.

\n\n

Use the DescribeTable action to check the status of the table.

" + } + }, + "com.amazonaws.dynamodb#DeleteTableInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table to delete.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#ExecuteTransactionOutput": { - "type": "structure", - "members": { - "Responses": { - "target": "com.amazonaws.dynamodb#ItemResponseList", - "traits": { - "smithy.api#documentation": "

The response to a PartiQL transaction.

" - } - }, - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", - "traits": { - "smithy.api#documentation": "

The capacity units consumed by the entire operation. The values of the list are\n ordered according to the ordering of the statements.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents the input of a DeleteTable operation.

" + } + }, + "com.amazonaws.dynamodb#DeleteTableOutput": { + "type": "structure", + "members": { + "TableDescription": { + "target": "com.amazonaws.dynamodb#TableDescription", + "traits": { + "smithy.api#documentation": "

Represents the properties of a table.

" } + } }, - "com.amazonaws.dynamodb#ExpectedAttributeMap": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#AttributeName" - }, - "value": { - "target": "com.amazonaws.dynamodb#ExpectedAttributeValue" + "traits": { + "smithy.api#documentation": "

Represents the output of a DeleteTable operation.

" + } + }, + "com.amazonaws.dynamodb#DescribeBackup": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeBackupInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeBackupOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#BackupNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Describes an existing backup of a table.

\n

You can call DescribeBackup at a maximum rate of 10 times per\n second.

" + } + }, + "com.amazonaws.dynamodb#DescribeBackupInput": { + "type": "structure", + "members": { + "BackupArn": { + "target": "com.amazonaws.dynamodb#BackupArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) associated with the backup.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DescribeBackupOutput": { + "type": "structure", + "members": { + "BackupDescription": { + "target": "com.amazonaws.dynamodb#BackupDescription", + "traits": { + "smithy.api#documentation": "

Contains the description of the backup created for the table.

" + } + } + } + }, + "com.amazonaws.dynamodb#DescribeContinuousBackups": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeContinuousBackupsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeContinuousBackupsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#TableNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Checks the status of continuous backups and point in time recovery on the specified\n table. Continuous backups are ENABLED on all tables at table creation. If\n point in time recovery is enabled, PointInTimeRecoveryStatus will be set to\n ENABLED.

\n

After continuous backups and point in time recovery are enabled, you can restore to\n any point in time within EarliestRestorableDateTime and\n LatestRestorableDateTime.

\n

\n LatestRestorableDateTime is typically 5 minutes before the current time.\n You can restore your table to any point in time during the last 35 days.

\n

You can call DescribeContinuousBackups at a maximum rate of 10 times per\n second.

" + } + }, + "com.amazonaws.dynamodb#DescribeContinuousBackupsInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

Name of the table for which the customer wants to check the continuous backups and\n point in time recovery settings.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DescribeContinuousBackupsOutput": { + "type": "structure", + "members": { + "ContinuousBackupsDescription": { + "target": "com.amazonaws.dynamodb#ContinuousBackupsDescription", + "traits": { + "smithy.api#documentation": "

Represents the continuous backups and point in time recovery settings on the\n table.

" + } + } + } + }, + "com.amazonaws.dynamodb#DescribeContributorInsights": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeContributorInsightsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeContributorInsightsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Returns information about contributor insights, for a given table or global secondary\n index.

" + } + }, + "com.amazonaws.dynamodb#DescribeContributorInsightsInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table to describe.

", + "smithy.api#required": {} + } + }, + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index to describe, if applicable.

" + } + } + } + }, + "com.amazonaws.dynamodb#DescribeContributorInsightsOutput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table being described.

" + } + }, + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index being described.

" + } + }, + "ContributorInsightsRuleList": { + "target": "com.amazonaws.dynamodb#ContributorInsightsRuleList", + "traits": { + "smithy.api#documentation": "

List of names of the associated contributor insights rules.

" + } + }, + "ContributorInsightsStatus": { + "target": "com.amazonaws.dynamodb#ContributorInsightsStatus", + "traits": { + "smithy.api#documentation": "

Current status of contributor insights.

" + } + }, + "LastUpdateDateTime": { + "target": "com.amazonaws.dynamodb#LastUpdateDateTime", + "traits": { + "smithy.api#documentation": "

Timestamp of the last time the status was changed.

" + } + }, + "FailureException": { + "target": "com.amazonaws.dynamodb#FailureException", + "traits": { + "smithy.api#documentation": "

Returns information about the last failure that was encountered.

\n

The most common exceptions for a FAILED status are:

\n
    \n
  • \n

    LimitExceededException - Per-account Amazon CloudWatch Contributor Insights\n rule limit reached. Please disable Contributor Insights for other tables/indexes\n OR disable Contributor Insights rules before retrying.

    \n
  • \n
  • \n

    AccessDeniedException - Amazon CloudWatch Contributor Insights rules cannot be\n modified due to insufficient permissions.

    \n
  • \n
  • \n

    AccessDeniedException - Failed to create service-linked role for Contributor\n Insights due to insufficient permissions.

    \n
  • \n
  • \n

    InternalServerError - Failed to create Amazon CloudWatch Contributor Insights\n rules. Please retry request.

    \n
  • \n
" + } + } + } + }, + "com.amazonaws.dynamodb#DescribeEndpoints": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeEndpointsRequest" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeEndpointsResponse" + }, + "traits": { + "smithy.api#documentation": "

Returns the regional endpoint information.

" + } + }, + "com.amazonaws.dynamodb#DescribeEndpointsRequest": { + "type": "structure", + "members": {} + }, + "com.amazonaws.dynamodb#DescribeEndpointsResponse": { + "type": "structure", + "members": { + "Endpoints": { + "target": "com.amazonaws.dynamodb#Endpoints", + "traits": { + "smithy.api#documentation": "

List of endpoints.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DescribeExport": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeExportInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeExportOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#ExportNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + } + ], + "traits": { + "smithy.api#documentation": "

Describes an existing table export.

" + } + }, + "com.amazonaws.dynamodb#DescribeExportInput": { + "type": "structure", + "members": { + "ExportArn": { + "target": "com.amazonaws.dynamodb#ExportArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) associated with the export.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DescribeExportOutput": { + "type": "structure", + "members": { + "ExportDescription": { + "target": "com.amazonaws.dynamodb#ExportDescription", + "traits": { + "smithy.api#documentation": "

Represents the properties of the export.

" + } + } + } + }, + "com.amazonaws.dynamodb#DescribeGlobalTable": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeGlobalTableInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeGlobalTableOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#GlobalTableNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Returns information about the specified global table.

\n \n

This operation only applies to Version\n 2017.11.29 of global tables. If you are using global tables Version\n 2019.11.21 you can use DescribeTable instead.

\n
" + } + }, + "com.amazonaws.dynamodb#DescribeGlobalTableInput": { + "type": "structure", + "members": { + "GlobalTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the global table.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DescribeGlobalTableOutput": { + "type": "structure", + "members": { + "GlobalTableDescription": { + "target": "com.amazonaws.dynamodb#GlobalTableDescription", + "traits": { + "smithy.api#documentation": "

Contains the details of the global table.

" + } + } + } + }, + "com.amazonaws.dynamodb#DescribeGlobalTableSettings": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeGlobalTableSettingsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeGlobalTableSettingsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#GlobalTableNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Describes Region-specific settings for a global table.

\n \n

This operation only applies to Version\n 2017.11.29 of global tables.

\n
" + } + }, + "com.amazonaws.dynamodb#DescribeGlobalTableSettingsInput": { + "type": "structure", + "members": { + "GlobalTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the global table to describe.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DescribeGlobalTableSettingsOutput": { + "type": "structure", + "members": { + "GlobalTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the global table.

" + } + }, + "ReplicaSettings": { + "target": "com.amazonaws.dynamodb#ReplicaSettingsDescriptionList", + "traits": { + "smithy.api#documentation": "

The Region-specific settings for the global table.

" + } + } + } + }, + "com.amazonaws.dynamodb#DescribeImport": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeImportInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeImportOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#ImportNotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

\n Represents the properties of the import.\n

" + } + }, + "com.amazonaws.dynamodb#DescribeImportInput": { + "type": "structure", + "members": { + "ImportArn": { + "target": "com.amazonaws.dynamodb#ImportArn", + "traits": { + "smithy.api#documentation": "

\n The Amazon Resource Name (ARN) associated with the table you're importing to.\n

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DescribeImportOutput": { + "type": "structure", + "members": { + "ImportTableDescription": { + "target": "com.amazonaws.dynamodb#ImportTableDescription", + "traits": { + "smithy.api#documentation": "

\n Represents the properties of the table created for the import, and parameters of \n the import. The import parameters include import status, how many items were processed, \n and how many errors were encountered.\n

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DescribeKinesisStreamingDestination": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeKinesisStreamingDestinationInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeKinesisStreamingDestinationOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Returns information about the status of Kinesis streaming.

" + } + }, + "com.amazonaws.dynamodb#DescribeKinesisStreamingDestinationInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table being described.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DescribeKinesisStreamingDestinationOutput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table being described.

" + } + }, + "KinesisDataStreamDestinations": { + "target": "com.amazonaws.dynamodb#KinesisDataStreamDestinations", + "traits": { + "smithy.api#documentation": "

The list of replica structures for the table being described.

" + } + } + } + }, + "com.amazonaws.dynamodb#DescribeLimits": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeLimitsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeLimitsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Returns the current provisioned-capacity quotas for your Amazon Web Services account in\n a Region, both for the Region as a whole and for any one DynamoDB table that you create\n there.

\n

When you establish an Amazon Web Services account, the account has initial quotas on\n the maximum read capacity units and write capacity units that you can provision across\n all of your DynamoDB tables in a given Region. Also, there are per-table\n quotas that apply when you create a table there. For more information, see Service,\n Account, and Table Quotas page in the Amazon DynamoDB\n Developer Guide.

\n\n

Although you can increase these quotas by filing a case at Amazon Web Services Support Center, obtaining the\n increase is not instantaneous. The DescribeLimits action lets you write\n code to compare the capacity you are currently using to those quotas imposed by your\n account so that you have enough time to apply for an increase before you hit a\n quota.

\n\n

For example, you could use one of the Amazon Web Services SDKs to do the\n following:

\n\n
    \n
  1. \n

    Call DescribeLimits for a particular Region to obtain your\n current account quotas on provisioned capacity there.

    \n
  2. \n
  3. \n

    Create a variable to hold the aggregate read capacity units provisioned for\n all your tables in that Region, and one to hold the aggregate write capacity\n units. Zero them both.

    \n
  4. \n
  5. \n

    Call ListTables to obtain a list of all your DynamoDB\n tables.

    \n
  6. \n
  7. \n

    For each table name listed by ListTables, do the\n following:

    \n
      \n
    • \n

      Call DescribeTable with the table name.

      \n
    • \n
    • \n

      Use the data returned by DescribeTable to add the read\n capacity units and write capacity units provisioned for the table itself\n to your variables.

      \n
    • \n
    • \n

      If the table has one or more global secondary indexes (GSIs), loop\n over these GSIs and add their provisioned capacity values to your\n variables as well.

      \n
    • \n
    \n
  8. \n
  9. \n

    Report the account quotas for that Region returned by\n DescribeLimits, along with the total current provisioned\n capacity levels you have calculated.

    \n
  10. \n
\n\n

This will let you see whether you are getting close to your account-level\n quotas.

\n

The per-table quotas apply only when you are creating a new table. They restrict the\n sum of the provisioned capacity of the new table itself and all its global secondary\n indexes.

\n

For existing tables and their GSIs, DynamoDB doesn't let you increase provisioned\n capacity extremely rapidly, but the only quota that applies is that the aggregate\n provisioned capacity over all your tables and GSIs cannot exceed either of the\n per-account quotas.

\n \n

\n DescribeLimits should only be called periodically. You can expect\n throttling errors if you call it more than once in a minute.

\n
\n

The DescribeLimits Request element has no content.

" + } + }, + "com.amazonaws.dynamodb#DescribeLimitsInput": { + "type": "structure", + "members": {}, + "traits": { + "smithy.api#documentation": "

Represents the input of a DescribeLimits operation. Has no\n content.

" + } + }, + "com.amazonaws.dynamodb#DescribeLimitsOutput": { + "type": "structure", + "members": { + "AccountMaxReadCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", + "traits": { + "smithy.api#documentation": "

The maximum total read capacity units that your account allows you to provision across\n all of your tables in this Region.

" + } + }, + "AccountMaxWriteCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", + "traits": { + "smithy.api#documentation": "

The maximum total write capacity units that your account allows you to provision\n across all of your tables in this Region.

" + } + }, + "TableMaxReadCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", + "traits": { + "smithy.api#documentation": "

The maximum read capacity units that your account allows you to provision for a new\n table that you are creating in this Region, including the read capacity units\n provisioned for its global secondary indexes (GSIs).

" + } + }, + "TableMaxWriteCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", + "traits": { + "smithy.api#documentation": "

The maximum write capacity units that your account allows you to provision for a new\n table that you are creating in this Region, including the write capacity units\n provisioned for its global secondary indexes (GSIs).

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the output of a DescribeLimits operation.

" + } + }, + "com.amazonaws.dynamodb#DescribeTable": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeTableInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeTableOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Returns information about the table, including the current status of the table, when\n it was created, the primary key schema, and any indexes on the table.

\n \n

If you issue a DescribeTable request immediately after a\n CreateTable request, DynamoDB might return a\n ResourceNotFoundException. This is because\n DescribeTable uses an eventually consistent query, and the metadata\n for your table might not be available at that moment. Wait for a few seconds, and\n then try the DescribeTable request again.

\n
", + "smithy.waiters#waitable": { + "TableExists": { + "acceptors": [ + { + "state": "success", + "matcher": { + "output": { + "path": "Table.TableStatus", + "expected": "ACTIVE", + "comparator": "stringEquals" + } + } + }, + { + "state": "retry", + "matcher": { + "errorType": "ResourceNotFoundException" + } + } + ], + "minDelay": 20 + }, + "TableNotExists": { + "acceptors": [ + { + "state": "success", + "matcher": { + "errorType": "ResourceNotFoundException" + } + } + ], + "minDelay": 20 + } + } + } + }, + "com.amazonaws.dynamodb#DescribeTableInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table to describe.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the input of a DescribeTable operation.

" + } + }, + "com.amazonaws.dynamodb#DescribeTableOutput": { + "type": "structure", + "members": { + "Table": { + "target": "com.amazonaws.dynamodb#TableDescription", + "traits": { + "smithy.api#documentation": "

The properties of the table.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the output of a DescribeTable operation.

" + } + }, + "com.amazonaws.dynamodb#DescribeTableReplicaAutoScaling": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeTableReplicaAutoScalingInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeTableReplicaAutoScalingOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Describes auto scaling settings across replicas of the global table at once.

\n \n

This operation only applies to Version\n 2019.11.21 of global tables.

\n
" + } + }, + "com.amazonaws.dynamodb#DescribeTableReplicaAutoScalingInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DescribeTableReplicaAutoScalingOutput": { + "type": "structure", + "members": { + "TableAutoScalingDescription": { + "target": "com.amazonaws.dynamodb#TableAutoScalingDescription", + "traits": { + "smithy.api#documentation": "

Represents the auto scaling properties of the table.

" + } + } + } + }, + "com.amazonaws.dynamodb#DescribeTimeToLive": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DescribeTimeToLiveInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DescribeTimeToLiveOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Gives a description of the Time to Live (TTL) status on the specified table.

" + } + }, + "com.amazonaws.dynamodb#DescribeTimeToLiveInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table to be described.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DescribeTimeToLiveOutput": { + "type": "structure", + "members": { + "TimeToLiveDescription": { + "target": "com.amazonaws.dynamodb#TimeToLiveDescription", + "traits": { + "smithy.api#documentation": "

" + } + } + } + }, + "com.amazonaws.dynamodb#DestinationStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "ENABLING", + "name": "ENABLING" + }, + { + "value": "ACTIVE", + "name": "ACTIVE" + }, + { + "value": "DISABLING", + "name": "DISABLING" + }, + { + "value": "DISABLED", + "name": "DISABLED" + }, + { + "value": "ENABLE_FAILED", + "name": "ENABLE_FAILED" + } + ] + } + }, + "com.amazonaws.dynamodb#DisableKinesisStreamingDestination": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#DisableKinesisStreamingDestinationInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#DisableKinesisStreamingDestinationOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceInUseException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Stops replication from the DynamoDB table to the Kinesis data stream. This is done\n without deleting either of the resources.

" + } + }, + "com.amazonaws.dynamodb#Double": { + "type": "double", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#DuplicateItemException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

There was an attempt to insert an item with the same primary key as an item that\n already exists in the DynamoDB table.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#DynamoDB_20120810": { + "type": "service", + "traits": { + "aws.api#clientEndpointDiscovery": { + "operation": "com.amazonaws.dynamodb#DescribeEndpoints", + "error": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + "aws.api#service": { + "sdkId": "DynamoDB", + "arnNamespace": "dynamodb", + "cloudFormationName": "DynamoDB", + "cloudTrailEventSource": "dynamodb.amazonaws.com", + "endpointPrefix": "dynamodb" + }, + "aws.auth#sigv4": { + "name": "dynamodb" + }, + "aws.protocols#awsJson1_0": {}, + "smithy.api#documentation": "Amazon DynamoDB\n\n

Amazon DynamoDB is a fully managed NoSQL database service that provides fast\n and predictable performance with seamless scalability. DynamoDB lets you\n offload the administrative burdens of operating and scaling a distributed database, so\n that you don't have to worry about hardware provisioning, setup and configuration,\n replication, software patching, or cluster scaling.

\n\n

With DynamoDB, you can create database tables that can store and retrieve\n any amount of data, and serve any level of request traffic. You can scale up or scale\n down your tables' throughput capacity without downtime or performance degradation, and\n use the Amazon Web Services Management Console to monitor resource utilization and performance\n metrics.

\n\n

DynamoDB automatically spreads the data and traffic for your tables over\n a sufficient number of servers to handle your throughput and storage requirements, while\n maintaining consistent and fast performance. All of your data is stored on solid state\n disks (SSDs) and automatically replicated across multiple Availability Zones in an\n Amazon Web Services Region, providing built-in high availability and data\n durability.

", + "smithy.api#title": "Amazon DynamoDB", + "smithy.api#xmlNamespace": { + "uri": "http://dynamodb.amazonaws.com/doc/2012-08-10/" + } + }, + "version": "2012-08-10", + "operations": [ + { + "target": "com.amazonaws.dynamodb#BatchExecuteStatement" + }, + { + "target": "com.amazonaws.dynamodb#BatchGetItem" + }, + { + "target": "com.amazonaws.dynamodb#BatchWriteItem" + }, + { + "target": "com.amazonaws.dynamodb#CreateBackup" + }, + { + "target": "com.amazonaws.dynamodb#CreateGlobalTable" + }, + { + "target": "com.amazonaws.dynamodb#CreateTable" + }, + { + "target": "com.amazonaws.dynamodb#DeleteBackup" + }, + { + "target": "com.amazonaws.dynamodb#DeleteItem" + }, + { + "target": "com.amazonaws.dynamodb#DeleteTable" + }, + { + "target": "com.amazonaws.dynamodb#DescribeBackup" + }, + { + "target": "com.amazonaws.dynamodb#DescribeContinuousBackups" + }, + { + "target": "com.amazonaws.dynamodb#DescribeContributorInsights" + }, + { + "target": "com.amazonaws.dynamodb#DescribeEndpoints" + }, + { + "target": "com.amazonaws.dynamodb#DescribeExport" + }, + { + "target": "com.amazonaws.dynamodb#DescribeGlobalTable" + }, + { + "target": "com.amazonaws.dynamodb#DescribeGlobalTableSettings" + }, + { + "target": "com.amazonaws.dynamodb#DescribeImport" + }, + { + "target": "com.amazonaws.dynamodb#DescribeKinesisStreamingDestination" + }, + { + "target": "com.amazonaws.dynamodb#DescribeLimits" + }, + { + "target": "com.amazonaws.dynamodb#DescribeTable" + }, + { + "target": "com.amazonaws.dynamodb#DescribeTableReplicaAutoScaling" + }, + { + "target": "com.amazonaws.dynamodb#DescribeTimeToLive" + }, + { + "target": "com.amazonaws.dynamodb#DisableKinesisStreamingDestination" + }, + { + "target": "com.amazonaws.dynamodb#EnableKinesisStreamingDestination" + }, + { + "target": "com.amazonaws.dynamodb#ExecuteStatement" + }, + { + "target": "com.amazonaws.dynamodb#ExecuteTransaction" + }, + { + "target": "com.amazonaws.dynamodb#ExportTableToPointInTime" + }, + { + "target": "com.amazonaws.dynamodb#GetItem" + }, + { + "target": "com.amazonaws.dynamodb#ImportTable" + }, + { + "target": "com.amazonaws.dynamodb#ListBackups" + }, + { + "target": "com.amazonaws.dynamodb#ListContributorInsights" + }, + { + "target": "com.amazonaws.dynamodb#ListExports" + }, + { + "target": "com.amazonaws.dynamodb#ListGlobalTables" + }, + { + "target": "com.amazonaws.dynamodb#ListImports" + }, + { + "target": "com.amazonaws.dynamodb#ListTables" + }, + { + "target": "com.amazonaws.dynamodb#ListTagsOfResource" + }, + { + "target": "com.amazonaws.dynamodb#PutItem" + }, + { + "target": "com.amazonaws.dynamodb#Query" + }, + { + "target": "com.amazonaws.dynamodb#RestoreTableFromBackup" + }, + { + "target": "com.amazonaws.dynamodb#RestoreTableToPointInTime" + }, + { + "target": "com.amazonaws.dynamodb#Scan" + }, + { + "target": "com.amazonaws.dynamodb#TagResource" + }, + { + "target": "com.amazonaws.dynamodb#TransactGetItems" + }, + { + "target": "com.amazonaws.dynamodb#TransactWriteItems" + }, + { + "target": "com.amazonaws.dynamodb#UntagResource" + }, + { + "target": "com.amazonaws.dynamodb#UpdateContinuousBackups" + }, + { + "target": "com.amazonaws.dynamodb#UpdateContributorInsights" + }, + { + "target": "com.amazonaws.dynamodb#UpdateGlobalTable" + }, + { + "target": "com.amazonaws.dynamodb#UpdateGlobalTableSettings" + }, + { + "target": "com.amazonaws.dynamodb#UpdateItem" + }, + { + "target": "com.amazonaws.dynamodb#UpdateTable" + }, + { + "target": "com.amazonaws.dynamodb#UpdateTableReplicaAutoScaling" + }, + { + "target": "com.amazonaws.dynamodb#UpdateTimeToLive" + } + ] + }, + "com.amazonaws.dynamodb#EnableKinesisStreamingDestination": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#EnableKinesisStreamingDestinationInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#EnableKinesisStreamingDestinationOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceInUseException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Starts table data replication to the specified Kinesis data stream at a timestamp\n chosen during the enable workflow. If this operation doesn't return results immediately,\n use DescribeKinesisStreamingDestination to check if streaming to the Kinesis data stream\n is ACTIVE.

" + } + }, + "com.amazonaws.dynamodb#Endpoint": { + "type": "structure", + "members": { + "Address": { + "target": "com.amazonaws.dynamodb#String", + "traits": { + "smithy.api#documentation": "

IP address of the endpoint.

", + "smithy.api#required": {} + } + }, + "CachePeriodInMinutes": { + "target": "com.amazonaws.dynamodb#Long", + "traits": { + "smithy.api#documentation": "

Endpoint cache time to live (TTL) value.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

An endpoint information details.

" + } + }, + "com.amazonaws.dynamodb#Endpoints": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#Endpoint" + } + }, + "com.amazonaws.dynamodb#ErrorCount": { + "type": "long", + "traits": { + "smithy.api#range": { + "min": 0 + } + } + }, + "com.amazonaws.dynamodb#ErrorMessage": { + "type": "string" + }, + "com.amazonaws.dynamodb#ExceptionDescription": { + "type": "string" + }, + "com.amazonaws.dynamodb#ExceptionName": { + "type": "string" + }, + "com.amazonaws.dynamodb#ExecuteStatement": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ExecuteStatementInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ExecuteStatementOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#ConditionalCheckFailedException" + }, + { + "target": "com.amazonaws.dynamodb#DuplicateItemException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#TransactionConflictException" + } + ], + "traits": { + "smithy.api#documentation": "

This operation allows you to perform reads and singleton writes on data stored in\n DynamoDB, using PartiQL.

\n

For PartiQL reads (SELECT statement), if the total number of processed\n items exceeds the maximum dataset size limit of 1 MB, the read stops and results are\n returned to the user as a LastEvaluatedKey value to continue the read in a\n subsequent operation. If the filter criteria in WHERE clause does not match\n any data, the read will return an empty result set.

\n

A single SELECT statement response can return up to the maximum number of\n items (if using the Limit parameter) or a maximum of 1 MB of data (and then apply any\n filtering to the results using WHERE clause). If\n LastEvaluatedKey is present in the response, you need to paginate the\n result set.

" + } + }, + "com.amazonaws.dynamodb#ExecuteStatementInput": { + "type": "structure", + "members": { + "Statement": { + "target": "com.amazonaws.dynamodb#PartiQLStatement", + "traits": { + "smithy.api#documentation": "

The PartiQL statement representing the operation to run.

", + "smithy.api#required": {} + } + }, + "Parameters": { + "target": "com.amazonaws.dynamodb#PreparedStatementParameters", + "traits": { + "smithy.api#documentation": "

The parameters for the PartiQL statement, if any.

" + } + }, + "ConsistentRead": { + "target": "com.amazonaws.dynamodb#ConsistentRead", + "traits": { + "smithy.api#documentation": "

The consistency of a read operation. If set to true, then a strongly\n consistent read is used; otherwise, an eventually consistent read is used.

" + } + }, + "NextToken": { + "target": "com.amazonaws.dynamodb#PartiQLNextToken", + "traits": { + "smithy.api#documentation": "

Set this value to get remaining results, if NextToken was returned in the\n statement response.

" + } + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" + }, + "Limit": { + "target": "com.amazonaws.dynamodb#PositiveIntegerObject", + "traits": { + "smithy.api#documentation": "

The maximum number of items to evaluate (not necessarily the number of matching\n items). If DynamoDB processes the number of items up to the limit while processing the\n results, it stops the operation and returns the matching values up to that point, along\n with a key in LastEvaluatedKey to apply in a subsequent operation so you\n can pick up where you left off. Also, if the processed dataset size exceeds 1 MB before\n DynamoDB reaches this limit, it stops the operation and returns the matching values up\n to the limit, and a key in LastEvaluatedKey to apply in a subsequent\n operation to continue the operation.

" + } + } + } + }, + "com.amazonaws.dynamodb#ExecuteStatementOutput": { + "type": "structure", + "members": { + "Items": { + "target": "com.amazonaws.dynamodb#ItemList", + "traits": { + "smithy.api#documentation": "

If a read operation was used, this property will contain the result of the read\n operation; a map of attribute names and their values. For the write operations this\n value will be empty.

" + } + }, + "NextToken": { + "target": "com.amazonaws.dynamodb#PartiQLNextToken", + "traits": { + "smithy.api#documentation": "

If the response of a read request exceeds the response payload limit DynamoDB will set\n this value in the response. If set, you can use that this value in the subsequent\n request to get the remaining results.

" + } + }, + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacity" + }, + "LastEvaluatedKey": { + "target": "com.amazonaws.dynamodb#Key", + "traits": { + "smithy.api#documentation": "

The primary key of the item where the operation stopped, inclusive of the previous\n result set. Use this value to start a new operation, excluding this value in the new\n request. If LastEvaluatedKey is empty, then the \"last page\" of results has\n been processed and there is no more data to be retrieved. If\n LastEvaluatedKey is not empty, it does not necessarily mean that there\n is more data in the result set. The only way to know when you have reached the end of\n the result set is when LastEvaluatedKey is empty.

" + } + } + } + }, + "com.amazonaws.dynamodb#ExecuteTransaction": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ExecuteTransactionInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ExecuteTransactionOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#IdempotentParameterMismatchException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#TransactionCanceledException" + }, + { + "target": "com.amazonaws.dynamodb#TransactionInProgressException" + } + ], + "traits": { + "smithy.api#documentation": "

This operation allows you to perform transactional reads or writes on data stored in\n DynamoDB, using PartiQL.

\n \n

The entire transaction must consist of either read statements or write statements,\n you cannot mix both in one transaction. The EXISTS function is an exception and can\n be used to check the condition of specific attributes of the item in a similar\n manner to ConditionCheck in the TransactWriteItems API.

\n
" + } + }, + "com.amazonaws.dynamodb#ExecuteTransactionInput": { + "type": "structure", + "members": { + "TransactStatements": { + "target": "com.amazonaws.dynamodb#ParameterizedStatements", + "traits": { + "smithy.api#documentation": "

The list of PartiQL statements representing the transaction to run.

", + "smithy.api#required": {} + } + }, + "ClientRequestToken": { + "target": "com.amazonaws.dynamodb#ClientRequestToken", + "traits": { + "smithy.api#documentation": "

Set this value to get remaining results, if NextToken was returned in the\n statement response.

", + "smithy.api#idempotencyToken": {} + } + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity", + "traits": { + "smithy.api#documentation": "

Determines the level of detail about either provisioned or on-demand throughput\n consumption that is returned in the response. For more information, see TransactGetItems and TransactWriteItems.

" + } + } + } + }, + "com.amazonaws.dynamodb#ExecuteTransactionOutput": { + "type": "structure", + "members": { + "Responses": { + "target": "com.amazonaws.dynamodb#ItemResponseList", + "traits": { + "smithy.api#documentation": "

The response to a PartiQL transaction.

" + } + }, + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", + "traits": { + "smithy.api#documentation": "

The capacity units consumed by the entire operation. The values of the list are\n ordered according to the ordering of the statements.

" + } + } + } + }, + "com.amazonaws.dynamodb#ExpectedAttributeMap": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#AttributeName" + }, + "value": { + "target": "com.amazonaws.dynamodb#ExpectedAttributeValue" + } + }, + "com.amazonaws.dynamodb#ExpectedAttributeValue": { + "type": "structure", + "members": { + "Value": { + "target": "com.amazonaws.dynamodb#AttributeValue", + "traits": { + "smithy.api#documentation": "

Represents the data for the expected attribute.

\n

Each attribute value is described as a name-value pair. The name is the data type, and\n the value is the data itself.

\n

For more information, see Data Types in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "Exists": { + "target": "com.amazonaws.dynamodb#BooleanObject", + "traits": { + "smithy.api#documentation": "

Causes DynamoDB to evaluate the value before attempting a conditional\n operation:

\n
    \n
  • \n

    If Exists is true, DynamoDB will check to\n see if that attribute value already exists in the table. If it is found, then\n the operation succeeds. If it is not found, the operation fails with a\n ConditionCheckFailedException.

    \n
  • \n
  • \n

    If Exists is false, DynamoDB assumes that\n the attribute value does not exist in the table. If in fact the value does not\n exist, then the assumption is valid and the operation succeeds. If the value is\n found, despite the assumption that it does not exist, the operation fails with a\n ConditionCheckFailedException.

    \n
  • \n
\n

The default setting for Exists is true. If you supply a\n Value all by itself, DynamoDB assumes the attribute exists:\n You don't have to set Exists to true, because it is\n implied.

\n

DynamoDB returns a ValidationException if:

\n
    \n
  • \n

    \n Exists is true but there is no Value to\n check. (You expect a value to exist, but don't specify what that value\n is.)

    \n
  • \n
  • \n

    \n Exists is false but you also provide a\n Value. (You cannot expect an attribute to have a value, while\n also expecting it not to exist.)

    \n
  • \n
" + } + }, + "ComparisonOperator": { + "target": "com.amazonaws.dynamodb#ComparisonOperator", + "traits": { + "smithy.api#documentation": "

A comparator for evaluating attributes in the AttributeValueList. For\n example, equals, greater than, less than, etc.

\n

The following comparison operators are available:

\n

\n EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS |\n BEGINS_WITH | IN | BETWEEN\n

\n

The following are descriptions of each comparison operator.

\n
    \n
  • \n

    \n EQ : Equal. EQ is supported for all data types,\n including lists and maps.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, Binary, String Set, Number Set, or Binary Set.\n If an item contains an AttributeValue element of a different type\n than the one provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not equal {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n NE : Not equal. NE is supported for all data types,\n including lists and maps.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String, Number, Binary, String Set, Number Set, or Binary Set. If an\n item contains an AttributeValue of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not equal {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n LE : Less than or equal.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n LT : Less than.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String, Number, or Binary (not a set type). If an item contains an\n AttributeValue element of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not compare to {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n GE : Greater than or equal.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n GT : Greater than.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n NOT_NULL : The attribute exists. NOT_NULL is supported\n for all data types, including lists and maps.

    \n \n

    This operator tests for the existence of an attribute, not its data type.\n If the data type of attribute \"a\" is null, and you evaluate it\n using NOT_NULL, the result is a Boolean true. This\n result is because the attribute \"a\" exists; its data type is\n not relevant to the NOT_NULL comparison operator.

    \n
    \n
  • \n
  • \n

    \n NULL : The attribute does not exist. NULL is supported\n for all data types, including lists and maps.

    \n \n

    This operator tests for the nonexistence of an attribute, not its data\n type. If the data type of attribute \"a\" is null, and you\n evaluate it using NULL, the result is a Boolean\n false. This is because the attribute \"a\"\n exists; its data type is not relevant to the NULL comparison\n operator.

    \n
    \n
  • \n
  • \n

    \n CONTAINS : Checks for a subsequence, or value in a set.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If the target\n attribute of the comparison is of type String, then the operator checks for a\n substring match. If the target attribute of the comparison is of type Binary,\n then the operator looks for a subsequence of the target that matches the input.\n If the target attribute of the comparison is a set (\"SS\",\n \"NS\", or \"BS\"), then the operator evaluates to\n true if it finds an exact match with any member of the set.

    \n

    CONTAINS is supported for lists: When evaluating \"a CONTAINS b\",\n \"a\" can be a list; however, \"b\" cannot be a set, a\n map, or a list.

    \n
  • \n
  • \n

    \n NOT_CONTAINS : Checks for absence of a subsequence, or absence of a\n value in a set.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If the target\n attribute of the comparison is a String, then the operator checks for the\n absence of a substring match. If the target attribute of the comparison is\n Binary, then the operator checks for the absence of a subsequence of the target\n that matches the input. If the target attribute of the comparison is a set\n (\"SS\", \"NS\", or \"BS\"), then the\n operator evaluates to true if it does not find an exact\n match with any member of the set.

    \n

    NOT_CONTAINS is supported for lists: When evaluating \"a NOT CONTAINS\n b\", \"a\" can be a list; however, \"b\" cannot\n be a set, a map, or a list.

    \n
  • \n
  • \n

    \n BEGINS_WITH : Checks for a prefix.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String or Binary (not a Number or a set type). The target attribute of\n the comparison must be of type String or Binary (not a Number or a set\n type).

    \n

    \n
  • \n
  • \n

    \n IN : Checks for matching elements in a list.

    \n

    \n AttributeValueList can contain one or more\n AttributeValue elements of type String, Number, or Binary.\n These attributes are compared against an existing attribute of an item. If any\n elements of the input are equal to the item attribute, the expression evaluates\n to true.

    \n
  • \n
  • \n

    \n BETWEEN : Greater than or equal to the first value, and less than\n or equal to the second value.

    \n

    \n AttributeValueList must contain two AttributeValue\n elements of the same type, either String, Number, or Binary (not a set type). A\n target attribute matches if the target value is greater than, or equal to, the\n first element and less than, or equal to, the second element. If an item\n contains an AttributeValue element of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not compare to {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not compare to {\"NS\":[\"6\", \"2\",\n \"1\"]}\n

    \n
  • \n
" + } + }, + "AttributeValueList": { + "target": "com.amazonaws.dynamodb#AttributeValueList", + "traits": { + "smithy.api#documentation": "

One or more values to evaluate against the supplied attribute. The number of values in\n the list depends on the ComparisonOperator being used.

\n

For type Number, value comparisons are numeric.

\n

String value comparisons for greater than, equals, or less than are based on ASCII\n character code values. For example, a is greater than A, and\n a is greater than B. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.

\n

For Binary, DynamoDB treats each byte of the binary data as unsigned when it\n compares binary values.

\n

For information on specifying data types in JSON, see JSON Data Format\n in the Amazon DynamoDB Developer Guide.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents a condition to be compared with an attribute value. This condition can be\n used with DeleteItem, PutItem, or UpdateItem\n operations; if the comparison evaluates to true, the operation succeeds; if not, the\n operation fails. You can use ExpectedAttributeValue in one of two different\n ways:

\n
    \n
  • \n

    Use AttributeValueList to specify one or more values to compare\n against an attribute. Use ComparisonOperator to specify how you\n want to perform the comparison. If the comparison evaluates to true, then the\n conditional operation succeeds.

    \n
  • \n
  • \n

    Use Value to specify a value that DynamoDB will compare against\n an attribute. If the values match, then ExpectedAttributeValue\n evaluates to true and the conditional operation succeeds. Optionally, you can\n also set Exists to false, indicating that you do\n not expect to find the attribute value in the table. In this\n case, the conditional operation succeeds only if the comparison evaluates to\n false.

    \n
  • \n
\n

\n Value and Exists are incompatible with\n AttributeValueList and ComparisonOperator. Note that if\n you use both sets of parameters at once, DynamoDB will return a\n ValidationException exception.

" + } + }, + "com.amazonaws.dynamodb#ExportArn": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 37, + "max": 1024 + } + } + }, + "com.amazonaws.dynamodb#ExportConflictException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

There was a conflict when writing to the specified S3 bucket.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ExportDescription": { + "type": "structure", + "members": { + "ExportArn": { + "target": "com.amazonaws.dynamodb#ExportArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the table export.

" + } + }, + "ExportStatus": { + "target": "com.amazonaws.dynamodb#ExportStatus", + "traits": { + "smithy.api#documentation": "

Export can be in one of the following states: IN_PROGRESS, COMPLETED, or\n FAILED.

" + } + }, + "StartTime": { + "target": "com.amazonaws.dynamodb#ExportStartTime", + "traits": { + "smithy.api#documentation": "

The time at which the export task began.

" + } + }, + "EndTime": { + "target": "com.amazonaws.dynamodb#ExportEndTime", + "traits": { + "smithy.api#documentation": "

The time at which the export task completed.

" + } + }, + "ExportManifest": { + "target": "com.amazonaws.dynamodb#ExportManifest", + "traits": { + "smithy.api#documentation": "

The name of the manifest file for the export task.

" + } + }, + "TableArn": { + "target": "com.amazonaws.dynamodb#TableArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the table that was exported.

" + } + }, + "TableId": { + "target": "com.amazonaws.dynamodb#TableId", + "traits": { + "smithy.api#documentation": "

Unique ID of the table that was exported.

" + } + }, + "ExportTime": { + "target": "com.amazonaws.dynamodb#ExportTime", + "traits": { + "smithy.api#documentation": "

Point in time from which table data was exported.

" + } + }, + "ClientToken": { + "target": "com.amazonaws.dynamodb#ClientToken", + "traits": { + "smithy.api#documentation": "

The client token that was provided for the export task. A client token makes calls to\n ExportTableToPointInTimeInput idempotent, meaning that multiple\n identical calls have the same effect as one single call.

" + } + }, + "S3Bucket": { + "target": "com.amazonaws.dynamodb#S3Bucket", + "traits": { + "smithy.api#documentation": "

The name of the Amazon S3 bucket containing the export.

" + } + }, + "S3BucketOwner": { + "target": "com.amazonaws.dynamodb#S3BucketOwner", + "traits": { + "smithy.api#documentation": "

The ID of the Amazon Web Services account that owns the bucket containing the\n export.

" + } + }, + "S3Prefix": { + "target": "com.amazonaws.dynamodb#S3Prefix", + "traits": { + "smithy.api#documentation": "

The Amazon S3 bucket prefix used as the file name and path of the exported\n snapshot.

" + } + }, + "S3SseAlgorithm": { + "target": "com.amazonaws.dynamodb#S3SseAlgorithm", + "traits": { + "smithy.api#documentation": "

Type of encryption used on the bucket where export data is stored. Valid values for\n S3SseAlgorithm are:

\n
    \n
  • \n

    \n AES256 - server-side encryption with Amazon S3 managed\n keys

    \n
  • \n
  • \n

    \n KMS - server-side encryption with KMS managed\n keys

    \n
  • \n
" + } + }, + "S3SseKmsKeyId": { + "target": "com.amazonaws.dynamodb#S3SseKmsKeyId", + "traits": { + "smithy.api#documentation": "

The ID of the KMS managed key used to encrypt the S3 bucket where\n export data is stored (if applicable).

" + } + }, + "FailureCode": { + "target": "com.amazonaws.dynamodb#FailureCode", + "traits": { + "smithy.api#documentation": "

Status code for the result of the failed export.

" + } + }, + "FailureMessage": { + "target": "com.amazonaws.dynamodb#FailureMessage", + "traits": { + "smithy.api#documentation": "

Export failure reason description.

" + } + }, + "ExportFormat": { + "target": "com.amazonaws.dynamodb#ExportFormat", + "traits": { + "smithy.api#documentation": "

The format of the exported data. Valid values for ExportFormat are\n DYNAMODB_JSON or ION.

" + } + }, + "BilledSizeBytes": { + "target": "com.amazonaws.dynamodb#BilledSizeBytes", + "traits": { + "smithy.api#documentation": "

The billable size of the table export.

" + } + }, + "ItemCount": { + "target": "com.amazonaws.dynamodb#ItemCount", + "traits": { + "smithy.api#documentation": "

The number of items exported.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the properties of the exported table.

" + } + }, + "com.amazonaws.dynamodb#ExportEndTime": { + "type": "timestamp" + }, + "com.amazonaws.dynamodb#ExportFormat": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "DYNAMODB_JSON", + "name": "DYNAMODB_JSON" + }, + { + "value": "ION", + "name": "ION" + } + ] + } + }, + "com.amazonaws.dynamodb#ExportManifest": { + "type": "string" + }, + "com.amazonaws.dynamodb#ExportNextToken": { + "type": "string" + }, + "com.amazonaws.dynamodb#ExportNotFoundException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

The specified export was not found.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ExportStartTime": { + "type": "timestamp" + }, + "com.amazonaws.dynamodb#ExportStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "IN_PROGRESS", + "name": "IN_PROGRESS" + }, + { + "value": "COMPLETED", + "name": "COMPLETED" + }, + { + "value": "FAILED", + "name": "FAILED" + } + ] + } + }, + "com.amazonaws.dynamodb#ExportSummaries": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ExportSummary" + } + }, + "com.amazonaws.dynamodb#ExportSummary": { + "type": "structure", + "members": { + "ExportArn": { + "target": "com.amazonaws.dynamodb#ExportArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the export.

" + } + }, + "ExportStatus": { + "target": "com.amazonaws.dynamodb#ExportStatus", + "traits": { + "smithy.api#documentation": "

Export can be in one of the following states: IN_PROGRESS, COMPLETED, or\n FAILED.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Summary information about an export task.

" + } + }, + "com.amazonaws.dynamodb#ExportTableToPointInTime": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ExportTableToPointInTimeInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ExportTableToPointInTimeOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#ExportConflictException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidExportTimeException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#PointInTimeRecoveryUnavailableException" + }, + { + "target": "com.amazonaws.dynamodb#TableNotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Exports table data to an S3 bucket. The table must have point in time recovery\n enabled, and you can export data from any time within the point in time recovery\n window.

" + } + }, + "com.amazonaws.dynamodb#ExportTableToPointInTimeInput": { + "type": "structure", + "members": { + "TableArn": { + "target": "com.amazonaws.dynamodb#TableArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) associated with the table to export.

", + "smithy.api#required": {} + } + }, + "ExportTime": { + "target": "com.amazonaws.dynamodb#ExportTime", + "traits": { + "smithy.api#documentation": "

Time in the past from which to export table data, counted in seconds from the start of\n the Unix epoch. The table export will be a snapshot of the table's state at this point\n in time.

" + } + }, + "ClientToken": { + "target": "com.amazonaws.dynamodb#ClientToken", + "traits": { + "smithy.api#documentation": "

Providing a ClientToken makes the call to\n ExportTableToPointInTimeInput idempotent, meaning that multiple\n identical calls have the same effect as one single call.

\n

A client token is valid for 8 hours after the first request that uses it is completed.\n After 8 hours, any request with the same client token is treated as a new request. Do\n not resubmit the same request with the same client token for more than 8 hours, or the\n result might not be idempotent.

\n

If you submit a request with the same client token but a change in other parameters\n within the 8-hour idempotency window, DynamoDB returns an\n ImportConflictException.

", + "smithy.api#idempotencyToken": {} + } + }, + "S3Bucket": { + "target": "com.amazonaws.dynamodb#S3Bucket", + "traits": { + "smithy.api#documentation": "

The name of the Amazon S3 bucket to export the snapshot to.

", + "smithy.api#required": {} + } + }, + "S3BucketOwner": { + "target": "com.amazonaws.dynamodb#S3BucketOwner", + "traits": { + "smithy.api#documentation": "

The ID of the Amazon Web Services account that owns the bucket the export will be\n stored in.

" + } + }, + "S3Prefix": { + "target": "com.amazonaws.dynamodb#S3Prefix", + "traits": { + "smithy.api#documentation": "

The Amazon S3 bucket prefix to use as the file name and path of the exported\n snapshot.

" + } + }, + "S3SseAlgorithm": { + "target": "com.amazonaws.dynamodb#S3SseAlgorithm", + "traits": { + "smithy.api#documentation": "

Type of encryption used on the bucket where export data will be stored. Valid values\n for S3SseAlgorithm are:

\n
    \n
  • \n

    \n AES256 - server-side encryption with Amazon S3 managed\n keys

    \n
  • \n
  • \n

    \n KMS - server-side encryption with KMS managed\n keys

    \n
  • \n
" + } + }, + "S3SseKmsKeyId": { + "target": "com.amazonaws.dynamodb#S3SseKmsKeyId", + "traits": { + "smithy.api#documentation": "

The ID of the KMS managed key used to encrypt the S3 bucket where\n export data will be stored (if applicable).

" + } + }, + "ExportFormat": { + "target": "com.amazonaws.dynamodb#ExportFormat", + "traits": { + "smithy.api#documentation": "

The format for the exported data. Valid values for ExportFormat are\n DYNAMODB_JSON or ION.

" + } + } + } + }, + "com.amazonaws.dynamodb#ExportTableToPointInTimeOutput": { + "type": "structure", + "members": { + "ExportDescription": { + "target": "com.amazonaws.dynamodb#ExportDescription", + "traits": { + "smithy.api#documentation": "

Contains a description of the table export.

" + } + } + } + }, + "com.amazonaws.dynamodb#ExportTime": { + "type": "timestamp" + }, + "com.amazonaws.dynamodb#ExpressionAttributeNameMap": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameVariable" + }, + "value": { + "target": "com.amazonaws.dynamodb#AttributeName" + } + }, + "com.amazonaws.dynamodb#ExpressionAttributeNameVariable": { + "type": "string" + }, + "com.amazonaws.dynamodb#ExpressionAttributeValueMap": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeValueVariable" + }, + "value": { + "target": "com.amazonaws.dynamodb#AttributeValue" + } + }, + "com.amazonaws.dynamodb#ExpressionAttributeValueVariable": { + "type": "string" + }, + "com.amazonaws.dynamodb#FailureCode": { + "type": "string" + }, + "com.amazonaws.dynamodb#FailureException": { + "type": "structure", + "members": { + "ExceptionName": { + "target": "com.amazonaws.dynamodb#ExceptionName", + "traits": { + "smithy.api#documentation": "

Exception name.

" + } + }, + "ExceptionDescription": { + "target": "com.amazonaws.dynamodb#ExceptionDescription", + "traits": { + "smithy.api#documentation": "

Description of the failure.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents a failure a contributor insights operation.

" + } + }, + "com.amazonaws.dynamodb#FailureMessage": { + "type": "string" + }, + "com.amazonaws.dynamodb#FilterConditionMap": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#AttributeName" + }, + "value": { + "target": "com.amazonaws.dynamodb#Condition" + } + }, + "com.amazonaws.dynamodb#Get": { + "type": "structure", + "members": { + "Key": { + "target": "com.amazonaws.dynamodb#Key", + "traits": { + "smithy.api#documentation": "

A map of attribute names to AttributeValue objects that specifies the\n primary key of the item to retrieve.

", + "smithy.api#required": {} + } + }, + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table from which to retrieve the specified item.

", + "smithy.api#required": {} + } + }, + "ProjectionExpression": { + "target": "com.amazonaws.dynamodb#ProjectionExpression", + "traits": { + "smithy.api#documentation": "

A string that identifies one or more attributes of the specified item to retrieve from\n the table. The attributes in the expression must be separated by commas. If no attribute\n names are specified, then all attributes of the specified item are returned. If any of\n the requested attributes are not found, they do not appear in the result.

" + } + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", + "traits": { + "smithy.api#documentation": "

One or more substitution tokens for attribute names in the ProjectionExpression\n parameter.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Specifies an item and related attribute values to retrieve in a\n TransactGetItem object.

" + } + }, + "com.amazonaws.dynamodb#GetItem": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#GetItemInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#GetItemOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

The GetItem operation returns a set of attributes for the item with the\n given primary key. If there is no matching item, GetItem does not return\n any data and there will be no Item element in the response.

\n

\n GetItem provides an eventually consistent read by default. If your\n application requires a strongly consistent read, set ConsistentRead to\n true. Although a strongly consistent read might take more time than an\n eventually consistent read, it always returns the last updated value.

" + } + }, + "com.amazonaws.dynamodb#GetItemInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table containing the requested item.

", + "smithy.api#required": {} + } + }, + "Key": { + "target": "com.amazonaws.dynamodb#Key", + "traits": { + "smithy.api#documentation": "

A map of attribute names to AttributeValue objects, representing the\n primary key of the item to retrieve.

\n

For the primary key, you must provide all of the attributes. For example, with a\n simple primary key, you only need to provide a value for the partition key. For a\n composite primary key, you must provide values for both the partition key and the sort\n key.

", + "smithy.api#required": {} + } + }, + "AttributesToGet": { + "target": "com.amazonaws.dynamodb#AttributeNameList", + "traits": { + "smithy.api#documentation": "

This is a legacy parameter. Use ProjectionExpression instead. For more\n information, see AttributesToGet in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ConsistentRead": { + "target": "com.amazonaws.dynamodb#ConsistentRead", + "traits": { + "smithy.api#documentation": "

Determines the read consistency model: If set to true, then the operation\n uses strongly consistent reads; otherwise, the operation uses eventually consistent\n reads.

" + } + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" + }, + "ProjectionExpression": { + "target": "com.amazonaws.dynamodb#ProjectionExpression", + "traits": { + "smithy.api#documentation": "

A string that identifies one or more attributes to retrieve from the table. These\n attributes can include scalars, sets, or elements of a JSON document. The attributes in\n the expression must be separated by commas.

\n

If no attribute names are specified, then all attributes are returned. If any of the\n requested attributes are not found, they do not appear in the result.

\n

For more information, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", + "traits": { + "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the input of a GetItem operation.

" + } + }, + "com.amazonaws.dynamodb#GetItemOutput": { + "type": "structure", + "members": { + "Item": { + "target": "com.amazonaws.dynamodb#AttributeMap", + "traits": { + "smithy.api#documentation": "

A map of attribute names to AttributeValue objects, as specified by\n ProjectionExpression.

" + } + }, + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacity", + "traits": { + "smithy.api#documentation": "

The capacity units consumed by the GetItem operation. The data returned\n includes the total provisioned throughput consumed, along with statistics for the table\n and any indexes involved in the operation. ConsumedCapacity is only\n returned if the ReturnConsumedCapacity parameter was specified. For more\n information, see Read/Write Capacity Mode in the Amazon DynamoDB Developer\n Guide.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the output of a GetItem operation.

" + } + }, + "com.amazonaws.dynamodb#GlobalSecondaryIndex": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index. The name must be unique among all other\n indexes on this table.

", + "smithy.api#required": {} + } + }, + "KeySchema": { + "target": "com.amazonaws.dynamodb#KeySchema", + "traits": { + "smithy.api#documentation": "

The complete key schema for a global secondary index, which consists of one or more\n pairs of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of\n an internal hash function to evenly distribute data items across partitions, based\n on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with the same\n partition key physically close together, in sorted order by the sort key\n value.

\n
", + "smithy.api#required": {} + } + }, + "Projection": { + "target": "com.amazonaws.dynamodb#Projection", + "traits": { + "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the global\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

", + "smithy.api#required": {} + } + }, + "ProvisionedThroughput": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughput", + "traits": { + "smithy.api#documentation": "

Represents the provisioned throughput settings for the specified global secondary\n index.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the properties of a global secondary index.

" + } + }, + "com.amazonaws.dynamodb#GlobalSecondaryIndexAutoScalingUpdate": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index.

" + } + }, + "ProvisionedWriteCapacityAutoScalingUpdate": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate" + } + }, + "traits": { + "smithy.api#documentation": "

Represents the auto scaling settings of a global secondary index for a global table\n that will be modified.

" + } + }, + "com.amazonaws.dynamodb#GlobalSecondaryIndexAutoScalingUpdateList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexAutoScalingUpdate" + }, + "traits": { + "smithy.api#length": { + "min": 1 + } + } + }, + "com.amazonaws.dynamodb#GlobalSecondaryIndexDescription": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index.

" + } + }, + "KeySchema": { + "target": "com.amazonaws.dynamodb#KeySchema", + "traits": { + "smithy.api#documentation": "

The complete key schema for a global secondary index, which consists of one or more\n pairs of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of an internal hash function to evenly distribute data items across\n partitions, based on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with\n the same partition key physically close together, in sorted order by the sort key\n value.

\n
" + } + }, + "Projection": { + "target": "com.amazonaws.dynamodb#Projection", + "traits": { + "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the global\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

" + } + }, + "IndexStatus": { + "target": "com.amazonaws.dynamodb#IndexStatus", + "traits": { + "smithy.api#documentation": "

The current state of the global secondary index:

\n
    \n
  • \n

    \n CREATING - The index is being created.

    \n
  • \n
  • \n

    \n UPDATING - The index is being updated.

    \n
  • \n
  • \n

    \n DELETING - The index is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The index is ready for use.

    \n
  • \n
" + } + }, + "Backfilling": { + "target": "com.amazonaws.dynamodb#Backfilling", + "traits": { + "smithy.api#documentation": "

Indicates whether the index is currently backfilling. Backfilling\n is the process of reading items from the table and determining whether they can be added\n to the index. (Not all items will qualify: For example, a partition key cannot have any\n duplicate values.) If an item can be added to the index, DynamoDB will do so. After all\n items have been processed, the backfilling operation is complete and\n Backfilling is false.

\n

You can delete an index that is being created during the Backfilling\n phase when IndexStatus is set to CREATING and Backfilling is\n true. You can't delete the index that is being created when IndexStatus is\n set to CREATING and Backfilling is false.

\n \n

For indexes that were created during a CreateTable operation, the\n Backfilling attribute does not appear in the\n DescribeTable output.

\n
" + } + }, + "ProvisionedThroughput": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputDescription", + "traits": { + "smithy.api#documentation": "

Represents the provisioned throughput settings for the specified global secondary\n index.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "IndexSizeBytes": { + "target": "com.amazonaws.dynamodb#Long", + "traits": { + "smithy.api#documentation": "

The total size of the specified index, in bytes. DynamoDB updates this value\n approximately every six hours. Recent changes might not be reflected in this\n value.

" + } + }, + "ItemCount": { + "target": "com.amazonaws.dynamodb#Long", + "traits": { + "smithy.api#documentation": "

The number of items in the specified index. DynamoDB updates this value approximately\n every six hours. Recent changes might not be reflected in this value.

" + } + }, + "IndexArn": { + "target": "com.amazonaws.dynamodb#String", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) that uniquely identifies the index.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the properties of a global secondary index.

" + } + }, + "com.amazonaws.dynamodb#GlobalSecondaryIndexDescriptionList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexDescription" + } + }, + "com.amazonaws.dynamodb#GlobalSecondaryIndexInfo": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index.

" + } + }, + "KeySchema": { + "target": "com.amazonaws.dynamodb#KeySchema", + "traits": { + "smithy.api#documentation": "

The complete key schema for a global secondary index, which consists of one or more\n pairs of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of an internal hash function to evenly distribute data items across\n partitions, based on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with\n the same partition key physically close together, in sorted order by the sort key\n value.

\n
" + } + }, + "Projection": { + "target": "com.amazonaws.dynamodb#Projection", + "traits": { + "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the global\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

" + } + }, + "ProvisionedThroughput": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughput", + "traits": { + "smithy.api#documentation": "

Represents the provisioned throughput settings for the specified global secondary\n index.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the properties of a global secondary index for the table when the backup\n was created.

" + } + }, + "com.amazonaws.dynamodb#GlobalSecondaryIndexList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndex" + } + }, + "com.amazonaws.dynamodb#GlobalSecondaryIndexUpdate": { + "type": "structure", + "members": { + "Update": { + "target": "com.amazonaws.dynamodb#UpdateGlobalSecondaryIndexAction", + "traits": { + "smithy.api#documentation": "

The name of an existing global secondary index, along with new provisioned throughput\n settings to be applied to that index.

" + } + }, + "Create": { + "target": "com.amazonaws.dynamodb#CreateGlobalSecondaryIndexAction", + "traits": { + "smithy.api#documentation": "

The parameters required for creating a global secondary index on an existing\n table:

\n
    \n
  • \n

    \n IndexName \n

    \n
  • \n
  • \n

    \n KeySchema \n

    \n
  • \n
  • \n

    \n AttributeDefinitions \n

    \n
  • \n
  • \n

    \n Projection \n

    \n
  • \n
  • \n

    \n ProvisionedThroughput \n

    \n
  • \n
" + } + }, + "Delete": { + "target": "com.amazonaws.dynamodb#DeleteGlobalSecondaryIndexAction", + "traits": { + "smithy.api#documentation": "

The name of an existing global secondary index to be removed.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents one of the following:

\n
    \n
  • \n

    A new global secondary index to be added to an existing table.

    \n
  • \n
  • \n

    New provisioned throughput parameters for an existing global secondary\n index.

    \n
  • \n
  • \n

    An existing global secondary index to be removed from an existing\n table.

    \n
  • \n
" + } + }, + "com.amazonaws.dynamodb#GlobalSecondaryIndexUpdateList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexUpdate" + } + }, + "com.amazonaws.dynamodb#GlobalSecondaryIndexes": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexInfo" + } + }, + "com.amazonaws.dynamodb#GlobalTable": { + "type": "structure", + "members": { + "GlobalTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The global table name.

" + } + }, + "ReplicationGroup": { + "target": "com.amazonaws.dynamodb#ReplicaList", + "traits": { + "smithy.api#documentation": "

The Regions where the global table has replicas.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the properties of a global table.

" + } + }, + "com.amazonaws.dynamodb#GlobalTableAlreadyExistsException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

The specified global table already exists.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#GlobalTableArnString": { + "type": "string" + }, + "com.amazonaws.dynamodb#GlobalTableDescription": { + "type": "structure", + "members": { + "ReplicationGroup": { + "target": "com.amazonaws.dynamodb#ReplicaDescriptionList", + "traits": { + "smithy.api#documentation": "

The Regions where the global table has replicas.

" + } + }, + "GlobalTableArn": { + "target": "com.amazonaws.dynamodb#GlobalTableArnString", + "traits": { + "smithy.api#documentation": "

The unique identifier of the global table.

" + } + }, + "CreationDateTime": { + "target": "com.amazonaws.dynamodb#Date", + "traits": { + "smithy.api#documentation": "

The creation time of the global table.

" + } + }, + "GlobalTableStatus": { + "target": "com.amazonaws.dynamodb#GlobalTableStatus", + "traits": { + "smithy.api#documentation": "

The current state of the global table:

\n
    \n
  • \n

    \n CREATING - The global table is being created.

    \n
  • \n
  • \n

    \n UPDATING - The global table is being updated.

    \n
  • \n
  • \n

    \n DELETING - The global table is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The global table is ready for use.

    \n
  • \n
" + } + }, + "GlobalTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The global table name.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains details about the global table.

" + } + }, + "com.amazonaws.dynamodb#GlobalTableGlobalSecondaryIndexSettingsUpdate": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index. The name must be unique among all other\n indexes on this table.

", + "smithy.api#required": {} + } + }, + "ProvisionedWriteCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", + "traits": { + "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException.\n

" + } + }, + "ProvisionedWriteCapacityAutoScalingSettingsUpdate": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate", + "traits": { + "smithy.api#documentation": "

Auto scaling settings for managing a global secondary index's write capacity\n units.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the settings of a global secondary index for a global table that will be\n modified.

" + } + }, + "com.amazonaws.dynamodb#GlobalTableGlobalSecondaryIndexSettingsUpdateList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#GlobalTableGlobalSecondaryIndexSettingsUpdate" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 20 + } + } + }, + "com.amazonaws.dynamodb#GlobalTableList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#GlobalTable" + } + }, + "com.amazonaws.dynamodb#GlobalTableNotFoundException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

The specified global table does not exist.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#GlobalTableStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "CREATING", + "name": "CREATING" + }, + { + "value": "ACTIVE", + "name": "ACTIVE" + }, + { + "value": "DELETING", + "name": "DELETING" + }, + { + "value": "UPDATING", + "name": "UPDATING" + } + ] + } + }, + "com.amazonaws.dynamodb#IdempotentParameterMismatchException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

DynamoDB rejected the request because you retried a request with a\n different payload but with an idempotent token that was already used.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ImportArn": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 37, + "max": 1024 + } + } + }, + "com.amazonaws.dynamodb#ImportConflictException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

\n There was a conflict when importing from the specified S3 source. \n This can occur when the current import conflicts with a previous import request \n that had the same client token.\n

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ImportEndTime": { + "type": "timestamp" + }, + "com.amazonaws.dynamodb#ImportNextToken": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 112, + "max": 1024 + }, + "smithy.api#pattern": "^([0-9a-f]{16})+$" + } + }, + "com.amazonaws.dynamodb#ImportNotFoundException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

\n The specified import was not found.\n

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ImportStartTime": { + "type": "timestamp" + }, + "com.amazonaws.dynamodb#ImportStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "IN_PROGRESS", + "name": "IN_PROGRESS" + }, + { + "value": "COMPLETED", + "name": "COMPLETED" + }, + { + "value": "CANCELLING", + "name": "CANCELLING" + }, + { + "value": "CANCELLED", + "name": "CANCELLED" + }, + { + "value": "FAILED", + "name": "FAILED" + } + ] + } + }, + "com.amazonaws.dynamodb#ImportSummary": { + "type": "structure", + "members": { + "ImportArn": { + "target": "com.amazonaws.dynamodb#ImportArn", + "traits": { + "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) corresponding to the import request.\n

" + } + }, + "ImportStatus": { + "target": "com.amazonaws.dynamodb#ImportStatus", + "traits": { + "smithy.api#documentation": "

\n The status of the import operation.\n

" + } + }, + "TableArn": { + "target": "com.amazonaws.dynamodb#TableArn", + "traits": { + "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) of the table being imported into.\n

" + } + }, + "S3BucketSource": { + "target": "com.amazonaws.dynamodb#S3BucketSource", + "traits": { + "smithy.api#documentation": "

\n The path and S3 bucket of the source file that is being imported. This includes the S3Bucket (required), \n S3KeyPrefix (optional) and S3BucketOwner (optional if the bucket is owned by the requester).\n

" + } + }, + "CloudWatchLogGroupArn": { + "target": "com.amazonaws.dynamodb#CloudWatchLogGroupArn", + "traits": { + "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) of the Cloudwatch Log Group associated with this import task.\n

" + } + }, + "InputFormat": { + "target": "com.amazonaws.dynamodb#InputFormat", + "traits": { + "smithy.api#documentation": "

\n The format of the source data. Valid values are CSV,\n DYNAMODB_JSON or ION.

" + } + }, + "StartTime": { + "target": "com.amazonaws.dynamodb#ImportStartTime", + "traits": { + "smithy.api#documentation": "

\n The time at which this import task began.\n

" + } + }, + "EndTime": { + "target": "com.amazonaws.dynamodb#ImportEndTime", + "traits": { + "smithy.api#documentation": "

\n The time at which this import task ended. (Does this include the successful complete creation of \n the table it was imported to?)\n

" + } + } + }, + "traits": { + "smithy.api#documentation": "

\n Summary information about the source file for the import.\n

" + } + }, + "com.amazonaws.dynamodb#ImportSummaryList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ImportSummary" + } + }, + "com.amazonaws.dynamodb#ImportTable": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ImportTableInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ImportTableOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#ImportConflictException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceInUseException" + } + ], + "traits": { + "smithy.api#documentation": "

\n Imports table data from an S3 bucket. \n \n

" + } + }, + "com.amazonaws.dynamodb#ImportTableDescription": { + "type": "structure", + "members": { + "ImportArn": { + "target": "com.amazonaws.dynamodb#ImportArn", + "traits": { + "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) corresponding to the import request.\n

" + } + }, + "ImportStatus": { + "target": "com.amazonaws.dynamodb#ImportStatus", + "traits": { + "smithy.api#documentation": "

\n The status of the import.\n

" + } + }, + "TableArn": { + "target": "com.amazonaws.dynamodb#TableArn", + "traits": { + "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) of the table being imported into.\n

" + } + }, + "TableId": { + "target": "com.amazonaws.dynamodb#TableId", + "traits": { + "smithy.api#documentation": "

\n The table id corresponding to the table created by import table process.\n \n

" + } + }, + "ClientToken": { + "target": "com.amazonaws.dynamodb#ClientToken", + "traits": { + "smithy.api#documentation": "

\n The client token that was provided for the import task. Reusing the client token \n on retry makes a call to ImportTable idempotent.\n

" + } + }, + "S3BucketSource": { + "target": "com.amazonaws.dynamodb#S3BucketSource", + "traits": { + "smithy.api#documentation": "

\n Values for the S3 bucket the source file is imported from. Includes bucket name (required), \n key prefix (optional) and bucket account owner ID (optional).\n

" + } + }, + "ErrorCount": { + "target": "com.amazonaws.dynamodb#ErrorCount", + "traits": { + "smithy.api#documentation": "

\n The number of errors occurred on importing the source file into the target table.\n

" + } + }, + "CloudWatchLogGroupArn": { + "target": "com.amazonaws.dynamodb#CloudWatchLogGroupArn", + "traits": { + "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) of the Cloudwatch Log Group associated with the target table.\n

" + } + }, + "InputFormat": { + "target": "com.amazonaws.dynamodb#InputFormat", + "traits": { + "smithy.api#documentation": "

\n The format of the source data going into the target table.\n

" + } + }, + "InputFormatOptions": { + "target": "com.amazonaws.dynamodb#InputFormatOptions", + "traits": { + "smithy.api#documentation": "

The format options for the data that was imported into the target table. There is one value, CsvOption.\n

" + } + }, + "InputCompressionType": { + "target": "com.amazonaws.dynamodb#InputCompressionType", + "traits": { + "smithy.api#documentation": "

\n The compression options for the data that has been imported into the target table. The values are \n NONE, GZIP, or ZSTD.\n

" + } + }, + "TableCreationParameters": { + "target": "com.amazonaws.dynamodb#TableCreationParameters", + "traits": { + "smithy.api#documentation": "

\n The parameters for the new table that is being imported into.\n

" + } + }, + "StartTime": { + "target": "com.amazonaws.dynamodb#ImportStartTime", + "traits": { + "smithy.api#documentation": "

\n The time when this import task started.\n

" + } + }, + "EndTime": { + "target": "com.amazonaws.dynamodb#ImportEndTime", + "traits": { + "smithy.api#documentation": "

\n The time at which the creation of the table associated with this import task completed.\n

" + } + }, + "ProcessedSizeBytes": { + "target": "com.amazonaws.dynamodb#Long", + "traits": { + "smithy.api#documentation": "

\n The total size of data processed from the source file, in Bytes.\n

" + } + }, + "ProcessedItemCount": { + "target": "com.amazonaws.dynamodb#ProcessedItemCount", + "traits": { + "smithy.api#documentation": "

\n The total number of items processed from the source file.\n

" + } + }, + "ImportedItemCount": { + "target": "com.amazonaws.dynamodb#ImportedItemCount", + "traits": { + "smithy.api#documentation": "

\n The number of items successfully imported into the new table.\n

" + } + }, + "FailureCode": { + "target": "com.amazonaws.dynamodb#FailureCode", + "traits": { + "smithy.api#documentation": "

\n The error code corresponding to the failure that the import job ran into during execution.\n

" + } + }, + "FailureMessage": { + "target": "com.amazonaws.dynamodb#FailureMessage", + "traits": { + "smithy.api#documentation": "

\n The error message corresponding to the failure that the import job ran into during execution.\n

" + } + } + }, + "traits": { + "smithy.api#documentation": "

\n Represents the properties of the table being imported into.\n

" + } + }, + "com.amazonaws.dynamodb#ImportTableInput": { + "type": "structure", + "members": { + "ClientToken": { + "target": "com.amazonaws.dynamodb#ClientToken", + "traits": { + "smithy.api#documentation": "

Providing a ClientToken makes the call to\n ImportTableInput idempotent, meaning that multiple\n identical calls have the same effect as one single call.

\n

A client token is valid for 8 hours after the first request that uses it is completed.\n After 8 hours, any request with the same client token is treated as a new request. Do\n not resubmit the same request with the same client token for more than 8 hours, or the\n result might not be idempotent.

\n

If you submit a request with the same client token but a change in other parameters\n within the 8-hour idempotency window, DynamoDB returns an\n IdempotentParameterMismatch exception.

", + "smithy.api#idempotencyToken": {} + } + }, + "S3BucketSource": { + "target": "com.amazonaws.dynamodb#S3BucketSource", + "traits": { + "smithy.api#documentation": "

\n The S3 bucket that provides the source for the import.\n

", + "smithy.api#required": {} + } + }, + "InputFormat": { + "target": "com.amazonaws.dynamodb#InputFormat", + "traits": { + "smithy.api#documentation": "

The format of the source data. Valid values for ImportFormat are\n CSV, DYNAMODB_JSON or ION.\n

", + "smithy.api#required": {} + } + }, + "InputFormatOptions": { + "target": "com.amazonaws.dynamodb#InputFormatOptions", + "traits": { + "smithy.api#documentation": "

\n Additional properties that specify how the input is formatted,\n

" + } + }, + "InputCompressionType": { + "target": "com.amazonaws.dynamodb#InputCompressionType", + "traits": { + "smithy.api#documentation": "

\n Type of compression to be used on the input coming from the imported table.\n

" + } + }, + "TableCreationParameters": { + "target": "com.amazonaws.dynamodb#TableCreationParameters", + "traits": { + "smithy.api#documentation": "

Parameters for the table to import the data into.\n

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#ImportTableOutput": { + "type": "structure", + "members": { + "ImportTableDescription": { + "target": "com.amazonaws.dynamodb#ImportTableDescription", + "traits": { + "smithy.api#documentation": "

\n Represents the properties of the table created for the import, and parameters of \n the import. The import parameters include import status, how many items were processed, \n and how many errors were encountered.\n

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#ImportedItemCount": { + "type": "long", + "traits": { + "smithy.api#range": { + "min": 0 + } + } + }, + "com.amazonaws.dynamodb#IndexName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 3, + "max": 255 + }, + "smithy.api#pattern": "^[a-zA-Z0-9_.-]+$" + } + }, + "com.amazonaws.dynamodb#IndexNotFoundException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

The operation tried to access a nonexistent index.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#IndexStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "CREATING", + "name": "CREATING" + }, + { + "value": "UPDATING", + "name": "UPDATING" + }, + { + "value": "DELETING", + "name": "DELETING" + }, + { + "value": "ACTIVE", + "name": "ACTIVE" + } + ] + } + }, + "com.amazonaws.dynamodb#InputCompressionType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "GZIP", + "name": "GZIP" + }, + { + "value": "ZSTD", + "name": "ZSTD" + }, + { + "value": "NONE", + "name": "NONE" + } + ] + } + }, + "com.amazonaws.dynamodb#InputFormat": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "DYNAMODB_JSON", + "name": "DYNAMODB_JSON" + }, + { + "value": "ION", + "name": "ION" + }, + { + "value": "CSV", + "name": "CSV" + } + ] + } + }, + "com.amazonaws.dynamodb#InputFormatOptions": { + "type": "structure", + "members": { + "Csv": { + "target": "com.amazonaws.dynamodb#CsvOptions", + "traits": { + "smithy.api#documentation": "

\n The options for imported source files in CSV format. The values are Delimiter and HeaderList.\n

" + } + } + }, + "traits": { + "smithy.api#documentation": "

\n The format options for the data that was imported into the target table. There is one value, CsvOption.

" + } + }, + "com.amazonaws.dynamodb#Integer": { + "type": "integer" + }, + "com.amazonaws.dynamodb#IntegerObject": { + "type": "integer", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#InternalServerError": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage", + "traits": { + "smithy.api#documentation": "

The server encountered an internal error trying to fulfill the request.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

An error occurred on the server side.

", + "smithy.api#error": "server" + } + }, + "com.amazonaws.dynamodb#InvalidEndpointException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.dynamodb#String" + } + }, + "traits": { + "smithy.api#error": "client", + "smithy.api#httpError": 421 + } + }, + "com.amazonaws.dynamodb#InvalidExportTimeException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

The specified ExportTime is outside of the point in time recovery\n window.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#InvalidRestoreTimeException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

An invalid restore time was specified. RestoreDateTime must be between\n EarliestRestorableDateTime and LatestRestorableDateTime.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ItemCollectionKeyAttributeMap": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#AttributeName" + }, + "value": { + "target": "com.amazonaws.dynamodb#AttributeValue" + } + }, + "com.amazonaws.dynamodb#ItemCollectionMetrics": { + "type": "structure", + "members": { + "ItemCollectionKey": { + "target": "com.amazonaws.dynamodb#ItemCollectionKeyAttributeMap", + "traits": { + "smithy.api#documentation": "

The partition key value of the item collection. This value is the same as the\n partition key value of the item.

" + } + }, + "SizeEstimateRangeGB": { + "target": "com.amazonaws.dynamodb#ItemCollectionSizeEstimateRange", + "traits": { + "smithy.api#documentation": "

An estimate of item collection size, in gigabytes. This value is a two-element array\n containing a lower bound and an upper bound for the estimate. The estimate includes the\n size of all the items in the table, plus the size of all attributes projected into all\n of the local secondary indexes on that table. Use this estimate to measure whether a\n local secondary index is approaching its size limit.

\n

The estimate is subject to change over time; therefore, do not rely on the precision\n or accuracy of the estimate.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Information about item collections, if any, that were affected by the operation.\n ItemCollectionMetrics is only returned if the request asked for it. If\n the table does not have any local secondary indexes, this information is not returned in\n the response.

" + } + }, + "com.amazonaws.dynamodb#ItemCollectionMetricsMultiple": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ItemCollectionMetrics" + } + }, + "com.amazonaws.dynamodb#ItemCollectionMetricsPerTable": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#TableName" + }, + "value": { + "target": "com.amazonaws.dynamodb#ItemCollectionMetricsMultiple" + } + }, + "com.amazonaws.dynamodb#ItemCollectionSizeEstimateBound": { + "type": "double", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#ItemCollectionSizeEstimateRange": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ItemCollectionSizeEstimateBound" + } + }, + "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage", + "traits": { + "smithy.api#documentation": "

The total size of an item collection has exceeded the maximum limit of 10\n gigabytes.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

An item collection is too large. This exception is only returned for tables that\n have one or more local secondary indexes.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ItemCount": { + "type": "long", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 0 + } + } + }, + "com.amazonaws.dynamodb#ItemList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#AttributeMap" + } + }, + "com.amazonaws.dynamodb#ItemResponse": { + "type": "structure", + "members": { + "Item": { + "target": "com.amazonaws.dynamodb#AttributeMap", + "traits": { + "smithy.api#documentation": "

Map of attribute data consisting of the data type and attribute value.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Details for the requested item.

" + } + }, + "com.amazonaws.dynamodb#ItemResponseList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ItemResponse" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 25 + } + } + }, + "com.amazonaws.dynamodb#KMSMasterKeyArn": { + "type": "string" + }, + "com.amazonaws.dynamodb#KMSMasterKeyId": { + "type": "string" + }, + "com.amazonaws.dynamodb#Key": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#AttributeName" + }, + "value": { + "target": "com.amazonaws.dynamodb#AttributeValue" + } + }, + "com.amazonaws.dynamodb#KeyConditions": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#AttributeName" + }, + "value": { + "target": "com.amazonaws.dynamodb#Condition" + } + }, + "com.amazonaws.dynamodb#KeyExpression": { + "type": "string" + }, + "com.amazonaws.dynamodb#KeyList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#Key" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 100 + } + } + }, + "com.amazonaws.dynamodb#KeySchema": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#KeySchemaElement" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 2 + } + } + }, + "com.amazonaws.dynamodb#KeySchemaAttributeName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 255 + } + } + }, + "com.amazonaws.dynamodb#KeySchemaElement": { + "type": "structure", + "members": { + "AttributeName": { + "target": "com.amazonaws.dynamodb#KeySchemaAttributeName", + "traits": { + "smithy.api#documentation": "

The name of a key attribute.

", + "smithy.api#required": {} + } + }, + "KeyType": { + "target": "com.amazonaws.dynamodb#KeyType", + "traits": { + "smithy.api#documentation": "

The role that this key attribute will assume:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of an internal hash function to evenly distribute data items across\n partitions, based on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with\n the same partition key physically close together, in sorted order by the sort key\n value.

\n
", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents a single element of a key schema. A key schema\n specifies the attributes that make up the primary key of a table, or the key attributes\n of an index.

\n

A KeySchemaElement represents exactly one attribute of the primary key.\n For example, a simple primary key would be represented by one\n KeySchemaElement (for the partition key). A composite primary key would\n require one KeySchemaElement for the partition key, and another\n KeySchemaElement for the sort key.

\n

A KeySchemaElement must be a scalar, top-level attribute (not a nested\n attribute). The data type must be one of String, Number, or Binary. The attribute cannot\n be nested within a List or a Map.

" + } + }, + "com.amazonaws.dynamodb#KeyType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "HASH", + "name": "HASH" + }, + { + "value": "RANGE", + "name": "RANGE" + } + ] + } + }, + "com.amazonaws.dynamodb#KeysAndAttributes": { + "type": "structure", + "members": { + "Keys": { + "target": "com.amazonaws.dynamodb#KeyList", + "traits": { + "smithy.api#documentation": "

The primary key attribute values that define the items and the attributes associated\n with the items.

", + "smithy.api#required": {} + } + }, + "AttributesToGet": { + "target": "com.amazonaws.dynamodb#AttributeNameList", + "traits": { + "smithy.api#documentation": "

This is a legacy parameter. Use ProjectionExpression instead. For more\n information, see Legacy\n Conditional Parameters in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ConsistentRead": { + "target": "com.amazonaws.dynamodb#ConsistentRead", + "traits": { + "smithy.api#documentation": "

The consistency of a read operation. If set to true, then a strongly\n consistent read is used; otherwise, an eventually consistent read is used.

" + } + }, + "ProjectionExpression": { + "target": "com.amazonaws.dynamodb#ProjectionExpression", + "traits": { + "smithy.api#documentation": "

A string that identifies one or more attributes to retrieve from the table. These\n attributes can include scalars, sets, or elements of a JSON document. The attributes in\n the ProjectionExpression must be separated by commas.

\n

If no attribute names are specified, then all attributes will be returned. If any of\n the requested attributes are not found, they will not appear in the result.

\n

For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", + "traits": { + "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer\n Guide.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents a set of primary keys and, for each key, the attributes to retrieve from\n the table.

\n

For each primary key, you must provide all of the key attributes.\n For example, with a simple primary key, you only need to provide the partition key. For\n a composite primary key, you must provide both the partition key\n and the sort key.

" + } + }, + "com.amazonaws.dynamodb#KinesisDataStreamDestination": { + "type": "structure", + "members": { + "StreamArn": { + "target": "com.amazonaws.dynamodb#StreamArn", + "traits": { + "smithy.api#documentation": "

The ARN for a specific Kinesis data stream.

" + } + }, + "DestinationStatus": { + "target": "com.amazonaws.dynamodb#DestinationStatus", + "traits": { + "smithy.api#documentation": "

The current status of replication.

" + } + }, + "DestinationStatusDescription": { + "target": "com.amazonaws.dynamodb#String", + "traits": { + "smithy.api#documentation": "

The human-readable string that corresponds to the replica status.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Describes a Kinesis data stream destination.

" + } + }, + "com.amazonaws.dynamodb#KinesisDataStreamDestinations": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#KinesisDataStreamDestination" + } + }, + "com.amazonaws.dynamodb#KinesisStreamingDestinationInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the DynamoDB table.

", + "smithy.api#required": {} + } + }, + "StreamArn": { + "target": "com.amazonaws.dynamodb#StreamArn", + "traits": { + "smithy.api#documentation": "

The ARN for a Kinesis data stream.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#KinesisStreamingDestinationOutput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table being modified.

" + } + }, + "StreamArn": { + "target": "com.amazonaws.dynamodb#StreamArn", + "traits": { + "smithy.api#documentation": "

The ARN for the specific Kinesis data stream.

" + } + }, + "DestinationStatus": { + "target": "com.amazonaws.dynamodb#DestinationStatus", + "traits": { + "smithy.api#documentation": "

The current status of the replication.

" + } + } + } + }, + "com.amazonaws.dynamodb#EnableKinesisStreamingDestinationInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the DynamoDB table.

", + "smithy.api#required": {} + } + }, + "StreamArn": { + "target": "com.amazonaws.dynamodb#StreamArn", + "traits": { + "smithy.api#documentation": "

The ARN for a Kinesis data stream.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#EnableKinesisStreamingDestinationOutput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table being modified.

" + } + }, + "StreamArn": { + "target": "com.amazonaws.dynamodb#StreamArn", + "traits": { + "smithy.api#documentation": "

The ARN for the specific Kinesis data stream.

" + } + }, + "DestinationStatus": { + "target": "com.amazonaws.dynamodb#DestinationStatus", + "traits": { + "smithy.api#documentation": "

The current status of the replication.

" + } + } + } + }, + "com.amazonaws.dynamodb#DisableKinesisStreamingDestinationInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the DynamoDB table.

", + "smithy.api#required": {} + } + }, + "StreamArn": { + "target": "com.amazonaws.dynamodb#StreamArn", + "traits": { + "smithy.api#documentation": "

The ARN for a Kinesis data stream.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#DisableKinesisStreamingDestinationOutput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table being modified.

" + } + }, + "StreamArn": { + "target": "com.amazonaws.dynamodb#StreamArn", + "traits": { + "smithy.api#documentation": "

The ARN for the specific Kinesis data stream.

" + } + }, + "DestinationStatus": { + "target": "com.amazonaws.dynamodb#DestinationStatus", + "traits": { + "smithy.api#documentation": "

The current status of the replication.

" + } + } + } + }, + "com.amazonaws.dynamodb#LastUpdateDateTime": { + "type": "timestamp" + }, + "com.amazonaws.dynamodb#LimitExceededException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage", + "traits": { + "smithy.api#documentation": "

Too many operations for a given subscriber.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

There is no limit to the number of daily on-demand backups that can be taken.

\n

Up to 500 simultaneous table operations are allowed per account. These operations\n include CreateTable, UpdateTable,\n DeleteTable,UpdateTimeToLive,\n RestoreTableFromBackup, and RestoreTableToPointInTime.

\n

The only exception is when you are creating a table with one or more secondary\n indexes. You can have up to 250 such requests running at a time; however, if the table or\n index specifications are complex, DynamoDB might temporarily reduce the number\n of concurrent operations.

\n

There is a soft account quota of 2,500 tables.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ListAttributeValue": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#AttributeValue" + } + }, + "com.amazonaws.dynamodb#ListBackups": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ListBackupsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ListBackupsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

List backups associated with an Amazon Web Services account. To list backups for a\n given table, specify TableName. ListBackups returns a\n paginated list of results with at most 1 MB worth of items in a page. You can also\n specify a maximum number of entries to be returned in a page.

\n

In the request, start time is inclusive, but end time is exclusive. Note that these\n boundaries are for the time at which the original backup was requested.

\n

You can call ListBackups a maximum of five times per second.

" + } + }, + "com.amazonaws.dynamodb#ListBackupsInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The backups from the table specified by TableName are listed.

" + } + }, + "Limit": { + "target": "com.amazonaws.dynamodb#BackupsInputLimit", + "traits": { + "smithy.api#documentation": "

Maximum number of backups to return at once.

" + } + }, + "TimeRangeLowerBound": { + "target": "com.amazonaws.dynamodb#TimeRangeLowerBound", + "traits": { + "smithy.api#documentation": "

Only backups created after this time are listed. TimeRangeLowerBound is\n inclusive.

" + } + }, + "TimeRangeUpperBound": { + "target": "com.amazonaws.dynamodb#TimeRangeUpperBound", + "traits": { + "smithy.api#documentation": "

Only backups created before this time are listed. TimeRangeUpperBound is\n exclusive.

" + } + }, + "ExclusiveStartBackupArn": { + "target": "com.amazonaws.dynamodb#BackupArn", + "traits": { + "smithy.api#documentation": "

\n LastEvaluatedBackupArn is the Amazon Resource Name (ARN) of the backup last\n evaluated when the current page of results was returned, inclusive of the current page\n of results. This value may be specified as the ExclusiveStartBackupArn of a\n new ListBackups operation in order to fetch the next page of results.\n

" + } + }, + "BackupType": { + "target": "com.amazonaws.dynamodb#BackupTypeFilter", + "traits": { + "smithy.api#documentation": "

The backups from the table specified by BackupType are listed.

\n

Where BackupType can be:

\n
    \n
  • \n

    \n USER - On-demand backup created by you. (The default setting if no other backup types are specified.)

    \n
  • \n
  • \n

    \n SYSTEM - On-demand backup automatically created by DynamoDB.

    \n
  • \n
  • \n

    \n ALL - All types of on-demand backups (USER and SYSTEM).

    \n
  • \n
" + } + } + } + }, + "com.amazonaws.dynamodb#ListBackupsOutput": { + "type": "structure", + "members": { + "BackupSummaries": { + "target": "com.amazonaws.dynamodb#BackupSummaries", + "traits": { + "smithy.api#documentation": "

List of BackupSummary objects.

" + } + }, + "LastEvaluatedBackupArn": { + "target": "com.amazonaws.dynamodb#BackupArn", + "traits": { + "smithy.api#documentation": "

The ARN of the backup last evaluated when the current page of results was returned,\n inclusive of the current page of results. This value may be specified as the\n ExclusiveStartBackupArn of a new ListBackups operation in\n order to fetch the next page of results.

\n

If LastEvaluatedBackupArn is empty, then the last page of results has\n been processed and there are no more results to be retrieved.

\n

If LastEvaluatedBackupArn is not empty, this may or may not indicate\n that there is more data to be returned. All results are guaranteed to have been returned\n if and only if no value for LastEvaluatedBackupArn is returned.

" + } + } + } + }, + "com.amazonaws.dynamodb#ListContributorInsights": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ListContributorInsightsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ListContributorInsightsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Returns a list of ContributorInsightsSummary for a table and all its global secondary\n indexes.

", + "smithy.api#paginated": { + "inputToken": "NextToken", + "outputToken": "NextToken", + "pageSize": "MaxResults" + } + } + }, + "com.amazonaws.dynamodb#ListContributorInsightsInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table.

" + } + }, + "NextToken": { + "target": "com.amazonaws.dynamodb#NextTokenString", + "traits": { + "smithy.api#documentation": "

A token to for the desired page, if there is one.

" + } + }, + "MaxResults": { + "target": "com.amazonaws.dynamodb#ListContributorInsightsLimit", + "traits": { + "smithy.api#documentation": "

Maximum number of results to return per page.

" + } + } + } + }, + "com.amazonaws.dynamodb#ListContributorInsightsLimit": { + "type": "integer", + "traits": { + "smithy.api#range": { + "max": 100 + } + } + }, + "com.amazonaws.dynamodb#ListContributorInsightsOutput": { + "type": "structure", + "members": { + "ContributorInsightsSummaries": { + "target": "com.amazonaws.dynamodb#ContributorInsightsSummaries", + "traits": { + "smithy.api#documentation": "

A list of ContributorInsightsSummary.

" + } + }, + "NextToken": { + "target": "com.amazonaws.dynamodb#NextTokenString", + "traits": { + "smithy.api#documentation": "

A token to go to the next page if there is one.

" + } + } + } + }, + "com.amazonaws.dynamodb#ListExports": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ListExportsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ListExportsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + } + ], + "traits": { + "smithy.api#documentation": "

Lists completed exports within the past 90 days.

", + "smithy.api#paginated": { + "inputToken": "NextToken", + "outputToken": "NextToken", + "pageSize": "MaxResults" + } + } + }, + "com.amazonaws.dynamodb#ListExportsInput": { + "type": "structure", + "members": { + "TableArn": { + "target": "com.amazonaws.dynamodb#TableArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) associated with the exported table.

" + } + }, + "MaxResults": { + "target": "com.amazonaws.dynamodb#ListExportsMaxLimit", + "traits": { + "smithy.api#documentation": "

Maximum number of results to return per page.

" + } + }, + "NextToken": { + "target": "com.amazonaws.dynamodb#ExportNextToken", + "traits": { + "smithy.api#documentation": "

An optional string that, if supplied, must be copied from the output of a previous\n call to ListExports. When provided in this manner, the API fetches the next\n page of results.

" + } + } + } + }, + "com.amazonaws.dynamodb#ListExportsMaxLimit": { + "type": "integer", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 1, + "max": 25 + } + } + }, + "com.amazonaws.dynamodb#ListExportsOutput": { + "type": "structure", + "members": { + "ExportSummaries": { + "target": "com.amazonaws.dynamodb#ExportSummaries", + "traits": { + "smithy.api#documentation": "

A list of ExportSummary objects.

" + } + }, + "NextToken": { + "target": "com.amazonaws.dynamodb#ExportNextToken", + "traits": { + "smithy.api#documentation": "

If this value is returned, there are additional results to be displayed. To retrieve\n them, call ListExports again, with NextToken set to this\n value.

" + } + } + } + }, + "com.amazonaws.dynamodb#ListGlobalTables": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ListGlobalTablesInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ListGlobalTablesOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Lists all global tables that have a replica in the specified Region.

\n \n

This operation only applies to Version\n 2017.11.29 of global tables.

\n
" + } + }, + "com.amazonaws.dynamodb#ListGlobalTablesInput": { + "type": "structure", + "members": { + "ExclusiveStartGlobalTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The first global table name that this operation will evaluate.

" + } + }, + "Limit": { + "target": "com.amazonaws.dynamodb#PositiveIntegerObject", + "traits": { + "smithy.api#documentation": "

The maximum number of table names to return, if the parameter is not specified\n DynamoDB defaults to 100.

\n

If the number of global tables DynamoDB finds reaches this limit, it stops the\n operation and returns the table names collected up to that point, with a table name in\n the LastEvaluatedGlobalTableName to apply in a subsequent operation to the\n ExclusiveStartGlobalTableName parameter.

" + } + }, + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", + "traits": { + "smithy.api#documentation": "

Lists the global tables in a specific Region.

" + } + } + } + }, + "com.amazonaws.dynamodb#ListGlobalTablesOutput": { + "type": "structure", + "members": { + "GlobalTables": { + "target": "com.amazonaws.dynamodb#GlobalTableList", + "traits": { + "smithy.api#documentation": "

List of global table names.

" + } + }, + "LastEvaluatedGlobalTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

Last evaluated global table name.

" + } + } + } + }, + "com.amazonaws.dynamodb#ListImports": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ListImportsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ListImportsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + } + ], + "traits": { + "smithy.api#documentation": "

\n Lists completed imports within the past 90 days.\n

", + "smithy.api#paginated": { + "inputToken": "NextToken", + "outputToken": "NextToken", + "pageSize": "PageSize" + } + } + }, + "com.amazonaws.dynamodb#ListImportsInput": { + "type": "structure", + "members": { + "TableArn": { + "target": "com.amazonaws.dynamodb#TableArn", + "traits": { + "smithy.api#documentation": "

\n The Amazon Resource Name (ARN) associated with the table that was imported to.\n

" + } + }, + "PageSize": { + "target": "com.amazonaws.dynamodb#ListImportsMaxLimit", + "traits": { + "smithy.api#documentation": "

\n The number of ImportSummary objects returned in a single page.\n

" + } + }, + "NextToken": { + "target": "com.amazonaws.dynamodb#ImportNextToken", + "traits": { + "smithy.api#documentation": "

\n An optional string that, if supplied, must be copied from the output of a previous\n call to ListImports. When provided in this manner, the API fetches the next\n page of results.\n

" + } + } + } + }, + "com.amazonaws.dynamodb#ListImportsMaxLimit": { + "type": "integer", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 1, + "max": 25 + } + } + }, + "com.amazonaws.dynamodb#ListImportsOutput": { + "type": "structure", + "members": { + "ImportSummaryList": { + "target": "com.amazonaws.dynamodb#ImportSummaryList", + "traits": { + "smithy.api#documentation": "

\n A list of ImportSummary objects.\n

" + } + }, + "NextToken": { + "target": "com.amazonaws.dynamodb#ImportNextToken", + "traits": { + "smithy.api#documentation": "

\n If this value is returned, there are additional results to be displayed. To retrieve\n them, call ListImports again, with NextToken set to this\n value.\n

" + } + } + } + }, + "com.amazonaws.dynamodb#ListTables": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ListTablesInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ListTablesOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Returns an array of table names associated with the current account and endpoint. The\n output from ListTables is paginated, with each page returning a maximum of\n 100 table names.

", + "smithy.api#paginated": { + "inputToken": "ExclusiveStartTableName", + "outputToken": "LastEvaluatedTableName", + "items": "TableNames", + "pageSize": "Limit" + } + } + }, + "com.amazonaws.dynamodb#ListTablesInput": { + "type": "structure", + "members": { + "ExclusiveStartTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The first table name that this operation will evaluate. Use the value that was\n returned for LastEvaluatedTableName in a previous operation, so that you\n can obtain the next page of results.

" + } + }, + "Limit": { + "target": "com.amazonaws.dynamodb#ListTablesInputLimit", + "traits": { + "smithy.api#documentation": "

A maximum number of table names to return. If this parameter is not specified, the\n limit is 100.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the input of a ListTables operation.

" + } + }, + "com.amazonaws.dynamodb#ListTablesInputLimit": { + "type": "integer", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 1, + "max": 100 + } + } + }, + "com.amazonaws.dynamodb#ListTablesOutput": { + "type": "structure", + "members": { + "TableNames": { + "target": "com.amazonaws.dynamodb#TableNameList", + "traits": { + "smithy.api#documentation": "

The names of the tables associated with the current account at the current endpoint.\n The maximum size of this array is 100.

\n

If LastEvaluatedTableName also appears in the output, you can use this\n value as the ExclusiveStartTableName parameter in a subsequent\n ListTables request and obtain the next page of results.

" + } + }, + "LastEvaluatedTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the last table in the current page of results. Use this value as the\n ExclusiveStartTableName in a new request to obtain the next page of\n results, until all the table names are returned.

\n

If you do not receive a LastEvaluatedTableName value in the response,\n this means that there are no more table names to be retrieved.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the output of a ListTables operation.

" + } + }, + "com.amazonaws.dynamodb#ListTagsOfResource": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ListTagsOfResourceInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ListTagsOfResourceOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

List all tags on an Amazon DynamoDB resource. You can call ListTagsOfResource up to 10\n times per second, per account.

\n

For an overview on tagging DynamoDB resources, see Tagging for DynamoDB\n in the Amazon DynamoDB Developer Guide.

" + } + }, + "com.amazonaws.dynamodb#ListTagsOfResourceInput": { + "type": "structure", + "members": { + "ResourceArn": { + "target": "com.amazonaws.dynamodb#ResourceArnString", + "traits": { + "smithy.api#documentation": "

The Amazon DynamoDB resource with tags to be listed. This value is an Amazon Resource\n Name (ARN).

", + "smithy.api#required": {} + } + }, + "NextToken": { + "target": "com.amazonaws.dynamodb#NextTokenString", + "traits": { + "smithy.api#documentation": "

An optional string that, if supplied, must be copied from the output of a previous\n call to ListTagOfResource. When provided in this manner, this API fetches the next page\n of results.

" + } + } + } + }, + "com.amazonaws.dynamodb#ListTagsOfResourceOutput": { + "type": "structure", + "members": { + "Tags": { + "target": "com.amazonaws.dynamodb#TagList", + "traits": { + "smithy.api#documentation": "

The tags currently associated with the Amazon DynamoDB resource.

" + } + }, + "NextToken": { + "target": "com.amazonaws.dynamodb#NextTokenString", + "traits": { + "smithy.api#documentation": "

If this value is returned, there are additional results to be displayed. To retrieve\n them, call ListTagsOfResource again, with NextToken set to this value.

" + } + } + } + }, + "com.amazonaws.dynamodb#LocalSecondaryIndex": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the local secondary index. The name must be unique among all other indexes\n on this table.

", + "smithy.api#required": {} + } + }, + "KeySchema": { + "target": "com.amazonaws.dynamodb#KeySchema", + "traits": { + "smithy.api#documentation": "

The complete key schema for the local secondary index, consisting of one or more pairs\n of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of\n an internal hash function to evenly distribute data items across partitions, based\n on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with the same\n partition key physically close together, in sorted order by the sort key\n value.

\n
", + "smithy.api#required": {} + } + }, + "Projection": { + "target": "com.amazonaws.dynamodb#Projection", + "traits": { + "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the local\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#ExpectedAttributeValue": { - "type": "structure", - "members": { - "Value": { - "target": "com.amazonaws.dynamodb#AttributeValue", - "traits": { - "smithy.api#documentation": "

Represents the data for the expected attribute.

\n

Each attribute value is described as a name-value pair. The name is the data type, and\n the value is the data itself.

\n

For more information, see Data Types in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "Exists": { - "target": "com.amazonaws.dynamodb#BooleanObject", - "traits": { - "smithy.api#documentation": "

Causes DynamoDB to evaluate the value before attempting a conditional\n operation:

\n
    \n
  • \n

    If Exists is true, DynamoDB will check to\n see if that attribute value already exists in the table. If it is found, then\n the operation succeeds. If it is not found, the operation fails with a\n ConditionCheckFailedException.

    \n
  • \n
  • \n

    If Exists is false, DynamoDB assumes that\n the attribute value does not exist in the table. If in fact the value does not\n exist, then the assumption is valid and the operation succeeds. If the value is\n found, despite the assumption that it does not exist, the operation fails with a\n ConditionCheckFailedException.

    \n
  • \n
\n

The default setting for Exists is true. If you supply a\n Value all by itself, DynamoDB assumes the attribute exists:\n You don't have to set Exists to true, because it is\n implied.

\n

DynamoDB returns a ValidationException if:

\n
    \n
  • \n

    \n Exists is true but there is no Value to\n check. (You expect a value to exist, but don't specify what that value\n is.)

    \n
  • \n
  • \n

    \n Exists is false but you also provide a\n Value. (You cannot expect an attribute to have a value, while\n also expecting it not to exist.)

    \n
  • \n
" - } - }, - "ComparisonOperator": { - "target": "com.amazonaws.dynamodb#ComparisonOperator", - "traits": { - "smithy.api#documentation": "

A comparator for evaluating attributes in the AttributeValueList. For\n example, equals, greater than, less than, etc.

\n

The following comparison operators are available:

\n

\n EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS |\n BEGINS_WITH | IN | BETWEEN\n

\n

The following are descriptions of each comparison operator.

\n
    \n
  • \n

    \n EQ : Equal. EQ is supported for all data types,\n including lists and maps.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, Binary, String Set, Number Set, or Binary Set.\n If an item contains an AttributeValue element of a different type\n than the one provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not equal {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n NE : Not equal. NE is supported for all data types,\n including lists and maps.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String, Number, Binary, String Set, Number Set, or Binary Set. If an\n item contains an AttributeValue of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not equal {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n LE : Less than or equal.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n LT : Less than.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String, Number, or Binary (not a set type). If an item contains an\n AttributeValue element of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not equal {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not compare to {\"NS\":[\"6\", \"2\",\n \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n GE : Greater than or equal.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n GT : Greater than.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If an item contains\n an AttributeValue element of a different type than the one provided\n in the request, the value does not match. For example, {\"S\":\"6\"}\n does not equal {\"N\":\"6\"}. Also, {\"N\":\"6\"} does not\n compare to {\"NS\":[\"6\", \"2\", \"1\"]}.

    \n

    \n
  • \n
  • \n

    \n NOT_NULL : The attribute exists. NOT_NULL is supported\n for all data types, including lists and maps.

    \n \n

    This operator tests for the existence of an attribute, not its data type.\n If the data type of attribute \"a\" is null, and you evaluate it\n using NOT_NULL, the result is a Boolean true. This\n result is because the attribute \"a\" exists; its data type is\n not relevant to the NOT_NULL comparison operator.

    \n
    \n
  • \n
  • \n

    \n NULL : The attribute does not exist. NULL is supported\n for all data types, including lists and maps.

    \n \n

    This operator tests for the nonexistence of an attribute, not its data\n type. If the data type of attribute \"a\" is null, and you\n evaluate it using NULL, the result is a Boolean\n false. This is because the attribute \"a\"\n exists; its data type is not relevant to the NULL comparison\n operator.

    \n
    \n
  • \n
  • \n

    \n CONTAINS : Checks for a subsequence, or value in a set.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If the target\n attribute of the comparison is of type String, then the operator checks for a\n substring match. If the target attribute of the comparison is of type Binary,\n then the operator looks for a subsequence of the target that matches the input.\n If the target attribute of the comparison is a set (\"SS\",\n \"NS\", or \"BS\"), then the operator evaluates to\n true if it finds an exact match with any member of the set.

    \n

    CONTAINS is supported for lists: When evaluating \"a CONTAINS b\",\n \"a\" can be a list; however, \"b\" cannot be a set, a\n map, or a list.

    \n
  • \n
  • \n

    \n NOT_CONTAINS : Checks for absence of a subsequence, or absence of a\n value in a set.

    \n

    \n AttributeValueList can contain only one AttributeValue\n element of type String, Number, or Binary (not a set type). If the target\n attribute of the comparison is a String, then the operator checks for the\n absence of a substring match. If the target attribute of the comparison is\n Binary, then the operator checks for the absence of a subsequence of the target\n that matches the input. If the target attribute of the comparison is a set\n (\"SS\", \"NS\", or \"BS\"), then the\n operator evaluates to true if it does not find an exact\n match with any member of the set.

    \n

    NOT_CONTAINS is supported for lists: When evaluating \"a NOT CONTAINS\n b\", \"a\" can be a list; however, \"b\" cannot\n be a set, a map, or a list.

    \n
  • \n
  • \n

    \n BEGINS_WITH : Checks for a prefix.

    \n

    \n AttributeValueList can contain only one AttributeValue\n of type String or Binary (not a Number or a set type). The target attribute of\n the comparison must be of type String or Binary (not a Number or a set\n type).

    \n

    \n
  • \n
  • \n

    \n IN : Checks for matching elements in a list.

    \n

    \n AttributeValueList can contain one or more\n AttributeValue elements of type String, Number, or Binary.\n These attributes are compared against an existing attribute of an item. If any\n elements of the input are equal to the item attribute, the expression evaluates\n to true.

    \n
  • \n
  • \n

    \n BETWEEN : Greater than or equal to the first value, and less than\n or equal to the second value.

    \n

    \n AttributeValueList must contain two AttributeValue\n elements of the same type, either String, Number, or Binary (not a set type). A\n target attribute matches if the target value is greater than, or equal to, the\n first element and less than, or equal to, the second element. If an item\n contains an AttributeValue element of a different type than the one\n provided in the request, the value does not match. For example,\n {\"S\":\"6\"} does not compare to {\"N\":\"6\"}. Also,\n {\"N\":\"6\"} does not compare to {\"NS\":[\"6\", \"2\",\n \"1\"]}\n

    \n
  • \n
" - } - }, - "AttributeValueList": { - "target": "com.amazonaws.dynamodb#AttributeValueList", - "traits": { - "smithy.api#documentation": "

One or more values to evaluate against the supplied attribute. The number of values in\n the list depends on the ComparisonOperator being used.

\n

For type Number, value comparisons are numeric.

\n

String value comparisons for greater than, equals, or less than are based on ASCII\n character code values. For example, a is greater than A, and\n a is greater than B. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.

\n

For Binary, DynamoDB treats each byte of the binary data as unsigned when it\n compares binary values.

\n

For information on specifying data types in JSON, see JSON Data Format\n in the Amazon DynamoDB Developer Guide.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the properties of a local secondary index.

" + } + }, + "com.amazonaws.dynamodb#LocalSecondaryIndexDescription": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", "traits": { - "smithy.api#documentation": "

Represents a condition to be compared with an attribute value. This condition can be\n used with DeleteItem, PutItem, or UpdateItem\n operations; if the comparison evaluates to true, the operation succeeds; if not, the\n operation fails. You can use ExpectedAttributeValue in one of two different\n ways:

\n
    \n
  • \n

    Use AttributeValueList to specify one or more values to compare\n against an attribute. Use ComparisonOperator to specify how you\n want to perform the comparison. If the comparison evaluates to true, then the\n conditional operation succeeds.

    \n
  • \n
  • \n

    Use Value to specify a value that DynamoDB will compare against\n an attribute. If the values match, then ExpectedAttributeValue\n evaluates to true and the conditional operation succeeds. Optionally, you can\n also set Exists to false, indicating that you do\n not expect to find the attribute value in the table. In this\n case, the conditional operation succeeds only if the comparison evaluates to\n false.

    \n
  • \n
\n

\n Value and Exists are incompatible with\n AttributeValueList and ComparisonOperator. Note that if\n you use both sets of parameters at once, DynamoDB will return a\n ValidationException exception.

" + "smithy.api#documentation": "

Represents the name of the local secondary index.

" } - }, - "com.amazonaws.dynamodb#ExportArn": { - "type": "string", + }, + "KeySchema": { + "target": "com.amazonaws.dynamodb#KeySchema", "traits": { - "smithy.api#length": { - "min": 37, - "max": 1024 - } + "smithy.api#documentation": "

The complete key schema for the local secondary index, consisting of one or more pairs\n of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of\n an internal hash function to evenly distribute data items across partitions, based\n on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with the same\n partition key physically close together, in sorted order by the sort key\n value.

\n
" } - }, - "com.amazonaws.dynamodb#ExportConflictException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "Projection": { + "target": "com.amazonaws.dynamodb#Projection", "traits": { - "smithy.api#documentation": "

There was a conflict when writing to the specified S3 bucket.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the global\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

" } - }, - "com.amazonaws.dynamodb#ExportDescription": { - "type": "structure", - "members": { - "ExportArn": { - "target": "com.amazonaws.dynamodb#ExportArn", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the table export.

" - } - }, - "ExportStatus": { - "target": "com.amazonaws.dynamodb#ExportStatus", - "traits": { - "smithy.api#documentation": "

Export can be in one of the following states: IN_PROGRESS, COMPLETED, or\n FAILED.

" - } - }, - "StartTime": { - "target": "com.amazonaws.dynamodb#ExportStartTime", - "traits": { - "smithy.api#documentation": "

The time at which the export task began.

" - } - }, - "EndTime": { - "target": "com.amazonaws.dynamodb#ExportEndTime", - "traits": { - "smithy.api#documentation": "

The time at which the export task completed.

" - } - }, - "ExportManifest": { - "target": "com.amazonaws.dynamodb#ExportManifest", - "traits": { - "smithy.api#documentation": "

The name of the manifest file for the export task.

" - } - }, - "TableArn": { - "target": "com.amazonaws.dynamodb#TableArn", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the table that was exported.

" - } - }, - "TableId": { - "target": "com.amazonaws.dynamodb#TableId", - "traits": { - "smithy.api#documentation": "

Unique ID of the table that was exported.

" - } - }, - "ExportTime": { - "target": "com.amazonaws.dynamodb#ExportTime", - "traits": { - "smithy.api#documentation": "

Point in time from which table data was exported.

" - } - }, - "ClientToken": { - "target": "com.amazonaws.dynamodb#ClientToken", - "traits": { - "smithy.api#documentation": "

The client token that was provided for the export task. A client token makes calls to\n ExportTableToPointInTimeInput idempotent, meaning that multiple\n identical calls have the same effect as one single call.

" - } - }, - "S3Bucket": { - "target": "com.amazonaws.dynamodb#S3Bucket", - "traits": { - "smithy.api#documentation": "

The name of the Amazon S3 bucket containing the export.

" - } - }, - "S3BucketOwner": { - "target": "com.amazonaws.dynamodb#S3BucketOwner", - "traits": { - "smithy.api#documentation": "

The ID of the Amazon Web Services account that owns the bucket containing the\n export.

" - } - }, - "S3Prefix": { - "target": "com.amazonaws.dynamodb#S3Prefix", - "traits": { - "smithy.api#documentation": "

The Amazon S3 bucket prefix used as the file name and path of the exported\n snapshot.

" - } - }, - "S3SseAlgorithm": { - "target": "com.amazonaws.dynamodb#S3SseAlgorithm", - "traits": { - "smithy.api#documentation": "

Type of encryption used on the bucket where export data is stored. Valid values for\n S3SseAlgorithm are:

\n
    \n
  • \n

    \n AES256 - server-side encryption with Amazon S3 managed\n keys

    \n
  • \n
  • \n

    \n KMS - server-side encryption with KMS managed\n keys

    \n
  • \n
" - } - }, - "S3SseKmsKeyId": { - "target": "com.amazonaws.dynamodb#S3SseKmsKeyId", - "traits": { - "smithy.api#documentation": "

The ID of the KMS managed key used to encrypt the S3 bucket where\n export data is stored (if applicable).

" - } - }, - "FailureCode": { - "target": "com.amazonaws.dynamodb#FailureCode", - "traits": { - "smithy.api#documentation": "

Status code for the result of the failed export.

" - } - }, - "FailureMessage": { - "target": "com.amazonaws.dynamodb#FailureMessage", - "traits": { - "smithy.api#documentation": "

Export failure reason description.

" - } - }, - "ExportFormat": { - "target": "com.amazonaws.dynamodb#ExportFormat", - "traits": { - "smithy.api#documentation": "

The format of the exported data. Valid values for ExportFormat are\n DYNAMODB_JSON or ION.

" - } - }, - "BilledSizeBytes": { - "target": "com.amazonaws.dynamodb#BilledSizeBytes", - "traits": { - "smithy.api#documentation": "

The billable size of the table export.

" - } - }, - "ItemCount": { - "target": "com.amazonaws.dynamodb#ItemCount", - "traits": { - "smithy.api#documentation": "

The number of items exported.

" - } - } - }, + }, + "IndexSizeBytes": { + "target": "com.amazonaws.dynamodb#Long", "traits": { - "smithy.api#documentation": "

Represents the properties of the exported table.

" + "smithy.api#documentation": "

The total size of the specified index, in bytes. DynamoDB updates this value\n approximately every six hours. Recent changes might not be reflected in this\n value.

" } - }, - "com.amazonaws.dynamodb#ExportEndTime": { - "type": "timestamp" - }, - "com.amazonaws.dynamodb#ExportFormat": { - "type": "string", + }, + "ItemCount": { + "target": "com.amazonaws.dynamodb#Long", "traits": { - "smithy.api#enum": [ - { - "value": "DYNAMODB_JSON", - "name": "DYNAMODB_JSON" - }, - { - "value": "ION", - "name": "ION" - } - ] + "smithy.api#documentation": "

The number of items in the specified index. DynamoDB updates this value\n approximately every six hours. Recent changes might not be reflected in this\n value.

" } + }, + "IndexArn": { + "target": "com.amazonaws.dynamodb#String", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) that uniquely identifies the index.

" + } + } }, - "com.amazonaws.dynamodb#ExportManifest": { - "type": "string" - }, - "com.amazonaws.dynamodb#ExportNextToken": { - "type": "string" - }, - "com.amazonaws.dynamodb#ExportNotFoundException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + "traits": { + "smithy.api#documentation": "

Represents the properties of a local secondary index.

" + } + }, + "com.amazonaws.dynamodb#LocalSecondaryIndexDescriptionList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#LocalSecondaryIndexDescription" + } + }, + "com.amazonaws.dynamodb#LocalSecondaryIndexInfo": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

Represents the name of the local secondary index.

" + } + }, + "KeySchema": { + "target": "com.amazonaws.dynamodb#KeySchema", + "traits": { + "smithy.api#documentation": "

The complete key schema for a local secondary index, which consists of one or more\n pairs of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of\n an internal hash function to evenly distribute data items across partitions, based\n on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with the same\n partition key physically close together, in sorted order by the sort key\n value.

\n
" + } + }, + "Projection": { + "target": "com.amazonaws.dynamodb#Projection", "traits": { - "smithy.api#documentation": "

The specified export was not found.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the global\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

" } + } }, - "com.amazonaws.dynamodb#ExportStartTime": { - "type": "timestamp" + "traits": { + "smithy.api#documentation": "

Represents the properties of a local secondary index for the table when the backup was\n created.

" + } + }, + "com.amazonaws.dynamodb#LocalSecondaryIndexList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#LocalSecondaryIndex" + } + }, + "com.amazonaws.dynamodb#LocalSecondaryIndexes": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#LocalSecondaryIndexInfo" + } + }, + "com.amazonaws.dynamodb#Long": { + "type": "long" + }, + "com.amazonaws.dynamodb#MapAttributeValue": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#AttributeName" }, - "com.amazonaws.dynamodb#ExportStatus": { - "type": "string", + "value": { + "target": "com.amazonaws.dynamodb#AttributeValue" + } + }, + "com.amazonaws.dynamodb#NextTokenString": { + "type": "string" + }, + "com.amazonaws.dynamodb#NonKeyAttributeName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 255 + } + } + }, + "com.amazonaws.dynamodb#NonKeyAttributeNameList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#NonKeyAttributeName" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 20 + } + } + }, + "com.amazonaws.dynamodb#NonNegativeLongObject": { + "type": "long", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 0 + } + } + }, + "com.amazonaws.dynamodb#NullAttributeValue": { + "type": "boolean", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#NumberAttributeValue": { + "type": "string" + }, + "com.amazonaws.dynamodb#NumberSetAttributeValue": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#NumberAttributeValue" + } + }, + "com.amazonaws.dynamodb#ParameterizedStatement": { + "type": "structure", + "members": { + "Statement": { + "target": "com.amazonaws.dynamodb#PartiQLStatement", "traits": { - "smithy.api#enum": [ - { - "value": "IN_PROGRESS", - "name": "IN_PROGRESS" - }, - { - "value": "COMPLETED", - "name": "COMPLETED" - }, - { - "value": "FAILED", - "name": "FAILED" - } - ] + "smithy.api#documentation": "

A PartiQL statment that uses parameters.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ExportSummaries": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ExportSummary" + }, + "Parameters": { + "target": "com.amazonaws.dynamodb#PreparedStatementParameters", + "traits": { + "smithy.api#documentation": "

The parameter values.

" } + } }, - "com.amazonaws.dynamodb#ExportSummary": { - "type": "structure", - "members": { - "ExportArn": { - "target": "com.amazonaws.dynamodb#ExportArn", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the export.

" - } - }, - "ExportStatus": { - "target": "com.amazonaws.dynamodb#ExportStatus", - "traits": { - "smithy.api#documentation": "

Export can be in one of the following states: IN_PROGRESS, COMPLETED, or\n FAILED.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents a PartiQL statment that uses parameters.

" + } + }, + "com.amazonaws.dynamodb#ParameterizedStatements": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ParameterizedStatement" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 25 + } + } + }, + "com.amazonaws.dynamodb#PartiQLBatchRequest": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#BatchStatementRequest" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 25 + } + } + }, + "com.amazonaws.dynamodb#PartiQLBatchResponse": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#BatchStatementResponse" + } + }, + "com.amazonaws.dynamodb#PartiQLNextToken": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 32768 + } + } + }, + "com.amazonaws.dynamodb#PartiQLStatement": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 8192 + } + } + }, + "com.amazonaws.dynamodb#PointInTimeRecoveryDescription": { + "type": "structure", + "members": { + "PointInTimeRecoveryStatus": { + "target": "com.amazonaws.dynamodb#PointInTimeRecoveryStatus", "traits": { - "smithy.api#documentation": "

Summary information about an export task.

" + "smithy.api#documentation": "

The current state of point in time recovery:

\n
    \n
  • \n

    \n ENABLED - Point in time recovery is enabled.

    \n
  • \n
  • \n

    \n DISABLED - Point in time recovery is disabled.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#ExportTableToPointInTime": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ExportTableToPointInTimeInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#ExportTableToPointInTimeOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#ExportConflictException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidExportTimeException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#PointInTimeRecoveryUnavailableException" - }, - { - "target": "com.amazonaws.dynamodb#TableNotFoundException" - } - ], + }, + "EarliestRestorableDateTime": { + "target": "com.amazonaws.dynamodb#Date", "traits": { - "smithy.api#documentation": "

Exports table data to an S3 bucket. The table must have point in time recovery\n enabled, and you can export data from any time within the point in time recovery\n window.

" + "smithy.api#documentation": "

Specifies the earliest point in time you can restore your table to. You can restore\n your table to any point in time during the last 35 days.

" } - }, - "com.amazonaws.dynamodb#ExportTableToPointInTimeInput": { - "type": "structure", - "members": { - "TableArn": { - "target": "com.amazonaws.dynamodb#TableArn", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) associated with the table to export.

", - "smithy.api#required": {} - } - }, - "ExportTime": { - "target": "com.amazonaws.dynamodb#ExportTime", - "traits": { - "smithy.api#documentation": "

Time in the past from which to export table data, counted in seconds from the start of\n the Unix epoch. The table export will be a snapshot of the table's state at this point\n in time.

" - } - }, - "ClientToken": { - "target": "com.amazonaws.dynamodb#ClientToken", - "traits": { - "smithy.api#documentation": "

Providing a ClientToken makes the call to\n ExportTableToPointInTimeInput idempotent, meaning that multiple\n identical calls have the same effect as one single call.

\n

A client token is valid for 8 hours after the first request that uses it is completed.\n After 8 hours, any request with the same client token is treated as a new request. Do\n not resubmit the same request with the same client token for more than 8 hours, or the\n result might not be idempotent.

\n

If you submit a request with the same client token but a change in other parameters\n within the 8-hour idempotency window, DynamoDB returns an\n ImportConflictException.

", - "smithy.api#idempotencyToken": {} - } - }, - "S3Bucket": { - "target": "com.amazonaws.dynamodb#S3Bucket", - "traits": { - "smithy.api#documentation": "

The name of the Amazon S3 bucket to export the snapshot to.

", - "smithy.api#required": {} - } - }, - "S3BucketOwner": { - "target": "com.amazonaws.dynamodb#S3BucketOwner", - "traits": { - "smithy.api#documentation": "

The ID of the Amazon Web Services account that owns the bucket the export will be\n stored in.

" - } - }, - "S3Prefix": { - "target": "com.amazonaws.dynamodb#S3Prefix", - "traits": { - "smithy.api#documentation": "

The Amazon S3 bucket prefix to use as the file name and path of the exported\n snapshot.

" - } - }, - "S3SseAlgorithm": { - "target": "com.amazonaws.dynamodb#S3SseAlgorithm", - "traits": { - "smithy.api#documentation": "

Type of encryption used on the bucket where export data will be stored. Valid values\n for S3SseAlgorithm are:

\n
    \n
  • \n

    \n AES256 - server-side encryption with Amazon S3 managed\n keys

    \n
  • \n
  • \n

    \n KMS - server-side encryption with KMS managed\n keys

    \n
  • \n
" - } - }, - "S3SseKmsKeyId": { - "target": "com.amazonaws.dynamodb#S3SseKmsKeyId", - "traits": { - "smithy.api#documentation": "

The ID of the KMS managed key used to encrypt the S3 bucket where\n export data will be stored (if applicable).

" - } - }, - "ExportFormat": { - "target": "com.amazonaws.dynamodb#ExportFormat", - "traits": { - "smithy.api#documentation": "

The format for the exported data. Valid values for ExportFormat are\n DYNAMODB_JSON or ION.

" - } - } + }, + "LatestRestorableDateTime": { + "target": "com.amazonaws.dynamodb#Date", + "traits": { + "smithy.api#documentation": "

\n LatestRestorableDateTime is typically 5 minutes before the current time.\n

" } + } }, - "com.amazonaws.dynamodb#ExportTableToPointInTimeOutput": { - "type": "structure", - "members": { - "ExportDescription": { - "target": "com.amazonaws.dynamodb#ExportDescription", - "traits": { - "smithy.api#documentation": "

Contains a description of the table export.

" - } - } + "traits": { + "smithy.api#documentation": "

The description of the point in time settings applied to the table.

" + } + }, + "com.amazonaws.dynamodb#PointInTimeRecoverySpecification": { + "type": "structure", + "members": { + "PointInTimeRecoveryEnabled": { + "target": "com.amazonaws.dynamodb#BooleanObject", + "traits": { + "smithy.api#documentation": "

Indicates whether point in time recovery is enabled (true) or disabled (false) on the\n table.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#ExportTime": { - "type": "timestamp" - }, - "com.amazonaws.dynamodb#ExpressionAttributeNameMap": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameVariable" + "traits": { + "smithy.api#documentation": "

Represents the settings used to enable point in time recovery.

" + } + }, + "com.amazonaws.dynamodb#PointInTimeRecoveryStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "ENABLED", + "name": "ENABLED" }, - "value": { - "target": "com.amazonaws.dynamodb#AttributeName" + { + "value": "DISABLED", + "name": "DISABLED" } + ] + } + }, + "com.amazonaws.dynamodb#PointInTimeRecoveryUnavailableException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } }, - "com.amazonaws.dynamodb#ExpressionAttributeNameVariable": { - "type": "string" - }, - "com.amazonaws.dynamodb#ExpressionAttributeValueMap": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeValueVariable" - }, - "value": { - "target": "com.amazonaws.dynamodb#AttributeValue" + "traits": { + "smithy.api#documentation": "

Point in time recovery has not yet been enabled for this source table.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#PositiveIntegerObject": { + "type": "integer", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 1 + } + } + }, + "com.amazonaws.dynamodb#PositiveLongObject": { + "type": "long", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 1 + } + } + }, + "com.amazonaws.dynamodb#PreparedStatementParameters": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#AttributeValue" + }, + "traits": { + "smithy.api#length": { + "min": 1 + } + } + }, + "com.amazonaws.dynamodb#ProcessedItemCount": { + "type": "long", + "traits": { + "smithy.api#range": { + "min": 0 + } + } + }, + "com.amazonaws.dynamodb#Projection": { + "type": "structure", + "members": { + "ProjectionType": { + "target": "com.amazonaws.dynamodb#ProjectionType", + "traits": { + "smithy.api#documentation": "

The set of attributes that are projected into the index:

\n
    \n
  • \n

    \n KEYS_ONLY - Only the index and primary keys are projected into the\n index.

    \n
  • \n
  • \n

    \n INCLUDE - In addition to the attributes described in\n KEYS_ONLY, the secondary index will include other non-key\n attributes that you specify.

    \n
  • \n
  • \n

    \n ALL - All of the table attributes are projected into the\n index.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#ExpressionAttributeValueVariable": { - "type": "string" - }, - "com.amazonaws.dynamodb#FailureCode": { - "type": "string" - }, - "com.amazonaws.dynamodb#FailureException": { - "type": "structure", - "members": { - "ExceptionName": { - "target": "com.amazonaws.dynamodb#ExceptionName", - "traits": { - "smithy.api#documentation": "

Exception name.

" - } - }, - "ExceptionDescription": { - "target": "com.amazonaws.dynamodb#ExceptionDescription", - "traits": { - "smithy.api#documentation": "

Description of the failure.

" - } - } - }, + }, + "NonKeyAttributes": { + "target": "com.amazonaws.dynamodb#NonKeyAttributeNameList", "traits": { - "smithy.api#documentation": "

Represents a failure a contributor insights operation.

" + "smithy.api#documentation": "

Represents the non-key attribute names which will be projected into the index.

\n

For local secondary indexes, the total count of NonKeyAttributes summed\n across all of the local secondary indexes, must not exceed 100. If you project the same\n attribute into two different indexes, this counts as two distinct attributes when\n determining the total.

" } + } }, - "com.amazonaws.dynamodb#FailureMessage": { - "type": "string" - }, - "com.amazonaws.dynamodb#FilterConditionMap": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#AttributeName" + "traits": { + "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into an index. These\n are in addition to the primary key attributes and index key attributes, which are\n automatically projected.

" + } + }, + "com.amazonaws.dynamodb#ProjectionExpression": { + "type": "string" + }, + "com.amazonaws.dynamodb#ProjectionType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "ALL", + "name": "ALL" }, - "value": { - "target": "com.amazonaws.dynamodb#Condition" - } - }, - "com.amazonaws.dynamodb#Get": { - "type": "structure", - "members": { - "Key": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

A map of attribute names to AttributeValue objects that specifies the\n primary key of the item to retrieve.

", - "smithy.api#required": {} - } - }, - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table from which to retrieve the specified item.

", - "smithy.api#required": {} - } - }, - "ProjectionExpression": { - "target": "com.amazonaws.dynamodb#ProjectionExpression", - "traits": { - "smithy.api#documentation": "

A string that identifies one or more attributes of the specified item to retrieve from\n the table. The attributes in the expression must be separated by commas. If no attribute\n names are specified, then all attributes of the specified item are returned. If any of\n the requested attributes are not found, they do not appear in the result.

" - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in the ProjectionExpression\n parameter.

" - } - } + { + "value": "KEYS_ONLY", + "name": "KEYS_ONLY" }, + { + "value": "INCLUDE", + "name": "INCLUDE" + } + ] + } + }, + "com.amazonaws.dynamodb#ProvisionedThroughput": { + "type": "structure", + "members": { + "ReadCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", "traits": { - "smithy.api#documentation": "

Specifies an item and related attribute values to retrieve in a\n TransactGetItem object.

" + "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB\n Developer Guide.

\n

If read/write capacity mode is PAY_PER_REQUEST the value is set to\n 0.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#GetItem": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#GetItemInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#GetItemOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "WriteCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

The GetItem operation returns a set of attributes for the item with the\n given primary key. If there is no matching item, GetItem does not return\n any data and there will be no Item element in the response.

\n

\n GetItem provides an eventually consistent read by default. If your\n application requires a strongly consistent read, set ConsistentRead to\n true. Although a strongly consistent read might take more time than an\n eventually consistent read, it always returns the last updated value.

" + "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB\n Developer Guide.

\n

If read/write capacity mode is PAY_PER_REQUEST the value is set to\n 0.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#GetItemInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table containing the requested item.

", - "smithy.api#required": {} - } - }, - "Key": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

A map of attribute names to AttributeValue objects, representing the\n primary key of the item to retrieve.

\n

For the primary key, you must provide all of the attributes. For example, with a\n simple primary key, you only need to provide a value for the partition key. For a\n composite primary key, you must provide values for both the partition key and the sort\n key.

", - "smithy.api#required": {} - } - }, - "AttributesToGet": { - "target": "com.amazonaws.dynamodb#AttributeNameList", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use ProjectionExpression instead. For more\n information, see AttributesToGet in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ConsistentRead": { - "target": "com.amazonaws.dynamodb#ConsistentRead", - "traits": { - "smithy.api#documentation": "

Determines the read consistency model: If set to true, then the operation\n uses strongly consistent reads; otherwise, the operation uses eventually consistent\n reads.

" - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" - }, - "ProjectionExpression": { - "target": "com.amazonaws.dynamodb#ProjectionExpression", - "traits": { - "smithy.api#documentation": "

A string that identifies one or more attributes to retrieve from the table. These\n attributes can include scalars, sets, or elements of a JSON document. The attributes in\n the expression must be separated by commas.

\n

If no attribute names are specified, then all attributes are returned. If any of the\n requested attributes are not found, they do not appear in the result.

\n

For more information, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the provisioned throughput settings for a specified table or index. The\n settings can be modified using the UpdateTable operation.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "com.amazonaws.dynamodb#ProvisionedThroughputDescription": { + "type": "structure", + "members": { + "LastIncreaseDateTime": { + "target": "com.amazonaws.dynamodb#Date", + "traits": { + "smithy.api#documentation": "

The date and time of the last provisioned throughput increase for this table.

" + } + }, + "LastDecreaseDateTime": { + "target": "com.amazonaws.dynamodb#Date", + "traits": { + "smithy.api#documentation": "

The date and time of the last provisioned throughput decrease for this table.

" + } + }, + "NumberOfDecreasesToday": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", + "traits": { + "smithy.api#documentation": "

The number of provisioned throughput decreases for this table during this UTC calendar\n day. For current maximums on provisioned throughput decreases, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ReadCapacityUnits": { + "target": "com.amazonaws.dynamodb#NonNegativeLongObject", "traits": { - "smithy.api#documentation": "

Represents the input of a GetItem operation.

" + "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException. Eventually consistent reads require less\n effort than strongly consistent reads, so a setting of 50 ReadCapacityUnits\n per second provides 100 eventually consistent ReadCapacityUnits per\n second.

" } - }, - "com.amazonaws.dynamodb#GetItemOutput": { - "type": "structure", - "members": { - "Item": { - "target": "com.amazonaws.dynamodb#AttributeMap", - "traits": { - "smithy.api#documentation": "

A map of attribute names to AttributeValue objects, as specified by\n ProjectionExpression.

" - } - }, - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacity", - "traits": { - "smithy.api#documentation": "

The capacity units consumed by the GetItem operation. The data returned\n includes the total provisioned throughput consumed, along with statistics for the table\n and any indexes involved in the operation. ConsumedCapacity is only\n returned if the ReturnConsumedCapacity parameter was specified. For more\n information, see Read/Write Capacity Mode in the Amazon DynamoDB Developer\n Guide.

" - } - } - }, + }, + "WriteCapacityUnits": { + "target": "com.amazonaws.dynamodb#NonNegativeLongObject", "traits": { - "smithy.api#documentation": "

Represents the output of a GetItem operation.

" + "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException.

" } + } }, - "com.amazonaws.dynamodb#GlobalSecondaryIndex": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index. The name must be unique among all other\n indexes on this table.

", - "smithy.api#required": {} - } - }, - "KeySchema": { - "target": "com.amazonaws.dynamodb#KeySchema", - "traits": { - "smithy.api#documentation": "

The complete key schema for a global secondary index, which consists of one or more\n pairs of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of\n an internal hash function to evenly distribute data items across partitions, based\n on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with the same\n partition key physically close together, in sorted order by the sort key\n value.

\n
", - "smithy.api#required": {} - } - }, - "Projection": { - "target": "com.amazonaws.dynamodb#Projection", - "traits": { - "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the global\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

", - "smithy.api#required": {} - } - }, - "ProvisionedThroughput": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughput", - "traits": { - "smithy.api#documentation": "

Represents the provisioned throughput settings for the specified global secondary\n index.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the provisioned throughput settings for the table, consisting of read and\n write capacity units, along with data about increases and decreases.

" + } + }, + "com.amazonaws.dynamodb#ProvisionedThroughputExceededException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage", "traits": { - "smithy.api#documentation": "

Represents the properties of a global secondary index.

" + "smithy.api#documentation": "

You exceeded your maximum allowed provisioned throughput.

" } + } }, - "com.amazonaws.dynamodb#GlobalSecondaryIndexAutoScalingUpdate": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index.

" - } - }, - "ProvisionedWriteCapacityAutoScalingUpdate": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate" - } - }, + "traits": { + "smithy.api#documentation": "

Your request rate is too high. The Amazon Web Services SDKs for DynamoDB\n automatically retry requests that receive this exception. Your request is eventually\n successful, unless your retry queue is too large to finish. Reduce the frequency of\n requests and use exponential backoff. For more information, go to Error Retries and Exponential Backoff in the Amazon DynamoDB Developer Guide.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ProvisionedThroughputOverride": { + "type": "structure", + "members": { + "ReadCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", "traits": { - "smithy.api#documentation": "

Represents the auto scaling settings of a global secondary index for a global table\n that will be modified.

" + "smithy.api#documentation": "

Replica-specific read capacity units. If not specified, uses the source table's read\n capacity settings.

" } + } }, - "com.amazonaws.dynamodb#GlobalSecondaryIndexAutoScalingUpdateList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexAutoScalingUpdate" - }, + "traits": { + "smithy.api#documentation": "

Replica-specific provisioned throughput settings. If not specified, uses the source\n table's provisioned throughput settings.

" + } + }, + "com.amazonaws.dynamodb#Put": { + "type": "structure", + "members": { + "Item": { + "target": "com.amazonaws.dynamodb#PutItemInputAttributeMap", "traits": { - "smithy.api#length": { - "min": 1 - } + "smithy.api#documentation": "

A map of attribute name to attribute values, representing the primary key of the item\n to be written by PutItem. All of the table's primary key attributes must be\n specified, and their data types must match those of the table's key schema. If any\n attributes are present in the item that are part of an index key schema for the table,\n their types must match the index key schema.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#GlobalSecondaryIndexDescription": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index.

" - } - }, - "KeySchema": { - "target": "com.amazonaws.dynamodb#KeySchema", - "traits": { - "smithy.api#documentation": "

The complete key schema for a global secondary index, which consists of one or more\n pairs of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of an internal hash function to evenly distribute data items across\n partitions, based on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with\n the same partition key physically close together, in sorted order by the sort key\n value.

\n
" - } - }, - "Projection": { - "target": "com.amazonaws.dynamodb#Projection", - "traits": { - "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the global\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

" - } - }, - "IndexStatus": { - "target": "com.amazonaws.dynamodb#IndexStatus", - "traits": { - "smithy.api#documentation": "

The current state of the global secondary index:

\n
    \n
  • \n

    \n CREATING - The index is being created.

    \n
  • \n
  • \n

    \n UPDATING - The index is being updated.

    \n
  • \n
  • \n

    \n DELETING - The index is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The index is ready for use.

    \n
  • \n
" - } - }, - "Backfilling": { - "target": "com.amazonaws.dynamodb#Backfilling", - "traits": { - "smithy.api#documentation": "

Indicates whether the index is currently backfilling. Backfilling\n is the process of reading items from the table and determining whether they can be added\n to the index. (Not all items will qualify: For example, a partition key cannot have any\n duplicate values.) If an item can be added to the index, DynamoDB will do so. After all\n items have been processed, the backfilling operation is complete and\n Backfilling is false.

\n

You can delete an index that is being created during the Backfilling\n phase when IndexStatus is set to CREATING and Backfilling is\n true. You can't delete the index that is being created when IndexStatus is\n set to CREATING and Backfilling is false.

\n \n

For indexes that were created during a CreateTable operation, the\n Backfilling attribute does not appear in the\n DescribeTable output.

\n
" - } - }, - "ProvisionedThroughput": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputDescription", - "traits": { - "smithy.api#documentation": "

Represents the provisioned throughput settings for the specified global secondary\n index.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "IndexSizeBytes": { - "target": "com.amazonaws.dynamodb#Long", - "traits": { - "smithy.api#documentation": "

The total size of the specified index, in bytes. DynamoDB updates this value\n approximately every six hours. Recent changes might not be reflected in this\n value.

" - } - }, - "ItemCount": { - "target": "com.amazonaws.dynamodb#Long", - "traits": { - "smithy.api#documentation": "

The number of items in the specified index. DynamoDB updates this value approximately\n every six hours. Recent changes might not be reflected in this value.

" - } - }, - "IndexArn": { - "target": "com.amazonaws.dynamodb#String", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) that uniquely identifies the index.

" - } - } - }, + }, + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

Represents the properties of a global secondary index.

" + "smithy.api#documentation": "

Name of the table in which to write the item.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#GlobalSecondaryIndexDescriptionList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexDescription" + }, + "ConditionExpression": { + "target": "com.amazonaws.dynamodb#ConditionExpression", + "traits": { + "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional update to\n succeed.

" } - }, - "com.amazonaws.dynamodb#GlobalSecondaryIndexInfo": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index.

" - } - }, - "KeySchema": { - "target": "com.amazonaws.dynamodb#KeySchema", - "traits": { - "smithy.api#documentation": "

The complete key schema for a global secondary index, which consists of one or more\n pairs of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of an internal hash function to evenly distribute data items across\n partitions, based on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with\n the same partition key physically close together, in sorted order by the sort key\n value.

\n
" - } - }, - "Projection": { - "target": "com.amazonaws.dynamodb#Projection", - "traits": { - "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the global\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

" - } - }, - "ProvisionedThroughput": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughput", - "traits": { - "smithy.api#documentation": "

Represents the provisioned throughput settings for the specified global secondary\n index.

" - } - } - }, + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", "traits": { - "smithy.api#documentation": "

Represents the properties of a global secondary index for the table when the backup\n was created.

" + "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression.

" } - }, - "com.amazonaws.dynamodb#GlobalSecondaryIndexList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndex" + }, + "ExpressionAttributeValues": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", + "traits": { + "smithy.api#documentation": "

One or more values that can be substituted in an expression.

" } - }, - "com.amazonaws.dynamodb#GlobalSecondaryIndexUpdate": { - "type": "structure", - "members": { - "Update": { - "target": "com.amazonaws.dynamodb#UpdateGlobalSecondaryIndexAction", - "traits": { - "smithy.api#documentation": "

The name of an existing global secondary index, along with new provisioned throughput\n settings to be applied to that index.

" - } - }, - "Create": { - "target": "com.amazonaws.dynamodb#CreateGlobalSecondaryIndexAction", - "traits": { - "smithy.api#documentation": "

The parameters required for creating a global secondary index on an existing\n table:

\n
    \n
  • \n

    \n IndexName \n

    \n
  • \n
  • \n

    \n KeySchema \n

    \n
  • \n
  • \n

    \n AttributeDefinitions \n

    \n
  • \n
  • \n

    \n Projection \n

    \n
  • \n
  • \n

    \n ProvisionedThroughput \n

    \n
  • \n
" - } - }, - "Delete": { - "target": "com.amazonaws.dynamodb#DeleteGlobalSecondaryIndexAction", - "traits": { - "smithy.api#documentation": "

The name of an existing global secondary index to be removed.

" - } - } - }, + }, + "ReturnValuesOnConditionCheckFailure": { + "target": "com.amazonaws.dynamodb#ReturnValuesOnConditionCheckFailure", "traits": { - "smithy.api#documentation": "

Represents one of the following:

\n
    \n
  • \n

    A new global secondary index to be added to an existing table.

    \n
  • \n
  • \n

    New provisioned throughput parameters for an existing global secondary\n index.

    \n
  • \n
  • \n

    An existing global secondary index to be removed from an existing\n table.

    \n
  • \n
" + "smithy.api#documentation": "

Use ReturnValuesOnConditionCheckFailure to get the item attributes if the\n Put condition fails. For\n ReturnValuesOnConditionCheckFailure, the valid values are: NONE and\n ALL_OLD.

" } + } }, - "com.amazonaws.dynamodb#GlobalSecondaryIndexUpdateList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexUpdate" + "traits": { + "smithy.api#documentation": "

Represents a request to perform a PutItem operation.

" + } + }, + "com.amazonaws.dynamodb#PutItem": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#PutItemInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#PutItemOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#ConditionalCheckFailedException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#TransactionConflictException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Creates a new item, or replaces an old item with a new item. If an item that has the\n same primary key as the new item already exists in the specified table, the new item\n completely replaces the existing item. You can perform a conditional put operation (add\n a new item if one with the specified primary key doesn't exist), or replace an existing\n item if it has certain attribute values. You can return the item's attribute values in\n the same operation, using the ReturnValues parameter.

\n\n

When you add an item, the primary key attributes are the only required attributes.\n Attribute values cannot be null.

\n

Empty String and Binary attribute values are allowed. Attribute values of type String\n and Binary must have a length greater than zero if the attribute is used as a key\n attribute for a table or index. Set type attributes cannot be empty.

\n

Invalid Requests with empty values will be rejected with a\n ValidationException exception.

\n \n

To prevent a new item from replacing an existing item, use a conditional\n expression that contains the attribute_not_exists function with the\n name of the attribute being used as the partition key for the table. Since every\n record must contain that attribute, the attribute_not_exists function\n will only succeed if no matching item exists.

\n
\n

For more information about PutItem, see Working with\n Items in the Amazon DynamoDB Developer Guide.

" + } + }, + "com.amazonaws.dynamodb#PutItemInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table to contain the item.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#GlobalSecondaryIndexes": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexInfo" + }, + "Item": { + "target": "com.amazonaws.dynamodb#PutItemInputAttributeMap", + "traits": { + "smithy.api#documentation": "

A map of attribute name/value pairs, one for each attribute. Only the primary key\n attributes are required; you can optionally provide other attribute name-value pairs for\n the item.

\n

You must provide all of the attributes for the primary key. For example, with a simple\n primary key, you only need to provide a value for the partition key. For a composite\n primary key, you must provide both values for both the partition key and the sort\n key.

\n

If you specify any attributes that are part of an index key, then the data types for\n those attributes must match those of the schema in the table's attribute\n definition.

\n

Empty String and Binary attribute values are allowed. Attribute values of type String\n and Binary must have a length greater than zero if the attribute is used as a key\n attribute for a table or index.

\n\n

For more information about primary keys, see Primary Key in the Amazon DynamoDB Developer\n Guide.

\n

Each element in the Item map is an AttributeValue\n object.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#GlobalTable": { - "type": "structure", - "members": { - "GlobalTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The global table name.

" - } - }, - "ReplicationGroup": { - "target": "com.amazonaws.dynamodb#ReplicaList", - "traits": { - "smithy.api#documentation": "

The Regions where the global table has replicas.

" - } - } - }, + }, + "Expected": { + "target": "com.amazonaws.dynamodb#ExpectedAttributeMap", "traits": { - "smithy.api#documentation": "

Represents the properties of a global table.

" + "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see Expected in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#GlobalTableAlreadyExistsException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "ReturnValues": { + "target": "com.amazonaws.dynamodb#ReturnValue", + "traits": { + "smithy.api#documentation": "

Use ReturnValues if you want to get the item attributes as they appeared\n before they were updated with the PutItem request. For\n PutItem, the valid values are:

\n
    \n
  • \n

    \n NONE - If ReturnValues is not specified, or if its\n value is NONE, then nothing is returned. (This setting is the\n default for ReturnValues.)

    \n
  • \n
  • \n

    \n ALL_OLD - If PutItem overwrote an attribute name-value\n pair, then the content of the old item is returned.

    \n
  • \n
\n

The values returned are strongly consistent.

\n

There is no additional cost associated with requesting a return value aside from the small \n network and processing overhead of receiving a larger response. No read capacity units are \n consumed.

\n \n

The ReturnValues parameter is used by several DynamoDB operations;\n however, PutItem does not recognize any values other than\n NONE or ALL_OLD.

\n
" + } + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" + }, + "ReturnItemCollectionMetrics": { + "target": "com.amazonaws.dynamodb#ReturnItemCollectionMetrics", + "traits": { + "smithy.api#documentation": "

Determines whether item collection metrics are returned. If set to SIZE,\n the response includes statistics about item collections, if any, that were modified\n during the operation are returned in the response. If set to NONE (the\n default), no statistics are returned.

" + } + }, + "ConditionalOperator": { + "target": "com.amazonaws.dynamodb#ConditionalOperator", + "traits": { + "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see ConditionalOperator in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ConditionExpression": { + "target": "com.amazonaws.dynamodb#ConditionExpression", "traits": { - "smithy.api#documentation": "

The specified global table already exists.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional PutItem\n operation to succeed.

\n

An expression can contain any of the following:

\n
    \n
  • \n

    Functions: attribute_exists | attribute_not_exists | attribute_type |\n contains | begins_with | size\n

    \n

    These function names are case-sensitive.

    \n
  • \n
  • \n

    Comparison operators: = | <> |\n < | > | <= | >= |\n BETWEEN | IN \n

    \n
  • \n
  • \n

    Logical operators: AND | OR | NOT\n

    \n
  • \n
\n

For more information on condition expressions, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" } + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", + "traits": { + "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ExpressionAttributeValues": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", + "traits": { + "smithy.api#documentation": "

One or more values that can be substituted in an expression.

\n

Use the : (colon) character in an expression to\n dereference an attribute value. For example, suppose that you wanted to check whether\n the value of the ProductStatus attribute was one of the following:

\n

\n Available | Backordered | Discontinued\n

\n

You would first need to specify ExpressionAttributeValues as\n follows:

\n

\n { \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"},\n \":disc\":{\"S\":\"Discontinued\"} }\n

\n

You could then use these values in an expression, such as this:

\n

\n ProductStatus IN (:avail, :back, :disc)\n

\n

For more information on expression attribute values, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" + } + } }, - "com.amazonaws.dynamodb#GlobalTableArnString": { - "type": "string" + "traits": { + "smithy.api#documentation": "

Represents the input of a PutItem operation.

" + } + }, + "com.amazonaws.dynamodb#PutItemInputAttributeMap": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#AttributeName" }, - "com.amazonaws.dynamodb#GlobalTableDescription": { - "type": "structure", - "members": { - "ReplicationGroup": { - "target": "com.amazonaws.dynamodb#ReplicaDescriptionList", - "traits": { - "smithy.api#documentation": "

The Regions where the global table has replicas.

" - } - }, - "GlobalTableArn": { - "target": "com.amazonaws.dynamodb#GlobalTableArnString", - "traits": { - "smithy.api#documentation": "

The unique identifier of the global table.

" - } - }, - "CreationDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

The creation time of the global table.

" - } - }, - "GlobalTableStatus": { - "target": "com.amazonaws.dynamodb#GlobalTableStatus", - "traits": { - "smithy.api#documentation": "

The current state of the global table:

\n
    \n
  • \n

    \n CREATING - The global table is being created.

    \n
  • \n
  • \n

    \n UPDATING - The global table is being updated.

    \n
  • \n
  • \n

    \n DELETING - The global table is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The global table is ready for use.

    \n
  • \n
" - } - }, - "GlobalTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The global table name.

" - } - } - }, + "value": { + "target": "com.amazonaws.dynamodb#AttributeValue" + } + }, + "com.amazonaws.dynamodb#PutItemOutput": { + "type": "structure", + "members": { + "Attributes": { + "target": "com.amazonaws.dynamodb#AttributeMap", "traits": { - "smithy.api#documentation": "

Contains details about the global table.

" + "smithy.api#documentation": "

The attribute values as they appeared before the PutItem operation, but\n only if ReturnValues is specified as ALL_OLD in the request.\n Each element consists of an attribute name and an attribute value.

" } - }, - "com.amazonaws.dynamodb#GlobalTableGlobalSecondaryIndexSettingsUpdate": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index. The name must be unique among all other\n indexes on this table.

", - "smithy.api#required": {} - } - }, - "ProvisionedWriteCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException.\n

" - } - }, - "ProvisionedWriteCapacityAutoScalingSettingsUpdate": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate", - "traits": { - "smithy.api#documentation": "

Auto scaling settings for managing a global secondary index's write capacity\n units.

" - } - } - }, + }, + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacity", "traits": { - "smithy.api#documentation": "

Represents the settings of a global secondary index for a global table that will be\n modified.

" + "smithy.api#documentation": "

The capacity units consumed by the PutItem operation. The data returned\n includes the total provisioned throughput consumed, along with statistics for the table\n and any indexes involved in the operation. ConsumedCapacity is only\n returned if the ReturnConsumedCapacity parameter was specified. For more\n information, see Read/Write Capacity Mode in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#GlobalTableGlobalSecondaryIndexSettingsUpdateList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#GlobalTableGlobalSecondaryIndexSettingsUpdate" - }, + }, + "ItemCollectionMetrics": { + "target": "com.amazonaws.dynamodb#ItemCollectionMetrics", "traits": { - "smithy.api#length": { - "min": 1, - "max": 20 - } + "smithy.api#documentation": "

Information about item collections, if any, that were affected by the\n PutItem operation. ItemCollectionMetrics is only returned\n if the ReturnItemCollectionMetrics parameter was specified. If the table\n does not have any local secondary indexes, this information is not returned in the\n response.

\n

Each ItemCollectionMetrics element consists of:

\n
    \n
  • \n

    \n ItemCollectionKey - The partition key value of the item collection.\n This is the same as the partition key value of the item itself.

    \n
  • \n
  • \n

    \n SizeEstimateRangeGB - An estimate of item collection size, in\n gigabytes. This value is a two-element array containing a lower bound and an\n upper bound for the estimate. The estimate includes the size of all the items in\n the table, plus the size of all attributes projected into all of the local\n secondary indexes on that table. Use this estimate to measure whether a local\n secondary index is approaching its size limit.

    \n

    The estimate is subject to change over time; therefore, do not rely on the\n precision or accuracy of the estimate.

    \n
  • \n
" } + } }, - "com.amazonaws.dynamodb#GlobalTableList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#GlobalTable" + "traits": { + "smithy.api#documentation": "

Represents the output of a PutItem operation.

" + } + }, + "com.amazonaws.dynamodb#PutRequest": { + "type": "structure", + "members": { + "Item": { + "target": "com.amazonaws.dynamodb#PutItemInputAttributeMap", + "traits": { + "smithy.api#documentation": "

A map of attribute name to attribute values, representing the primary key of an item\n to be processed by PutItem. All of the table's primary key attributes must\n be specified, and their data types must match those of the table's key schema. If any\n attributes are present in the item that are part of an index key schema for the table,\n their types must match the index key schema.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#GlobalTableNotFoundException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + "traits": { + "smithy.api#documentation": "

Represents a request to perform a PutItem operation on an item.

" + } + }, + "com.amazonaws.dynamodb#Query": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#QueryInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#QueryOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

You must provide the name of the partition key attribute and a single value for that\n attribute. Query returns all items with that partition key value.\n Optionally, you can provide a sort key attribute and use a comparison operator to refine\n the search results.

\n\n

Use the KeyConditionExpression parameter to provide a specific value for\n the partition key. The Query operation will return all of the items from\n the table or index with that partition key value. You can optionally narrow the scope of\n the Query operation by specifying a sort key value and a comparison\n operator in KeyConditionExpression. To further refine the\n Query results, you can optionally provide a\n FilterExpression. A FilterExpression determines which\n items within the results should be returned to you. All of the other results are\n discarded.

\n

A Query operation always returns a result set. If no matching items are\n found, the result set will be empty. Queries that do not return results consume the\n minimum number of read capacity units for that type of read operation.

\n \n

DynamoDB calculates the number of read capacity units consumed based on item\n size, not on the amount of data that is returned to an application. The number of\n capacity units consumed will be the same whether you request all of the attributes\n (the default behavior) or just some of them (using a projection expression). The\n number will also be the same whether or not you use a FilterExpression.\n

\n
\n

\n Query results are always sorted by the sort key value. If the data type of\n the sort key is Number, the results are returned in numeric order; otherwise, the\n results are returned in order of UTF-8 bytes. By default, the sort order is ascending.\n To reverse the order, set the ScanIndexForward parameter to false.

\n

A single Query operation will read up to the maximum number of items set\n (if using the Limit parameter) or a maximum of 1 MB of data and then apply\n any filtering to the results using FilterExpression. If\n LastEvaluatedKey is present in the response, you will need to paginate\n the result set. For more information, see Paginating\n the Results in the Amazon DynamoDB Developer Guide.

\n

\n FilterExpression is applied after a Query finishes, but before\n the results are returned. A FilterExpression cannot contain partition key\n or sort key attributes. You need to specify those attributes in the\n KeyConditionExpression.

\n \n

A Query operation can return an empty result set and a\n LastEvaluatedKey if all the items read for the page of results are\n filtered out.

\n
\n

You can query a table, a local secondary index, or a global secondary index. For a\n query on a table or on a local secondary index, you can set the\n ConsistentRead parameter to true and obtain a strongly\n consistent result. Global secondary indexes support eventually consistent reads only, so\n do not specify ConsistentRead when querying a global secondary\n index.

", + "smithy.api#paginated": { + "inputToken": "ExclusiveStartKey", + "outputToken": "LastEvaluatedKey", + "items": "Items", + "pageSize": "Limit" + }, + "smithy.api#suppress": ["PaginatedTrait"] + } + }, + "com.amazonaws.dynamodb#QueryInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

The specified global table does not exist.

", - "smithy.api#error": "client" - } - }, - "com.amazonaws.dynamodb#GlobalTableStatus": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "CREATING", - "name": "CREATING" - }, - { - "value": "ACTIVE", - "name": "ACTIVE" - }, - { - "value": "DELETING", - "name": "DELETING" - }, - { - "value": "UPDATING", - "name": "UPDATING" - } - ] + "smithy.api#documentation": "

The name of the table containing the requested items.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#IdempotentParameterMismatchException": { - "type": "structure", - "members": { - "Message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", "traits": { - "smithy.api#documentation": "

DynamoDB rejected the request because you retried a request with a\n different payload but with an idempotent token that was already used.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The name of an index to query. This index can be any local secondary index or global\n secondary index on the table. Note that if you use the IndexName parameter,\n you must also provide TableName.\n

" } - }, - "com.amazonaws.dynamodb#ImportArn": { - "type": "string", + }, + "Select": { + "target": "com.amazonaws.dynamodb#Select", "traits": { - "smithy.api#length": { - "min": 37, - "max": 1024 - } + "smithy.api#documentation": "

The attributes to be returned in the result. You can retrieve all item attributes,\n specific item attributes, the count of matching items, or in the case of an index, some\n or all of the attributes projected into the index.

\n
    \n
  • \n

    \n ALL_ATTRIBUTES - Returns all of the item attributes from the\n specified table or index. If you query a local secondary index, then for each\n matching item in the index, DynamoDB fetches the entire item from the parent\n table. If the index is configured to project all item attributes, then all of\n the data can be obtained from the local secondary index, and no fetching is\n required.

    \n
  • \n
  • \n

    \n ALL_PROJECTED_ATTRIBUTES - Allowed only when querying an index.\n Retrieves all attributes that have been projected into the index. If the index\n is configured to project all attributes, this return value is equivalent to\n specifying ALL_ATTRIBUTES.

    \n
  • \n
  • \n

    \n COUNT - Returns the number of matching items, rather than the\n matching items themselves.

    \n
  • \n
  • \n

    \n SPECIFIC_ATTRIBUTES - Returns only the attributes listed in\n ProjectionExpression. This return value is equivalent to\n specifying ProjectionExpression without specifying any value for\n Select.

    \n

    If you query or scan a local secondary index and request only attributes that\n are projected into that index, the operation will read only the index and not\n the table. If any of the requested attributes are not projected into the local\n secondary index, DynamoDB fetches each of these attributes from the parent\n table. This extra fetching incurs additional throughput cost and latency.

    \n

    If you query or scan a global secondary index, you can only request attributes\n that are projected into the index. Global secondary index queries cannot fetch\n attributes from the parent table.

    \n
  • \n
\n

If neither Select nor ProjectionExpression are specified,\n DynamoDB defaults to ALL_ATTRIBUTES when accessing a table, and\n ALL_PROJECTED_ATTRIBUTES when accessing an index. You cannot use both\n Select and ProjectionExpression together in a single\n request, unless the value for Select is SPECIFIC_ATTRIBUTES.\n (This usage is equivalent to specifying ProjectionExpression without any\n value for Select.)

\n \n

If you use the ProjectionExpression parameter, then the value for\n Select can only be SPECIFIC_ATTRIBUTES. Any other\n value for Select will return an error.

\n
" } - }, - "com.amazonaws.dynamodb#ImportConflictException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "AttributesToGet": { + "target": "com.amazonaws.dynamodb#AttributeNameList", "traits": { - "smithy.api#documentation": "

\n There was a conflict when importing from the specified S3 source. \n This can occur when the current import conflicts with a previous import request \n that had the same client token.\n

", - "smithy.api#error": "client" + "smithy.api#documentation": "

This is a legacy parameter. Use ProjectionExpression instead. For more\n information, see AttributesToGet in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#ImportEndTime": { - "type": "timestamp" - }, - "com.amazonaws.dynamodb#ImportNextToken": { - "type": "string", + }, + "Limit": { + "target": "com.amazonaws.dynamodb#PositiveIntegerObject", "traits": { - "smithy.api#length": { - "min": 112, - "max": 1024 - }, - "smithy.api#pattern": "^([0-9a-f]{16})+$" + "smithy.api#documentation": "

The maximum number of items to evaluate (not necessarily the number of matching\n items). If DynamoDB processes the number of items up to the limit while processing the\n results, it stops the operation and returns the matching values up to that point, and a\n key in LastEvaluatedKey to apply in a subsequent operation, so that you can\n pick up where you left off. Also, if the processed dataset size exceeds 1 MB before\n DynamoDB reaches this limit, it stops the operation and returns the matching values up\n to the limit, and a key in LastEvaluatedKey to apply in a subsequent\n operation to continue the operation. For more information, see Query and Scan in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#ImportNotFoundException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "ConsistentRead": { + "target": "com.amazonaws.dynamodb#ConsistentRead", "traits": { - "smithy.api#documentation": "

\n The specified import was not found.\n

", - "smithy.api#error": "client" - } - }, - "com.amazonaws.dynamodb#ImportStartTime": { - "type": "timestamp" - }, - "com.amazonaws.dynamodb#ImportStatus": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "IN_PROGRESS", - "name": "IN_PROGRESS" - }, - { - "value": "COMPLETED", - "name": "COMPLETED" - }, - { - "value": "CANCELLING", - "name": "CANCELLING" - }, - { - "value": "CANCELLED", - "name": "CANCELLED" - }, - { - "value": "FAILED", - "name": "FAILED" - } - ] + "smithy.api#documentation": "

Determines the read consistency model: If set to true, then the operation\n uses strongly consistent reads; otherwise, the operation uses eventually consistent\n reads.

\n

Strongly consistent reads are not supported on global secondary indexes. If you query\n a global secondary index with ConsistentRead set to true, you\n will receive a ValidationException.

" } - }, - "com.amazonaws.dynamodb#ImportSummary": { - "type": "structure", - "members": { - "ImportArn": { - "target": "com.amazonaws.dynamodb#ImportArn", - "traits": { - "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) corresponding to the import request.\n

" - } - }, - "ImportStatus": { - "target": "com.amazonaws.dynamodb#ImportStatus", - "traits": { - "smithy.api#documentation": "

\n The status of the import operation.\n

" - } - }, - "TableArn": { - "target": "com.amazonaws.dynamodb#TableArn", - "traits": { - "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) of the table being imported into.\n

" - } - }, - "S3BucketSource": { - "target": "com.amazonaws.dynamodb#S3BucketSource", - "traits": { - "smithy.api#documentation": "

\n The path and S3 bucket of the source file that is being imported. This includes the S3Bucket (required), \n S3KeyPrefix (optional) and S3BucketOwner (optional if the bucket is owned by the requester).\n

" - } - }, - "CloudWatchLogGroupArn": { - "target": "com.amazonaws.dynamodb#CloudWatchLogGroupArn", - "traits": { - "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) of the Cloudwatch Log Group associated with this import task.\n

" - } - }, - "InputFormat": { - "target": "com.amazonaws.dynamodb#InputFormat", - "traits": { - "smithy.api#documentation": "

\n The format of the source data. Valid values are CSV,\n DYNAMODB_JSON or ION.

" - } - }, - "StartTime": { - "target": "com.amazonaws.dynamodb#ImportStartTime", - "traits": { - "smithy.api#documentation": "

\n The time at which this import task began.\n

" - } - }, - "EndTime": { - "target": "com.amazonaws.dynamodb#ImportEndTime", - "traits": { - "smithy.api#documentation": "

\n The time at which this import task ended. (Does this include the successful complete creation of \n the table it was imported to?)\n

" - } - } - }, + }, + "KeyConditions": { + "target": "com.amazonaws.dynamodb#KeyConditions", "traits": { - "smithy.api#documentation": "

\n Summary information about the source file for the import.\n

" + "smithy.api#documentation": "

This is a legacy parameter. Use KeyConditionExpression instead. For more\n information, see KeyConditions in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#ImportSummaryList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ImportSummary" + }, + "QueryFilter": { + "target": "com.amazonaws.dynamodb#FilterConditionMap", + "traits": { + "smithy.api#documentation": "

This is a legacy parameter. Use FilterExpression instead. For more\n information, see QueryFilter in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#ImportTable": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ImportTableInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#ImportTableOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#ImportConflictException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceInUseException" - } - ], + }, + "ConditionalOperator": { + "target": "com.amazonaws.dynamodb#ConditionalOperator", "traits": { - "smithy.api#documentation": "

\n Imports table data from an S3 bucket. \n \n

" + "smithy.api#documentation": "

This is a legacy parameter. Use FilterExpression instead. For more\n information, see ConditionalOperator in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#ImportTableDescription": { - "type": "structure", - "members": { - "ImportArn": { - "target": "com.amazonaws.dynamodb#ImportArn", - "traits": { - "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) corresponding to the import request.\n

" - } - }, - "ImportStatus": { - "target": "com.amazonaws.dynamodb#ImportStatus", - "traits": { - "smithy.api#documentation": "

\n The status of the import.\n

" - } - }, - "TableArn": { - "target": "com.amazonaws.dynamodb#TableArn", - "traits": { - "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) of the table being imported into.\n

" - } - }, - "TableId": { - "target": "com.amazonaws.dynamodb#TableId", - "traits": { - "smithy.api#documentation": "

\n The table id corresponding to the table created by import table process.\n \n

" - } - }, - "ClientToken": { - "target": "com.amazonaws.dynamodb#ClientToken", - "traits": { - "smithy.api#documentation": "

\n The client token that was provided for the import task. Reusing the client token \n on retry makes a call to ImportTable idempotent.\n

" - } - }, - "S3BucketSource": { - "target": "com.amazonaws.dynamodb#S3BucketSource", - "traits": { - "smithy.api#documentation": "

\n Values for the S3 bucket the source file is imported from. Includes bucket name (required), \n key prefix (optional) and bucket account owner ID (optional).\n

" - } - }, - "ErrorCount": { - "target": "com.amazonaws.dynamodb#ErrorCount", - "traits": { - "smithy.api#documentation": "

\n The number of errors occurred on importing the source file into the target table.\n

" - } - }, - "CloudWatchLogGroupArn": { - "target": "com.amazonaws.dynamodb#CloudWatchLogGroupArn", - "traits": { - "smithy.api#documentation": "

\n The Amazon Resource Number (ARN) of the Cloudwatch Log Group associated with the target table.\n

" - } - }, - "InputFormat": { - "target": "com.amazonaws.dynamodb#InputFormat", - "traits": { - "smithy.api#documentation": "

\n The format of the source data going into the target table.\n

" - } - }, - "InputFormatOptions": { - "target": "com.amazonaws.dynamodb#InputFormatOptions", - "traits": { - "smithy.api#documentation": "

The format options for the data that was imported into the target table. There is one value, CsvOption.\n

" - } - }, - "InputCompressionType": { - "target": "com.amazonaws.dynamodb#InputCompressionType", - "traits": { - "smithy.api#documentation": "

\n The compression options for the data that has been imported into the target table. The values are \n NONE, GZIP, or ZSTD.\n

" - } - }, - "TableCreationParameters": { - "target": "com.amazonaws.dynamodb#TableCreationParameters", - "traits": { - "smithy.api#documentation": "

\n The parameters for the new table that is being imported into.\n

" - } - }, - "StartTime": { - "target": "com.amazonaws.dynamodb#ImportStartTime", - "traits": { - "smithy.api#documentation": "

\n The time when this import task started.\n

" - } - }, - "EndTime": { - "target": "com.amazonaws.dynamodb#ImportEndTime", - "traits": { - "smithy.api#documentation": "

\n The time at which the creation of the table associated with this import task completed.\n

" - } - }, - "ProcessedSizeBytes": { - "target": "com.amazonaws.dynamodb#Long", - "traits": { - "smithy.api#documentation": "

\n The total size of data processed from the source file, in Bytes.\n

" - } - }, - "ProcessedItemCount": { - "target": "com.amazonaws.dynamodb#ProcessedItemCount", - "traits": { - "smithy.api#documentation": "

\n The total number of items processed from the source file.\n

" - } - }, - "ImportedItemCount": { - "target": "com.amazonaws.dynamodb#ImportedItemCount", - "traits": { - "smithy.api#documentation": "

\n The number of items successfully imported into the new table.\n

" - } - }, - "FailureCode": { - "target": "com.amazonaws.dynamodb#FailureCode", - "traits": { - "smithy.api#documentation": "

\n The error code corresponding to the failure that the import job ran into during execution.\n

" - } - }, - "FailureMessage": { - "target": "com.amazonaws.dynamodb#FailureMessage", - "traits": { - "smithy.api#documentation": "

\n The error message corresponding to the failure that the import job ran into during execution.\n

" - } - } - }, + }, + "ScanIndexForward": { + "target": "com.amazonaws.dynamodb#BooleanObject", "traits": { - "smithy.api#documentation": "

\n Represents the properties of the table being imported into.\n

" + "smithy.api#documentation": "

Specifies the order for index traversal: If true (default), the traversal\n is performed in ascending order; if false, the traversal is performed in\n descending order.

\n

Items with the same partition key value are stored in sorted order by sort key. If the\n sort key data type is Number, the results are stored in numeric order. For type String,\n the results are stored in order of UTF-8 bytes. For type Binary, DynamoDB treats each\n byte of the binary data as unsigned.

\n

If ScanIndexForward is true, DynamoDB returns the results in\n the order in which they are stored (by sort key value). This is the default behavior. If\n ScanIndexForward is false, DynamoDB reads the results in\n reverse order by sort key value, and then returns the results to the client.

" } - }, - "com.amazonaws.dynamodb#ImportTableInput": { - "type": "structure", - "members": { - "ClientToken": { - "target": "com.amazonaws.dynamodb#ClientToken", - "traits": { - "smithy.api#documentation": "

Providing a ClientToken makes the call to\n ImportTableInput idempotent, meaning that multiple\n identical calls have the same effect as one single call.

\n

A client token is valid for 8 hours after the first request that uses it is completed.\n After 8 hours, any request with the same client token is treated as a new request. Do\n not resubmit the same request with the same client token for more than 8 hours, or the\n result might not be idempotent.

\n

If you submit a request with the same client token but a change in other parameters\n within the 8-hour idempotency window, DynamoDB returns an\n IdempotentParameterMismatch exception.

", - "smithy.api#idempotencyToken": {} - } - }, - "S3BucketSource": { - "target": "com.amazonaws.dynamodb#S3BucketSource", - "traits": { - "smithy.api#documentation": "

\n The S3 bucket that provides the source for the import.\n

", - "smithy.api#required": {} - } - }, - "InputFormat": { - "target": "com.amazonaws.dynamodb#InputFormat", - "traits": { - "smithy.api#documentation": "

The format of the source data. Valid values for ImportFormat are\n CSV, DYNAMODB_JSON or ION.\n

", - "smithy.api#required": {} - } - }, - "InputFormatOptions": { - "target": "com.amazonaws.dynamodb#InputFormatOptions", - "traits": { - "smithy.api#documentation": "

\n Additional properties that specify how the input is formatted,\n

" - } - }, - "InputCompressionType": { - "target": "com.amazonaws.dynamodb#InputCompressionType", - "traits": { - "smithy.api#documentation": "

\n Type of compression to be used on the input coming from the imported table.\n

" - } - }, - "TableCreationParameters": { - "target": "com.amazonaws.dynamodb#TableCreationParameters", - "traits": { - "smithy.api#documentation": "

Parameters for the table to import the data into.\n

", - "smithy.api#required": {} - } - } + }, + "ExclusiveStartKey": { + "target": "com.amazonaws.dynamodb#Key", + "traits": { + "smithy.api#documentation": "

The primary key of the first item that this operation will evaluate. Use the value\n that was returned for LastEvaluatedKey in the previous operation.

\n

The data type for ExclusiveStartKey must be String, Number, or Binary. No\n set data types are allowed.

" + } + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" + }, + "ProjectionExpression": { + "target": "com.amazonaws.dynamodb#ProjectionExpression", + "traits": { + "smithy.api#documentation": "

A string that identifies one or more attributes to retrieve from the table. These\n attributes can include scalars, sets, or elements of a JSON document. The attributes in\n the expression must be separated by commas.

\n

If no attribute names are specified, then all attributes will be returned. If any of\n the requested attributes are not found, they will not appear in the result.

\n

For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer\n Guide.

" } + }, + "FilterExpression": { + "target": "com.amazonaws.dynamodb#ConditionExpression", + "traits": { + "smithy.api#documentation": "

A string that contains conditions that DynamoDB applies after the Query\n operation, but before the data is returned to you. Items that do not satisfy the\n FilterExpression criteria are not returned.

\n

A FilterExpression does not allow key attributes. You cannot define a\n filter expression based on a partition key or a sort key.

\n \n

A FilterExpression is applied after the items have already been read;\n the process of filtering does not consume any additional read capacity units.

\n
\n

For more information, see Filter Expressions in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "KeyConditionExpression": { + "target": "com.amazonaws.dynamodb#KeyExpression", + "traits": { + "smithy.api#documentation": "

The condition that specifies the key values for items to be retrieved by the\n Query action.

\n\n

The condition must perform an equality test on a single partition key value.

\n

The condition can optionally perform one of several comparison tests on a single sort\n key value. This allows Query to retrieve one item with a given partition\n key value and sort key value, or several items that have the same partition key value\n but different sort key values.

\n\n

The partition key equality test is required, and must be specified in the following\n format:

\n\n

\n partitionKeyName\n =\n :partitionkeyval\n

\n\n

If you also want to provide a condition for the sort key, it must be combined using\n AND with the condition for the sort key. Following is an example, using\n the = comparison operator for the sort key:

\n\n

\n partitionKeyName\n =\n :partitionkeyval\n AND\n sortKeyName\n =\n :sortkeyval\n

\n

Valid comparisons for the sort key condition are as follows:

\n
    \n
  • \n

    \n sortKeyName\n =\n :sortkeyval - true if the sort key value is equal to\n :sortkeyval.

    \n
  • \n
  • \n

    \n sortKeyName\n <\n :sortkeyval - true if the sort key value is less than\n :sortkeyval.

    \n
  • \n
  • \n

    \n sortKeyName\n <=\n :sortkeyval - true if the sort key value is less than or equal to\n :sortkeyval.

    \n
  • \n
  • \n

    \n sortKeyName\n >\n :sortkeyval - true if the sort key value is greater than\n :sortkeyval.

    \n
  • \n
  • \n

    \n sortKeyName\n >= \n :sortkeyval - true if the sort key value is greater than or equal\n to :sortkeyval.

    \n
  • \n
  • \n

    \n sortKeyName\n BETWEEN\n :sortkeyval1\n AND\n :sortkeyval2 - true if the sort key value is greater than or equal\n to :sortkeyval1, and less than or equal to\n :sortkeyval2.

    \n
  • \n
  • \n

    \n begins_with (\n sortKeyName, :sortkeyval\n ) - true if the sort key value begins with a particular operand.\n (You cannot use this function with a sort key that is of type Number.) Note that\n the function name begins_with is case-sensitive.

    \n\n
  • \n
\n\n

Use the ExpressionAttributeValues parameter to replace tokens such as\n :partitionval and :sortval with actual values at\n runtime.

\n\n

You can optionally use the ExpressionAttributeNames parameter to replace\n the names of the partition key and sort key with placeholder tokens. This option might\n be necessary if an attribute name conflicts with a DynamoDB reserved word. For example,\n the following KeyConditionExpression parameter causes an error because\n Size is a reserved word:

\n
    \n
  • \n

    \n Size = :myval\n

    \n
  • \n
\n

To work around this, define a placeholder (such a #S) to represent the\n attribute name Size. KeyConditionExpression then is as\n follows:

\n
    \n
  • \n

    \n #S = :myval\n

    \n
  • \n
\n

For a list of reserved words, see Reserved Words\n in the Amazon DynamoDB Developer Guide.

\n\n

For more information on ExpressionAttributeNames and\n ExpressionAttributeValues, see Using\n Placeholders for Attribute Names and Values in the Amazon DynamoDB\n Developer Guide.

" + } + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", + "traits": { + "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ExpressionAttributeValues": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", + "traits": { + "smithy.api#documentation": "

One or more values that can be substituted in an expression.

\n

Use the : (colon) character in an expression to\n dereference an attribute value. For example, suppose that you wanted to check whether\n the value of the ProductStatus attribute was one of the following:

\n

\n Available | Backordered | Discontinued\n

\n

You would first need to specify ExpressionAttributeValues as\n follows:

\n

\n { \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"},\n \":disc\":{\"S\":\"Discontinued\"} }\n

\n

You could then use these values in an expression, such as this:

\n

\n ProductStatus IN (:avail, :back, :disc)\n

\n

For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer\n Guide.

" + } + } }, - "com.amazonaws.dynamodb#ImportTableOutput": { - "type": "structure", - "members": { - "ImportTableDescription": { - "target": "com.amazonaws.dynamodb#ImportTableDescription", - "traits": { - "smithy.api#documentation": "

\n Represents the properties of the table created for the import, and parameters of \n the import. The import parameters include import status, how many items were processed, \n and how many errors were encountered.\n

", - "smithy.api#required": {} - } - } + "traits": { + "smithy.api#documentation": "

Represents the input of a Query operation.

" + } + }, + "com.amazonaws.dynamodb#QueryOutput": { + "type": "structure", + "members": { + "Items": { + "target": "com.amazonaws.dynamodb#ItemList", + "traits": { + "smithy.api#documentation": "

An array of item attributes that match the query criteria. Each element in this array\n consists of an attribute name and the value for that attribute.

" + } + }, + "Count": { + "target": "com.amazonaws.dynamodb#Integer", + "traits": { + "smithy.api#documentation": "

The number of items in the response.

\n

If you used a QueryFilter in the request, then Count is the\n number of items returned after the filter was applied, and ScannedCount is\n the number of matching items before the filter was applied.

\n

If you did not use a filter in the request, then Count and\n ScannedCount are the same.

" } - }, - "com.amazonaws.dynamodb#ImportedItemCount": { - "type": "long", + }, + "ScannedCount": { + "target": "com.amazonaws.dynamodb#Integer", "traits": { - "smithy.api#range": { - "min": 0 - } + "smithy.api#documentation": "

The number of items evaluated, before any QueryFilter is applied. A high\n ScannedCount value with few, or no, Count results\n indicates an inefficient Query operation. For more information, see Count and\n ScannedCount in the Amazon DynamoDB Developer\n Guide.

\n

If you did not use a filter in the request, then ScannedCount is the same\n as Count.

" } - }, - "com.amazonaws.dynamodb#IndexName": { - "type": "string", + }, + "LastEvaluatedKey": { + "target": "com.amazonaws.dynamodb#Key", "traits": { - "smithy.api#length": { - "min": 3, - "max": 255 - }, - "smithy.api#pattern": "^[a-zA-Z0-9_.-]+$" + "smithy.api#documentation": "

The primary key of the item where the operation stopped, inclusive of the previous\n result set. Use this value to start a new operation, excluding this value in the new\n request.

\n

If LastEvaluatedKey is empty, then the \"last page\" of results has been\n processed and there is no more data to be retrieved.

\n

If LastEvaluatedKey is not empty, it does not necessarily mean that there\n is more data in the result set. The only way to know when you have reached the end of\n the result set is when LastEvaluatedKey is empty.

" } - }, - "com.amazonaws.dynamodb#IndexNotFoundException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacity", "traits": { - "smithy.api#documentation": "

The operation tried to access a nonexistent index.

", - "smithy.api#error": "client" - } - }, - "com.amazonaws.dynamodb#IndexStatus": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "CREATING", - "name": "CREATING" - }, - { - "value": "UPDATING", - "name": "UPDATING" - }, - { - "value": "DELETING", - "name": "DELETING" - }, - { - "value": "ACTIVE", - "name": "ACTIVE" - } - ] - } - }, - "com.amazonaws.dynamodb#InputCompressionType": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "GZIP", - "name": "GZIP" - }, - { - "value": "ZSTD", - "name": "ZSTD" - }, - { - "value": "NONE", - "name": "NONE" - } - ] - } - }, - "com.amazonaws.dynamodb#InputFormat": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "DYNAMODB_JSON", - "name": "DYNAMODB_JSON" - }, - { - "value": "ION", - "name": "ION" - }, - { - "value": "CSV", - "name": "CSV" - } - ] + "smithy.api#documentation": "

The capacity units consumed by the Query operation. The data returned\n includes the total provisioned throughput consumed, along with statistics for the table\n and any indexes involved in the operation. ConsumedCapacity is only\n returned if the ReturnConsumedCapacity parameter was specified. For more\n information, see Provisioned Throughput in the Amazon DynamoDB Developer\n Guide.

" } + } }, - "com.amazonaws.dynamodb#InputFormatOptions": { - "type": "structure", - "members": { - "Csv": { - "target": "com.amazonaws.dynamodb#CsvOptions", - "traits": { - "smithy.api#documentation": "

\n The options for imported source files in CSV format. The values are Delimiter and HeaderList.\n

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the output of a Query operation.

" + } + }, + "com.amazonaws.dynamodb#RegionName": { + "type": "string" + }, + "com.amazonaws.dynamodb#Replica": { + "type": "structure", + "members": { + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", "traits": { - "smithy.api#documentation": "

\n The format options for the data that was imported into the target table. There is one value, CsvOption.

" + "smithy.api#documentation": "

The Region where the replica needs to be created.

" } + } }, - "com.amazonaws.dynamodb#Integer": { - "type": "integer" + "traits": { + "smithy.api#documentation": "

Represents the properties of a replica.

" + } + }, + "com.amazonaws.dynamodb#ReplicaAlreadyExistsException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } }, - "com.amazonaws.dynamodb#IntegerObject": { - "type": "integer", + "traits": { + "smithy.api#documentation": "

The specified replica is already part of the global table.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ReplicaAutoScalingDescription": { + "type": "structure", + "members": { + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

The Region where the replica exists.

" } - }, - "com.amazonaws.dynamodb#InternalServerError": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage", - "traits": { - "smithy.api#documentation": "

The server encountered an internal error trying to fulfill the request.

" - } - } - }, + }, + "GlobalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingDescriptionList", "traits": { - "smithy.api#documentation": "

An error occurred on the server side.

", - "smithy.api#error": "server" + "smithy.api#documentation": "

Replica-specific global secondary index auto scaling settings.

" } - }, - "com.amazonaws.dynamodb#InvalidEndpointException": { - "type": "structure", - "members": { - "Message": { - "target": "com.amazonaws.dynamodb#String" - } - }, + }, + "ReplicaProvisionedReadCapacityAutoScalingSettings": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription" + }, + "ReplicaProvisionedWriteCapacityAutoScalingSettings": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription" + }, + "ReplicaStatus": { + "target": "com.amazonaws.dynamodb#ReplicaStatus", "traits": { - "smithy.api#error": "client", - "smithy.api#httpError": 421 + "smithy.api#documentation": "

The current state of the replica:

\n
    \n
  • \n

    \n CREATING - The replica is being created.

    \n
  • \n
  • \n

    \n UPDATING - The replica is being updated.

    \n
  • \n
  • \n

    \n DELETING - The replica is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The replica is ready for use.

    \n
  • \n
" } + } }, - "com.amazonaws.dynamodb#InvalidExportTimeException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + "traits": { + "smithy.api#documentation": "

Represents the auto scaling settings of the replica.

" + } + }, + "com.amazonaws.dynamodb#ReplicaAutoScalingDescriptionList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaAutoScalingDescription" + } + }, + "com.amazonaws.dynamodb#ReplicaAutoScalingUpdate": { + "type": "structure", + "members": { + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", "traits": { - "smithy.api#documentation": "

The specified ExportTime is outside of the point in time recovery\n window.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The Region where the replica exists.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#InvalidRestoreTimeException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "ReplicaGlobalSecondaryIndexUpdates": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingUpdateList", "traits": { - "smithy.api#documentation": "

An invalid restore time was specified. RestoreDateTime must be between\n EarliestRestorableDateTime and LatestRestorableDateTime.

", - "smithy.api#error": "client" - } - }, - "com.amazonaws.dynamodb#ItemCollectionKeyAttributeMap": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#AttributeName" - }, - "value": { - "target": "com.amazonaws.dynamodb#AttributeValue" + "smithy.api#documentation": "

Represents the auto scaling settings of global secondary indexes that will be\n modified.

" } + }, + "ReplicaProvisionedReadCapacityAutoScalingUpdate": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate" + } }, - "com.amazonaws.dynamodb#ItemCollectionMetrics": { - "type": "structure", - "members": { - "ItemCollectionKey": { - "target": "com.amazonaws.dynamodb#ItemCollectionKeyAttributeMap", - "traits": { - "smithy.api#documentation": "

The partition key value of the item collection. This value is the same as the\n partition key value of the item.

" - } - }, - "SizeEstimateRangeGB": { - "target": "com.amazonaws.dynamodb#ItemCollectionSizeEstimateRange", - "traits": { - "smithy.api#documentation": "

An estimate of item collection size, in gigabytes. This value is a two-element array\n containing a lower bound and an upper bound for the estimate. The estimate includes the\n size of all the items in the table, plus the size of all attributes projected into all\n of the local secondary indexes on that table. Use this estimate to measure whether a\n local secondary index is approaching its size limit.

\n

The estimate is subject to change over time; therefore, do not rely on the precision\n or accuracy of the estimate.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the auto scaling settings of a replica that will be modified.

" + } + }, + "com.amazonaws.dynamodb#ReplicaAutoScalingUpdateList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaAutoScalingUpdate" + }, + "traits": { + "smithy.api#length": { + "min": 1 + } + } + }, + "com.amazonaws.dynamodb#ReplicaDescription": { + "type": "structure", + "members": { + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", "traits": { - "smithy.api#documentation": "

Information about item collections, if any, that were affected by the operation.\n ItemCollectionMetrics is only returned if the request asked for it. If\n the table does not have any local secondary indexes, this information is not returned in\n the response.

" + "smithy.api#documentation": "

The name of the Region.

" } - }, - "com.amazonaws.dynamodb#ItemCollectionMetricsMultiple": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ItemCollectionMetrics" + }, + "ReplicaStatus": { + "target": "com.amazonaws.dynamodb#ReplicaStatus", + "traits": { + "smithy.api#documentation": "

The current state of the replica:

\n
    \n
  • \n

    \n CREATING - The replica is being created.

    \n
  • \n
  • \n

    \n UPDATING - The replica is being updated.

    \n
  • \n
  • \n

    \n DELETING - The replica is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The replica is ready for use.

    \n
  • \n
  • \n

    \n REGION_DISABLED - The replica is inaccessible because the Amazon Web Services Region has been disabled.

    \n \n

    If the Amazon Web Services Region remains inaccessible for more than 20\n hours, DynamoDB will remove this replica from the replication\n group. The replica will not be deleted and replication will stop from and to\n this region.

    \n
    \n
  • \n
  • \n

    \n INACCESSIBLE_ENCRYPTION_CREDENTIALS - The KMS key\n used to encrypt the table is inaccessible.

    \n \n

    If the KMS key remains inaccessible for more than 20 hours,\n DynamoDB will remove this replica from the replication group.\n The replica will not be deleted and replication will stop from and to this\n region.

    \n
    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#ItemCollectionMetricsPerTable": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#TableName" - }, - "value": { - "target": "com.amazonaws.dynamodb#ItemCollectionMetricsMultiple" + }, + "ReplicaStatusDescription": { + "target": "com.amazonaws.dynamodb#ReplicaStatusDescription", + "traits": { + "smithy.api#documentation": "

Detailed information about the replica status.

" } - }, - "com.amazonaws.dynamodb#ItemCollectionSizeEstimateBound": { - "type": "double", + }, + "ReplicaStatusPercentProgress": { + "target": "com.amazonaws.dynamodb#ReplicaStatusPercentProgress", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

Specifies the progress of a Create, Update, or Delete action on the replica as a\n percentage.

" } - }, - "com.amazonaws.dynamodb#ItemCollectionSizeEstimateRange": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ItemCollectionSizeEstimateBound" + }, + "KMSMasterKeyId": { + "target": "com.amazonaws.dynamodb#KMSMasterKeyId", + "traits": { + "smithy.api#documentation": "

The KMS key of the replica that will be used for\n KMS encryption.

" } - }, - "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage", - "traits": { - "smithy.api#documentation": "

The total size of an item collection has exceeded the maximum limit of 10\n gigabytes.

" - } - } - }, + }, + "ProvisionedThroughputOverride": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputOverride", "traits": { - "smithy.api#documentation": "

An item collection is too large. This exception is only returned for tables that\n have one or more local secondary indexes.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

Replica-specific provisioned throughput. If not described, uses the source table's\n provisioned throughput settings.

" } - }, - "com.amazonaws.dynamodb#ItemCount": { - "type": "long", + }, + "GlobalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexDescriptionList", "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 0 - } + "smithy.api#documentation": "

Replica-specific global secondary index settings.

" } - }, - "com.amazonaws.dynamodb#ItemList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#AttributeMap" + }, + "ReplicaInaccessibleDateTime": { + "target": "com.amazonaws.dynamodb#Date", + "traits": { + "smithy.api#documentation": "

The time at which the replica was first detected as inaccessible. To determine cause\n of inaccessibility check the ReplicaStatus property.

" } + }, + "ReplicaTableClassSummary": { + "target": "com.amazonaws.dynamodb#TableClassSummary" + } }, - "com.amazonaws.dynamodb#ItemResponse": { - "type": "structure", - "members": { - "Item": { - "target": "com.amazonaws.dynamodb#AttributeMap", - "traits": { - "smithy.api#documentation": "

Map of attribute data consisting of the data type and attribute value.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Contains the details of the replica.

" + } + }, + "com.amazonaws.dynamodb#ReplicaDescriptionList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaDescription" + } + }, + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndex": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", "traits": { - "smithy.api#documentation": "

Details for the requested item.

" + "smithy.api#documentation": "

The name of the global secondary index.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ItemResponseList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ItemResponse" - }, + }, + "ProvisionedThroughputOverride": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputOverride", "traits": { - "smithy.api#length": { - "min": 1, - "max": 25 - } + "smithy.api#documentation": "

Replica table GSI-specific provisioned throughput. If not specified, uses the source\n table GSI's read capacity settings.

" } + } }, - "com.amazonaws.dynamodb#KMSMasterKeyArn": { - "type": "string" - }, - "com.amazonaws.dynamodb#KMSMasterKeyId": { - "type": "string" + "traits": { + "smithy.api#documentation": "

Represents the properties of a replica global secondary index.

" + } + }, + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingDescription": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index.

" + } + }, + "IndexStatus": { + "target": "com.amazonaws.dynamodb#IndexStatus", + "traits": { + "smithy.api#documentation": "

The current state of the replica global secondary index:

\n
    \n
  • \n

    \n CREATING - The index is being created.

    \n
  • \n
  • \n

    \n UPDATING - The index is being updated.

    \n
  • \n
  • \n

    \n DELETING - The index is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The index is ready for use.

    \n
  • \n
" + } + }, + "ProvisionedReadCapacityAutoScalingSettings": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription" + }, + "ProvisionedWriteCapacityAutoScalingSettings": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription" + } }, - "com.amazonaws.dynamodb#Key": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#AttributeName" - }, - "value": { - "target": "com.amazonaws.dynamodb#AttributeValue" + "traits": { + "smithy.api#documentation": "

Represents the auto scaling configuration for a replica global secondary index.

" + } + }, + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingDescriptionList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingDescription" + } + }, + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingUpdate": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index.

" } + }, + "ProvisionedReadCapacityAutoScalingUpdate": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate" + } }, - "com.amazonaws.dynamodb#KeyConditions": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#AttributeName" - }, - "value": { - "target": "com.amazonaws.dynamodb#Condition" + "traits": { + "smithy.api#documentation": "

Represents the auto scaling settings of a global secondary index for a replica that\n will be modified.

" + } + }, + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingUpdateList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingUpdate" + } + }, + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexDescription": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index.

" } - }, - "com.amazonaws.dynamodb#KeyExpression": { - "type": "string" - }, - "com.amazonaws.dynamodb#KeyList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#Key" - }, + }, + "ProvisionedThroughputOverride": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputOverride", "traits": { - "smithy.api#length": { - "min": 1, - "max": 100 - } + "smithy.api#documentation": "

If not described, uses the source table GSI's read capacity settings.

" } + } }, - "com.amazonaws.dynamodb#KeySchema": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#KeySchemaElement" - }, + "traits": { + "smithy.api#documentation": "

Represents the properties of a replica global secondary index.

" + } + }, + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexDescriptionList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexDescription" + } + }, + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndex" + }, + "traits": { + "smithy.api#length": { + "min": 1 + } + } + }, + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsDescription": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", "traits": { - "smithy.api#length": { - "min": 1, - "max": 2 - } + "smithy.api#documentation": "

The name of the global secondary index. The name must be unique among all other\n indexes on this table.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#KeySchemaAttributeName": { - "type": "string", + }, + "IndexStatus": { + "target": "com.amazonaws.dynamodb#IndexStatus", "traits": { - "smithy.api#length": { - "min": 1, - "max": 255 - } + "smithy.api#documentation": "

The current status of the global secondary index:

\n
    \n
  • \n

    \n CREATING - The global secondary index is being created.

    \n
  • \n
  • \n

    \n UPDATING - The global secondary index is being updated.

    \n
  • \n
  • \n

    \n DELETING - The global secondary index is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The global secondary index is ready for use.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#KeySchemaElement": { - "type": "structure", - "members": { - "AttributeName": { - "target": "com.amazonaws.dynamodb#KeySchemaAttributeName", - "traits": { - "smithy.api#documentation": "

The name of a key attribute.

", - "smithy.api#required": {} - } - }, - "KeyType": { - "target": "com.amazonaws.dynamodb#KeyType", - "traits": { - "smithy.api#documentation": "

The role that this key attribute will assume:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of an internal hash function to evenly distribute data items across\n partitions, based on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with\n the same partition key physically close together, in sorted order by the sort key\n value.

\n
", - "smithy.api#required": {} - } - } - }, + }, + "ProvisionedReadCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", "traits": { - "smithy.api#documentation": "

Represents a single element of a key schema. A key schema\n specifies the attributes that make up the primary key of a table, or the key attributes\n of an index.

\n

A KeySchemaElement represents exactly one attribute of the primary key.\n For example, a simple primary key would be represented by one\n KeySchemaElement (for the partition key). A composite primary key would\n require one KeySchemaElement for the partition key, and another\n KeySchemaElement for the sort key.

\n

A KeySchemaElement must be a scalar, top-level attribute (not a nested\n attribute). The data type must be one of String, Number, or Binary. The attribute cannot\n be nested within a List or a Map.

" + "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException.

" } - }, - "com.amazonaws.dynamodb#KeyType": { - "type": "string", + }, + "ProvisionedReadCapacityAutoScalingSettings": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription", "traits": { - "smithy.api#enum": [ - { - "value": "HASH", - "name": "HASH" - }, - { - "value": "RANGE", - "name": "RANGE" - } - ] + "smithy.api#documentation": "

Auto scaling settings for a global secondary index replica's read capacity\n units.

" } - }, - "com.amazonaws.dynamodb#KeysAndAttributes": { - "type": "structure", - "members": { - "Keys": { - "target": "com.amazonaws.dynamodb#KeyList", - "traits": { - "smithy.api#documentation": "

The primary key attribute values that define the items and the attributes associated\n with the items.

", - "smithy.api#required": {} - } - }, - "AttributesToGet": { - "target": "com.amazonaws.dynamodb#AttributeNameList", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use ProjectionExpression instead. For more\n information, see Legacy\n Conditional Parameters in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ConsistentRead": { - "target": "com.amazonaws.dynamodb#ConsistentRead", - "traits": { - "smithy.api#documentation": "

The consistency of a read operation. If set to true, then a strongly\n consistent read is used; otherwise, an eventually consistent read is used.

" - } - }, - "ProjectionExpression": { - "target": "com.amazonaws.dynamodb#ProjectionExpression", - "traits": { - "smithy.api#documentation": "

A string that identifies one or more attributes to retrieve from the table. These\n attributes can include scalars, sets, or elements of a JSON document. The attributes in\n the ProjectionExpression must be separated by commas.

\n

If no attribute names are specified, then all attributes will be returned. If any of\n the requested attributes are not found, they will not appear in the result.

\n

For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - } - }, + }, + "ProvisionedWriteCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", "traits": { - "smithy.api#documentation": "

Represents a set of primary keys and, for each key, the attributes to retrieve from\n the table.

\n

For each primary key, you must provide all of the key attributes.\n For example, with a simple primary key, you only need to provide the partition key. For\n a composite primary key, you must provide both the partition key\n and the sort key.

" + "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException.

" } - }, - "com.amazonaws.dynamodb#KinesisDataStreamDestination": { - "type": "structure", - "members": { - "StreamArn": { - "target": "com.amazonaws.dynamodb#StreamArn", - "traits": { - "smithy.api#documentation": "

The ARN for a specific Kinesis data stream.

" - } - }, - "DestinationStatus": { - "target": "com.amazonaws.dynamodb#DestinationStatus", - "traits": { - "smithy.api#documentation": "

The current status of replication.

" - } - }, - "DestinationStatusDescription": { - "target": "com.amazonaws.dynamodb#String", - "traits": { - "smithy.api#documentation": "

The human-readable string that corresponds to the replica status.

" - } - } - }, + }, + "ProvisionedWriteCapacityAutoScalingSettings": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription", "traits": { - "smithy.api#documentation": "

Describes a Kinesis data stream destination.

" + "smithy.api#documentation": "

Auto scaling settings for a global secondary index replica's write capacity\n units.

" } + } }, - "com.amazonaws.dynamodb#KinesisDataStreamDestinations": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#KinesisDataStreamDestination" + "traits": { + "smithy.api#documentation": "

Represents the properties of a global secondary index.

" + } + }, + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsDescriptionList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsDescription" + } + }, + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsUpdate": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index. The name must be unique among all other\n indexes on this table.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#KinesisStreamingDestinationInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the DynamoDB table.

", - "smithy.api#required": {} - } - }, - "StreamArn": { - "target": "com.amazonaws.dynamodb#StreamArn", - "traits": { - "smithy.api#documentation": "

The ARN for a Kinesis data stream.

", - "smithy.api#required": {} - } - } + }, + "ProvisionedReadCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", + "traits": { + "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException.

" } - }, - "com.amazonaws.dynamodb#KinesisStreamingDestinationOutput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table being modified.

" - } - }, - "StreamArn": { - "target": "com.amazonaws.dynamodb#StreamArn", - "traits": { - "smithy.api#documentation": "

The ARN for the specific Kinesis data stream.

" - } - }, - "DestinationStatus": { - "target": "com.amazonaws.dynamodb#DestinationStatus", - "traits": { - "smithy.api#documentation": "

The current status of the replication.

" - } - } + }, + "ProvisionedReadCapacityAutoScalingSettingsUpdate": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate", + "traits": { + "smithy.api#documentation": "

Auto scaling settings for managing a global secondary index replica's read capacity\n units.

" } - }, - "com.amazonaws.dynamodb#EnableKinesisStreamingDestinationInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the DynamoDB table.

", - "smithy.api#required": {} - } - }, - "StreamArn": { - "target": "com.amazonaws.dynamodb#StreamArn", - "traits": { - "smithy.api#documentation": "

The ARN for a Kinesis data stream.

", - "smithy.api#required": {} - } - } } + }, + "traits": { + "smithy.api#documentation": "

Represents the settings of a global secondary index for a global table that will be\n modified.

" + } }, - "com.amazonaws.dynamodb#EnableKinesisStreamingDestinationOutput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table being modified.

" - } - }, - "StreamArn": { - "target": "com.amazonaws.dynamodb#StreamArn", - "traits": { - "smithy.api#documentation": "

The ARN for the specific Kinesis data stream.

" - } - }, - "DestinationStatus": { - "target": "com.amazonaws.dynamodb#DestinationStatus", - "traits": { - "smithy.api#documentation": "

The current status of the replication.

" - } - } + "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsUpdateList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsUpdate" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 20 } + } }, - "com.amazonaws.dynamodb#DisableKinesisStreamingDestinationInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the DynamoDB table.

", - "smithy.api#required": {} - } - }, - "StreamArn": { - "target": "com.amazonaws.dynamodb#StreamArn", - "traits": { - "smithy.api#documentation": "

The ARN for a Kinesis data stream.

", - "smithy.api#required": {} - } - } - } + "com.amazonaws.dynamodb#ReplicaList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#Replica" + } }, - "com.amazonaws.dynamodb#DisableKinesisStreamingDestinationOutput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table being modified.

" - } - }, - "StreamArn": { - "target": "com.amazonaws.dynamodb#StreamArn", - "traits": { - "smithy.api#documentation": "

The ARN for the specific Kinesis data stream.

" - } - }, - "DestinationStatus": { - "target": "com.amazonaws.dynamodb#DestinationStatus", - "traits": { - "smithy.api#documentation": "

The current status of the replication.

" - } - } + "com.amazonaws.dynamodb#ReplicaNotFoundException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" } - }, - "com.amazonaws.dynamodb#LastUpdateDateTime": { - "type": "timestamp" }, - "com.amazonaws.dynamodb#LimitExceededException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage", - "traits": { - "smithy.api#documentation": "

Too many operations for a given subscriber.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

The specified replica is no longer part of the global table.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ReplicaSettingsDescription": { + "type": "structure", + "members": { + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", + "traits": { + "smithy.api#documentation": "

The Region name of the replica.

", + "smithy.api#required": {} + } + }, + "ReplicaStatus": { + "target": "com.amazonaws.dynamodb#ReplicaStatus", + "traits": { + "smithy.api#documentation": "

The current state of the Region:

\n
    \n
  • \n

    \n CREATING - The Region is being created.

    \n
  • \n
  • \n

    \n UPDATING - The Region is being updated.

    \n
  • \n
  • \n

    \n DELETING - The Region is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The Region is ready for use.

    \n
  • \n
" + } + }, + "ReplicaBillingModeSummary": { + "target": "com.amazonaws.dynamodb#BillingModeSummary", "traits": { - "smithy.api#documentation": "

There is no limit to the number of daily on-demand backups that can be taken.

\n

Up to 500 simultaneous table operations are allowed per account. These operations\n include CreateTable, UpdateTable,\n DeleteTable,UpdateTimeToLive,\n RestoreTableFromBackup, and RestoreTableToPointInTime.

\n

The only exception is when you are creating a table with one or more secondary\n indexes. You can have up to 250 such requests running at a time; however, if the table or\n index specifications are complex, DynamoDB might temporarily reduce the number\n of concurrent operations.

\n

There is a soft account quota of 2,500 tables.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The read/write capacity mode of the replica.

" } + }, + "ReplicaProvisionedReadCapacityUnits": { + "target": "com.amazonaws.dynamodb#NonNegativeLongObject", + "traits": { + "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB\n Developer Guide.

" + } + }, + "ReplicaProvisionedReadCapacityAutoScalingSettings": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription", + "traits": { + "smithy.api#documentation": "

Auto scaling settings for a global table replica's read capacity units.

" + } + }, + "ReplicaProvisionedWriteCapacityUnits": { + "target": "com.amazonaws.dynamodb#NonNegativeLongObject", + "traits": { + "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB\n Developer Guide.

" + } + }, + "ReplicaProvisionedWriteCapacityAutoScalingSettings": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription", + "traits": { + "smithy.api#documentation": "

Auto scaling settings for a global table replica's write capacity units.

" + } + }, + "ReplicaGlobalSecondaryIndexSettings": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsDescriptionList", + "traits": { + "smithy.api#documentation": "

Replica global secondary index settings for the global table.

" + } + }, + "ReplicaTableClassSummary": { + "target": "com.amazonaws.dynamodb#TableClassSummary" + } }, - "com.amazonaws.dynamodb#ListAttributeValue": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#AttributeValue" + "traits": { + "smithy.api#documentation": "

Represents the properties of a replica.

" + } + }, + "com.amazonaws.dynamodb#ReplicaSettingsDescriptionList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaSettingsDescription" + } + }, + "com.amazonaws.dynamodb#ReplicaSettingsUpdate": { + "type": "structure", + "members": { + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", + "traits": { + "smithy.api#documentation": "

The Region of the replica to be added.

", + "smithy.api#required": {} } + }, + "ReplicaProvisionedReadCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", + "traits": { + "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB\n Developer Guide.

" + } + }, + "ReplicaProvisionedReadCapacityAutoScalingSettingsUpdate": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate", + "traits": { + "smithy.api#documentation": "

Auto scaling settings for managing a global table replica's read capacity\n units.

" + } + }, + "ReplicaGlobalSecondaryIndexSettingsUpdate": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsUpdateList", + "traits": { + "smithy.api#documentation": "

Represents the settings of a global secondary index for a global table that will be\n modified.

" + } + }, + "ReplicaTableClass": { + "target": "com.amazonaws.dynamodb#TableClass", + "traits": { + "smithy.api#documentation": "

Replica-specific table class. If not specified, uses the source table's\n table class.

" + } + } }, - "com.amazonaws.dynamodb#ListBackups": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ListBackupsInput" + "traits": { + "smithy.api#documentation": "

Represents the settings for a global table in a Region that will be modified.

" + } + }, + "com.amazonaws.dynamodb#ReplicaSettingsUpdateList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaSettingsUpdate" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 50 + } + } + }, + "com.amazonaws.dynamodb#ReplicaStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "CREATING", + "name": "CREATING" + }, + { + "value": "CREATION_FAILED", + "name": "CREATION_FAILED" }, - "output": { - "target": "com.amazonaws.dynamodb#ListBackupsOutput" + { + "value": "UPDATING", + "name": "UPDATING" }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - } - ], - "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

List backups associated with an Amazon Web Services account. To list backups for a\n given table, specify TableName. ListBackups returns a\n paginated list of results with at most 1 MB worth of items in a page. You can also\n specify a maximum number of entries to be returned in a page.

\n

In the request, start time is inclusive, but end time is exclusive. Note that these\n boundaries are for the time at which the original backup was requested.

\n

You can call ListBackups a maximum of five times per second.

" + { + "value": "DELETING", + "name": "DELETING" + }, + { + "value": "ACTIVE", + "name": "ACTIVE" + }, + { + "value": "REGION_DISABLED", + "name": "REGION_DISABLED" + }, + { + "value": "INACCESSIBLE_ENCRYPTION_CREDENTIALS", + "name": "INACCESSIBLE_ENCRYPTION_CREDENTIALS" } - }, - "com.amazonaws.dynamodb#ListBackupsInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The backups from the table specified by TableName are listed.

" - } - }, - "Limit": { - "target": "com.amazonaws.dynamodb#BackupsInputLimit", - "traits": { - "smithy.api#documentation": "

Maximum number of backups to return at once.

" - } - }, - "TimeRangeLowerBound": { - "target": "com.amazonaws.dynamodb#TimeRangeLowerBound", - "traits": { - "smithy.api#documentation": "

Only backups created after this time are listed. TimeRangeLowerBound is\n inclusive.

" - } - }, - "TimeRangeUpperBound": { - "target": "com.amazonaws.dynamodb#TimeRangeUpperBound", - "traits": { - "smithy.api#documentation": "

Only backups created before this time are listed. TimeRangeUpperBound is\n exclusive.

" - } - }, - "ExclusiveStartBackupArn": { - "target": "com.amazonaws.dynamodb#BackupArn", - "traits": { - "smithy.api#documentation": "

\n LastEvaluatedBackupArn is the Amazon Resource Name (ARN) of the backup last\n evaluated when the current page of results was returned, inclusive of the current page\n of results. This value may be specified as the ExclusiveStartBackupArn of a\n new ListBackups operation in order to fetch the next page of results.\n

" - } - }, - "BackupType": { - "target": "com.amazonaws.dynamodb#BackupTypeFilter", - "traits": { - "smithy.api#documentation": "

The backups from the table specified by BackupType are listed.

\n

Where BackupType can be:

\n
    \n
  • \n

    \n USER - On-demand backup created by you. (The default setting if no other backup types are specified.)

    \n
  • \n
  • \n

    \n SYSTEM - On-demand backup automatically created by DynamoDB.

    \n
  • \n
  • \n

    \n ALL - All types of on-demand backups (USER and SYSTEM).

    \n
  • \n
" - } - } + ] + } + }, + "com.amazonaws.dynamodb#ReplicaStatusDescription": { + "type": "string" + }, + "com.amazonaws.dynamodb#ReplicaStatusPercentProgress": { + "type": "string" + }, + "com.amazonaws.dynamodb#ReplicaUpdate": { + "type": "structure", + "members": { + "Create": { + "target": "com.amazonaws.dynamodb#CreateReplicaAction", + "traits": { + "smithy.api#documentation": "

The parameters required for creating a replica on an existing global table.

" } - }, - "com.amazonaws.dynamodb#ListBackupsOutput": { - "type": "structure", - "members": { - "BackupSummaries": { - "target": "com.amazonaws.dynamodb#BackupSummaries", - "traits": { - "smithy.api#documentation": "

List of BackupSummary objects.

" - } - }, - "LastEvaluatedBackupArn": { - "target": "com.amazonaws.dynamodb#BackupArn", - "traits": { - "smithy.api#documentation": "

The ARN of the backup last evaluated when the current page of results was returned,\n inclusive of the current page of results. This value may be specified as the\n ExclusiveStartBackupArn of a new ListBackups operation in\n order to fetch the next page of results.

\n

If LastEvaluatedBackupArn is empty, then the last page of results has\n been processed and there are no more results to be retrieved.

\n

If LastEvaluatedBackupArn is not empty, this may or may not indicate\n that there is more data to be returned. All results are guaranteed to have been returned\n if and only if no value for LastEvaluatedBackupArn is returned.

" - } - } + }, + "Delete": { + "target": "com.amazonaws.dynamodb#DeleteReplicaAction", + "traits": { + "smithy.api#documentation": "

The name of the existing replica to be removed.

" } + } }, - "com.amazonaws.dynamodb#ListContributorInsights": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ListContributorInsightsInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#ListContributorInsightsOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + "traits": { + "smithy.api#documentation": "

Represents one of the following:

\n
    \n
  • \n

    A new replica to be added to an existing global table.

    \n
  • \n
  • \n

    New parameters for an existing replica.

    \n
  • \n
  • \n

    An existing replica to be removed from an existing global table.

    \n
  • \n
" + } + }, + "com.amazonaws.dynamodb#ReplicaUpdateList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicaUpdate" + } + }, + "com.amazonaws.dynamodb#ReplicationGroupUpdate": { + "type": "structure", + "members": { + "Create": { + "target": "com.amazonaws.dynamodb#CreateReplicationGroupMemberAction", "traits": { - "smithy.api#documentation": "

Returns a list of ContributorInsightsSummary for a table and all its global secondary\n indexes.

", - "smithy.api#paginated": { - "inputToken": "NextToken", - "outputToken": "NextToken", - "pageSize": "MaxResults" - } + "smithy.api#documentation": "

The parameters required for creating a replica for the table.

" } - }, - "com.amazonaws.dynamodb#ListContributorInsightsInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table.

" - } - }, - "NextToken": { - "target": "com.amazonaws.dynamodb#NextTokenString", - "traits": { - "smithy.api#documentation": "

A token to for the desired page, if there is one.

" - } - }, - "MaxResults": { - "target": "com.amazonaws.dynamodb#ListContributorInsightsLimit", - "traits": { - "smithy.api#documentation": "

Maximum number of results to return per page.

" - } - } + }, + "Update": { + "target": "com.amazonaws.dynamodb#UpdateReplicationGroupMemberAction", + "traits": { + "smithy.api#documentation": "

The parameters required for updating a replica for the table.

" } - }, - "com.amazonaws.dynamodb#ListContributorInsightsLimit": { - "type": "integer", + }, + "Delete": { + "target": "com.amazonaws.dynamodb#DeleteReplicationGroupMemberAction", "traits": { - "smithy.api#range": { - "max": 100 - } + "smithy.api#documentation": "

The parameters required for deleting a replica for the table.

" } + } }, - "com.amazonaws.dynamodb#ListContributorInsightsOutput": { - "type": "structure", - "members": { - "ContributorInsightsSummaries": { - "target": "com.amazonaws.dynamodb#ContributorInsightsSummaries", - "traits": { - "smithy.api#documentation": "

A list of ContributorInsightsSummary.

" - } - }, - "NextToken": { - "target": "com.amazonaws.dynamodb#NextTokenString", - "traits": { - "smithy.api#documentation": "

A token to go to the next page if there is one.

" - } - } - } + "traits": { + "smithy.api#documentation": "

Represents one of the following:

\n
    \n
  • \n

    A new replica to be added to an existing regional table or global table. This\n request invokes the CreateTableReplica action in the destination\n Region.

    \n
  • \n
  • \n

    New parameters for an existing replica. This request invokes the\n UpdateTable action in the destination Region.

    \n
  • \n
  • \n

    An existing replica to be deleted. The request invokes the\n DeleteTableReplica action in the destination Region, deleting\n the replica and all if its items in the destination Region.

    \n
  • \n
\n \n

When you manually remove a table or global table replica, you do not \n automatically remove any associated scalable targets, scaling policies, or \n CloudWatch alarms.

\n
" + } + }, + "com.amazonaws.dynamodb#ReplicationGroupUpdateList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#ReplicationGroupUpdate" + }, + "traits": { + "smithy.api#length": { + "min": 1 + } + } + }, + "com.amazonaws.dynamodb#RequestLimitExceeded": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } }, - "com.amazonaws.dynamodb#ListExports": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ListExportsInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#ListExportsOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - } - ], + "traits": { + "smithy.api#documentation": "

Throughput exceeds the current throughput quota for your account. Please contact\n Amazon Web Services Support to request a\n quota increase.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ResourceArnString": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 1283 + } + } + }, + "com.amazonaws.dynamodb#ResourceInUseException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage", "traits": { - "smithy.api#documentation": "

Lists completed exports within the past 90 days.

", - "smithy.api#paginated": { - "inputToken": "NextToken", - "outputToken": "NextToken", - "pageSize": "MaxResults" - } + "smithy.api#documentation": "

The resource which is being attempted to be changed is in use.

" } + } }, - "com.amazonaws.dynamodb#ListExportsInput": { - "type": "structure", - "members": { - "TableArn": { - "target": "com.amazonaws.dynamodb#TableArn", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) associated with the exported table.

" - } - }, - "MaxResults": { - "target": "com.amazonaws.dynamodb#ListExportsMaxLimit", - "traits": { - "smithy.api#documentation": "

Maximum number of results to return per page.

" - } - }, - "NextToken": { - "target": "com.amazonaws.dynamodb#ExportNextToken", - "traits": { - "smithy.api#documentation": "

An optional string that, if supplied, must be copied from the output of a previous\n call to ListExports. When provided in this manner, the API fetches the next\n page of results.

" - } - } + "traits": { + "smithy.api#documentation": "

The operation conflicts with the resource's availability. For example, you\n attempted to recreate an existing table, or tried to delete a table currently in the\n CREATING state.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#ResourceNotFoundException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage", + "traits": { + "smithy.api#documentation": "

The resource which is being requested does not exist.

" } + } }, - "com.amazonaws.dynamodb#ListExportsMaxLimit": { - "type": "integer", + "traits": { + "smithy.api#documentation": "

The operation tried to access a nonexistent table or index. The resource might not\n be specified correctly, or its status might not be ACTIVE.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#RestoreInProgress": { + "type": "boolean", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#RestoreSummary": { + "type": "structure", + "members": { + "SourceBackupArn": { + "target": "com.amazonaws.dynamodb#BackupArn", "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 1, - "max": 25 - } + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the backup from which the table was restored.

" } - }, - "com.amazonaws.dynamodb#ListExportsOutput": { - "type": "structure", - "members": { - "ExportSummaries": { - "target": "com.amazonaws.dynamodb#ExportSummaries", - "traits": { - "smithy.api#documentation": "

A list of ExportSummary objects.

" - } - }, - "NextToken": { - "target": "com.amazonaws.dynamodb#ExportNextToken", - "traits": { - "smithy.api#documentation": "

If this value is returned, there are additional results to be displayed. To retrieve\n them, call ListExports again, with NextToken set to this\n value.

" - } - } + }, + "SourceTableArn": { + "target": "com.amazonaws.dynamodb#TableArn", + "traits": { + "smithy.api#documentation": "

The ARN of the source table of the backup that is being restored.

" } - }, - "com.amazonaws.dynamodb#ListGlobalTables": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ListGlobalTablesInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#ListGlobalTablesOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - } - ], + }, + "RestoreDateTime": { + "target": "com.amazonaws.dynamodb#Date", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Lists all global tables that have a replica in the specified Region.

\n \n

This operation only applies to Version\n 2017.11.29 of global tables.

\n
" + "smithy.api#documentation": "

Point in time or source backup time.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ListGlobalTablesInput": { - "type": "structure", - "members": { - "ExclusiveStartGlobalTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The first global table name that this operation will evaluate.

" - } - }, - "Limit": { - "target": "com.amazonaws.dynamodb#PositiveIntegerObject", - "traits": { - "smithy.api#documentation": "

The maximum number of table names to return, if the parameter is not specified\n DynamoDB defaults to 100.

\n

If the number of global tables DynamoDB finds reaches this limit, it stops the\n operation and returns the table names collected up to that point, with a table name in\n the LastEvaluatedGlobalTableName to apply in a subsequent operation to the\n ExclusiveStartGlobalTableName parameter.

" - } - }, - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

Lists the global tables in a specific Region.

" - } - } + }, + "RestoreInProgress": { + "target": "com.amazonaws.dynamodb#RestoreInProgress", + "traits": { + "smithy.api#documentation": "

Indicates if a restore is in progress or not.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#ListGlobalTablesOutput": { - "type": "structure", - "members": { - "GlobalTables": { - "target": "com.amazonaws.dynamodb#GlobalTableList", - "traits": { - "smithy.api#documentation": "

List of global table names.

" - } - }, - "LastEvaluatedGlobalTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

Last evaluated global table name.

" - } - } + "traits": { + "smithy.api#documentation": "

Contains details for the restore.

" + } + }, + "com.amazonaws.dynamodb#RestoreTableFromBackup": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#RestoreTableFromBackupInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#RestoreTableFromBackupOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#BackupInUseException" + }, + { + "target": "com.amazonaws.dynamodb#BackupNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#TableAlreadyExistsException" + }, + { + "target": "com.amazonaws.dynamodb#TableInUseException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Creates a new table from an existing backup. Any number of users can execute up to 4\n concurrent restores (any type of restore) in a given account.

\n

You can call RestoreTableFromBackup at a maximum rate of 10 times per\n second.

\n

You must manually set up the following on the restored table:

\n
    \n
  • \n

    Auto scaling policies

    \n
  • \n
  • \n

    IAM policies

    \n
  • \n
  • \n

    Amazon CloudWatch metrics and alarms

    \n
  • \n
  • \n

    Tags

    \n
  • \n
  • \n

    Stream settings

    \n
  • \n
  • \n

    Time to Live (TTL) settings

    \n
  • \n
" + } + }, + "com.amazonaws.dynamodb#RestoreTableFromBackupInput": { + "type": "structure", + "members": { + "TargetTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the new table to which the backup must be restored.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ListImports": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ListImportsInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#ListImportsOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - } - ], + }, + "BackupArn": { + "target": "com.amazonaws.dynamodb#BackupArn", "traits": { - "smithy.api#documentation": "

\n Lists completed imports within the past 90 days.\n

", - "smithy.api#paginated": { - "inputToken": "NextToken", - "outputToken": "NextToken", - "pageSize": "PageSize" - } + "smithy.api#documentation": "

The Amazon Resource Name (ARN) associated with the backup.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ListImportsInput": { - "type": "structure", - "members": { - "TableArn": { - "target": "com.amazonaws.dynamodb#TableArn", - "traits": { - "smithy.api#documentation": "

\n The Amazon Resource Name (ARN) associated with the table that was imported to.\n

" - } - }, - "PageSize": { - "target": "com.amazonaws.dynamodb#ListImportsMaxLimit", - "traits": { - "smithy.api#documentation": "

\n The number of ImportSummary objects returned in a single page.\n

" - } - }, - "NextToken": { - "target": "com.amazonaws.dynamodb#ImportNextToken", - "traits": { - "smithy.api#documentation": "

\n An optional string that, if supplied, must be copied from the output of a previous\n call to ListImports. When provided in this manner, the API fetches the next\n page of results.\n

" - } - } + }, + "BillingModeOverride": { + "target": "com.amazonaws.dynamodb#BillingMode", + "traits": { + "smithy.api#documentation": "

The billing mode of the restored table.

" } - }, - "com.amazonaws.dynamodb#ListImportsMaxLimit": { - "type": "integer", + }, + "GlobalSecondaryIndexOverride": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexList", "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 1, - "max": 25 - } + "smithy.api#documentation": "

List of global secondary indexes for the restored table. The indexes provided should\n match existing secondary indexes. You can choose to exclude some or all of the indexes\n at the time of restore.

" } - }, - "com.amazonaws.dynamodb#ListImportsOutput": { - "type": "structure", - "members": { - "ImportSummaryList": { - "target": "com.amazonaws.dynamodb#ImportSummaryList", - "traits": { - "smithy.api#documentation": "

\n A list of ImportSummary objects.\n

" - } - }, - "NextToken": { - "target": "com.amazonaws.dynamodb#ImportNextToken", - "traits": { - "smithy.api#documentation": "

\n If this value is returned, there are additional results to be displayed. To retrieve\n them, call ListImports again, with NextToken set to this\n value.\n

" - } - } + }, + "LocalSecondaryIndexOverride": { + "target": "com.amazonaws.dynamodb#LocalSecondaryIndexList", + "traits": { + "smithy.api#documentation": "

List of local secondary indexes for the restored table. The indexes provided should\n match existing secondary indexes. You can choose to exclude some or all of the indexes\n at the time of restore.

" } - }, - "com.amazonaws.dynamodb#ListTables": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ListTablesInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#ListTablesOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - } - ], + }, + "ProvisionedThroughputOverride": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughput", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Returns an array of table names associated with the current account and endpoint. The\n output from ListTables is paginated, with each page returning a maximum of\n 100 table names.

", - "smithy.api#paginated": { - "inputToken": "ExclusiveStartTableName", - "outputToken": "LastEvaluatedTableName", - "items": "TableNames", - "pageSize": "Limit" - } + "smithy.api#documentation": "

Provisioned throughput settings for the restored table.

" } - }, - "com.amazonaws.dynamodb#ListTablesInput": { - "type": "structure", - "members": { - "ExclusiveStartTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The first table name that this operation will evaluate. Use the value that was\n returned for LastEvaluatedTableName in a previous operation, so that you\n can obtain the next page of results.

" - } - }, - "Limit": { - "target": "com.amazonaws.dynamodb#ListTablesInputLimit", - "traits": { - "smithy.api#documentation": "

A maximum number of table names to return. If this parameter is not specified, the\n limit is 100.

" - } - } - }, + }, + "SSESpecificationOverride": { + "target": "com.amazonaws.dynamodb#SSESpecification", "traits": { - "smithy.api#documentation": "

Represents the input of a ListTables operation.

" + "smithy.api#documentation": "

The new server-side encryption settings for the restored table.

" } - }, - "com.amazonaws.dynamodb#ListTablesInputLimit": { - "type": "integer", + } + } + }, + "com.amazonaws.dynamodb#RestoreTableFromBackupOutput": { + "type": "structure", + "members": { + "TableDescription": { + "target": "com.amazonaws.dynamodb#TableDescription", "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 1, - "max": 100 - } + "smithy.api#documentation": "

The description of the table created from an existing backup.

" } - }, - "com.amazonaws.dynamodb#ListTablesOutput": { - "type": "structure", - "members": { - "TableNames": { - "target": "com.amazonaws.dynamodb#TableNameList", - "traits": { - "smithy.api#documentation": "

The names of the tables associated with the current account at the current endpoint.\n The maximum size of this array is 100.

\n

If LastEvaluatedTableName also appears in the output, you can use this\n value as the ExclusiveStartTableName parameter in a subsequent\n ListTables request and obtain the next page of results.

" - } - }, - "LastEvaluatedTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the last table in the current page of results. Use this value as the\n ExclusiveStartTableName in a new request to obtain the next page of\n results, until all the table names are returned.

\n

If you do not receive a LastEvaluatedTableName value in the response,\n this means that there are no more table names to be retrieved.

" - } - } - }, + } + } + }, + "com.amazonaws.dynamodb#RestoreTableToPointInTime": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#RestoreTableToPointInTimeInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#RestoreTableToPointInTimeOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#InvalidRestoreTimeException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#PointInTimeRecoveryUnavailableException" + }, + { + "target": "com.amazonaws.dynamodb#TableAlreadyExistsException" + }, + { + "target": "com.amazonaws.dynamodb#TableInUseException" + }, + { + "target": "com.amazonaws.dynamodb#TableNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Restores the specified table to the specified point in time within\n EarliestRestorableDateTime and LatestRestorableDateTime.\n You can restore your table to any point in time during the last 35 days. Any number of\n users can execute up to 4 concurrent restores (any type of restore) in a given account.

\n

When you restore using point in time recovery, DynamoDB restores your table data to\n the state based on the selected date and time (day:hour:minute:second) to a new table.

\n

Along with data, the following are also included on the new restored table using\n point in time recovery:

\n
    \n
  • \n

    Global secondary indexes (GSIs)

    \n
  • \n
  • \n

    Local secondary indexes (LSIs)

    \n
  • \n
  • \n

    Provisioned read and write capacity

    \n
  • \n
  • \n

    Encryption settings

    \n \n

    All these settings come from the current settings of the source table at\n the time of restore.

    \n
    \n
  • \n
\n\n

You must manually set up the following on the restored table:

\n
    \n
  • \n

    Auto scaling policies

    \n
  • \n
  • \n

    IAM policies

    \n
  • \n
  • \n

    Amazon CloudWatch metrics and alarms

    \n
  • \n
  • \n

    Tags

    \n
  • \n
  • \n

    Stream settings

    \n
  • \n
  • \n

    Time to Live (TTL) settings

    \n
  • \n
  • \n

    Point in time recovery settings

    \n
  • \n
" + } + }, + "com.amazonaws.dynamodb#RestoreTableToPointInTimeInput": { + "type": "structure", + "members": { + "SourceTableArn": { + "target": "com.amazonaws.dynamodb#TableArn", "traits": { - "smithy.api#documentation": "

Represents the output of a ListTables operation.

" + "smithy.api#documentation": "

The DynamoDB table that will be restored. This value is an Amazon Resource Name\n (ARN).

" } - }, - "com.amazonaws.dynamodb#ListTagsOfResource": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ListTagsOfResourceInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#ListTagsOfResourceOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "SourceTableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

List all tags on an Amazon DynamoDB resource. You can call ListTagsOfResource up to 10\n times per second, per account.

\n

For an overview on tagging DynamoDB resources, see Tagging for DynamoDB\n in the Amazon DynamoDB Developer Guide.

" + "smithy.api#documentation": "

Name of the source table that is being restored.

" } - }, - "com.amazonaws.dynamodb#ListTagsOfResourceInput": { - "type": "structure", - "members": { - "ResourceArn": { - "target": "com.amazonaws.dynamodb#ResourceArnString", - "traits": { - "smithy.api#documentation": "

The Amazon DynamoDB resource with tags to be listed. This value is an Amazon Resource\n Name (ARN).

", - "smithy.api#required": {} - } - }, - "NextToken": { - "target": "com.amazonaws.dynamodb#NextTokenString", - "traits": { - "smithy.api#documentation": "

An optional string that, if supplied, must be copied from the output of a previous\n call to ListTagOfResource. When provided in this manner, this API fetches the next page\n of results.

" - } - } + }, + "TargetTableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the new table to which it must be restored to.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ListTagsOfResourceOutput": { - "type": "structure", - "members": { - "Tags": { - "target": "com.amazonaws.dynamodb#TagList", - "traits": { - "smithy.api#documentation": "

The tags currently associated with the Amazon DynamoDB resource.

" - } - }, - "NextToken": { - "target": "com.amazonaws.dynamodb#NextTokenString", - "traits": { - "smithy.api#documentation": "

If this value is returned, there are additional results to be displayed. To retrieve\n them, call ListTagsOfResource again, with NextToken set to this value.

" - } - } + }, + "UseLatestRestorableTime": { + "target": "com.amazonaws.dynamodb#BooleanObject", + "traits": { + "smithy.api#documentation": "

Restore the table to the latest possible time. LatestRestorableDateTime\n is typically 5 minutes before the current time.

" } - }, - "com.amazonaws.dynamodb#LocalSecondaryIndex": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the local secondary index. The name must be unique among all other indexes\n on this table.

", - "smithy.api#required": {} - } - }, - "KeySchema": { - "target": "com.amazonaws.dynamodb#KeySchema", - "traits": { - "smithy.api#documentation": "

The complete key schema for the local secondary index, consisting of one or more pairs\n of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of\n an internal hash function to evenly distribute data items across partitions, based\n on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with the same\n partition key physically close together, in sorted order by the sort key\n value.

\n
", - "smithy.api#required": {} - } - }, - "Projection": { - "target": "com.amazonaws.dynamodb#Projection", - "traits": { - "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the local\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

", - "smithy.api#required": {} - } - } - }, + }, + "RestoreDateTime": { + "target": "com.amazonaws.dynamodb#Date", "traits": { - "smithy.api#documentation": "

Represents the properties of a local secondary index.

" + "smithy.api#documentation": "

Time in the past to restore the table to.

" } - }, - "com.amazonaws.dynamodb#LocalSecondaryIndexDescription": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

Represents the name of the local secondary index.

" - } - }, - "KeySchema": { - "target": "com.amazonaws.dynamodb#KeySchema", - "traits": { - "smithy.api#documentation": "

The complete key schema for the local secondary index, consisting of one or more pairs\n of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of\n an internal hash function to evenly distribute data items across partitions, based\n on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with the same\n partition key physically close together, in sorted order by the sort key\n value.

\n
" - } - }, - "Projection": { - "target": "com.amazonaws.dynamodb#Projection", - "traits": { - "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the global\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

" - } - }, - "IndexSizeBytes": { - "target": "com.amazonaws.dynamodb#Long", - "traits": { - "smithy.api#documentation": "

The total size of the specified index, in bytes. DynamoDB updates this value\n approximately every six hours. Recent changes might not be reflected in this\n value.

" - } - }, - "ItemCount": { - "target": "com.amazonaws.dynamodb#Long", - "traits": { - "smithy.api#documentation": "

The number of items in the specified index. DynamoDB updates this value\n approximately every six hours. Recent changes might not be reflected in this\n value.

" - } - }, - "IndexArn": { - "target": "com.amazonaws.dynamodb#String", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) that uniquely identifies the index.

" - } - } - }, + }, + "BillingModeOverride": { + "target": "com.amazonaws.dynamodb#BillingMode", "traits": { - "smithy.api#documentation": "

Represents the properties of a local secondary index.

" + "smithy.api#documentation": "

The billing mode of the restored table.

" } - }, - "com.amazonaws.dynamodb#LocalSecondaryIndexDescriptionList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#LocalSecondaryIndexDescription" + }, + "GlobalSecondaryIndexOverride": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexList", + "traits": { + "smithy.api#documentation": "

List of global secondary indexes for the restored table. The indexes provided should\n match existing secondary indexes. You can choose to exclude some or all of the indexes\n at the time of restore.

" } - }, - "com.amazonaws.dynamodb#LocalSecondaryIndexInfo": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

Represents the name of the local secondary index.

" - } - }, - "KeySchema": { - "target": "com.amazonaws.dynamodb#KeySchema", - "traits": { - "smithy.api#documentation": "

The complete key schema for a local secondary index, which consists of one or more\n pairs of attribute names and key types:

\n
    \n
  • \n

    \n HASH - partition key

    \n
  • \n
  • \n

    \n RANGE - sort key

    \n
  • \n
\n \n

The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's usage of\n an internal hash function to evenly distribute data items across partitions, based\n on their partition key values.

\n

The sort key of an item is also known as its range attribute.\n The term \"range attribute\" derives from the way DynamoDB stores items with the same\n partition key physically close together, in sorted order by the sort key\n value.

\n
" - } - }, - "Projection": { - "target": "com.amazonaws.dynamodb#Projection", - "traits": { - "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into the global\n secondary index. These are in addition to the primary key attributes and index key\n attributes, which are automatically projected.

" - } - } - }, + }, + "LocalSecondaryIndexOverride": { + "target": "com.amazonaws.dynamodb#LocalSecondaryIndexList", "traits": { - "smithy.api#documentation": "

Represents the properties of a local secondary index for the table when the backup was\n created.

" + "smithy.api#documentation": "

List of local secondary indexes for the restored table. The indexes provided should\n match existing secondary indexes. You can choose to exclude some or all of the indexes\n at the time of restore.

" } - }, - "com.amazonaws.dynamodb#LocalSecondaryIndexList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#LocalSecondaryIndex" + }, + "ProvisionedThroughputOverride": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughput", + "traits": { + "smithy.api#documentation": "

Provisioned throughput settings for the restored table.

" } - }, - "com.amazonaws.dynamodb#LocalSecondaryIndexes": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#LocalSecondaryIndexInfo" + }, + "SSESpecificationOverride": { + "target": "com.amazonaws.dynamodb#SSESpecification", + "traits": { + "smithy.api#documentation": "

The new server-side encryption settings for the restored table.

" } - }, - "com.amazonaws.dynamodb#Long": { - "type": "long" - }, - "com.amazonaws.dynamodb#MapAttributeValue": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#AttributeName" + } + } + }, + "com.amazonaws.dynamodb#RestoreTableToPointInTimeOutput": { + "type": "structure", + "members": { + "TableDescription": { + "target": "com.amazonaws.dynamodb#TableDescription", + "traits": { + "smithy.api#documentation": "

Represents the properties of a table.

" + } + } + } + }, + "com.amazonaws.dynamodb#ReturnConsumedCapacity": { + "type": "string", + "traits": { + "smithy.api#documentation": "

Determines the level of detail about either provisioned or on-demand throughput\n consumption that is returned in the response:

\n
    \n
  • \n

    \n INDEXES - The response includes the aggregate\n ConsumedCapacity for the operation, together with\n ConsumedCapacity for each table and secondary index that was\n accessed.

    \n

    Note that some operations, such as GetItem and\n BatchGetItem, do not access any indexes at all. In these cases,\n specifying INDEXES will only return ConsumedCapacity\n information for table(s).

    \n
  • \n
  • \n

    \n TOTAL - The response includes only the aggregate\n ConsumedCapacity for the operation.

    \n
  • \n
  • \n

    \n NONE - No ConsumedCapacity details are included in the\n response.

    \n
  • \n
", + "smithy.api#enum": [ + { + "value": "INDEXES", + "name": "INDEXES" + }, + { + "value": "TOTAL", + "name": "TOTAL" }, - "value": { - "target": "com.amazonaws.dynamodb#AttributeValue" + { + "value": "NONE", + "name": "NONE" } - }, - "com.amazonaws.dynamodb#NextTokenString": { - "type": "string" - }, - "com.amazonaws.dynamodb#NonKeyAttributeName": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 255 - } + ] + } + }, + "com.amazonaws.dynamodb#ReturnItemCollectionMetrics": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "SIZE", + "name": "SIZE" + }, + { + "value": "NONE", + "name": "NONE" } - }, - "com.amazonaws.dynamodb#NonKeyAttributeNameList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#NonKeyAttributeName" + ] + } + }, + "com.amazonaws.dynamodb#ReturnValue": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "NONE", + "name": "NONE" }, - "traits": { - "smithy.api#length": { - "min": 1, - "max": 20 - } + { + "value": "ALL_OLD", + "name": "ALL_OLD" + }, + { + "value": "UPDATED_OLD", + "name": "UPDATED_OLD" + }, + { + "value": "ALL_NEW", + "name": "ALL_NEW" + }, + { + "value": "UPDATED_NEW", + "name": "UPDATED_NEW" + } + ] + } + }, + "com.amazonaws.dynamodb#ReturnValuesOnConditionCheckFailure": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "ALL_OLD", + "name": "ALL_OLD" + }, + { + "value": "NONE", + "name": "NONE" } - }, - "com.amazonaws.dynamodb#NonNegativeLongObject": { - "type": "long", + ] + } + }, + "com.amazonaws.dynamodb#S3Bucket": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 0, + "max": 255 + }, + "smithy.api#pattern": "^[a-z0-9A-Z]+[\\.\\-\\w]*[a-z0-9A-Z]+$" + } + }, + "com.amazonaws.dynamodb#S3BucketOwner": { + "type": "string", + "traits": { + "smithy.api#pattern": "^[0-9]{12}$" + } + }, + "com.amazonaws.dynamodb#S3BucketSource": { + "type": "structure", + "members": { + "S3BucketOwner": { + "target": "com.amazonaws.dynamodb#S3BucketOwner", "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 0 - } + "smithy.api#documentation": "

\n The account number of the S3 bucket that is being imported from. \n If the bucket is owned by the requester this is optional. \n

" } - }, - "com.amazonaws.dynamodb#NullAttributeValue": { - "type": "boolean", + }, + "S3Bucket": { + "target": "com.amazonaws.dynamodb#S3Bucket", "traits": { - "smithy.api#box": {} - } - }, - "com.amazonaws.dynamodb#NumberAttributeValue": { - "type": "string" - }, - "com.amazonaws.dynamodb#NumberSetAttributeValue": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#NumberAttributeValue" + "smithy.api#documentation": "

\n The S3 bucket that is being imported from.\n

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ParameterizedStatement": { - "type": "structure", - "members": { - "Statement": { - "target": "com.amazonaws.dynamodb#PartiQLStatement", - "traits": { - "smithy.api#documentation": "

A PartiQL statment that uses parameters.

", - "smithy.api#required": {} - } - }, - "Parameters": { - "target": "com.amazonaws.dynamodb#PreparedStatementParameters", - "traits": { - "smithy.api#documentation": "

The parameter values.

" - } - } - }, + }, + "S3KeyPrefix": { + "target": "com.amazonaws.dynamodb#S3Prefix", "traits": { - "smithy.api#documentation": "

Represents a PartiQL statment that uses parameters.

" + "smithy.api#documentation": "

\n The key prefix shared by all S3 Objects that are being imported.\n

" } + } }, - "com.amazonaws.dynamodb#ParameterizedStatements": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ParameterizedStatement" + "traits": { + "smithy.api#documentation": "

\n The S3 bucket that is being imported from.\n

" + } + }, + "com.amazonaws.dynamodb#S3Prefix": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 0, + "max": 1024 + } + } + }, + "com.amazonaws.dynamodb#S3SseAlgorithm": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "AES256", + "name": "AES256" }, - "traits": { - "smithy.api#length": { - "min": 1, - "max": 25 - } + { + "value": "KMS", + "name": "KMS" } - }, - "com.amazonaws.dynamodb#PartiQLBatchRequest": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#BatchStatementRequest" - }, + ] + } + }, + "com.amazonaws.dynamodb#S3SseKmsKeyId": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 2048 + } + } + }, + "com.amazonaws.dynamodb#SSEDescription": { + "type": "structure", + "members": { + "Status": { + "target": "com.amazonaws.dynamodb#SSEStatus", "traits": { - "smithy.api#length": { - "min": 1, - "max": 25 - } + "smithy.api#documentation": "

Represents the current state of server-side encryption. The only supported values\n are:

\n
    \n
  • \n

    \n ENABLED - Server-side encryption is enabled.

    \n
  • \n
  • \n

    \n UPDATING - Server-side encryption is being updated.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#PartiQLBatchResponse": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#BatchStatementResponse" - } - }, - "com.amazonaws.dynamodb#PartiQLNextToken": { - "type": "string", + }, + "SSEType": { + "target": "com.amazonaws.dynamodb#SSEType", "traits": { - "smithy.api#length": { - "min": 1, - "max": 32768 - } + "smithy.api#documentation": "

Server-side encryption type. The only supported value is:

\n
    \n
  • \n

    \n KMS - Server-side encryption that uses Key Management Service. The\n key is stored in your account and is managed by KMS (KMS charges apply).

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#PartiQLStatement": { - "type": "string", + }, + "KMSMasterKeyArn": { + "target": "com.amazonaws.dynamodb#KMSMasterKeyArn", "traits": { - "smithy.api#length": { - "min": 1, - "max": 8192 - } + "smithy.api#documentation": "

The KMS key ARN used for the KMS\n encryption.

" } - }, - "com.amazonaws.dynamodb#PointInTimeRecoveryDescription": { - "type": "structure", - "members": { - "PointInTimeRecoveryStatus": { - "target": "com.amazonaws.dynamodb#PointInTimeRecoveryStatus", - "traits": { - "smithy.api#documentation": "

The current state of point in time recovery:

\n
    \n
  • \n

    \n ENABLED - Point in time recovery is enabled.

    \n
  • \n
  • \n

    \n DISABLED - Point in time recovery is disabled.

    \n
  • \n
" - } - }, - "EarliestRestorableDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

Specifies the earliest point in time you can restore your table to. You can restore\n your table to any point in time during the last 35 days.

" - } - }, - "LatestRestorableDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

\n LatestRestorableDateTime is typically 5 minutes before the current time.\n

" - } - } - }, + }, + "InaccessibleEncryptionDateTime": { + "target": "com.amazonaws.dynamodb#Date", "traits": { - "smithy.api#documentation": "

The description of the point in time settings applied to the table.

" + "smithy.api#documentation": "

Indicates the time, in UNIX epoch date format, when DynamoDB detected that\n the table's KMS key was inaccessible. This attribute will automatically\n be cleared when DynamoDB detects that the table's KMS key is accessible\n again. DynamoDB will initiate the table archival process when table's KMS key remains inaccessible for more than seven days from this date.

" } + } }, - "com.amazonaws.dynamodb#PointInTimeRecoverySpecification": { - "type": "structure", - "members": { - "PointInTimeRecoveryEnabled": { - "target": "com.amazonaws.dynamodb#BooleanObject", - "traits": { - "smithy.api#documentation": "

Indicates whether point in time recovery is enabled (true) or disabled (false) on the\n table.

", - "smithy.api#required": {} - } - } - }, + "traits": { + "smithy.api#documentation": "

The description of the server-side encryption status on the specified table.

" + } + }, + "com.amazonaws.dynamodb#SSEEnabled": { + "type": "boolean", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#SSESpecification": { + "type": "structure", + "members": { + "Enabled": { + "target": "com.amazonaws.dynamodb#SSEEnabled", "traits": { - "smithy.api#documentation": "

Represents the settings used to enable point in time recovery.

" + "smithy.api#documentation": "

Indicates whether server-side encryption is done using an Amazon Web Services managed\n key or an Amazon Web Services owned key. If enabled (true), server-side encryption type\n is set to KMS and an Amazon Web Services managed key is used (KMS charges apply). If disabled (false) or not specified, server-side\n encryption is set to Amazon Web Services owned key.

" } - }, - "com.amazonaws.dynamodb#PointInTimeRecoveryStatus": { - "type": "string", + }, + "SSEType": { + "target": "com.amazonaws.dynamodb#SSEType", "traits": { - "smithy.api#enum": [ - { - "value": "ENABLED", - "name": "ENABLED" - }, - { - "value": "DISABLED", - "name": "DISABLED" - } - ] + "smithy.api#documentation": "

Server-side encryption type. The only supported value is:

\n
    \n
  • \n

    \n KMS - Server-side encryption that uses Key Management Service. The\n key is stored in your account and is managed by KMS (KMS charges apply).

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#PointInTimeRecoveryUnavailableException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "KMSMasterKeyId": { + "target": "com.amazonaws.dynamodb#KMSMasterKeyId", "traits": { - "smithy.api#documentation": "

Point in time recovery has not yet been enabled for this source table.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The KMS key that should be used for the KMS encryption.\n To specify a key, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN.\n Note that you should only provide this parameter if the key is different from the\n default DynamoDB key alias/aws/dynamodb.

" } + } }, - "com.amazonaws.dynamodb#PositiveIntegerObject": { - "type": "integer", - "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 1 - } + "traits": { + "smithy.api#documentation": "

Represents the settings used to enable server-side encryption.

" + } + }, + "com.amazonaws.dynamodb#SSEStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "ENABLING", + "name": "ENABLING" + }, + { + "value": "ENABLED", + "name": "ENABLED" + }, + { + "value": "DISABLING", + "name": "DISABLING" + }, + { + "value": "DISABLED", + "name": "DISABLED" + }, + { + "value": "UPDATING", + "name": "UPDATING" } - }, - "com.amazonaws.dynamodb#PositiveLongObject": { - "type": "long", - "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 1 - } + ] + } + }, + "com.amazonaws.dynamodb#SSEType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "AES256", + "name": "AES256" + }, + { + "value": "KMS", + "name": "KMS" } - }, - "com.amazonaws.dynamodb#PreparedStatementParameters": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#AttributeValue" + ] + } + }, + "com.amazonaws.dynamodb#ScalarAttributeType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "S", + "name": "S" }, - "traits": { - "smithy.api#length": { - "min": 1 - } + { + "value": "N", + "name": "N" + }, + { + "value": "B", + "name": "B" } - }, - "com.amazonaws.dynamodb#ProcessedItemCount": { - "type": "long", + ] + } + }, + "com.amazonaws.dynamodb#Scan": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#ScanInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#ScanOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

The Scan operation returns one or more items and item attributes by\n accessing every item in a table or a secondary index. To have DynamoDB return fewer\n items, you can provide a FilterExpression operation.

\n

If the total number of scanned items exceeds the maximum dataset size limit of 1 MB,\n the scan stops and results are returned to the user as a LastEvaluatedKey\n value to continue the scan in a subsequent operation. The results also include the\n number of items exceeding the limit. A scan can result in no table data meeting the\n filter criteria.

\n

A single Scan operation reads up to the maximum number of items set (if\n using the Limit parameter) or a maximum of 1 MB of data and then apply any\n filtering to the results using FilterExpression. If\n LastEvaluatedKey is present in the response, you need to paginate the\n result set. For more information, see Paginating the\n Results in the Amazon DynamoDB Developer Guide.

\n

\n Scan operations proceed sequentially; however, for faster performance on\n a large table or secondary index, applications can request a parallel Scan\n operation by providing the Segment and TotalSegments\n parameters. For more information, see Parallel\n Scan in the Amazon DynamoDB Developer Guide.

\n

\n Scan uses eventually consistent reads when accessing the data in a table;\n therefore, the result set might not include the changes to data in the table immediately\n before the operation began. If you need a consistent copy of the data, as of the time\n that the Scan begins, you can set the ConsistentRead parameter\n to true.

", + "smithy.api#paginated": { + "inputToken": "ExclusiveStartKey", + "outputToken": "LastEvaluatedKey", + "items": "Items", + "pageSize": "Limit" + }, + "smithy.api#suppress": ["PaginatedTrait"] + } + }, + "com.amazonaws.dynamodb#ScanInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#range": { - "min": 0 - } + "smithy.api#documentation": "

The name of the table containing the requested items; or, if you provide\n IndexName, the name of the table to which that index belongs.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#Projection": { - "type": "structure", - "members": { - "ProjectionType": { - "target": "com.amazonaws.dynamodb#ProjectionType", - "traits": { - "smithy.api#documentation": "

The set of attributes that are projected into the index:

\n
    \n
  • \n

    \n KEYS_ONLY - Only the index and primary keys are projected into the\n index.

    \n
  • \n
  • \n

    \n INCLUDE - In addition to the attributes described in\n KEYS_ONLY, the secondary index will include other non-key\n attributes that you specify.

    \n
  • \n
  • \n

    \n ALL - All of the table attributes are projected into the\n index.

    \n
  • \n
" - } - }, - "NonKeyAttributes": { - "target": "com.amazonaws.dynamodb#NonKeyAttributeNameList", - "traits": { - "smithy.api#documentation": "

Represents the non-key attribute names which will be projected into the index.

\n

For local secondary indexes, the total count of NonKeyAttributes summed\n across all of the local secondary indexes, must not exceed 100. If you project the same\n attribute into two different indexes, this counts as two distinct attributes when\n determining the total.

" - } - } - }, + }, + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", "traits": { - "smithy.api#documentation": "

Represents attributes that are copied (projected) from the table into an index. These\n are in addition to the primary key attributes and index key attributes, which are\n automatically projected.

" + "smithy.api#documentation": "

The name of a secondary index to scan. This index can be any local secondary index or\n global secondary index. Note that if you use the IndexName parameter, you\n must also provide TableName.

" } - }, - "com.amazonaws.dynamodb#ProjectionExpression": { - "type": "string" - }, - "com.amazonaws.dynamodb#ProjectionType": { - "type": "string", + }, + "AttributesToGet": { + "target": "com.amazonaws.dynamodb#AttributeNameList", "traits": { - "smithy.api#enum": [ - { - "value": "ALL", - "name": "ALL" - }, - { - "value": "KEYS_ONLY", - "name": "KEYS_ONLY" - }, - { - "value": "INCLUDE", - "name": "INCLUDE" - } - ] + "smithy.api#documentation": "

This is a legacy parameter. Use ProjectionExpression instead. For more\n information, see AttributesToGet in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#ProvisionedThroughput": { - "type": "structure", - "members": { - "ReadCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB\n Developer Guide.

\n

If read/write capacity mode is PAY_PER_REQUEST the value is set to\n 0.

", - "smithy.api#required": {} - } - }, - "WriteCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB\n Developer Guide.

\n

If read/write capacity mode is PAY_PER_REQUEST the value is set to\n 0.

", - "smithy.api#required": {} - } - } - }, + }, + "Limit": { + "target": "com.amazonaws.dynamodb#PositiveIntegerObject", "traits": { - "smithy.api#documentation": "

Represents the provisioned throughput settings for a specified table or index. The\n settings can be modified using the UpdateTable operation.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" + "smithy.api#documentation": "

The maximum number of items to evaluate (not necessarily the number of matching\n items). If DynamoDB processes the number of items up to the limit while processing the\n results, it stops the operation and returns the matching values up to that point, and a\n key in LastEvaluatedKey to apply in a subsequent operation, so that you can\n pick up where you left off. Also, if the processed dataset size exceeds 1 MB before\n DynamoDB reaches this limit, it stops the operation and returns the matching values up\n to the limit, and a key in LastEvaluatedKey to apply in a subsequent\n operation to continue the operation. For more information, see Working with Queries in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#ProvisionedThroughputDescription": { - "type": "structure", - "members": { - "LastIncreaseDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

The date and time of the last provisioned throughput increase for this table.

" - } - }, - "LastDecreaseDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

The date and time of the last provisioned throughput decrease for this table.

" - } - }, - "NumberOfDecreasesToday": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The number of provisioned throughput decreases for this table during this UTC calendar\n day. For current maximums on provisioned throughput decreases, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ReadCapacityUnits": { - "target": "com.amazonaws.dynamodb#NonNegativeLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException. Eventually consistent reads require less\n effort than strongly consistent reads, so a setting of 50 ReadCapacityUnits\n per second provides 100 eventually consistent ReadCapacityUnits per\n second.

" - } - }, - "WriteCapacityUnits": { - "target": "com.amazonaws.dynamodb#NonNegativeLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException.

" - } - } - }, + }, + "Select": { + "target": "com.amazonaws.dynamodb#Select", "traits": { - "smithy.api#documentation": "

Represents the provisioned throughput settings for the table, consisting of read and\n write capacity units, along with data about increases and decreases.

" + "smithy.api#documentation": "

The attributes to be returned in the result. You can retrieve all item attributes,\n specific item attributes, the count of matching items, or in the case of an index, some\n or all of the attributes projected into the index.

\n
    \n
  • \n

    \n ALL_ATTRIBUTES - Returns all of the item attributes from the\n specified table or index. If you query a local secondary index, then for each\n matching item in the index, DynamoDB fetches the entire item from the parent\n table. If the index is configured to project all item attributes, then all of\n the data can be obtained from the local secondary index, and no fetching is\n required.

    \n
  • \n
  • \n

    \n ALL_PROJECTED_ATTRIBUTES - Allowed only when querying an index.\n Retrieves all attributes that have been projected into the index. If the index\n is configured to project all attributes, this return value is equivalent to\n specifying ALL_ATTRIBUTES.

    \n
  • \n
  • \n

    \n COUNT - Returns the number of matching items, rather than the\n matching items themselves.

    \n
  • \n
  • \n

    \n SPECIFIC_ATTRIBUTES - Returns only the attributes listed in\n ProjectionExpression. This return value is equivalent to\n specifying ProjectionExpression without specifying any value for\n Select.

    \n

    If you query or scan a local secondary index and request only attributes that\n are projected into that index, the operation reads only the index and not the\n table. If any of the requested attributes are not projected into the local\n secondary index, DynamoDB fetches each of these attributes from the parent\n table. This extra fetching incurs additional throughput cost and latency.

    \n

    If you query or scan a global secondary index, you can only request attributes\n that are projected into the index. Global secondary index queries cannot fetch\n attributes from the parent table.

    \n
  • \n
\n

If neither Select nor ProjectionExpression are specified,\n DynamoDB defaults to ALL_ATTRIBUTES when accessing a table, and\n ALL_PROJECTED_ATTRIBUTES when accessing an index. You cannot use both\n Select and ProjectionExpression together in a single\n request, unless the value for Select is SPECIFIC_ATTRIBUTES.\n (This usage is equivalent to specifying ProjectionExpression without any\n value for Select.)

\n \n

If you use the ProjectionExpression parameter, then the value for\n Select can only be SPECIFIC_ATTRIBUTES. Any other\n value for Select will return an error.

\n
" } - }, - "com.amazonaws.dynamodb#ProvisionedThroughputExceededException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage", - "traits": { - "smithy.api#documentation": "

You exceeded your maximum allowed provisioned throughput.

" - } - } - }, + }, + "ScanFilter": { + "target": "com.amazonaws.dynamodb#FilterConditionMap", "traits": { - "smithy.api#documentation": "

Your request rate is too high. The Amazon Web Services SDKs for DynamoDB\n automatically retry requests that receive this exception. Your request is eventually\n successful, unless your retry queue is too large to finish. Reduce the frequency of\n requests and use exponential backoff. For more information, go to Error Retries and Exponential Backoff in the Amazon DynamoDB Developer Guide.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

This is a legacy parameter. Use FilterExpression instead. For more\n information, see ScanFilter in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#ProvisionedThroughputOverride": { - "type": "structure", - "members": { - "ReadCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

Replica-specific read capacity units. If not specified, uses the source table's read\n capacity settings.

" - } - } - }, + }, + "ConditionalOperator": { + "target": "com.amazonaws.dynamodb#ConditionalOperator", "traits": { - "smithy.api#documentation": "

Replica-specific provisioned throughput settings. If not specified, uses the source\n table's provisioned throughput settings.

" + "smithy.api#documentation": "

This is a legacy parameter. Use FilterExpression instead. For more\n information, see ConditionalOperator in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#Put": { - "type": "structure", - "members": { - "Item": { - "target": "com.amazonaws.dynamodb#PutItemInputAttributeMap", - "traits": { - "smithy.api#documentation": "

A map of attribute name to attribute values, representing the primary key of the item\n to be written by PutItem. All of the table's primary key attributes must be\n specified, and their data types must match those of the table's key schema. If any\n attributes are present in the item that are part of an index key schema for the table,\n their types must match the index key schema.

", - "smithy.api#required": {} - } - }, - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

Name of the table in which to write the item.

", - "smithy.api#required": {} - } - }, - "ConditionExpression": { - "target": "com.amazonaws.dynamodb#ConditionExpression", - "traits": { - "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional update to\n succeed.

" - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression.

" - } - }, - "ExpressionAttributeValues": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", - "traits": { - "smithy.api#documentation": "

One or more values that can be substituted in an expression.

" - } - }, - "ReturnValuesOnConditionCheckFailure": { - "target": "com.amazonaws.dynamodb#ReturnValuesOnConditionCheckFailure", - "traits": { - "smithy.api#documentation": "

Use ReturnValuesOnConditionCheckFailure to get the item attributes if the\n Put condition fails. For\n ReturnValuesOnConditionCheckFailure, the valid values are: NONE and\n ALL_OLD.

" - } - } - }, + }, + "ExclusiveStartKey": { + "target": "com.amazonaws.dynamodb#Key", "traits": { - "smithy.api#documentation": "

Represents a request to perform a PutItem operation.

" + "smithy.api#documentation": "

The primary key of the first item that this operation will evaluate. Use the value\n that was returned for LastEvaluatedKey in the previous operation.

\n

The data type for ExclusiveStartKey must be String, Number or Binary. No\n set data types are allowed.

\n

In a parallel scan, a Scan request that includes\n ExclusiveStartKey must specify the same segment whose previous\n Scan returned the corresponding value of\n LastEvaluatedKey.

" } - }, - "com.amazonaws.dynamodb#PutItem": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#PutItemInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#PutItemOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#ConditionalCheckFailedException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#TransactionConflictException" - } - ], + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" + }, + "TotalSegments": { + "target": "com.amazonaws.dynamodb#ScanTotalSegments", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Creates a new item, or replaces an old item with a new item. If an item that has the\n same primary key as the new item already exists in the specified table, the new item\n completely replaces the existing item. You can perform a conditional put operation (add\n a new item if one with the specified primary key doesn't exist), or replace an existing\n item if it has certain attribute values. You can return the item's attribute values in\n the same operation, using the ReturnValues parameter.

\n\n

When you add an item, the primary key attributes are the only required attributes.\n Attribute values cannot be null.

\n

Empty String and Binary attribute values are allowed. Attribute values of type String\n and Binary must have a length greater than zero if the attribute is used as a key\n attribute for a table or index. Set type attributes cannot be empty.

\n

Invalid Requests with empty values will be rejected with a\n ValidationException exception.

\n \n

To prevent a new item from replacing an existing item, use a conditional\n expression that contains the attribute_not_exists function with the\n name of the attribute being used as the partition key for the table. Since every\n record must contain that attribute, the attribute_not_exists function\n will only succeed if no matching item exists.

\n
\n

For more information about PutItem, see Working with\n Items in the Amazon DynamoDB Developer Guide.

" + "smithy.api#documentation": "

For a parallel Scan request, TotalSegments represents the\n total number of segments into which the Scan operation will be divided. The\n value of TotalSegments corresponds to the number of application workers\n that will perform the parallel scan. For example, if you want to use four application\n threads to scan a table or an index, specify a TotalSegments value of\n 4.

\n

The value for TotalSegments must be greater than or equal to 1, and less\n than or equal to 1000000. If you specify a TotalSegments value of 1, the\n Scan operation will be sequential rather than parallel.

\n

If you specify TotalSegments, you must also specify\n Segment.

" } - }, - "com.amazonaws.dynamodb#PutItemInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table to contain the item.

", - "smithy.api#required": {} - } - }, - "Item": { - "target": "com.amazonaws.dynamodb#PutItemInputAttributeMap", - "traits": { - "smithy.api#documentation": "

A map of attribute name/value pairs, one for each attribute. Only the primary key\n attributes are required; you can optionally provide other attribute name-value pairs for\n the item.

\n

You must provide all of the attributes for the primary key. For example, with a simple\n primary key, you only need to provide a value for the partition key. For a composite\n primary key, you must provide both values for both the partition key and the sort\n key.

\n

If you specify any attributes that are part of an index key, then the data types for\n those attributes must match those of the schema in the table's attribute\n definition.

\n

Empty String and Binary attribute values are allowed. Attribute values of type String\n and Binary must have a length greater than zero if the attribute is used as a key\n attribute for a table or index.

\n\n

For more information about primary keys, see Primary Key in the Amazon DynamoDB Developer\n Guide.

\n

Each element in the Item map is an AttributeValue\n object.

", - "smithy.api#required": {} - } - }, - "Expected": { - "target": "com.amazonaws.dynamodb#ExpectedAttributeMap", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see Expected in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ReturnValues": { - "target": "com.amazonaws.dynamodb#ReturnValue", - "traits": { - "smithy.api#documentation": "

Use ReturnValues if you want to get the item attributes as they appeared\n before they were updated with the PutItem request. For\n PutItem, the valid values are:

\n
    \n
  • \n

    \n NONE - If ReturnValues is not specified, or if its\n value is NONE, then nothing is returned. (This setting is the\n default for ReturnValues.)

    \n
  • \n
  • \n

    \n ALL_OLD - If PutItem overwrote an attribute name-value\n pair, then the content of the old item is returned.

    \n
  • \n
\n

The values returned are strongly consistent.

\n

There is no additional cost associated with requesting a return value aside from the small \n network and processing overhead of receiving a larger response. No read capacity units are \n consumed.

\n \n

The ReturnValues parameter is used by several DynamoDB operations;\n however, PutItem does not recognize any values other than\n NONE or ALL_OLD.

\n
" - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" - }, - "ReturnItemCollectionMetrics": { - "target": "com.amazonaws.dynamodb#ReturnItemCollectionMetrics", - "traits": { - "smithy.api#documentation": "

Determines whether item collection metrics are returned. If set to SIZE,\n the response includes statistics about item collections, if any, that were modified\n during the operation are returned in the response. If set to NONE (the\n default), no statistics are returned.

" - } - }, - "ConditionalOperator": { - "target": "com.amazonaws.dynamodb#ConditionalOperator", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see ConditionalOperator in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ConditionExpression": { - "target": "com.amazonaws.dynamodb#ConditionExpression", - "traits": { - "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional PutItem\n operation to succeed.

\n

An expression can contain any of the following:

\n
    \n
  • \n

    Functions: attribute_exists | attribute_not_exists | attribute_type |\n contains | begins_with | size\n

    \n

    These function names are case-sensitive.

    \n
  • \n
  • \n

    Comparison operators: = | <> |\n < | > | <= | >= |\n BETWEEN | IN \n

    \n
  • \n
  • \n

    Logical operators: AND | OR | NOT\n

    \n
  • \n
\n

For more information on condition expressions, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExpressionAttributeValues": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", - "traits": { - "smithy.api#documentation": "

One or more values that can be substituted in an expression.

\n

Use the : (colon) character in an expression to\n dereference an attribute value. For example, suppose that you wanted to check whether\n the value of the ProductStatus attribute was one of the following:

\n

\n Available | Backordered | Discontinued\n

\n

You would first need to specify ExpressionAttributeValues as\n follows:

\n

\n { \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"},\n \":disc\":{\"S\":\"Discontinued\"} }\n

\n

You could then use these values in an expression, such as this:

\n

\n ProductStatus IN (:avail, :back, :disc)\n

\n

For more information on expression attribute values, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" - } - } - }, + }, + "Segment": { + "target": "com.amazonaws.dynamodb#ScanSegment", "traits": { - "smithy.api#documentation": "

Represents the input of a PutItem operation.

" + "smithy.api#documentation": "

For a parallel Scan request, Segment identifies an\n individual segment to be scanned by an application worker.

\n

Segment IDs are zero-based, so the first segment is always 0. For example, if you want\n to use four application threads to scan a table or an index, then the first thread\n specifies a Segment value of 0, the second thread specifies 1, and so\n on.

\n

The value of LastEvaluatedKey returned from a parallel Scan\n request must be used as ExclusiveStartKey with the same segment ID in a\n subsequent Scan operation.

\n

The value for Segment must be greater than or equal to 0, and less than\n the value provided for TotalSegments.

\n

If you provide Segment, you must also provide\n TotalSegments.

" } - }, - "com.amazonaws.dynamodb#PutItemInputAttributeMap": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#AttributeName" - }, - "value": { - "target": "com.amazonaws.dynamodb#AttributeValue" + }, + "ProjectionExpression": { + "target": "com.amazonaws.dynamodb#ProjectionExpression", + "traits": { + "smithy.api#documentation": "

A string that identifies one or more attributes to retrieve from the specified table\n or index. These attributes can include scalars, sets, or elements of a JSON document.\n The attributes in the expression must be separated by commas.

\n

If no attribute names are specified, then all attributes will be returned. If any of\n the requested attributes are not found, they will not appear in the result.

\n

For more information, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#PutItemOutput": { - "type": "structure", - "members": { - "Attributes": { - "target": "com.amazonaws.dynamodb#AttributeMap", - "traits": { - "smithy.api#documentation": "

The attribute values as they appeared before the PutItem operation, but\n only if ReturnValues is specified as ALL_OLD in the request.\n Each element consists of an attribute name and an attribute value.

" - } - }, - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacity", - "traits": { - "smithy.api#documentation": "

The capacity units consumed by the PutItem operation. The data returned\n includes the total provisioned throughput consumed, along with statistics for the table\n and any indexes involved in the operation. ConsumedCapacity is only\n returned if the ReturnConsumedCapacity parameter was specified. For more\n information, see Read/Write Capacity Mode in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ItemCollectionMetrics": { - "target": "com.amazonaws.dynamodb#ItemCollectionMetrics", - "traits": { - "smithy.api#documentation": "

Information about item collections, if any, that were affected by the\n PutItem operation. ItemCollectionMetrics is only returned\n if the ReturnItemCollectionMetrics parameter was specified. If the table\n does not have any local secondary indexes, this information is not returned in the\n response.

\n

Each ItemCollectionMetrics element consists of:

\n
    \n
  • \n

    \n ItemCollectionKey - The partition key value of the item collection.\n This is the same as the partition key value of the item itself.

    \n
  • \n
  • \n

    \n SizeEstimateRangeGB - An estimate of item collection size, in\n gigabytes. This value is a two-element array containing a lower bound and an\n upper bound for the estimate. The estimate includes the size of all the items in\n the table, plus the size of all attributes projected into all of the local\n secondary indexes on that table. Use this estimate to measure whether a local\n secondary index is approaching its size limit.

    \n

    The estimate is subject to change over time; therefore, do not rely on the\n precision or accuracy of the estimate.

    \n
  • \n
" - } - } - }, + }, + "FilterExpression": { + "target": "com.amazonaws.dynamodb#ConditionExpression", "traits": { - "smithy.api#documentation": "

Represents the output of a PutItem operation.

" + "smithy.api#documentation": "

A string that contains conditions that DynamoDB applies after the Scan\n operation, but before the data is returned to you. Items that do not satisfy the\n FilterExpression criteria are not returned.

\n \n

A FilterExpression is applied after the items have already been read;\n the process of filtering does not consume any additional read capacity units.

\n
\n

For more information, see Filter Expressions in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#PutRequest": { - "type": "structure", - "members": { - "Item": { - "target": "com.amazonaws.dynamodb#PutItemInputAttributeMap", - "traits": { - "smithy.api#documentation": "

A map of attribute name to attribute values, representing the primary key of an item\n to be processed by PutItem. All of the table's primary key attributes must\n be specified, and their data types must match those of the table's key schema. If any\n attributes are present in the item that are part of an index key schema for the table,\n their types must match the index key schema.

", - "smithy.api#required": {} - } - } - }, + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", "traits": { - "smithy.api#documentation": "

Represents a request to perform a PutItem operation on an item.

" + "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#Query": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#QueryInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#QueryOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "ExpressionAttributeValues": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

You must provide the name of the partition key attribute and a single value for that\n attribute. Query returns all items with that partition key value.\n Optionally, you can provide a sort key attribute and use a comparison operator to refine\n the search results.

\n\n

Use the KeyConditionExpression parameter to provide a specific value for\n the partition key. The Query operation will return all of the items from\n the table or index with that partition key value. You can optionally narrow the scope of\n the Query operation by specifying a sort key value and a comparison\n operator in KeyConditionExpression. To further refine the\n Query results, you can optionally provide a\n FilterExpression. A FilterExpression determines which\n items within the results should be returned to you. All of the other results are\n discarded.

\n

A Query operation always returns a result set. If no matching items are\n found, the result set will be empty. Queries that do not return results consume the\n minimum number of read capacity units for that type of read operation.

\n \n

DynamoDB calculates the number of read capacity units consumed based on item\n size, not on the amount of data that is returned to an application. The number of\n capacity units consumed will be the same whether you request all of the attributes\n (the default behavior) or just some of them (using a projection expression). The\n number will also be the same whether or not you use a FilterExpression.\n

\n
\n

\n Query results are always sorted by the sort key value. If the data type of\n the sort key is Number, the results are returned in numeric order; otherwise, the\n results are returned in order of UTF-8 bytes. By default, the sort order is ascending.\n To reverse the order, set the ScanIndexForward parameter to false.

\n

A single Query operation will read up to the maximum number of items set\n (if using the Limit parameter) or a maximum of 1 MB of data and then apply\n any filtering to the results using FilterExpression. If\n LastEvaluatedKey is present in the response, you will need to paginate\n the result set. For more information, see Paginating\n the Results in the Amazon DynamoDB Developer Guide.

\n

\n FilterExpression is applied after a Query finishes, but before\n the results are returned. A FilterExpression cannot contain partition key\n or sort key attributes. You need to specify those attributes in the\n KeyConditionExpression.

\n \n

A Query operation can return an empty result set and a\n LastEvaluatedKey if all the items read for the page of results are\n filtered out.

\n
\n

You can query a table, a local secondary index, or a global secondary index. For a\n query on a table or on a local secondary index, you can set the\n ConsistentRead parameter to true and obtain a strongly\n consistent result. Global secondary indexes support eventually consistent reads only, so\n do not specify ConsistentRead when querying a global secondary\n index.

", - "smithy.api#paginated": { - "inputToken": "ExclusiveStartKey", - "outputToken": "LastEvaluatedKey", - "items": "Items", - "pageSize": "Limit" - }, - "smithy.api#suppress": [ - "PaginatedTrait" - ] - } - }, - "com.amazonaws.dynamodb#QueryInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table containing the requested items.

", - "smithy.api#required": {} - } - }, - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of an index to query. This index can be any local secondary index or global\n secondary index on the table. Note that if you use the IndexName parameter,\n you must also provide TableName.\n

" - } - }, - "Select": { - "target": "com.amazonaws.dynamodb#Select", - "traits": { - "smithy.api#documentation": "

The attributes to be returned in the result. You can retrieve all item attributes,\n specific item attributes, the count of matching items, or in the case of an index, some\n or all of the attributes projected into the index.

\n
    \n
  • \n

    \n ALL_ATTRIBUTES - Returns all of the item attributes from the\n specified table or index. If you query a local secondary index, then for each\n matching item in the index, DynamoDB fetches the entire item from the parent\n table. If the index is configured to project all item attributes, then all of\n the data can be obtained from the local secondary index, and no fetching is\n required.

    \n
  • \n
  • \n

    \n ALL_PROJECTED_ATTRIBUTES - Allowed only when querying an index.\n Retrieves all attributes that have been projected into the index. If the index\n is configured to project all attributes, this return value is equivalent to\n specifying ALL_ATTRIBUTES.

    \n
  • \n
  • \n

    \n COUNT - Returns the number of matching items, rather than the\n matching items themselves.

    \n
  • \n
  • \n

    \n SPECIFIC_ATTRIBUTES - Returns only the attributes listed in\n ProjectionExpression. This return value is equivalent to\n specifying ProjectionExpression without specifying any value for\n Select.

    \n

    If you query or scan a local secondary index and request only attributes that\n are projected into that index, the operation will read only the index and not\n the table. If any of the requested attributes are not projected into the local\n secondary index, DynamoDB fetches each of these attributes from the parent\n table. This extra fetching incurs additional throughput cost and latency.

    \n

    If you query or scan a global secondary index, you can only request attributes\n that are projected into the index. Global secondary index queries cannot fetch\n attributes from the parent table.

    \n
  • \n
\n

If neither Select nor ProjectionExpression are specified,\n DynamoDB defaults to ALL_ATTRIBUTES when accessing a table, and\n ALL_PROJECTED_ATTRIBUTES when accessing an index. You cannot use both\n Select and ProjectionExpression together in a single\n request, unless the value for Select is SPECIFIC_ATTRIBUTES.\n (This usage is equivalent to specifying ProjectionExpression without any\n value for Select.)

\n \n

If you use the ProjectionExpression parameter, then the value for\n Select can only be SPECIFIC_ATTRIBUTES. Any other\n value for Select will return an error.

\n
" - } - }, - "AttributesToGet": { - "target": "com.amazonaws.dynamodb#AttributeNameList", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use ProjectionExpression instead. For more\n information, see AttributesToGet in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "Limit": { - "target": "com.amazonaws.dynamodb#PositiveIntegerObject", - "traits": { - "smithy.api#documentation": "

The maximum number of items to evaluate (not necessarily the number of matching\n items). If DynamoDB processes the number of items up to the limit while processing the\n results, it stops the operation and returns the matching values up to that point, and a\n key in LastEvaluatedKey to apply in a subsequent operation, so that you can\n pick up where you left off. Also, if the processed dataset size exceeds 1 MB before\n DynamoDB reaches this limit, it stops the operation and returns the matching values up\n to the limit, and a key in LastEvaluatedKey to apply in a subsequent\n operation to continue the operation. For more information, see Query and Scan in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ConsistentRead": { - "target": "com.amazonaws.dynamodb#ConsistentRead", - "traits": { - "smithy.api#documentation": "

Determines the read consistency model: If set to true, then the operation\n uses strongly consistent reads; otherwise, the operation uses eventually consistent\n reads.

\n

Strongly consistent reads are not supported on global secondary indexes. If you query\n a global secondary index with ConsistentRead set to true, you\n will receive a ValidationException.

" - } - }, - "KeyConditions": { - "target": "com.amazonaws.dynamodb#KeyConditions", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use KeyConditionExpression instead. For more\n information, see KeyConditions in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "QueryFilter": { - "target": "com.amazonaws.dynamodb#FilterConditionMap", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use FilterExpression instead. For more\n information, see QueryFilter in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ConditionalOperator": { - "target": "com.amazonaws.dynamodb#ConditionalOperator", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use FilterExpression instead. For more\n information, see ConditionalOperator in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ScanIndexForward": { - "target": "com.amazonaws.dynamodb#BooleanObject", - "traits": { - "smithy.api#documentation": "

Specifies the order for index traversal: If true (default), the traversal\n is performed in ascending order; if false, the traversal is performed in\n descending order.

\n

Items with the same partition key value are stored in sorted order by sort key. If the\n sort key data type is Number, the results are stored in numeric order. For type String,\n the results are stored in order of UTF-8 bytes. For type Binary, DynamoDB treats each\n byte of the binary data as unsigned.

\n

If ScanIndexForward is true, DynamoDB returns the results in\n the order in which they are stored (by sort key value). This is the default behavior. If\n ScanIndexForward is false, DynamoDB reads the results in\n reverse order by sort key value, and then returns the results to the client.

" - } - }, - "ExclusiveStartKey": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

The primary key of the first item that this operation will evaluate. Use the value\n that was returned for LastEvaluatedKey in the previous operation.

\n

The data type for ExclusiveStartKey must be String, Number, or Binary. No\n set data types are allowed.

" - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" - }, - "ProjectionExpression": { - "target": "com.amazonaws.dynamodb#ProjectionExpression", - "traits": { - "smithy.api#documentation": "

A string that identifies one or more attributes to retrieve from the table. These\n attributes can include scalars, sets, or elements of a JSON document. The attributes in\n the expression must be separated by commas.

\n

If no attribute names are specified, then all attributes will be returned. If any of\n the requested attributes are not found, they will not appear in the result.

\n

For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "FilterExpression": { - "target": "com.amazonaws.dynamodb#ConditionExpression", - "traits": { - "smithy.api#documentation": "

A string that contains conditions that DynamoDB applies after the Query\n operation, but before the data is returned to you. Items that do not satisfy the\n FilterExpression criteria are not returned.

\n

A FilterExpression does not allow key attributes. You cannot define a\n filter expression based on a partition key or a sort key.

\n \n

A FilterExpression is applied after the items have already been read;\n the process of filtering does not consume any additional read capacity units.

\n
\n

For more information, see Filter Expressions in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "KeyConditionExpression": { - "target": "com.amazonaws.dynamodb#KeyExpression", - "traits": { - "smithy.api#documentation": "

The condition that specifies the key values for items to be retrieved by the\n Query action.

\n\n

The condition must perform an equality test on a single partition key value.

\n

The condition can optionally perform one of several comparison tests on a single sort\n key value. This allows Query to retrieve one item with a given partition\n key value and sort key value, or several items that have the same partition key value\n but different sort key values.

\n\n

The partition key equality test is required, and must be specified in the following\n format:

\n\n

\n partitionKeyName\n =\n :partitionkeyval\n

\n\n

If you also want to provide a condition for the sort key, it must be combined using\n AND with the condition for the sort key. Following is an example, using\n the = comparison operator for the sort key:

\n\n

\n partitionKeyName\n =\n :partitionkeyval\n AND\n sortKeyName\n =\n :sortkeyval\n

\n

Valid comparisons for the sort key condition are as follows:

\n
    \n
  • \n

    \n sortKeyName\n =\n :sortkeyval - true if the sort key value is equal to\n :sortkeyval.

    \n
  • \n
  • \n

    \n sortKeyName\n <\n :sortkeyval - true if the sort key value is less than\n :sortkeyval.

    \n
  • \n
  • \n

    \n sortKeyName\n <=\n :sortkeyval - true if the sort key value is less than or equal to\n :sortkeyval.

    \n
  • \n
  • \n

    \n sortKeyName\n >\n :sortkeyval - true if the sort key value is greater than\n :sortkeyval.

    \n
  • \n
  • \n

    \n sortKeyName\n >= \n :sortkeyval - true if the sort key value is greater than or equal\n to :sortkeyval.

    \n
  • \n
  • \n

    \n sortKeyName\n BETWEEN\n :sortkeyval1\n AND\n :sortkeyval2 - true if the sort key value is greater than or equal\n to :sortkeyval1, and less than or equal to\n :sortkeyval2.

    \n
  • \n
  • \n

    \n begins_with (\n sortKeyName, :sortkeyval\n ) - true if the sort key value begins with a particular operand.\n (You cannot use this function with a sort key that is of type Number.) Note that\n the function name begins_with is case-sensitive.

    \n\n
  • \n
\n\n

Use the ExpressionAttributeValues parameter to replace tokens such as\n :partitionval and :sortval with actual values at\n runtime.

\n\n

You can optionally use the ExpressionAttributeNames parameter to replace\n the names of the partition key and sort key with placeholder tokens. This option might\n be necessary if an attribute name conflicts with a DynamoDB reserved word. For example,\n the following KeyConditionExpression parameter causes an error because\n Size is a reserved word:

\n
    \n
  • \n

    \n Size = :myval\n

    \n
  • \n
\n

To work around this, define a placeholder (such a #S) to represent the\n attribute name Size. KeyConditionExpression then is as\n follows:

\n
    \n
  • \n

    \n #S = :myval\n

    \n
  • \n
\n

For a list of reserved words, see Reserved Words\n in the Amazon DynamoDB Developer Guide.

\n\n

For more information on ExpressionAttributeNames and\n ExpressionAttributeValues, see Using\n Placeholders for Attribute Names and Values in the Amazon DynamoDB\n Developer Guide.

" - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExpressionAttributeValues": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", - "traits": { - "smithy.api#documentation": "

One or more values that can be substituted in an expression.

\n

Use the : (colon) character in an expression to\n dereference an attribute value. For example, suppose that you wanted to check whether\n the value of the ProductStatus attribute was one of the following:

\n

\n Available | Backordered | Discontinued\n

\n

You would first need to specify ExpressionAttributeValues as\n follows:

\n

\n { \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"},\n \":disc\":{\"S\":\"Discontinued\"} }\n

\n

You could then use these values in an expression, such as this:

\n

\n ProductStatus IN (:avail, :back, :disc)\n

\n

For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer\n Guide.

" - } - } - }, + "smithy.api#documentation": "

One or more values that can be substituted in an expression.

\n

Use the : (colon) character in an expression to\n dereference an attribute value. For example, suppose that you wanted to check whether\n the value of the ProductStatus attribute was one of the following:

\n

\n Available | Backordered | Discontinued\n

\n

You would first need to specify ExpressionAttributeValues as\n follows:

\n

\n { \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"},\n \":disc\":{\"S\":\"Discontinued\"} }\n

\n

You could then use these values in an expression, such as this:

\n

\n ProductStatus IN (:avail, :back, :disc)\n

\n

For more information on expression attribute values, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "ConsistentRead": { + "target": "com.amazonaws.dynamodb#ConsistentRead", "traits": { - "smithy.api#documentation": "

Represents the input of a Query operation.

" + "smithy.api#documentation": "

A Boolean value that determines the read consistency model during the scan:

\n
    \n
  • \n

    If ConsistentRead is false, then the data returned\n from Scan might not contain the results from other recently\n completed write operations (PutItem, UpdateItem, or\n DeleteItem).

    \n
  • \n
  • \n

    If ConsistentRead is true, then all of the write\n operations that completed before the Scan began are guaranteed to\n be contained in the Scan response.

    \n
  • \n
\n

The default setting for ConsistentRead is false.

\n

The ConsistentRead parameter is not supported on global secondary\n indexes. If you scan a global secondary index with ConsistentRead set to\n true, you will receive a ValidationException.

" } + } }, - "com.amazonaws.dynamodb#QueryOutput": { - "type": "structure", - "members": { - "Items": { - "target": "com.amazonaws.dynamodb#ItemList", - "traits": { - "smithy.api#documentation": "

An array of item attributes that match the query criteria. Each element in this array\n consists of an attribute name and the value for that attribute.

" - } - }, - "Count": { - "target": "com.amazonaws.dynamodb#Integer", - "traits": { - "smithy.api#documentation": "

The number of items in the response.

\n

If you used a QueryFilter in the request, then Count is the\n number of items returned after the filter was applied, and ScannedCount is\n the number of matching items before the filter was applied.

\n

If you did not use a filter in the request, then Count and\n ScannedCount are the same.

" - } - }, - "ScannedCount": { - "target": "com.amazonaws.dynamodb#Integer", - "traits": { - "smithy.api#documentation": "

The number of items evaluated, before any QueryFilter is applied. A high\n ScannedCount value with few, or no, Count results\n indicates an inefficient Query operation. For more information, see Count and\n ScannedCount in the Amazon DynamoDB Developer\n Guide.

\n

If you did not use a filter in the request, then ScannedCount is the same\n as Count.

" - } - }, - "LastEvaluatedKey": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

The primary key of the item where the operation stopped, inclusive of the previous\n result set. Use this value to start a new operation, excluding this value in the new\n request.

\n

If LastEvaluatedKey is empty, then the \"last page\" of results has been\n processed and there is no more data to be retrieved.

\n

If LastEvaluatedKey is not empty, it does not necessarily mean that there\n is more data in the result set. The only way to know when you have reached the end of\n the result set is when LastEvaluatedKey is empty.

" - } - }, - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacity", - "traits": { - "smithy.api#documentation": "

The capacity units consumed by the Query operation. The data returned\n includes the total provisioned throughput consumed, along with statistics for the table\n and any indexes involved in the operation. ConsumedCapacity is only\n returned if the ReturnConsumedCapacity parameter was specified. For more\n information, see Provisioned Throughput in the Amazon DynamoDB Developer\n Guide.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the input of a Scan operation.

" + } + }, + "com.amazonaws.dynamodb#ScanOutput": { + "type": "structure", + "members": { + "Items": { + "target": "com.amazonaws.dynamodb#ItemList", "traits": { - "smithy.api#documentation": "

Represents the output of a Query operation.

" + "smithy.api#documentation": "

An array of item attributes that match the scan criteria. Each element in this array\n consists of an attribute name and the value for that attribute.

" } - }, - "com.amazonaws.dynamodb#RegionName": { - "type": "string" - }, - "com.amazonaws.dynamodb#Replica": { - "type": "structure", - "members": { - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

The Region where the replica needs to be created.

" - } - } - }, + }, + "Count": { + "target": "com.amazonaws.dynamodb#Integer", "traits": { - "smithy.api#documentation": "

Represents the properties of a replica.

" + "smithy.api#documentation": "

The number of items in the response.

\n

If you set ScanFilter in the request, then Count is the\n number of items returned after the filter was applied, and ScannedCount is\n the number of matching items before the filter was applied.

\n

If you did not use a filter in the request, then Count is the same as\n ScannedCount.

" } - }, - "com.amazonaws.dynamodb#ReplicaAlreadyExistsException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "ScannedCount": { + "target": "com.amazonaws.dynamodb#Integer", "traits": { - "smithy.api#documentation": "

The specified replica is already part of the global table.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The number of items evaluated, before any ScanFilter is applied. A high\n ScannedCount value with few, or no, Count results\n indicates an inefficient Scan operation. For more information, see Count and\n ScannedCount in the Amazon DynamoDB Developer\n Guide.

\n

If you did not use a filter in the request, then ScannedCount is the same\n as Count.

" } - }, - "com.amazonaws.dynamodb#ReplicaAutoScalingDescription": { - "type": "structure", - "members": { - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

The Region where the replica exists.

" - } - }, - "GlobalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingDescriptionList", - "traits": { - "smithy.api#documentation": "

Replica-specific global secondary index auto scaling settings.

" - } - }, - "ReplicaProvisionedReadCapacityAutoScalingSettings": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription" - }, - "ReplicaProvisionedWriteCapacityAutoScalingSettings": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription" - }, - "ReplicaStatus": { - "target": "com.amazonaws.dynamodb#ReplicaStatus", - "traits": { - "smithy.api#documentation": "

The current state of the replica:

\n
    \n
  • \n

    \n CREATING - The replica is being created.

    \n
  • \n
  • \n

    \n UPDATING - The replica is being updated.

    \n
  • \n
  • \n

    \n DELETING - The replica is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The replica is ready for use.

    \n
  • \n
" - } - } - }, + }, + "LastEvaluatedKey": { + "target": "com.amazonaws.dynamodb#Key", "traits": { - "smithy.api#documentation": "

Represents the auto scaling settings of the replica.

" + "smithy.api#documentation": "

The primary key of the item where the operation stopped, inclusive of the previous\n result set. Use this value to start a new operation, excluding this value in the new\n request.

\n

If LastEvaluatedKey is empty, then the \"last page\" of results has been\n processed and there is no more data to be retrieved.

\n

If LastEvaluatedKey is not empty, it does not necessarily mean that there\n is more data in the result set. The only way to know when you have reached the end of\n the result set is when LastEvaluatedKey is empty.

" } - }, - "com.amazonaws.dynamodb#ReplicaAutoScalingDescriptionList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaAutoScalingDescription" + }, + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacity", + "traits": { + "smithy.api#documentation": "

The capacity units consumed by the Scan operation. The data returned\n includes the total provisioned throughput consumed, along with statistics for the table\n and any indexes involved in the operation. ConsumedCapacity is only\n returned if the ReturnConsumedCapacity parameter was specified. For more\n information, see Provisioned Throughput in the Amazon DynamoDB Developer\n Guide.

" } + } }, - "com.amazonaws.dynamodb#ReplicaAutoScalingUpdate": { - "type": "structure", - "members": { - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

The Region where the replica exists.

", - "smithy.api#required": {} - } - }, - "ReplicaGlobalSecondaryIndexUpdates": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingUpdateList", - "traits": { - "smithy.api#documentation": "

Represents the auto scaling settings of global secondary indexes that will be\n modified.

" - } - }, - "ReplicaProvisionedReadCapacityAutoScalingUpdate": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate" - } + "traits": { + "smithy.api#documentation": "

Represents the output of a Scan operation.

" + } + }, + "com.amazonaws.dynamodb#ScanSegment": { + "type": "integer", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 0, + "max": 999999 + } + } + }, + "com.amazonaws.dynamodb#ScanTotalSegments": { + "type": "integer", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 1, + "max": 1000000 + } + } + }, + "com.amazonaws.dynamodb#SecondaryIndexesCapacityMap": { + "type": "map", + "key": { + "target": "com.amazonaws.dynamodb#IndexName" + }, + "value": { + "target": "com.amazonaws.dynamodb#Capacity" + } + }, + "com.amazonaws.dynamodb#Select": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "ALL_ATTRIBUTES", + "name": "ALL_ATTRIBUTES" + }, + { + "value": "ALL_PROJECTED_ATTRIBUTES", + "name": "ALL_PROJECTED_ATTRIBUTES" + }, + { + "value": "SPECIFIC_ATTRIBUTES", + "name": "SPECIFIC_ATTRIBUTES" }, + { + "value": "COUNT", + "name": "COUNT" + } + ] + } + }, + "com.amazonaws.dynamodb#SourceTableDetails": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

Represents the auto scaling settings of a replica that will be modified.

" + "smithy.api#documentation": "

The name of the table for which the backup was created.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ReplicaAutoScalingUpdateList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaAutoScalingUpdate" - }, + }, + "TableId": { + "target": "com.amazonaws.dynamodb#TableId", "traits": { - "smithy.api#length": { - "min": 1 - } + "smithy.api#documentation": "

Unique identifier for the table for which the backup was created.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ReplicaDescription": { - "type": "structure", - "members": { - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

The name of the Region.

" - } - }, - "ReplicaStatus": { - "target": "com.amazonaws.dynamodb#ReplicaStatus", - "traits": { - "smithy.api#documentation": "

The current state of the replica:

\n
    \n
  • \n

    \n CREATING - The replica is being created.

    \n
  • \n
  • \n

    \n UPDATING - The replica is being updated.

    \n
  • \n
  • \n

    \n DELETING - The replica is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The replica is ready for use.

    \n
  • \n
  • \n

    \n REGION_DISABLED - The replica is inaccessible because the Amazon Web Services Region has been disabled.

    \n \n

    If the Amazon Web Services Region remains inaccessible for more than 20\n hours, DynamoDB will remove this replica from the replication\n group. The replica will not be deleted and replication will stop from and to\n this region.

    \n
    \n
  • \n
  • \n

    \n INACCESSIBLE_ENCRYPTION_CREDENTIALS - The KMS key\n used to encrypt the table is inaccessible.

    \n \n

    If the KMS key remains inaccessible for more than 20 hours,\n DynamoDB will remove this replica from the replication group.\n The replica will not be deleted and replication will stop from and to this\n region.

    \n
    \n
  • \n
" - } - }, - "ReplicaStatusDescription": { - "target": "com.amazonaws.dynamodb#ReplicaStatusDescription", - "traits": { - "smithy.api#documentation": "

Detailed information about the replica status.

" - } - }, - "ReplicaStatusPercentProgress": { - "target": "com.amazonaws.dynamodb#ReplicaStatusPercentProgress", - "traits": { - "smithy.api#documentation": "

Specifies the progress of a Create, Update, or Delete action on the replica as a\n percentage.

" - } - }, - "KMSMasterKeyId": { - "target": "com.amazonaws.dynamodb#KMSMasterKeyId", - "traits": { - "smithy.api#documentation": "

The KMS key of the replica that will be used for\n KMS encryption.

" - } - }, - "ProvisionedThroughputOverride": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputOverride", - "traits": { - "smithy.api#documentation": "

Replica-specific provisioned throughput. If not described, uses the source table's\n provisioned throughput settings.

" - } - }, - "GlobalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexDescriptionList", - "traits": { - "smithy.api#documentation": "

Replica-specific global secondary index settings.

" - } - }, - "ReplicaInaccessibleDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

The time at which the replica was first detected as inaccessible. To determine cause\n of inaccessibility check the ReplicaStatus property.

" - } - }, - "ReplicaTableClassSummary": { - "target": "com.amazonaws.dynamodb#TableClassSummary" - } - }, + }, + "TableArn": { + "target": "com.amazonaws.dynamodb#TableArn", "traits": { - "smithy.api#documentation": "

Contains the details of the replica.

" + "smithy.api#documentation": "

ARN of the table for which backup was created.

" } - }, - "com.amazonaws.dynamodb#ReplicaDescriptionList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaDescription" + }, + "TableSizeBytes": { + "target": "com.amazonaws.dynamodb#Long", + "traits": { + "smithy.api#documentation": "

Size of the table in bytes. Note that this is an approximate value.

" } - }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndex": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index.

", - "smithy.api#required": {} - } - }, - "ProvisionedThroughputOverride": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputOverride", - "traits": { - "smithy.api#documentation": "

Replica table GSI-specific provisioned throughput. If not specified, uses the source\n table GSI's read capacity settings.

" - } - } - }, + }, + "KeySchema": { + "target": "com.amazonaws.dynamodb#KeySchema", "traits": { - "smithy.api#documentation": "

Represents the properties of a replica global secondary index.

" + "smithy.api#documentation": "

Schema of the table.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingDescription": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index.

" - } - }, - "IndexStatus": { - "target": "com.amazonaws.dynamodb#IndexStatus", - "traits": { - "smithy.api#documentation": "

The current state of the replica global secondary index:

\n
    \n
  • \n

    \n CREATING - The index is being created.

    \n
  • \n
  • \n

    \n UPDATING - The index is being updated.

    \n
  • \n
  • \n

    \n DELETING - The index is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The index is ready for use.

    \n
  • \n
" - } - }, - "ProvisionedReadCapacityAutoScalingSettings": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription" - }, - "ProvisionedWriteCapacityAutoScalingSettings": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription" - } - }, + }, + "TableCreationDateTime": { + "target": "com.amazonaws.dynamodb#TableCreationDateTime", "traits": { - "smithy.api#documentation": "

Represents the auto scaling configuration for a replica global secondary index.

" + "smithy.api#documentation": "

Time when the source table was created.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingDescriptionList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingDescription" + }, + "ProvisionedThroughput": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughput", + "traits": { + "smithy.api#documentation": "

Read IOPs and Write IOPS on the table when the backup was created.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingUpdate": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index.

" - } - }, - "ProvisionedReadCapacityAutoScalingUpdate": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate" - } - }, + }, + "ItemCount": { + "target": "com.amazonaws.dynamodb#ItemCount", "traits": { - "smithy.api#documentation": "

Represents the auto scaling settings of a global secondary index for a replica that\n will be modified.

" + "smithy.api#documentation": "

Number of items in the table. Note that this is an approximate value.

" } - }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingUpdateList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexAutoScalingUpdate" + }, + "BillingMode": { + "target": "com.amazonaws.dynamodb#BillingMode", + "traits": { + "smithy.api#documentation": "

Controls how you are charged for read and write throughput and how you manage\n capacity. This setting can be changed later.

\n
    \n
  • \n

    \n PROVISIONED - Sets the read/write capacity mode to\n PROVISIONED. We recommend using PROVISIONED for\n predictable workloads.

    \n
  • \n
  • \n

    \n PAY_PER_REQUEST - Sets the read/write capacity mode to\n PAY_PER_REQUEST. We recommend using\n PAY_PER_REQUEST for unpredictable workloads.

    \n
  • \n
" } + } }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexDescription": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index.

" - } - }, - "ProvisionedThroughputOverride": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputOverride", - "traits": { - "smithy.api#documentation": "

If not described, uses the source table GSI's read capacity settings.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Contains the details of the table when the backup was created.

" + } + }, + "com.amazonaws.dynamodb#SourceTableFeatureDetails": { + "type": "structure", + "members": { + "LocalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#LocalSecondaryIndexes", "traits": { - "smithy.api#documentation": "

Represents the properties of a replica global secondary index.

" + "smithy.api#documentation": "

Represents the LSI properties for the table when the backup was created. It includes\n the IndexName, KeySchema and Projection for the LSIs on the table at the time of backup.\n

" } - }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexDescriptionList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexDescription" + }, + "GlobalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexes", + "traits": { + "smithy.api#documentation": "

Represents the GSI properties for the table when the backup was created. It includes\n the IndexName, KeySchema, Projection, and ProvisionedThroughput for the GSIs on the\n table at the time of backup.

" } - }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndex" - }, + }, + "StreamDescription": { + "target": "com.amazonaws.dynamodb#StreamSpecification", "traits": { - "smithy.api#length": { - "min": 1 - } + "smithy.api#documentation": "

Stream settings on the table when the backup was created.

" } - }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsDescription": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index. The name must be unique among all other\n indexes on this table.

", - "smithy.api#required": {} - } - }, - "IndexStatus": { - "target": "com.amazonaws.dynamodb#IndexStatus", - "traits": { - "smithy.api#documentation": "

The current status of the global secondary index:

\n
    \n
  • \n

    \n CREATING - The global secondary index is being created.

    \n
  • \n
  • \n

    \n UPDATING - The global secondary index is being updated.

    \n
  • \n
  • \n

    \n DELETING - The global secondary index is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The global secondary index is ready for use.

    \n
  • \n
" - } - }, - "ProvisionedReadCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException.

" - } - }, - "ProvisionedReadCapacityAutoScalingSettings": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription", - "traits": { - "smithy.api#documentation": "

Auto scaling settings for a global secondary index replica's read capacity\n units.

" - } - }, - "ProvisionedWriteCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException.

" - } - }, - "ProvisionedWriteCapacityAutoScalingSettings": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription", - "traits": { - "smithy.api#documentation": "

Auto scaling settings for a global secondary index replica's write capacity\n units.

" - } - } - }, + }, + "TimeToLiveDescription": { + "target": "com.amazonaws.dynamodb#TimeToLiveDescription", "traits": { - "smithy.api#documentation": "

Represents the properties of a global secondary index.

" + "smithy.api#documentation": "

Time to Live settings on the table when the backup was created.

" } - }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsDescriptionList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsDescription" + }, + "SSEDescription": { + "target": "com.amazonaws.dynamodb#SSEDescription", + "traits": { + "smithy.api#documentation": "

The description of the server-side encryption status on the table when the backup was\n created.

" } + } }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsUpdate": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index. The name must be unique among all other\n indexes on this table.

", - "smithy.api#required": {} - } - }, - "ProvisionedReadCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException.

" - } - }, - "ProvisionedReadCapacityAutoScalingSettingsUpdate": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate", - "traits": { - "smithy.api#documentation": "

Auto scaling settings for managing a global secondary index replica's read capacity\n units.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Contains the details of the features enabled on the table when the backup was created.\n For example, LSIs, GSIs, streams, TTL.

" + } + }, + "com.amazonaws.dynamodb#StreamArn": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 37, + "max": 1024 + } + } + }, + "com.amazonaws.dynamodb#StreamEnabled": { + "type": "boolean", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#StreamSpecification": { + "type": "structure", + "members": { + "StreamEnabled": { + "target": "com.amazonaws.dynamodb#StreamEnabled", "traits": { - "smithy.api#documentation": "

Represents the settings of a global secondary index for a global table that will be\n modified.

" + "smithy.api#documentation": "

Indicates whether DynamoDB Streams is enabled (true) or disabled (false) on the\n table.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsUpdateList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsUpdate" - }, + }, + "StreamViewType": { + "target": "com.amazonaws.dynamodb#StreamViewType", "traits": { - "smithy.api#length": { - "min": 1, - "max": 20 - } + "smithy.api#documentation": "

When an item in the table is modified, StreamViewType determines what\n information is written to the stream for this table. Valid values for\n StreamViewType are:

\n
    \n
  • \n

    \n KEYS_ONLY - Only the key attributes of the modified item are\n written to the stream.

    \n
  • \n
  • \n

    \n NEW_IMAGE - The entire item, as it appears after it was modified,\n is written to the stream.

    \n
  • \n
  • \n

    \n OLD_IMAGE - The entire item, as it appeared before it was modified,\n is written to the stream.

    \n
  • \n
  • \n

    \n NEW_AND_OLD_IMAGES - Both the new and the old item images of the\n item are written to the stream.

    \n
  • \n
" } + } }, - "com.amazonaws.dynamodb#ReplicaList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#Replica" + "traits": { + "smithy.api#documentation": "

Represents the DynamoDB Streams configuration for a table in DynamoDB.

" + } + }, + "com.amazonaws.dynamodb#StreamViewType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "NEW_IMAGE", + "name": "NEW_IMAGE" + }, + { + "value": "OLD_IMAGE", + "name": "OLD_IMAGE" + }, + { + "value": "NEW_AND_OLD_IMAGES", + "name": "NEW_AND_OLD_IMAGES" + }, + { + "value": "KEYS_ONLY", + "name": "KEYS_ONLY" } + ] + } + }, + "com.amazonaws.dynamodb#String": { + "type": "string" + }, + "com.amazonaws.dynamodb#StringAttributeValue": { + "type": "string" + }, + "com.amazonaws.dynamodb#StringSetAttributeValue": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#StringAttributeValue" + } + }, + "com.amazonaws.dynamodb#TableAlreadyExistsException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } }, - "com.amazonaws.dynamodb#ReplicaNotFoundException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + "traits": { + "smithy.api#documentation": "

A target table with the specified name already exists.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#TableArn": { + "type": "string" + }, + "com.amazonaws.dynamodb#TableAutoScalingDescription": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

The specified replica is no longer part of the global table.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The name of the table.

" } - }, - "com.amazonaws.dynamodb#ReplicaSettingsDescription": { - "type": "structure", - "members": { - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

The Region name of the replica.

", - "smithy.api#required": {} - } - }, - "ReplicaStatus": { - "target": "com.amazonaws.dynamodb#ReplicaStatus", - "traits": { - "smithy.api#documentation": "

The current state of the Region:

\n
    \n
  • \n

    \n CREATING - The Region is being created.

    \n
  • \n
  • \n

    \n UPDATING - The Region is being updated.

    \n
  • \n
  • \n

    \n DELETING - The Region is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The Region is ready for use.

    \n
  • \n
" - } - }, - "ReplicaBillingModeSummary": { - "target": "com.amazonaws.dynamodb#BillingModeSummary", - "traits": { - "smithy.api#documentation": "

The read/write capacity mode of the replica.

" - } - }, - "ReplicaProvisionedReadCapacityUnits": { - "target": "com.amazonaws.dynamodb#NonNegativeLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB\n Developer Guide.

" - } - }, - "ReplicaProvisionedReadCapacityAutoScalingSettings": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription", - "traits": { - "smithy.api#documentation": "

Auto scaling settings for a global table replica's read capacity units.

" - } - }, - "ReplicaProvisionedWriteCapacityUnits": { - "target": "com.amazonaws.dynamodb#NonNegativeLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB\n Developer Guide.

" - } - }, - "ReplicaProvisionedWriteCapacityAutoScalingSettings": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsDescription", - "traits": { - "smithy.api#documentation": "

Auto scaling settings for a global table replica's write capacity units.

" - } - }, - "ReplicaGlobalSecondaryIndexSettings": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsDescriptionList", - "traits": { - "smithy.api#documentation": "

Replica global secondary index settings for the global table.

" - } - }, - "ReplicaTableClassSummary": { - "target": "com.amazonaws.dynamodb#TableClassSummary" - } - }, + }, + "TableStatus": { + "target": "com.amazonaws.dynamodb#TableStatus", "traits": { - "smithy.api#documentation": "

Represents the properties of a replica.

" + "smithy.api#documentation": "

The current state of the table:

\n
    \n
  • \n

    \n CREATING - The table is being created.

    \n
  • \n
  • \n

    \n UPDATING - The table is being updated.

    \n
  • \n
  • \n

    \n DELETING - The table is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The table is ready for use.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#ReplicaSettingsDescriptionList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaSettingsDescription" + }, + "Replicas": { + "target": "com.amazonaws.dynamodb#ReplicaAutoScalingDescriptionList", + "traits": { + "smithy.api#documentation": "

Represents replicas of the global table.

" } + } }, - "com.amazonaws.dynamodb#ReplicaSettingsUpdate": { - "type": "structure", - "members": { - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

The Region of the replica to be added.

", - "smithy.api#required": {} - } - }, - "ReplicaProvisionedReadCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of strongly consistent reads consumed per second before DynamoDB\n returns a ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB\n Developer Guide.

" - } - }, - "ReplicaProvisionedReadCapacityAutoScalingSettingsUpdate": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate", - "traits": { - "smithy.api#documentation": "

Auto scaling settings for managing a global table replica's read capacity\n units.

" - } - }, - "ReplicaGlobalSecondaryIndexSettingsUpdate": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexSettingsUpdateList", - "traits": { - "smithy.api#documentation": "

Represents the settings of a global secondary index for a global table that will be\n modified.

" - } - }, - "ReplicaTableClass": { - "target": "com.amazonaws.dynamodb#TableClass", - "traits": { - "smithy.api#documentation": "

Replica-specific table class. If not specified, uses the source table's\n table class.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents the auto scaling configuration for a global table.

" + } + }, + "com.amazonaws.dynamodb#TableClass": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "STANDARD", + "name": "STANDARD" }, + { + "value": "STANDARD_INFREQUENT_ACCESS", + "name": "STANDARD_INFREQUENT_ACCESS" + } + ] + } + }, + "com.amazonaws.dynamodb#TableClassSummary": { + "type": "structure", + "members": { + "TableClass": { + "target": "com.amazonaws.dynamodb#TableClass", "traits": { - "smithy.api#documentation": "

Represents the settings for a global table in a Region that will be modified.

" + "smithy.api#documentation": "

The table class of the specified table. Valid values are STANDARD and\n STANDARD_INFREQUENT_ACCESS.

" } - }, - "com.amazonaws.dynamodb#ReplicaSettingsUpdateList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaSettingsUpdate" - }, + }, + "LastUpdateDateTime": { + "target": "com.amazonaws.dynamodb#Date", "traits": { - "smithy.api#length": { - "min": 1, - "max": 50 - } + "smithy.api#documentation": "

The date and time at which the table class was last updated.

" } + } }, - "com.amazonaws.dynamodb#ReplicaStatus": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "CREATING", - "name": "CREATING" - }, - { - "value": "CREATION_FAILED", - "name": "CREATION_FAILED" - }, - { - "value": "UPDATING", - "name": "UPDATING" - }, - { - "value": "DELETING", - "name": "DELETING" - }, - { - "value": "ACTIVE", - "name": "ACTIVE" - }, - { - "value": "REGION_DISABLED", - "name": "REGION_DISABLED" - }, - { - "value": "INACCESSIBLE_ENCRYPTION_CREDENTIALS", - "name": "INACCESSIBLE_ENCRYPTION_CREDENTIALS" - } - ] + "traits": { + "smithy.api#documentation": "

Contains details of the table class.

" + } + }, + "com.amazonaws.dynamodb#TableCreationDateTime": { + "type": "timestamp" + }, + "com.amazonaws.dynamodb#TableCreationParameters": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

\n The name of the table created as part of the import operation. \n

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ReplicaStatusDescription": { - "type": "string" - }, - "com.amazonaws.dynamodb#ReplicaStatusPercentProgress": { - "type": "string" - }, - "com.amazonaws.dynamodb#ReplicaUpdate": { - "type": "structure", - "members": { - "Create": { - "target": "com.amazonaws.dynamodb#CreateReplicaAction", - "traits": { - "smithy.api#documentation": "

The parameters required for creating a replica on an existing global table.

" - } - }, - "Delete": { - "target": "com.amazonaws.dynamodb#DeleteReplicaAction", - "traits": { - "smithy.api#documentation": "

The name of the existing replica to be removed.

" - } - } - }, + }, + "AttributeDefinitions": { + "target": "com.amazonaws.dynamodb#AttributeDefinitions", "traits": { - "smithy.api#documentation": "

Represents one of the following:

\n
    \n
  • \n

    A new replica to be added to an existing global table.

    \n
  • \n
  • \n

    New parameters for an existing replica.

    \n
  • \n
  • \n

    An existing replica to be removed from an existing global table.

    \n
  • \n
" + "smithy.api#documentation": "

\n The attributes of the table created as part of the import operation.\n

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ReplicaUpdateList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicaUpdate" + }, + "KeySchema": { + "target": "com.amazonaws.dynamodb#KeySchema", + "traits": { + "smithy.api#documentation": "

\n The primary key and option sort key of the table created as part of the import operation.\n

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ReplicationGroupUpdate": { - "type": "structure", - "members": { - "Create": { - "target": "com.amazonaws.dynamodb#CreateReplicationGroupMemberAction", - "traits": { - "smithy.api#documentation": "

The parameters required for creating a replica for the table.

" - } - }, - "Update": { - "target": "com.amazonaws.dynamodb#UpdateReplicationGroupMemberAction", - "traits": { - "smithy.api#documentation": "

The parameters required for updating a replica for the table.

" - } - }, - "Delete": { - "target": "com.amazonaws.dynamodb#DeleteReplicationGroupMemberAction", - "traits": { - "smithy.api#documentation": "

The parameters required for deleting a replica for the table.

" - } - } - }, + }, + "BillingMode": { + "target": "com.amazonaws.dynamodb#BillingMode", "traits": { - "smithy.api#documentation": "

Represents one of the following:

\n
    \n
  • \n

    A new replica to be added to an existing regional table or global table. This\n request invokes the CreateTableReplica action in the destination\n Region.

    \n
  • \n
  • \n

    New parameters for an existing replica. This request invokes the\n UpdateTable action in the destination Region.

    \n
  • \n
  • \n

    An existing replica to be deleted. The request invokes the\n DeleteTableReplica action in the destination Region, deleting\n the replica and all if its items in the destination Region.

    \n
  • \n
\n \n

When you manually remove a table or global table replica, you do not \n automatically remove any associated scalable targets, scaling policies, or \n CloudWatch alarms.

\n
" + "smithy.api#documentation": "

\n The billing mode for provisioning the table created as part of the import operation.\n

" } - }, - "com.amazonaws.dynamodb#ReplicationGroupUpdateList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#ReplicationGroupUpdate" - }, + }, + "ProvisionedThroughput": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughput" + }, + "SSESpecification": { + "target": "com.amazonaws.dynamodb#SSESpecification" + }, + "GlobalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexList", "traits": { - "smithy.api#length": { - "min": 1 - } + "smithy.api#documentation": "

\n The Global Secondary Indexes (GSI) of the table to be created as part of the import operation.\n

" } + } }, - "com.amazonaws.dynamodb#RequestLimitExceeded": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + "traits": { + "smithy.api#documentation": "

The parameters for the table created as part of the import operation.\n

" + } + }, + "com.amazonaws.dynamodb#TableDescription": { + "type": "structure", + "members": { + "AttributeDefinitions": { + "target": "com.amazonaws.dynamodb#AttributeDefinitions", + "traits": { + "smithy.api#documentation": "

An array of AttributeDefinition objects. Each of these objects describes\n one attribute in the table and index key schema.

\n

Each AttributeDefinition object in this array is composed of:

\n
    \n
  • \n

    \n AttributeName - The name of the attribute.

    \n
  • \n
  • \n

    \n AttributeType - The data type for the attribute.

    \n
  • \n
" + } + }, + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table.

" + } + }, + "KeySchema": { + "target": "com.amazonaws.dynamodb#KeySchema", + "traits": { + "smithy.api#documentation": "

The primary key structure for the table. Each KeySchemaElement consists\n of:

\n
    \n
  • \n

    \n AttributeName - The name of the attribute.

    \n
  • \n
  • \n

    \n KeyType - The role of the attribute:

    \n
      \n
    • \n

      \n HASH - partition key

      \n
    • \n
    • \n

      \n RANGE - sort key

      \n
    • \n
    \n \n

    The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's\n usage of an internal hash function to evenly distribute data items across\n partitions, based on their partition key values.

    \n

    The sort key of an item is also known as its range\n attribute. The term \"range attribute\" derives from the way\n DynamoDB stores items with the same partition key physically close together,\n in sorted order by the sort key value.

    \n
    \n\n
  • \n
\n

For more information about primary keys, see Primary Key in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "TableStatus": { + "target": "com.amazonaws.dynamodb#TableStatus", "traits": { - "smithy.api#documentation": "

Throughput exceeds the current throughput quota for your account. Please contact\n Amazon Web Services Support to request a\n quota increase.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The current state of the table:

\n
    \n
  • \n

    \n CREATING - The table is being created.

    \n
  • \n
  • \n

    \n UPDATING - The table is being updated.

    \n
  • \n
  • \n

    \n DELETING - The table is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The table is ready for use.

    \n
  • \n
  • \n

    \n INACCESSIBLE_ENCRYPTION_CREDENTIALS - The KMS key\n used to encrypt the table in inaccessible. Table operations may fail due to\n failure to use the KMS key. DynamoDB will initiate the\n table archival process when a table's KMS key remains\n inaccessible for more than seven days.

    \n
  • \n
  • \n

    \n ARCHIVING - The table is being archived. Operations are not allowed\n until archival is complete.

    \n
  • \n
  • \n

    \n ARCHIVED - The table has been archived. See the ArchivalReason for\n more information.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#ResourceArnString": { - "type": "string", + }, + "CreationDateTime": { + "target": "com.amazonaws.dynamodb#Date", "traits": { - "smithy.api#length": { - "min": 1, - "max": 1283 - } + "smithy.api#documentation": "

The date and time when the table was created, in UNIX epoch time format.

" } - }, - "com.amazonaws.dynamodb#ResourceInUseException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage", - "traits": { - "smithy.api#documentation": "

The resource which is being attempted to be changed is in use.

" - } - } - }, + }, + "ProvisionedThroughput": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputDescription", "traits": { - "smithy.api#documentation": "

The operation conflicts with the resource's availability. For example, you\n attempted to recreate an existing table, or tried to delete a table currently in the\n CREATING state.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The provisioned throughput settings for the table, consisting of read and write\n capacity units, along with data about increases and decreases.

" } - }, - "com.amazonaws.dynamodb#ResourceNotFoundException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage", - "traits": { - "smithy.api#documentation": "

The resource which is being requested does not exist.

" - } - } - }, + }, + "TableSizeBytes": { + "target": "com.amazonaws.dynamodb#Long", "traits": { - "smithy.api#documentation": "

The operation tried to access a nonexistent table or index. The resource might not\n be specified correctly, or its status might not be ACTIVE.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

The total size of the specified table, in bytes. DynamoDB updates this value\n approximately every six hours. Recent changes might not be reflected in this\n value.

" } - }, - "com.amazonaws.dynamodb#RestoreInProgress": { - "type": "boolean", + }, + "ItemCount": { + "target": "com.amazonaws.dynamodb#Long", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

The number of items in the specified table. DynamoDB updates this value approximately\n every six hours. Recent changes might not be reflected in this value.

" } - }, - "com.amazonaws.dynamodb#RestoreSummary": { - "type": "structure", - "members": { - "SourceBackupArn": { - "target": "com.amazonaws.dynamodb#BackupArn", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the backup from which the table was restored.

" - } - }, - "SourceTableArn": { - "target": "com.amazonaws.dynamodb#TableArn", - "traits": { - "smithy.api#documentation": "

The ARN of the source table of the backup that is being restored.

" - } - }, - "RestoreDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

Point in time or source backup time.

", - "smithy.api#required": {} - } - }, - "RestoreInProgress": { - "target": "com.amazonaws.dynamodb#RestoreInProgress", - "traits": { - "smithy.api#documentation": "

Indicates if a restore is in progress or not.

", - "smithy.api#required": {} - } - } - }, + }, + "TableArn": { + "target": "com.amazonaws.dynamodb#String", "traits": { - "smithy.api#documentation": "

Contains details for the restore.

" + "smithy.api#documentation": "

The Amazon Resource Name (ARN) that uniquely identifies the table.

" } - }, - "com.amazonaws.dynamodb#RestoreTableFromBackup": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#RestoreTableFromBackupInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#RestoreTableFromBackupOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#BackupInUseException" - }, - { - "target": "com.amazonaws.dynamodb#BackupNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#TableAlreadyExistsException" - }, - { - "target": "com.amazonaws.dynamodb#TableInUseException" - } - ], + }, + "TableId": { + "target": "com.amazonaws.dynamodb#TableId", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Creates a new table from an existing backup. Any number of users can execute up to 4\n concurrent restores (any type of restore) in a given account.

\n

You can call RestoreTableFromBackup at a maximum rate of 10 times per\n second.

\n

You must manually set up the following on the restored table:

\n
    \n
  • \n

    Auto scaling policies

    \n
  • \n
  • \n

    IAM policies

    \n
  • \n
  • \n

    Amazon CloudWatch metrics and alarms

    \n
  • \n
  • \n

    Tags

    \n
  • \n
  • \n

    Stream settings

    \n
  • \n
  • \n

    Time to Live (TTL) settings

    \n
  • \n
" + "smithy.api#documentation": "

Unique identifier for the table for which the backup was created.

" } - }, - "com.amazonaws.dynamodb#RestoreTableFromBackupInput": { - "type": "structure", - "members": { - "TargetTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the new table to which the backup must be restored.

", - "smithy.api#required": {} - } - }, - "BackupArn": { - "target": "com.amazonaws.dynamodb#BackupArn", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) associated with the backup.

", - "smithy.api#required": {} - } - }, - "BillingModeOverride": { - "target": "com.amazonaws.dynamodb#BillingMode", - "traits": { - "smithy.api#documentation": "

The billing mode of the restored table.

" - } - }, - "GlobalSecondaryIndexOverride": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexList", - "traits": { - "smithy.api#documentation": "

List of global secondary indexes for the restored table. The indexes provided should\n match existing secondary indexes. You can choose to exclude some or all of the indexes\n at the time of restore.

" - } - }, - "LocalSecondaryIndexOverride": { - "target": "com.amazonaws.dynamodb#LocalSecondaryIndexList", - "traits": { - "smithy.api#documentation": "

List of local secondary indexes for the restored table. The indexes provided should\n match existing secondary indexes. You can choose to exclude some or all of the indexes\n at the time of restore.

" - } - }, - "ProvisionedThroughputOverride": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughput", - "traits": { - "smithy.api#documentation": "

Provisioned throughput settings for the restored table.

" - } - }, - "SSESpecificationOverride": { - "target": "com.amazonaws.dynamodb#SSESpecification", - "traits": { - "smithy.api#documentation": "

The new server-side encryption settings for the restored table.

" - } - } + }, + "BillingModeSummary": { + "target": "com.amazonaws.dynamodb#BillingModeSummary", + "traits": { + "smithy.api#documentation": "

Contains the details for the read/write capacity mode.

" } - }, - "com.amazonaws.dynamodb#RestoreTableFromBackupOutput": { - "type": "structure", - "members": { - "TableDescription": { - "target": "com.amazonaws.dynamodb#TableDescription", - "traits": { - "smithy.api#documentation": "

The description of the table created from an existing backup.

" - } - } + }, + "LocalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#LocalSecondaryIndexDescriptionList", + "traits": { + "smithy.api#documentation": "

Represents one or more local secondary indexes on the table. Each index is scoped to a\n given partition key value. Tables with one or more local secondary indexes are subject\n to an item collection size limit, where the amount of data within a given item\n collection cannot exceed 10 GB. Each element is composed of:

\n
    \n
  • \n

    \n IndexName - The name of the local secondary index.

    \n
  • \n
  • \n

    \n KeySchema - Specifies the complete index key schema. The attribute\n names in the key schema must be between 1 and 255 characters (inclusive). The\n key schema must begin with the same partition key as the table.

    \n
  • \n
  • \n

    \n Projection - Specifies attributes that are copied (projected) from\n the table into the index. These are in addition to the primary key attributes\n and index key attributes, which are automatically projected. Each attribute\n specification is composed of:

    \n
      \n
    • \n

      \n ProjectionType - One of the following:

      \n
        \n
      • \n

        \n KEYS_ONLY - Only the index and primary keys are\n projected into the index.

        \n
      • \n
      • \n

        \n INCLUDE - Only the specified table attributes are\n projected into the index. The list of projected attributes is in\n NonKeyAttributes.

        \n
      • \n
      • \n

        \n ALL - All of the table attributes are projected\n into the index.

        \n
      • \n
      \n
    • \n
    • \n

      \n NonKeyAttributes - A list of one or more non-key attribute\n names that are projected into the secondary index. The total count of\n attributes provided in NonKeyAttributes, summed across all\n of the secondary indexes, must not exceed 100. If you project the same\n attribute into two different indexes, this counts as two distinct\n attributes when determining the total.

      \n
    • \n
    \n
  • \n
  • \n

    \n IndexSizeBytes - Represents the total size of the index, in bytes.\n DynamoDB updates this value approximately every six hours. Recent changes might\n not be reflected in this value.

    \n
  • \n
  • \n

    \n ItemCount - Represents the number of items in the index. DynamoDB\n updates this value approximately every six hours. Recent changes might not be\n reflected in this value.

    \n
  • \n
\n

If the table is in the DELETING state, no information about indexes will\n be returned.

" } - }, - "com.amazonaws.dynamodb#RestoreTableToPointInTime": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#RestoreTableToPointInTimeInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#RestoreTableToPointInTimeOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#InvalidRestoreTimeException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#PointInTimeRecoveryUnavailableException" - }, - { - "target": "com.amazonaws.dynamodb#TableAlreadyExistsException" - }, - { - "target": "com.amazonaws.dynamodb#TableInUseException" - }, - { - "target": "com.amazonaws.dynamodb#TableNotFoundException" - } - ], + }, + "GlobalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexDescriptionList", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Restores the specified table to the specified point in time within\n EarliestRestorableDateTime and LatestRestorableDateTime.\n You can restore your table to any point in time during the last 35 days. Any number of\n users can execute up to 4 concurrent restores (any type of restore) in a given account.

\n

When you restore using point in time recovery, DynamoDB restores your table data to\n the state based on the selected date and time (day:hour:minute:second) to a new table.

\n

Along with data, the following are also included on the new restored table using\n point in time recovery:

\n
    \n
  • \n

    Global secondary indexes (GSIs)

    \n
  • \n
  • \n

    Local secondary indexes (LSIs)

    \n
  • \n
  • \n

    Provisioned read and write capacity

    \n
  • \n
  • \n

    Encryption settings

    \n \n

    All these settings come from the current settings of the source table at\n the time of restore.

    \n
    \n
  • \n
\n\n

You must manually set up the following on the restored table:

\n
    \n
  • \n

    Auto scaling policies

    \n
  • \n
  • \n

    IAM policies

    \n
  • \n
  • \n

    Amazon CloudWatch metrics and alarms

    \n
  • \n
  • \n

    Tags

    \n
  • \n
  • \n

    Stream settings

    \n
  • \n
  • \n

    Time to Live (TTL) settings

    \n
  • \n
  • \n

    Point in time recovery settings

    \n
  • \n
" + "smithy.api#documentation": "

The global secondary indexes, if any, on the table. Each index is scoped to a given\n partition key value. Each element is composed of:

\n
    \n
  • \n

    \n Backfilling - If true, then the index is currently in the\n backfilling phase. Backfilling occurs only when a new global secondary index is\n added to the table. It is the process by which DynamoDB populates the new index\n with data from the table. (This attribute does not appear for indexes that were\n created during a CreateTable operation.)

    \n

    You can delete an index that is being created during the\n Backfilling phase when IndexStatus is set to\n CREATING and Backfilling is true. You can't delete the index that\n is being created when IndexStatus is set to CREATING and\n Backfilling is false. (This attribute does not appear for\n indexes that were created during a CreateTable operation.)

    \n
  • \n
  • \n

    \n IndexName - The name of the global secondary index.

    \n
  • \n
  • \n

    \n IndexSizeBytes - The total size of the global secondary index, in\n bytes. DynamoDB updates this value approximately every six hours. Recent changes\n might not be reflected in this value.

    \n
  • \n
  • \n

    \n IndexStatus - The current status of the global secondary\n index:

    \n
      \n
    • \n

      \n CREATING - The index is being created.

      \n
    • \n
    • \n

      \n UPDATING - The index is being updated.

      \n
    • \n
    • \n

      \n DELETING - The index is being deleted.

      \n
    • \n
    • \n

      \n ACTIVE - The index is ready for use.

      \n
    • \n
    \n
  • \n
  • \n

    \n ItemCount - The number of items in the global secondary index.\n DynamoDB updates this value approximately every six hours. Recent changes might\n not be reflected in this value.

    \n
  • \n
  • \n

    \n KeySchema - Specifies the complete index key schema. The attribute\n names in the key schema must be between 1 and 255 characters (inclusive). The\n key schema must begin with the same partition key as the table.

    \n
  • \n
  • \n

    \n Projection - Specifies attributes that are copied (projected) from\n the table into the index. These are in addition to the primary key attributes\n and index key attributes, which are automatically projected. Each attribute\n specification is composed of:

    \n
      \n
    • \n

      \n ProjectionType - One of the following:

      \n
        \n
      • \n

        \n KEYS_ONLY - Only the index and primary keys are\n projected into the index.

        \n
      • \n
      • \n

        \n INCLUDE - In addition to the attributes described\n in KEYS_ONLY, the secondary index will include\n other non-key attributes that you specify.

        \n
      • \n
      • \n

        \n ALL - All of the table attributes are projected\n into the index.

        \n
      • \n
      \n
    • \n
    • \n

      \n NonKeyAttributes - A list of one or more non-key attribute\n names that are projected into the secondary index. The total count of\n attributes provided in NonKeyAttributes, summed across all\n of the secondary indexes, must not exceed 100. If you project the same\n attribute into two different indexes, this counts as two distinct\n attributes when determining the total.

      \n
    • \n
    \n
  • \n
  • \n

    \n ProvisionedThroughput - The provisioned throughput settings for the\n global secondary index, consisting of read and write capacity units, along with\n data about increases and decreases.

    \n
  • \n
\n

If the table is in the DELETING state, no information about indexes will\n be returned.

" } - }, - "com.amazonaws.dynamodb#RestoreTableToPointInTimeInput": { - "type": "structure", - "members": { - "SourceTableArn": { - "target": "com.amazonaws.dynamodb#TableArn", - "traits": { - "smithy.api#documentation": "

The DynamoDB table that will be restored. This value is an Amazon Resource Name\n (ARN).

" - } - }, - "SourceTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

Name of the source table that is being restored.

" - } - }, - "TargetTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the new table to which it must be restored to.

", - "smithy.api#required": {} - } - }, - "UseLatestRestorableTime": { - "target": "com.amazonaws.dynamodb#BooleanObject", - "traits": { - "smithy.api#documentation": "

Restore the table to the latest possible time. LatestRestorableDateTime\n is typically 5 minutes before the current time.

" - } - }, - "RestoreDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

Time in the past to restore the table to.

" - } - }, - "BillingModeOverride": { - "target": "com.amazonaws.dynamodb#BillingMode", - "traits": { - "smithy.api#documentation": "

The billing mode of the restored table.

" - } - }, - "GlobalSecondaryIndexOverride": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexList", - "traits": { - "smithy.api#documentation": "

List of global secondary indexes for the restored table. The indexes provided should\n match existing secondary indexes. You can choose to exclude some or all of the indexes\n at the time of restore.

" - } - }, - "LocalSecondaryIndexOverride": { - "target": "com.amazonaws.dynamodb#LocalSecondaryIndexList", - "traits": { - "smithy.api#documentation": "

List of local secondary indexes for the restored table. The indexes provided should\n match existing secondary indexes. You can choose to exclude some or all of the indexes\n at the time of restore.

" - } - }, - "ProvisionedThroughputOverride": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughput", - "traits": { - "smithy.api#documentation": "

Provisioned throughput settings for the restored table.

" - } - }, - "SSESpecificationOverride": { - "target": "com.amazonaws.dynamodb#SSESpecification", - "traits": { - "smithy.api#documentation": "

The new server-side encryption settings for the restored table.

" - } - } + }, + "StreamSpecification": { + "target": "com.amazonaws.dynamodb#StreamSpecification", + "traits": { + "smithy.api#documentation": "

The current DynamoDB Streams configuration for the table.

" } - }, - "com.amazonaws.dynamodb#RestoreTableToPointInTimeOutput": { - "type": "structure", - "members": { - "TableDescription": { - "target": "com.amazonaws.dynamodb#TableDescription", - "traits": { - "smithy.api#documentation": "

Represents the properties of a table.

" - } - } + }, + "LatestStreamLabel": { + "target": "com.amazonaws.dynamodb#String", + "traits": { + "smithy.api#documentation": "

A timestamp, in ISO 8601 format, for this stream.

\n\n

Note that LatestStreamLabel is not a unique identifier for the stream,\n because it is possible that a stream from another table might have the same timestamp.\n However, the combination of the following three elements is guaranteed to be\n unique:

\n
    \n
  • \n

    Amazon Web Services customer ID

    \n
  • \n
  • \n

    Table name

    \n
  • \n
  • \n

    \n StreamLabel\n

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#ReturnConsumedCapacity": { - "type": "string", - "traits": { - "smithy.api#documentation": "

Determines the level of detail about either provisioned or on-demand throughput\n consumption that is returned in the response:

\n
    \n
  • \n

    \n INDEXES - The response includes the aggregate\n ConsumedCapacity for the operation, together with\n ConsumedCapacity for each table and secondary index that was\n accessed.

    \n

    Note that some operations, such as GetItem and\n BatchGetItem, do not access any indexes at all. In these cases,\n specifying INDEXES will only return ConsumedCapacity\n information for table(s).

    \n
  • \n
  • \n

    \n TOTAL - The response includes only the aggregate\n ConsumedCapacity for the operation.

    \n
  • \n
  • \n

    \n NONE - No ConsumedCapacity details are included in the\n response.

    \n
  • \n
", - "smithy.api#enum": [ - { - "value": "INDEXES", - "name": "INDEXES" - }, - { - "value": "TOTAL", - "name": "TOTAL" - }, - { - "value": "NONE", - "name": "NONE" - } - ] + }, + "LatestStreamArn": { + "target": "com.amazonaws.dynamodb#StreamArn", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) that uniquely identifies the latest stream for this\n table.

" } - }, - "com.amazonaws.dynamodb#ReturnItemCollectionMetrics": { - "type": "string", + }, + "GlobalTableVersion": { + "target": "com.amazonaws.dynamodb#String", "traits": { - "smithy.api#enum": [ - { - "value": "SIZE", - "name": "SIZE" - }, - { - "value": "NONE", - "name": "NONE" - } - ] - } - }, - "com.amazonaws.dynamodb#ReturnValue": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "NONE", - "name": "NONE" - }, - { - "value": "ALL_OLD", - "name": "ALL_OLD" - }, - { - "value": "UPDATED_OLD", - "name": "UPDATED_OLD" - }, - { - "value": "ALL_NEW", - "name": "ALL_NEW" - }, - { - "value": "UPDATED_NEW", - "name": "UPDATED_NEW" - } - ] + "smithy.api#documentation": "

Represents the version of global tables\n in use, if the table is replicated across Amazon Web Services Regions.

" } - }, - "com.amazonaws.dynamodb#ReturnValuesOnConditionCheckFailure": { - "type": "string", + }, + "Replicas": { + "target": "com.amazonaws.dynamodb#ReplicaDescriptionList", "traits": { - "smithy.api#enum": [ - { - "value": "ALL_OLD", - "name": "ALL_OLD" - }, - { - "value": "NONE", - "name": "NONE" - } - ] + "smithy.api#documentation": "

Represents replicas of the table.

" } - }, - "com.amazonaws.dynamodb#S3Bucket": { - "type": "string", + }, + "RestoreSummary": { + "target": "com.amazonaws.dynamodb#RestoreSummary", "traits": { - "smithy.api#length": { - "min": 0, - "max": 255 - }, - "smithy.api#pattern": "^[a-z0-9A-Z]+[\\.\\-\\w]*[a-z0-9A-Z]+$" + "smithy.api#documentation": "

Contains details for the restore.

" } - }, - "com.amazonaws.dynamodb#S3BucketOwner": { - "type": "string", + }, + "SSEDescription": { + "target": "com.amazonaws.dynamodb#SSEDescription", "traits": { - "smithy.api#pattern": "^[0-9]{12}$" + "smithy.api#documentation": "

The description of the server-side encryption status on the specified table.

" } - }, - "com.amazonaws.dynamodb#S3BucketSource": { - "type": "structure", - "members": { - "S3BucketOwner": { - "target": "com.amazonaws.dynamodb#S3BucketOwner", - "traits": { - "smithy.api#documentation": "

\n The account number of the S3 bucket that is being imported from. \n If the bucket is owned by the requester this is optional. \n

" - } - }, - "S3Bucket": { - "target": "com.amazonaws.dynamodb#S3Bucket", - "traits": { - "smithy.api#documentation": "

\n The S3 bucket that is being imported from.\n

", - "smithy.api#required": {} - } - }, - "S3KeyPrefix": { - "target": "com.amazonaws.dynamodb#S3Prefix", - "traits": { - "smithy.api#documentation": "

\n The key prefix shared by all S3 Objects that are being imported.\n

" - } - } - }, + }, + "ArchivalSummary": { + "target": "com.amazonaws.dynamodb#ArchivalSummary", "traits": { - "smithy.api#documentation": "

\n The S3 bucket that is being imported from.\n

" + "smithy.api#documentation": "

Contains information about the table archive.

" } - }, - "com.amazonaws.dynamodb#S3Prefix": { - "type": "string", + }, + "TableClassSummary": { + "target": "com.amazonaws.dynamodb#TableClassSummary", "traits": { - "smithy.api#length": { - "min": 0, - "max": 1024 - } + "smithy.api#documentation": "

Contains details of the table class.

" } + } + }, + "traits": { + "smithy.api#documentation": "

Represents the properties of a table.

" + } + }, + "com.amazonaws.dynamodb#TableId": { + "type": "string", + "traits": { + "smithy.api#pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" + } + }, + "com.amazonaws.dynamodb#TableInUseException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } + }, + "traits": { + "smithy.api#documentation": "

A target table with the specified name is either being created or deleted.\n

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#TableName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 3, + "max": 255 + }, + "smithy.api#pattern": "^[a-zA-Z0-9_.-]+$" + } + }, + "com.amazonaws.dynamodb#TableNameList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#TableName" + } + }, + "com.amazonaws.dynamodb#TableNotFoundException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } }, - "com.amazonaws.dynamodb#S3SseAlgorithm": { - "type": "string", + "traits": { + "smithy.api#documentation": "

A source table with the name TableName does not currently exist within\n the subscriber's account or the subscriber is operating in the wrong Amazon Web Services Region.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#TableStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "CREATING", + "name": "CREATING" + }, + { + "value": "UPDATING", + "name": "UPDATING" + }, + { + "value": "DELETING", + "name": "DELETING" + }, + { + "value": "ACTIVE", + "name": "ACTIVE" + }, + { + "value": "INACCESSIBLE_ENCRYPTION_CREDENTIALS", + "name": "INACCESSIBLE_ENCRYPTION_CREDENTIALS" + }, + { + "value": "ARCHIVING", + "name": "ARCHIVING" + }, + { + "value": "ARCHIVED", + "name": "ARCHIVED" + } + ] + } + }, + "com.amazonaws.dynamodb#Tag": { + "type": "structure", + "members": { + "Key": { + "target": "com.amazonaws.dynamodb#TagKeyString", "traits": { - "smithy.api#enum": [ - { - "value": "AES256", - "name": "AES256" - }, - { - "value": "KMS", - "name": "KMS" - } - ] + "smithy.api#documentation": "

The key of the tag. Tag keys are case sensitive. Each DynamoDB table can\n only have up to one tag with the same key. If you try to add an existing tag (same key),\n the existing tag value will be updated to the new value.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#S3SseKmsKeyId": { - "type": "string", + }, + "Value": { + "target": "com.amazonaws.dynamodb#TagValueString", "traits": { - "smithy.api#length": { - "min": 1, - "max": 2048 - } + "smithy.api#documentation": "

The value of the tag. Tag values are case-sensitive and can be null.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#SSEDescription": { - "type": "structure", - "members": { - "Status": { - "target": "com.amazonaws.dynamodb#SSEStatus", - "traits": { - "smithy.api#documentation": "

Represents the current state of server-side encryption. The only supported values\n are:

\n
    \n
  • \n

    \n ENABLED - Server-side encryption is enabled.

    \n
  • \n
  • \n

    \n UPDATING - Server-side encryption is being updated.

    \n
  • \n
" - } - }, - "SSEType": { - "target": "com.amazonaws.dynamodb#SSEType", - "traits": { - "smithy.api#documentation": "

Server-side encryption type. The only supported value is:

\n
    \n
  • \n

    \n KMS - Server-side encryption that uses Key Management Service. The\n key is stored in your account and is managed by KMS (KMS charges apply).

    \n
  • \n
" - } - }, - "KMSMasterKeyArn": { - "target": "com.amazonaws.dynamodb#KMSMasterKeyArn", - "traits": { - "smithy.api#documentation": "

The KMS key ARN used for the KMS\n encryption.

" - } - }, - "InaccessibleEncryptionDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

Indicates the time, in UNIX epoch date format, when DynamoDB detected that\n the table's KMS key was inaccessible. This attribute will automatically\n be cleared when DynamoDB detects that the table's KMS key is accessible\n again. DynamoDB will initiate the table archival process when table's KMS key remains inaccessible for more than seven days from this date.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Describes a tag. A tag is a key-value pair. You can add up to 50 tags to a single\n DynamoDB table.

\n

Amazon Web Services-assigned tag names and values are automatically assigned the\n aws: prefix, which the user cannot assign. Amazon Web Services-assigned\n tag names do not count towards the tag limit of 50. User-assigned tag names have the\n prefix user: in the Cost Allocation Report. You cannot backdate the\n application of a tag.

\n

For an overview on tagging DynamoDB resources, see Tagging\n for DynamoDB in the Amazon DynamoDB Developer\n Guide.

" + } + }, + "com.amazonaws.dynamodb#TagKeyList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#TagKeyString" + } + }, + "com.amazonaws.dynamodb#TagKeyString": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 128 + } + } + }, + "com.amazonaws.dynamodb#TagList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#Tag" + } + }, + "com.amazonaws.dynamodb#TagResource": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#TagResourceInput" + }, + "output": { + "target": "smithy.api#Unit" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceInUseException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Associate a set of tags with an Amazon DynamoDB resource. You can then activate these\n user-defined tags so that they appear on the Billing and Cost Management console for\n cost allocation tracking. You can call TagResource up to five times per second, per\n account.

\n

For an overview on tagging DynamoDB resources, see Tagging for DynamoDB\n in the Amazon DynamoDB Developer Guide.

" + } + }, + "com.amazonaws.dynamodb#TagResourceInput": { + "type": "structure", + "members": { + "ResourceArn": { + "target": "com.amazonaws.dynamodb#ResourceArnString", "traits": { - "smithy.api#documentation": "

The description of the server-side encryption status on the specified table.

" + "smithy.api#documentation": "

Identifies the Amazon DynamoDB resource to which tags should be added. This value is\n an Amazon Resource Name (ARN).

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#SSEEnabled": { - "type": "boolean", + }, + "Tags": { + "target": "com.amazonaws.dynamodb#TagList", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

The tags to be assigned to the Amazon DynamoDB resource.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#SSESpecification": { - "type": "structure", - "members": { - "Enabled": { - "target": "com.amazonaws.dynamodb#SSEEnabled", - "traits": { - "smithy.api#documentation": "

Indicates whether server-side encryption is done using an Amazon Web Services managed\n key or an Amazon Web Services owned key. If enabled (true), server-side encryption type\n is set to KMS and an Amazon Web Services managed key is used (KMS charges apply). If disabled (false) or not specified, server-side\n encryption is set to Amazon Web Services owned key.

" - } - }, - "SSEType": { - "target": "com.amazonaws.dynamodb#SSEType", - "traits": { - "smithy.api#documentation": "

Server-side encryption type. The only supported value is:

\n
    \n
  • \n

    \n KMS - Server-side encryption that uses Key Management Service. The\n key is stored in your account and is managed by KMS (KMS charges apply).

    \n
  • \n
" - } - }, - "KMSMasterKeyId": { - "target": "com.amazonaws.dynamodb#KMSMasterKeyId", - "traits": { - "smithy.api#documentation": "

The KMS key that should be used for the KMS encryption.\n To specify a key, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN.\n Note that you should only provide this parameter if the key is different from the\n default DynamoDB key alias/aws/dynamodb.

" - } - } - }, + } + } + }, + "com.amazonaws.dynamodb#TagValueString": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 0, + "max": 256 + } + } + }, + "com.amazonaws.dynamodb#TimeRangeLowerBound": { + "type": "timestamp" + }, + "com.amazonaws.dynamodb#TimeRangeUpperBound": { + "type": "timestamp" + }, + "com.amazonaws.dynamodb#TimeToLiveAttributeName": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 255 + } + } + }, + "com.amazonaws.dynamodb#TimeToLiveDescription": { + "type": "structure", + "members": { + "TimeToLiveStatus": { + "target": "com.amazonaws.dynamodb#TimeToLiveStatus", "traits": { - "smithy.api#documentation": "

Represents the settings used to enable server-side encryption.

" - } - }, - "com.amazonaws.dynamodb#SSEStatus": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "ENABLING", - "name": "ENABLING" - }, - { - "value": "ENABLED", - "name": "ENABLED" - }, - { - "value": "DISABLING", - "name": "DISABLING" - }, - { - "value": "DISABLED", - "name": "DISABLED" - }, - { - "value": "UPDATING", - "name": "UPDATING" - } - ] + "smithy.api#documentation": "

The TTL status for the table.

" } - }, - "com.amazonaws.dynamodb#SSEType": { - "type": "string", + }, + "AttributeName": { + "target": "com.amazonaws.dynamodb#TimeToLiveAttributeName", "traits": { - "smithy.api#enum": [ - { - "value": "AES256", - "name": "AES256" - }, - { - "value": "KMS", - "name": "KMS" - } - ] - } - }, - "com.amazonaws.dynamodb#ScalarAttributeType": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "S", - "name": "S" - }, - { - "value": "N", - "name": "N" - }, - { - "value": "B", - "name": "B" - } - ] + "smithy.api#documentation": "

The name of the TTL attribute for items in the table.

" } + } }, - "com.amazonaws.dynamodb#Scan": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#ScanInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#ScanOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], - "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

The Scan operation returns one or more items and item attributes by\n accessing every item in a table or a secondary index. To have DynamoDB return fewer\n items, you can provide a FilterExpression operation.

\n

If the total number of scanned items exceeds the maximum dataset size limit of 1 MB,\n the scan stops and results are returned to the user as a LastEvaluatedKey\n value to continue the scan in a subsequent operation. The results also include the\n number of items exceeding the limit. A scan can result in no table data meeting the\n filter criteria.

\n

A single Scan operation reads up to the maximum number of items set (if\n using the Limit parameter) or a maximum of 1 MB of data and then apply any\n filtering to the results using FilterExpression. If\n LastEvaluatedKey is present in the response, you need to paginate the\n result set. For more information, see Paginating the\n Results in the Amazon DynamoDB Developer Guide.

\n

\n Scan operations proceed sequentially; however, for faster performance on\n a large table or secondary index, applications can request a parallel Scan\n operation by providing the Segment and TotalSegments\n parameters. For more information, see Parallel\n Scan in the Amazon DynamoDB Developer Guide.

\n

\n Scan uses eventually consistent reads when accessing the data in a table;\n therefore, the result set might not include the changes to data in the table immediately\n before the operation began. If you need a consistent copy of the data, as of the time\n that the Scan begins, you can set the ConsistentRead parameter\n to true.

", - "smithy.api#paginated": { - "inputToken": "ExclusiveStartKey", - "outputToken": "LastEvaluatedKey", - "items": "Items", - "pageSize": "Limit" - }, - "smithy.api#suppress": [ - "PaginatedTrait" - ] - } - }, - "com.amazonaws.dynamodb#ScanInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table containing the requested items; or, if you provide\n IndexName, the name of the table to which that index belongs.

", - "smithy.api#required": {} - } - }, - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of a secondary index to scan. This index can be any local secondary index or\n global secondary index. Note that if you use the IndexName parameter, you\n must also provide TableName.

" - } - }, - "AttributesToGet": { - "target": "com.amazonaws.dynamodb#AttributeNameList", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use ProjectionExpression instead. For more\n information, see AttributesToGet in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "Limit": { - "target": "com.amazonaws.dynamodb#PositiveIntegerObject", - "traits": { - "smithy.api#documentation": "

The maximum number of items to evaluate (not necessarily the number of matching\n items). If DynamoDB processes the number of items up to the limit while processing the\n results, it stops the operation and returns the matching values up to that point, and a\n key in LastEvaluatedKey to apply in a subsequent operation, so that you can\n pick up where you left off. Also, if the processed dataset size exceeds 1 MB before\n DynamoDB reaches this limit, it stops the operation and returns the matching values up\n to the limit, and a key in LastEvaluatedKey to apply in a subsequent\n operation to continue the operation. For more information, see Working with Queries in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "Select": { - "target": "com.amazonaws.dynamodb#Select", - "traits": { - "smithy.api#documentation": "

The attributes to be returned in the result. You can retrieve all item attributes,\n specific item attributes, the count of matching items, or in the case of an index, some\n or all of the attributes projected into the index.

\n
    \n
  • \n

    \n ALL_ATTRIBUTES - Returns all of the item attributes from the\n specified table or index. If you query a local secondary index, then for each\n matching item in the index, DynamoDB fetches the entire item from the parent\n table. If the index is configured to project all item attributes, then all of\n the data can be obtained from the local secondary index, and no fetching is\n required.

    \n
  • \n
  • \n

    \n ALL_PROJECTED_ATTRIBUTES - Allowed only when querying an index.\n Retrieves all attributes that have been projected into the index. If the index\n is configured to project all attributes, this return value is equivalent to\n specifying ALL_ATTRIBUTES.

    \n
  • \n
  • \n

    \n COUNT - Returns the number of matching items, rather than the\n matching items themselves.

    \n
  • \n
  • \n

    \n SPECIFIC_ATTRIBUTES - Returns only the attributes listed in\n ProjectionExpression. This return value is equivalent to\n specifying ProjectionExpression without specifying any value for\n Select.

    \n

    If you query or scan a local secondary index and request only attributes that\n are projected into that index, the operation reads only the index and not the\n table. If any of the requested attributes are not projected into the local\n secondary index, DynamoDB fetches each of these attributes from the parent\n table. This extra fetching incurs additional throughput cost and latency.

    \n

    If you query or scan a global secondary index, you can only request attributes\n that are projected into the index. Global secondary index queries cannot fetch\n attributes from the parent table.

    \n
  • \n
\n

If neither Select nor ProjectionExpression are specified,\n DynamoDB defaults to ALL_ATTRIBUTES when accessing a table, and\n ALL_PROJECTED_ATTRIBUTES when accessing an index. You cannot use both\n Select and ProjectionExpression together in a single\n request, unless the value for Select is SPECIFIC_ATTRIBUTES.\n (This usage is equivalent to specifying ProjectionExpression without any\n value for Select.)

\n \n

If you use the ProjectionExpression parameter, then the value for\n Select can only be SPECIFIC_ATTRIBUTES. Any other\n value for Select will return an error.

\n
" - } - }, - "ScanFilter": { - "target": "com.amazonaws.dynamodb#FilterConditionMap", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use FilterExpression instead. For more\n information, see ScanFilter in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ConditionalOperator": { - "target": "com.amazonaws.dynamodb#ConditionalOperator", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use FilterExpression instead. For more\n information, see ConditionalOperator in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExclusiveStartKey": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

The primary key of the first item that this operation will evaluate. Use the value\n that was returned for LastEvaluatedKey in the previous operation.

\n

The data type for ExclusiveStartKey must be String, Number or Binary. No\n set data types are allowed.

\n

In a parallel scan, a Scan request that includes\n ExclusiveStartKey must specify the same segment whose previous\n Scan returned the corresponding value of\n LastEvaluatedKey.

" - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" - }, - "TotalSegments": { - "target": "com.amazonaws.dynamodb#ScanTotalSegments", - "traits": { - "smithy.api#documentation": "

For a parallel Scan request, TotalSegments represents the\n total number of segments into which the Scan operation will be divided. The\n value of TotalSegments corresponds to the number of application workers\n that will perform the parallel scan. For example, if you want to use four application\n threads to scan a table or an index, specify a TotalSegments value of\n 4.

\n

The value for TotalSegments must be greater than or equal to 1, and less\n than or equal to 1000000. If you specify a TotalSegments value of 1, the\n Scan operation will be sequential rather than parallel.

\n

If you specify TotalSegments, you must also specify\n Segment.

" - } - }, - "Segment": { - "target": "com.amazonaws.dynamodb#ScanSegment", - "traits": { - "smithy.api#documentation": "

For a parallel Scan request, Segment identifies an\n individual segment to be scanned by an application worker.

\n

Segment IDs are zero-based, so the first segment is always 0. For example, if you want\n to use four application threads to scan a table or an index, then the first thread\n specifies a Segment value of 0, the second thread specifies 1, and so\n on.

\n

The value of LastEvaluatedKey returned from a parallel Scan\n request must be used as ExclusiveStartKey with the same segment ID in a\n subsequent Scan operation.

\n

The value for Segment must be greater than or equal to 0, and less than\n the value provided for TotalSegments.

\n

If you provide Segment, you must also provide\n TotalSegments.

" - } - }, - "ProjectionExpression": { - "target": "com.amazonaws.dynamodb#ProjectionExpression", - "traits": { - "smithy.api#documentation": "

A string that identifies one or more attributes to retrieve from the specified table\n or index. These attributes can include scalars, sets, or elements of a JSON document.\n The attributes in the expression must be separated by commas.

\n

If no attribute names are specified, then all attributes will be returned. If any of\n the requested attributes are not found, they will not appear in the result.

\n

For more information, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "FilterExpression": { - "target": "com.amazonaws.dynamodb#ConditionExpression", - "traits": { - "smithy.api#documentation": "

A string that contains conditions that DynamoDB applies after the Scan\n operation, but before the data is returned to you. Items that do not satisfy the\n FilterExpression criteria are not returned.

\n \n

A FilterExpression is applied after the items have already been read;\n the process of filtering does not consume any additional read capacity units.

\n
\n

For more information, see Filter Expressions in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide). To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information on expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExpressionAttributeValues": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", - "traits": { - "smithy.api#documentation": "

One or more values that can be substituted in an expression.

\n

Use the : (colon) character in an expression to\n dereference an attribute value. For example, suppose that you wanted to check whether\n the value of the ProductStatus attribute was one of the following:

\n

\n Available | Backordered | Discontinued\n

\n

You would first need to specify ExpressionAttributeValues as\n follows:

\n

\n { \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"},\n \":disc\":{\"S\":\"Discontinued\"} }\n

\n

You could then use these values in an expression, such as this:

\n

\n ProductStatus IN (:avail, :back, :disc)\n

\n

For more information on expression attribute values, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ConsistentRead": { - "target": "com.amazonaws.dynamodb#ConsistentRead", - "traits": { - "smithy.api#documentation": "

A Boolean value that determines the read consistency model during the scan:

\n
    \n
  • \n

    If ConsistentRead is false, then the data returned\n from Scan might not contain the results from other recently\n completed write operations (PutItem, UpdateItem, or\n DeleteItem).

    \n
  • \n
  • \n

    If ConsistentRead is true, then all of the write\n operations that completed before the Scan began are guaranteed to\n be contained in the Scan response.

    \n
  • \n
\n

The default setting for ConsistentRead is false.

\n

The ConsistentRead parameter is not supported on global secondary\n indexes. If you scan a global secondary index with ConsistentRead set to\n true, you will receive a ValidationException.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

The description of the Time to Live (TTL) status on the specified table.

" + } + }, + "com.amazonaws.dynamodb#TimeToLiveEnabled": { + "type": "boolean", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.dynamodb#TimeToLiveSpecification": { + "type": "structure", + "members": { + "Enabled": { + "target": "com.amazonaws.dynamodb#TimeToLiveEnabled", "traits": { - "smithy.api#documentation": "

Represents the input of a Scan operation.

" + "smithy.api#documentation": "

Indicates whether TTL is to be enabled (true) or disabled (false) on the table.

", + "smithy.api#required": {} } + }, + "AttributeName": { + "target": "com.amazonaws.dynamodb#TimeToLiveAttributeName", + "traits": { + "smithy.api#documentation": "

The name of the TTL attribute used to store the expiration time for items in the\n table.

", + "smithy.api#required": {} + } + } }, - "com.amazonaws.dynamodb#ScanOutput": { - "type": "structure", - "members": { - "Items": { - "target": "com.amazonaws.dynamodb#ItemList", - "traits": { - "smithy.api#documentation": "

An array of item attributes that match the scan criteria. Each element in this array\n consists of an attribute name and the value for that attribute.

" - } - }, - "Count": { - "target": "com.amazonaws.dynamodb#Integer", - "traits": { - "smithy.api#documentation": "

The number of items in the response.

\n

If you set ScanFilter in the request, then Count is the\n number of items returned after the filter was applied, and ScannedCount is\n the number of matching items before the filter was applied.

\n

If you did not use a filter in the request, then Count is the same as\n ScannedCount.

" - } - }, - "ScannedCount": { - "target": "com.amazonaws.dynamodb#Integer", - "traits": { - "smithy.api#documentation": "

The number of items evaluated, before any ScanFilter is applied. A high\n ScannedCount value with few, or no, Count results\n indicates an inefficient Scan operation. For more information, see Count and\n ScannedCount in the Amazon DynamoDB Developer\n Guide.

\n

If you did not use a filter in the request, then ScannedCount is the same\n as Count.

" - } - }, - "LastEvaluatedKey": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

The primary key of the item where the operation stopped, inclusive of the previous\n result set. Use this value to start a new operation, excluding this value in the new\n request.

\n

If LastEvaluatedKey is empty, then the \"last page\" of results has been\n processed and there is no more data to be retrieved.

\n

If LastEvaluatedKey is not empty, it does not necessarily mean that there\n is more data in the result set. The only way to know when you have reached the end of\n the result set is when LastEvaluatedKey is empty.

" - } - }, - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacity", - "traits": { - "smithy.api#documentation": "

The capacity units consumed by the Scan operation. The data returned\n includes the total provisioned throughput consumed, along with statistics for the table\n and any indexes involved in the operation. ConsumedCapacity is only\n returned if the ReturnConsumedCapacity parameter was specified. For more\n information, see Provisioned Throughput in the Amazon DynamoDB Developer\n Guide.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents the settings used to enable or disable Time to Live (TTL) for the specified\n table.

" + } + }, + "com.amazonaws.dynamodb#TimeToLiveStatus": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "ENABLING", + "name": "ENABLING" + }, + { + "value": "DISABLING", + "name": "DISABLING" + }, + { + "value": "ENABLED", + "name": "ENABLED" }, + { + "value": "DISABLED", + "name": "DISABLED" + } + ] + } + }, + "com.amazonaws.dynamodb#TransactGetItem": { + "type": "structure", + "members": { + "Get": { + "target": "com.amazonaws.dynamodb#Get", "traits": { - "smithy.api#documentation": "

Represents the output of a Scan operation.

" + "smithy.api#documentation": "

Contains the primary key that identifies the item to get, together with the name of\n the table that contains the item, and optionally the specific attributes of the item to\n retrieve.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#ScanSegment": { - "type": "integer", + "traits": { + "smithy.api#documentation": "

Specifies an item to be retrieved as part of the transaction.

" + } + }, + "com.amazonaws.dynamodb#TransactGetItemList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#TransactGetItem" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 25 + } + } + }, + "com.amazonaws.dynamodb#TransactGetItems": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#TransactGetItemsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#TransactGetItemsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#TransactionCanceledException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

\n TransactGetItems is a synchronous operation that atomically retrieves\n multiple items from one or more tables (but not from indexes) in a single account and\n Region. A TransactGetItems call can contain up to 25\n TransactGetItem objects, each of which contains a Get\n structure that specifies an item to retrieve from a table in the account and Region. A\n call to TransactGetItems cannot retrieve items from tables in more than one\n Amazon Web Services account or Region. The aggregate size of the items in the\n transaction cannot exceed 4 MB.

\n

DynamoDB rejects the entire TransactGetItems request if any of\n the following is true:

\n
    \n
  • \n

    A conflicting operation is in the process of updating an item to be\n read.

    \n
  • \n
  • \n

    There is insufficient provisioned capacity for the transaction to be\n completed.

    \n
  • \n
  • \n

    There is a user error, such as an invalid data format.

    \n
  • \n
  • \n

    The aggregate size of the items in the transaction cannot exceed 4 MB.

    \n
  • \n
" + } + }, + "com.amazonaws.dynamodb#TransactGetItemsInput": { + "type": "structure", + "members": { + "TransactItems": { + "target": "com.amazonaws.dynamodb#TransactGetItemList", "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 0, - "max": 999999 - } + "smithy.api#documentation": "

An ordered array of up to 25 TransactGetItem objects, each of which\n contains a Get structure.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#ScanTotalSegments": { - "type": "integer", + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity", "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 1, - "max": 1000000 - } + "smithy.api#documentation": "

A value of TOTAL causes consumed capacity information to be returned, and\n a value of NONE prevents that information from being returned. No other\n value is valid.

" } - }, - "com.amazonaws.dynamodb#SecondaryIndexesCapacityMap": { - "type": "map", - "key": { - "target": "com.amazonaws.dynamodb#IndexName" - }, - "value": { - "target": "com.amazonaws.dynamodb#Capacity" - } - }, - "com.amazonaws.dynamodb#Select": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "ALL_ATTRIBUTES", - "name": "ALL_ATTRIBUTES" - }, - { - "value": "ALL_PROJECTED_ATTRIBUTES", - "name": "ALL_PROJECTED_ATTRIBUTES" - }, - { - "value": "SPECIFIC_ATTRIBUTES", - "name": "SPECIFIC_ATTRIBUTES" - }, - { - "value": "COUNT", - "name": "COUNT" - } - ] + } + } + }, + "com.amazonaws.dynamodb#TransactGetItemsOutput": { + "type": "structure", + "members": { + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", + "traits": { + "smithy.api#documentation": "

If the ReturnConsumedCapacity value was TOTAL, this\n is an array of ConsumedCapacity objects, one for each table addressed by\n TransactGetItem objects in the TransactItems\n parameter. These ConsumedCapacity objects report the read-capacity units\n consumed by the TransactGetItems call in that table.

" } - }, - "com.amazonaws.dynamodb#SourceTableDetails": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table for which the backup was created.

", - "smithy.api#required": {} - } - }, - "TableId": { - "target": "com.amazonaws.dynamodb#TableId", - "traits": { - "smithy.api#documentation": "

Unique identifier for the table for which the backup was created.

", - "smithy.api#required": {} - } - }, - "TableArn": { - "target": "com.amazonaws.dynamodb#TableArn", - "traits": { - "smithy.api#documentation": "

ARN of the table for which backup was created.

" - } - }, - "TableSizeBytes": { - "target": "com.amazonaws.dynamodb#Long", - "traits": { - "smithy.api#documentation": "

Size of the table in bytes. Note that this is an approximate value.

" - } - }, - "KeySchema": { - "target": "com.amazonaws.dynamodb#KeySchema", - "traits": { - "smithy.api#documentation": "

Schema of the table.

", - "smithy.api#required": {} - } - }, - "TableCreationDateTime": { - "target": "com.amazonaws.dynamodb#TableCreationDateTime", - "traits": { - "smithy.api#documentation": "

Time when the source table was created.

", - "smithy.api#required": {} - } - }, - "ProvisionedThroughput": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughput", - "traits": { - "smithy.api#documentation": "

Read IOPs and Write IOPS on the table when the backup was created.

", - "smithy.api#required": {} - } - }, - "ItemCount": { - "target": "com.amazonaws.dynamodb#ItemCount", - "traits": { - "smithy.api#documentation": "

Number of items in the table. Note that this is an approximate value.

" - } - }, - "BillingMode": { - "target": "com.amazonaws.dynamodb#BillingMode", - "traits": { - "smithy.api#documentation": "

Controls how you are charged for read and write throughput and how you manage\n capacity. This setting can be changed later.

\n
    \n
  • \n

    \n PROVISIONED - Sets the read/write capacity mode to\n PROVISIONED. We recommend using PROVISIONED for\n predictable workloads.

    \n
  • \n
  • \n

    \n PAY_PER_REQUEST - Sets the read/write capacity mode to\n PAY_PER_REQUEST. We recommend using\n PAY_PER_REQUEST for unpredictable workloads.

    \n
  • \n
" - } - } - }, + }, + "Responses": { + "target": "com.amazonaws.dynamodb#ItemResponseList", "traits": { - "smithy.api#documentation": "

Contains the details of the table when the backup was created.

" + "smithy.api#documentation": "

An ordered array of up to 25 ItemResponse objects, each of which\n corresponds to the TransactGetItem object in the same position in the\n TransactItems array. Each ItemResponse object\n contains a Map of the name-value pairs that are the projected attributes of the\n requested item.

\n

If a requested item could not be retrieved, the corresponding\n ItemResponse object is Null, or if the requested item has no projected\n attributes, the corresponding ItemResponse object is an empty Map.

" } - }, - "com.amazonaws.dynamodb#SourceTableFeatureDetails": { - "type": "structure", - "members": { - "LocalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#LocalSecondaryIndexes", - "traits": { - "smithy.api#documentation": "

Represents the LSI properties for the table when the backup was created. It includes\n the IndexName, KeySchema and Projection for the LSIs on the table at the time of backup.\n

" - } - }, - "GlobalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexes", - "traits": { - "smithy.api#documentation": "

Represents the GSI properties for the table when the backup was created. It includes\n the IndexName, KeySchema, Projection, and ProvisionedThroughput for the GSIs on the\n table at the time of backup.

" - } - }, - "StreamDescription": { - "target": "com.amazonaws.dynamodb#StreamSpecification", - "traits": { - "smithy.api#documentation": "

Stream settings on the table when the backup was created.

" - } - }, - "TimeToLiveDescription": { - "target": "com.amazonaws.dynamodb#TimeToLiveDescription", - "traits": { - "smithy.api#documentation": "

Time to Live settings on the table when the backup was created.

" - } - }, - "SSEDescription": { - "target": "com.amazonaws.dynamodb#SSEDescription", - "traits": { - "smithy.api#documentation": "

The description of the server-side encryption status on the table when the backup was\n created.

" - } - } - }, + } + } + }, + "com.amazonaws.dynamodb#TransactWriteItem": { + "type": "structure", + "members": { + "ConditionCheck": { + "target": "com.amazonaws.dynamodb#ConditionCheck", "traits": { - "smithy.api#documentation": "

Contains the details of the features enabled on the table when the backup was created.\n For example, LSIs, GSIs, streams, TTL.

" + "smithy.api#documentation": "

A request to perform a check item operation.

" } - }, - "com.amazonaws.dynamodb#StreamArn": { - "type": "string", + }, + "Put": { + "target": "com.amazonaws.dynamodb#Put", "traits": { - "smithy.api#length": { - "min": 37, - "max": 1024 - } + "smithy.api#documentation": "

A request to perform a PutItem operation.

" } - }, - "com.amazonaws.dynamodb#StreamEnabled": { - "type": "boolean", + }, + "Delete": { + "target": "com.amazonaws.dynamodb#Delete", + "traits": { + "smithy.api#documentation": "

A request to perform a DeleteItem operation.

" + } + }, + "Update": { + "target": "com.amazonaws.dynamodb#Update", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

A request to perform an UpdateItem operation.

" } + } }, - "com.amazonaws.dynamodb#StreamSpecification": { - "type": "structure", - "members": { - "StreamEnabled": { - "target": "com.amazonaws.dynamodb#StreamEnabled", - "traits": { - "smithy.api#documentation": "

Indicates whether DynamoDB Streams is enabled (true) or disabled (false) on the\n table.

", - "smithy.api#required": {} - } - }, - "StreamViewType": { - "target": "com.amazonaws.dynamodb#StreamViewType", - "traits": { - "smithy.api#documentation": "

When an item in the table is modified, StreamViewType determines what\n information is written to the stream for this table. Valid values for\n StreamViewType are:

\n
    \n
  • \n

    \n KEYS_ONLY - Only the key attributes of the modified item are\n written to the stream.

    \n
  • \n
  • \n

    \n NEW_IMAGE - The entire item, as it appears after it was modified,\n is written to the stream.

    \n
  • \n
  • \n

    \n OLD_IMAGE - The entire item, as it appeared before it was modified,\n is written to the stream.

    \n
  • \n
  • \n

    \n NEW_AND_OLD_IMAGES - Both the new and the old item images of the\n item are written to the stream.

    \n
  • \n
" - } - } - }, + "traits": { + "smithy.api#documentation": "

A list of requests that can perform update, put, delete, or check operations on\n multiple items in one or more tables atomically.

" + } + }, + "com.amazonaws.dynamodb#TransactWriteItemList": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#TransactWriteItem" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 25 + } + } + }, + "com.amazonaws.dynamodb#TransactWriteItems": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#TransactWriteItemsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#TransactWriteItemsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#IdempotentParameterMismatchException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#TransactionCanceledException" + }, + { + "target": "com.amazonaws.dynamodb#TransactionInProgressException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

\n TransactWriteItems is a synchronous write operation that groups up to 25\n action requests. These actions can target items in different tables, but not in\n different Amazon Web Services accounts or Regions, and no two actions can target the same\n item. For example, you cannot both ConditionCheck and Update\n the same item. The aggregate size of the items in the transaction cannot exceed 4\n MB.

\n\n

The actions are completed atomically so that either all of them succeed, or all of\n them fail. They are defined by the following objects:

\n\n
    \n
  • \n

    \n Put — Initiates a PutItem\n operation to write a new item. This structure specifies the primary key of the\n item to be written, the name of the table to write it in, an optional condition\n expression that must be satisfied for the write to succeed, a list of the item's\n attributes, and a field indicating whether to retrieve the item's attributes if\n the condition is not met.

    \n
  • \n
  • \n

    \n Update — Initiates an UpdateItem\n operation to update an existing item. This structure specifies the primary key\n of the item to be updated, the name of the table where it resides, an optional\n condition expression that must be satisfied for the update to succeed, an\n expression that defines one or more attributes to be updated, and a field\n indicating whether to retrieve the item's attributes if the condition is not\n met.

    \n
  • \n
  • \n

    \n Delete — Initiates a DeleteItem\n operation to delete an existing item. This structure specifies the primary key\n of the item to be deleted, the name of the table where it resides, an optional\n condition expression that must be satisfied for the deletion to succeed, and a\n field indicating whether to retrieve the item's attributes if the condition is\n not met.

    \n
  • \n
  • \n

    \n ConditionCheck — Applies a condition to an item\n that is not being modified by the transaction. This structure specifies the\n primary key of the item to be checked, the name of the table where it resides, a\n condition expression that must be satisfied for the transaction to succeed, and\n a field indicating whether to retrieve the item's attributes if the condition is\n not met.

    \n
  • \n
\n\n

DynamoDB rejects the entire TransactWriteItems request if any of the\n following is true:

\n
    \n
  • \n

    A condition in one of the condition expressions is not met.

    \n
  • \n
  • \n

    An ongoing operation is in the process of updating the same item.

    \n
  • \n
  • \n

    There is insufficient provisioned capacity for the transaction to be\n completed.

    \n
  • \n
  • \n

    An item size becomes too large (bigger than 400 KB), a local secondary index\n (LSI) becomes too large, or a similar validation error occurs because of changes\n made by the transaction.

    \n
  • \n
  • \n

    The aggregate size of the items in the transaction exceeds 4 MB.

    \n
  • \n
  • \n

    There is a user error, such as an invalid data format.

    \n
  • \n
" + } + }, + "com.amazonaws.dynamodb#TransactWriteItemsInput": { + "type": "structure", + "members": { + "TransactItems": { + "target": "com.amazonaws.dynamodb#TransactWriteItemList", "traits": { - "smithy.api#documentation": "

Represents the DynamoDB Streams configuration for a table in DynamoDB.

" - } - }, - "com.amazonaws.dynamodb#StreamViewType": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "NEW_IMAGE", - "name": "NEW_IMAGE" - }, - { - "value": "OLD_IMAGE", - "name": "OLD_IMAGE" - }, - { - "value": "NEW_AND_OLD_IMAGES", - "name": "NEW_AND_OLD_IMAGES" - }, - { - "value": "KEYS_ONLY", - "name": "KEYS_ONLY" - } - ] + "smithy.api#documentation": "

An ordered array of up to 25 TransactWriteItem objects, each of which\n contains a ConditionCheck, Put, Update, or\n Delete object. These can operate on items in different tables, but the\n tables must reside in the same Amazon Web Services account and Region, and no two of them\n can operate on the same item.

", + "smithy.api#required": {} + } + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" + }, + "ReturnItemCollectionMetrics": { + "target": "com.amazonaws.dynamodb#ReturnItemCollectionMetrics", + "traits": { + "smithy.api#documentation": "

Determines whether item collection metrics are returned. If set to SIZE,\n the response includes statistics about item collections (if any), that were modified\n during the operation and are returned in the response. If set to NONE (the\n default), no statistics are returned.

" + } + }, + "ClientRequestToken": { + "target": "com.amazonaws.dynamodb#ClientRequestToken", + "traits": { + "smithy.api#documentation": "

Providing a ClientRequestToken makes the call to\n TransactWriteItems idempotent, meaning that multiple identical calls\n have the same effect as one single call.

\n

Although multiple identical calls using the same client request token produce the same\n result on the server (no side effects), the responses to the calls might not be the\n same. If the ReturnConsumedCapacity> parameter is set, then the initial\n TransactWriteItems call returns the amount of write capacity units\n consumed in making the changes. Subsequent TransactWriteItems calls with\n the same client token return the number of read capacity units consumed in reading the\n item.

\n

A client request token is valid for 10 minutes after the first request that uses it is\n completed. After 10 minutes, any request with the same client token is treated as a new\n request. Do not resubmit the same request with the same client token for more than 10\n minutes, or the result might not be idempotent.

\n

If you submit a request with the same client token but a change in other parameters\n within the 10-minute idempotency window, DynamoDB returns an\n IdempotentParameterMismatch exception.

", + "smithy.api#idempotencyToken": {} + } + } + } + }, + "com.amazonaws.dynamodb#TransactWriteItemsOutput": { + "type": "structure", + "members": { + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", + "traits": { + "smithy.api#documentation": "

The capacity units consumed by the entire TransactWriteItems operation.\n The values of the list are ordered according to the ordering of the\n TransactItems request parameter.

" + } + }, + "ItemCollectionMetrics": { + "target": "com.amazonaws.dynamodb#ItemCollectionMetricsPerTable", + "traits": { + "smithy.api#documentation": "

A list of tables that were processed by TransactWriteItems and, for each\n table, information about any item collections that were affected by individual\n UpdateItem, PutItem, or DeleteItem\n operations.

" + } + } + } + }, + "com.amazonaws.dynamodb#TransactionCanceledException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + }, + "CancellationReasons": { + "target": "com.amazonaws.dynamodb#CancellationReasonList", + "traits": { + "smithy.api#documentation": "

A list of cancellation reasons.

" } + } }, - "com.amazonaws.dynamodb#String": { - "type": "string" + "traits": { + "smithy.api#documentation": "

The entire transaction request was canceled.

\n

DynamoDB cancels a TransactWriteItems request under the following\n circumstances:

\n
    \n
  • \n

    A condition in one of the condition expressions is not met.

    \n
  • \n
  • \n

    A table in the TransactWriteItems request is in a different\n account or region.

    \n
  • \n
  • \n

    More than one action in the TransactWriteItems operation\n targets the same item.

    \n
  • \n
  • \n

    There is insufficient provisioned capacity for the transaction to be\n completed.

    \n
  • \n
  • \n

    An item size becomes too large (larger than 400 KB), or a local secondary\n index (LSI) becomes too large, or a similar validation error occurs because of\n changes made by the transaction.

    \n
  • \n
  • \n

    There is a user error, such as an invalid data format.

    \n
  • \n
\n\n

DynamoDB cancels a TransactGetItems request under the\n following circumstances:

\n
    \n
  • \n

    There is an ongoing TransactGetItems operation that conflicts\n with a concurrent PutItem, UpdateItem,\n DeleteItem or TransactWriteItems request. In this\n case the TransactGetItems operation fails with a\n TransactionCanceledException.

    \n
  • \n
  • \n

    A table in the TransactGetItems request is in a different\n account or region.

    \n
  • \n
  • \n

    There is insufficient provisioned capacity for the transaction to be\n completed.

    \n
  • \n
  • \n

    There is a user error, such as an invalid data format.

    \n
  • \n
\n\n \n

If using Java, DynamoDB lists the cancellation reasons on the\n CancellationReasons property. This property is not set for other\n languages. Transaction cancellation reasons are ordered in the order of requested\n items, if an item has no error it will have None code and\n Null message.

\n
\n

Cancellation reason codes and possible error messages:

\n
    \n
  • \n

    No Errors:

    \n
      \n
    • \n

      Code: None\n

      \n
    • \n
    • \n

      Message: null\n

      \n
    • \n
    \n
  • \n
  • \n

    Conditional Check Failed:

    \n
      \n
    • \n

      Code: ConditionalCheckFailed\n

      \n
    • \n
    • \n

      Message: The conditional request failed.

      \n
    • \n
    \n
  • \n
  • \n

    Item Collection Size Limit Exceeded:

    \n
      \n
    • \n

      Code: ItemCollectionSizeLimitExceeded\n

      \n
    • \n
    • \n

      Message: Collection size exceeded.

      \n
    • \n
    \n
  • \n
  • \n

    Transaction Conflict:

    \n
      \n
    • \n

      Code: TransactionConflict\n

      \n
    • \n
    • \n

      Message: Transaction is ongoing for the item.

      \n
    • \n
    \n
  • \n
  • \n

    Provisioned Throughput Exceeded:

    \n
      \n
    • \n

      Code: ProvisionedThroughputExceeded\n

      \n
    • \n
    • \n

      Messages:

      \n
        \n
      • \n

        The level of configured provisioned throughput for the\n table was exceeded. Consider increasing your provisioning level\n with the UpdateTable API.

        \n \n

        This Message is received when provisioned throughput is\n exceeded is on a provisioned DynamoDB\n table.

        \n
        \n
      • \n
      • \n

        The level of configured provisioned throughput for one or\n more global secondary indexes of the table was exceeded.\n Consider increasing your provisioning level for the\n under-provisioned global secondary indexes with the UpdateTable\n API.

        \n \n

        This message is returned when provisioned throughput is\n exceeded is on a provisioned GSI.

        \n
        \n
      • \n
      \n\n
    • \n
    \n
  • \n
  • \n

    Throttling Error:

    \n
      \n
    • \n

      Code: ThrottlingError\n

      \n
    • \n
    • \n

      Messages:

      \n
        \n
      • \n

        Throughput exceeds the current capacity of your table or\n index. DynamoDB is automatically scaling your table or\n index so please try again shortly. If exceptions persist, check\n if you have a hot key:\n https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html.

        \n \n

        This message is returned when writes get throttled on an\n On-Demand table as DynamoDB is automatically\n scaling the table.

        \n
        \n
      • \n
      • \n

        Throughput exceeds the current capacity for one or more\n global secondary indexes. DynamoDB is automatically\n scaling your index so please try again shortly.

        \n \n

        This message is returned when when writes get throttled on\n an On-Demand GSI as DynamoDB is automatically\n scaling the GSI.

        \n
        \n
      • \n
      \n\n
    • \n
    \n
  • \n
  • \n

    Validation Error:

    \n
      \n
    • \n

      Code: ValidationError\n

      \n
    • \n
    • \n

      Messages:

      \n
        \n
      • \n

        One or more parameter values were invalid.

        \n
      • \n
      • \n

        The update expression attempted to update the secondary\n index key beyond allowed size limits.

        \n
      • \n
      • \n

        The update expression attempted to update the secondary\n index key to unsupported type.

        \n
      • \n
      • \n

        An operand in the update expression has an incorrect data\n type.

        \n
      • \n
      • \n

        Item size to update has exceeded the maximum allowed\n size.

        \n
      • \n
      • \n

        Number overflow. Attempting to store a number with\n magnitude larger than supported range.

        \n
      • \n
      • \n

        Type mismatch for attribute to update.

        \n
      • \n
      • \n

        Nesting Levels have exceeded supported limits.

        \n
      • \n
      • \n

        The document path provided in the update expression is\n invalid for update.

        \n
      • \n
      • \n

        The provided expression refers to an attribute that does\n not exist in the item.

        \n
      • \n
      \n\n
    • \n
    \n
  • \n
", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#TransactionConflictException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } }, - "com.amazonaws.dynamodb#StringAttributeValue": { - "type": "string" + "traits": { + "smithy.api#documentation": "

Operation was rejected because there is an ongoing transaction for the\n item.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#TransactionInProgressException": { + "type": "structure", + "members": { + "Message": { + "target": "com.amazonaws.dynamodb#ErrorMessage" + } }, - "com.amazonaws.dynamodb#StringSetAttributeValue": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#StringAttributeValue" + "traits": { + "smithy.api#documentation": "

The transaction with the given request token is already in progress.

", + "smithy.api#error": "client" + } + }, + "com.amazonaws.dynamodb#UntagResource": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#UntagResourceInput" + }, + "output": { + "target": "smithy.api#Unit" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceInUseException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Removes the association of tags from an Amazon DynamoDB resource. You can call\n UntagResource up to five times per second, per account.

\n

For an overview on tagging DynamoDB resources, see Tagging for DynamoDB\n in the Amazon DynamoDB Developer Guide.

" + } + }, + "com.amazonaws.dynamodb#UntagResourceInput": { + "type": "structure", + "members": { + "ResourceArn": { + "target": "com.amazonaws.dynamodb#ResourceArnString", + "traits": { + "smithy.api#documentation": "

The DynamoDB resource that the tags will be removed from. This value is an Amazon\n Resource Name (ARN).

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TableAlreadyExistsException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "TagKeys": { + "target": "com.amazonaws.dynamodb#TagKeyList", "traits": { - "smithy.api#documentation": "

A target table with the specified name already exists.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

A list of tag keys. Existing tags of the resource whose keys are members of this list\n will be removed from the DynamoDB resource.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TableArn": { - "type": "string" - }, - "com.amazonaws.dynamodb#TableAutoScalingDescription": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table.

" - } - }, - "TableStatus": { - "target": "com.amazonaws.dynamodb#TableStatus", - "traits": { - "smithy.api#documentation": "

The current state of the table:

\n
    \n
  • \n

    \n CREATING - The table is being created.

    \n
  • \n
  • \n

    \n UPDATING - The table is being updated.

    \n
  • \n
  • \n

    \n DELETING - The table is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The table is ready for use.

    \n
  • \n
" - } - }, - "Replicas": { - "target": "com.amazonaws.dynamodb#ReplicaAutoScalingDescriptionList", - "traits": { - "smithy.api#documentation": "

Represents replicas of the global table.

" - } - } - }, + } + } + }, + "com.amazonaws.dynamodb#Update": { + "type": "structure", + "members": { + "Key": { + "target": "com.amazonaws.dynamodb#Key", "traits": { - "smithy.api#documentation": "

Represents the auto scaling configuration for a global table.

" + "smithy.api#documentation": "

The primary key of the item to be updated. Each element consists of an attribute name\n and a value for that attribute.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TableClass": { - "type": "string", + }, + "UpdateExpression": { + "target": "com.amazonaws.dynamodb#UpdateExpression", "traits": { - "smithy.api#enum": [ - { - "value": "STANDARD", - "name": "STANDARD" - }, - { - "value": "STANDARD_INFREQUENT_ACCESS", - "name": "STANDARD_INFREQUENT_ACCESS" - } - ] + "smithy.api#documentation": "

An expression that defines one or more attributes to be updated, the action to be\n performed on them, and new value(s) for them.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TableClassSummary": { - "type": "structure", - "members": { - "TableClass": { - "target": "com.amazonaws.dynamodb#TableClass", - "traits": { - "smithy.api#documentation": "

The table class of the specified table. Valid values are STANDARD and\n STANDARD_INFREQUENT_ACCESS.

" - } - }, - "LastUpdateDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

The date and time at which the table class was last updated.

" - } - } - }, + }, + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

Contains details of the table class.

" + "smithy.api#documentation": "

Name of the table for the UpdateItem request.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TableCreationDateTime": { - "type": "timestamp" - }, - "com.amazonaws.dynamodb#TableCreationParameters": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

\n The name of the table created as part of the import operation. \n

", - "smithy.api#required": {} - } - }, - "AttributeDefinitions": { - "target": "com.amazonaws.dynamodb#AttributeDefinitions", - "traits": { - "smithy.api#documentation": "

\n The attributes of the table created as part of the import operation.\n

", - "smithy.api#required": {} - } - }, - "KeySchema": { - "target": "com.amazonaws.dynamodb#KeySchema", - "traits": { - "smithy.api#documentation": "

\n The primary key and option sort key of the table created as part of the import operation.\n

", - "smithy.api#required": {} - } - }, - "BillingMode": { - "target": "com.amazonaws.dynamodb#BillingMode", - "traits": { - "smithy.api#documentation": "

\n The billing mode for provisioning the table created as part of the import operation.\n

" - } - }, - "ProvisionedThroughput": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughput" - }, - "SSESpecification": { - "target": "com.amazonaws.dynamodb#SSESpecification" - }, - "GlobalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexList", - "traits": { - "smithy.api#documentation": "

\n The Global Secondary Indexes (GSI) of the table to be created as part of the import operation.\n

" - } - } - }, + }, + "ConditionExpression": { + "target": "com.amazonaws.dynamodb#ConditionExpression", "traits": { - "smithy.api#documentation": "

The parameters for the table created as part of the import operation.\n

" + "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional update to\n succeed.

" } - }, - "com.amazonaws.dynamodb#TableDescription": { - "type": "structure", - "members": { - "AttributeDefinitions": { - "target": "com.amazonaws.dynamodb#AttributeDefinitions", - "traits": { - "smithy.api#documentation": "

An array of AttributeDefinition objects. Each of these objects describes\n one attribute in the table and index key schema.

\n

Each AttributeDefinition object in this array is composed of:

\n
    \n
  • \n

    \n AttributeName - The name of the attribute.

    \n
  • \n
  • \n

    \n AttributeType - The data type for the attribute.

    \n
  • \n
" - } - }, - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table.

" - } - }, - "KeySchema": { - "target": "com.amazonaws.dynamodb#KeySchema", - "traits": { - "smithy.api#documentation": "

The primary key structure for the table. Each KeySchemaElement consists\n of:

\n
    \n
  • \n

    \n AttributeName - The name of the attribute.

    \n
  • \n
  • \n

    \n KeyType - The role of the attribute:

    \n
      \n
    • \n

      \n HASH - partition key

      \n
    • \n
    • \n

      \n RANGE - sort key

      \n
    • \n
    \n \n

    The partition key of an item is also known as its hash\n attribute. The term \"hash attribute\" derives from DynamoDB's\n usage of an internal hash function to evenly distribute data items across\n partitions, based on their partition key values.

    \n

    The sort key of an item is also known as its range\n attribute. The term \"range attribute\" derives from the way\n DynamoDB stores items with the same partition key physically close together,\n in sorted order by the sort key value.

    \n
    \n\n
  • \n
\n

For more information about primary keys, see Primary Key in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "TableStatus": { - "target": "com.amazonaws.dynamodb#TableStatus", - "traits": { - "smithy.api#documentation": "

The current state of the table:

\n
    \n
  • \n

    \n CREATING - The table is being created.

    \n
  • \n
  • \n

    \n UPDATING - The table is being updated.

    \n
  • \n
  • \n

    \n DELETING - The table is being deleted.

    \n
  • \n
  • \n

    \n ACTIVE - The table is ready for use.

    \n
  • \n
  • \n

    \n INACCESSIBLE_ENCRYPTION_CREDENTIALS - The KMS key\n used to encrypt the table in inaccessible. Table operations may fail due to\n failure to use the KMS key. DynamoDB will initiate the\n table archival process when a table's KMS key remains\n inaccessible for more than seven days.

    \n
  • \n
  • \n

    \n ARCHIVING - The table is being archived. Operations are not allowed\n until archival is complete.

    \n
  • \n
  • \n

    \n ARCHIVED - The table has been archived. See the ArchivalReason for\n more information.

    \n
  • \n
" - } - }, - "CreationDateTime": { - "target": "com.amazonaws.dynamodb#Date", - "traits": { - "smithy.api#documentation": "

The date and time when the table was created, in UNIX epoch time format.

" - } - }, - "ProvisionedThroughput": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputDescription", - "traits": { - "smithy.api#documentation": "

The provisioned throughput settings for the table, consisting of read and write\n capacity units, along with data about increases and decreases.

" - } - }, - "TableSizeBytes": { - "target": "com.amazonaws.dynamodb#Long", - "traits": { - "smithy.api#documentation": "

The total size of the specified table, in bytes. DynamoDB updates this value\n approximately every six hours. Recent changes might not be reflected in this\n value.

" - } - }, - "ItemCount": { - "target": "com.amazonaws.dynamodb#Long", - "traits": { - "smithy.api#documentation": "

The number of items in the specified table. DynamoDB updates this value approximately\n every six hours. Recent changes might not be reflected in this value.

" - } - }, - "TableArn": { - "target": "com.amazonaws.dynamodb#String", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) that uniquely identifies the table.

" - } - }, - "TableId": { - "target": "com.amazonaws.dynamodb#TableId", - "traits": { - "smithy.api#documentation": "

Unique identifier for the table for which the backup was created.

" - } - }, - "BillingModeSummary": { - "target": "com.amazonaws.dynamodb#BillingModeSummary", - "traits": { - "smithy.api#documentation": "

Contains the details for the read/write capacity mode.

" - } - }, - "LocalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#LocalSecondaryIndexDescriptionList", - "traits": { - "smithy.api#documentation": "

Represents one or more local secondary indexes on the table. Each index is scoped to a\n given partition key value. Tables with one or more local secondary indexes are subject\n to an item collection size limit, where the amount of data within a given item\n collection cannot exceed 10 GB. Each element is composed of:

\n
    \n
  • \n

    \n IndexName - The name of the local secondary index.

    \n
  • \n
  • \n

    \n KeySchema - Specifies the complete index key schema. The attribute\n names in the key schema must be between 1 and 255 characters (inclusive). The\n key schema must begin with the same partition key as the table.

    \n
  • \n
  • \n

    \n Projection - Specifies attributes that are copied (projected) from\n the table into the index. These are in addition to the primary key attributes\n and index key attributes, which are automatically projected. Each attribute\n specification is composed of:

    \n
      \n
    • \n

      \n ProjectionType - One of the following:

      \n
        \n
      • \n

        \n KEYS_ONLY - Only the index and primary keys are\n projected into the index.

        \n
      • \n
      • \n

        \n INCLUDE - Only the specified table attributes are\n projected into the index. The list of projected attributes is in\n NonKeyAttributes.

        \n
      • \n
      • \n

        \n ALL - All of the table attributes are projected\n into the index.

        \n
      • \n
      \n
    • \n
    • \n

      \n NonKeyAttributes - A list of one or more non-key attribute\n names that are projected into the secondary index. The total count of\n attributes provided in NonKeyAttributes, summed across all\n of the secondary indexes, must not exceed 100. If you project the same\n attribute into two different indexes, this counts as two distinct\n attributes when determining the total.

      \n
    • \n
    \n
  • \n
  • \n

    \n IndexSizeBytes - Represents the total size of the index, in bytes.\n DynamoDB updates this value approximately every six hours. Recent changes might\n not be reflected in this value.

    \n
  • \n
  • \n

    \n ItemCount - Represents the number of items in the index. DynamoDB\n updates this value approximately every six hours. Recent changes might not be\n reflected in this value.

    \n
  • \n
\n

If the table is in the DELETING state, no information about indexes will\n be returned.

" - } - }, - "GlobalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexDescriptionList", - "traits": { - "smithy.api#documentation": "

The global secondary indexes, if any, on the table. Each index is scoped to a given\n partition key value. Each element is composed of:

\n
    \n
  • \n

    \n Backfilling - If true, then the index is currently in the\n backfilling phase. Backfilling occurs only when a new global secondary index is\n added to the table. It is the process by which DynamoDB populates the new index\n with data from the table. (This attribute does not appear for indexes that were\n created during a CreateTable operation.)

    \n

    You can delete an index that is being created during the\n Backfilling phase when IndexStatus is set to\n CREATING and Backfilling is true. You can't delete the index that\n is being created when IndexStatus is set to CREATING and\n Backfilling is false. (This attribute does not appear for\n indexes that were created during a CreateTable operation.)

    \n
  • \n
  • \n

    \n IndexName - The name of the global secondary index.

    \n
  • \n
  • \n

    \n IndexSizeBytes - The total size of the global secondary index, in\n bytes. DynamoDB updates this value approximately every six hours. Recent changes\n might not be reflected in this value.

    \n
  • \n
  • \n

    \n IndexStatus - The current status of the global secondary\n index:

    \n
      \n
    • \n

      \n CREATING - The index is being created.

      \n
    • \n
    • \n

      \n UPDATING - The index is being updated.

      \n
    • \n
    • \n

      \n DELETING - The index is being deleted.

      \n
    • \n
    • \n

      \n ACTIVE - The index is ready for use.

      \n
    • \n
    \n
  • \n
  • \n

    \n ItemCount - The number of items in the global secondary index.\n DynamoDB updates this value approximately every six hours. Recent changes might\n not be reflected in this value.

    \n
  • \n
  • \n

    \n KeySchema - Specifies the complete index key schema. The attribute\n names in the key schema must be between 1 and 255 characters (inclusive). The\n key schema must begin with the same partition key as the table.

    \n
  • \n
  • \n

    \n Projection - Specifies attributes that are copied (projected) from\n the table into the index. These are in addition to the primary key attributes\n and index key attributes, which are automatically projected. Each attribute\n specification is composed of:

    \n
      \n
    • \n

      \n ProjectionType - One of the following:

      \n
        \n
      • \n

        \n KEYS_ONLY - Only the index and primary keys are\n projected into the index.

        \n
      • \n
      • \n

        \n INCLUDE - In addition to the attributes described\n in KEYS_ONLY, the secondary index will include\n other non-key attributes that you specify.

        \n
      • \n
      • \n

        \n ALL - All of the table attributes are projected\n into the index.

        \n
      • \n
      \n
    • \n
    • \n

      \n NonKeyAttributes - A list of one or more non-key attribute\n names that are projected into the secondary index. The total count of\n attributes provided in NonKeyAttributes, summed across all\n of the secondary indexes, must not exceed 100. If you project the same\n attribute into two different indexes, this counts as two distinct\n attributes when determining the total.

      \n
    • \n
    \n
  • \n
  • \n

    \n ProvisionedThroughput - The provisioned throughput settings for the\n global secondary index, consisting of read and write capacity units, along with\n data about increases and decreases.

    \n
  • \n
\n

If the table is in the DELETING state, no information about indexes will\n be returned.

" - } - }, - "StreamSpecification": { - "target": "com.amazonaws.dynamodb#StreamSpecification", - "traits": { - "smithy.api#documentation": "

The current DynamoDB Streams configuration for the table.

" - } - }, - "LatestStreamLabel": { - "target": "com.amazonaws.dynamodb#String", - "traits": { - "smithy.api#documentation": "

A timestamp, in ISO 8601 format, for this stream.

\n\n

Note that LatestStreamLabel is not a unique identifier for the stream,\n because it is possible that a stream from another table might have the same timestamp.\n However, the combination of the following three elements is guaranteed to be\n unique:

\n
    \n
  • \n

    Amazon Web Services customer ID

    \n
  • \n
  • \n

    Table name

    \n
  • \n
  • \n

    \n StreamLabel\n

    \n
  • \n
" - } - }, - "LatestStreamArn": { - "target": "com.amazonaws.dynamodb#StreamArn", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) that uniquely identifies the latest stream for this\n table.

" - } - }, - "GlobalTableVersion": { - "target": "com.amazonaws.dynamodb#String", - "traits": { - "smithy.api#documentation": "

Represents the version of global tables\n in use, if the table is replicated across Amazon Web Services Regions.

" - } - }, - "Replicas": { - "target": "com.amazonaws.dynamodb#ReplicaDescriptionList", - "traits": { - "smithy.api#documentation": "

Represents replicas of the table.

" - } - }, - "RestoreSummary": { - "target": "com.amazonaws.dynamodb#RestoreSummary", - "traits": { - "smithy.api#documentation": "

Contains details for the restore.

" - } - }, - "SSEDescription": { - "target": "com.amazonaws.dynamodb#SSEDescription", - "traits": { - "smithy.api#documentation": "

The description of the server-side encryption status on the specified table.

" - } - }, - "ArchivalSummary": { - "target": "com.amazonaws.dynamodb#ArchivalSummary", - "traits": { - "smithy.api#documentation": "

Contains information about the table archive.

" - } - }, - "TableClassSummary": { - "target": "com.amazonaws.dynamodb#TableClassSummary", - "traits": { - "smithy.api#documentation": "

Contains details of the table class.

" - } - } - }, + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", "traits": { - "smithy.api#documentation": "

Represents the properties of a table.

" + "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression.

" } - }, - "com.amazonaws.dynamodb#TableId": { - "type": "string", + }, + "ExpressionAttributeValues": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", "traits": { - "smithy.api#pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" + "smithy.api#documentation": "

One or more values that can be substituted in an expression.

" } - }, - "com.amazonaws.dynamodb#TableInUseException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "ReturnValuesOnConditionCheckFailure": { + "target": "com.amazonaws.dynamodb#ReturnValuesOnConditionCheckFailure", "traits": { - "smithy.api#documentation": "

A target table with the specified name is either being created or deleted.\n

", - "smithy.api#error": "client" + "smithy.api#documentation": "

Use ReturnValuesOnConditionCheckFailure to get the item attributes if the\n Update condition fails. For\n ReturnValuesOnConditionCheckFailure, the valid values are: NONE,\n ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW.

" } + } }, - "com.amazonaws.dynamodb#TableName": { - "type": "string", + "traits": { + "smithy.api#documentation": "

Represents a request to perform an UpdateItem operation.

" + } + }, + "com.amazonaws.dynamodb#UpdateContinuousBackups": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#UpdateContinuousBackupsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#UpdateContinuousBackupsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#ContinuousBackupsUnavailableException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#TableNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

\n UpdateContinuousBackups enables or disables point in time recovery for\n the specified table. A successful UpdateContinuousBackups call returns the\n current ContinuousBackupsDescription. Continuous backups are\n ENABLED on all tables at table creation. If point in time recovery is\n enabled, PointInTimeRecoveryStatus will be set to ENABLED.

\n

Once continuous backups and point in time recovery are enabled, you can restore to\n any point in time within EarliestRestorableDateTime and\n LatestRestorableDateTime.

\n

\n LatestRestorableDateTime is typically 5 minutes before the current time.\n You can restore your table to any point in time during the last 35 days.

" + } + }, + "com.amazonaws.dynamodb#UpdateContinuousBackupsInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#length": { - "min": 3, - "max": 255 - }, - "smithy.api#pattern": "^[a-zA-Z0-9_.-]+$" + "smithy.api#documentation": "

The name of the table.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TableNameList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#TableName" + }, + "PointInTimeRecoverySpecification": { + "target": "com.amazonaws.dynamodb#PointInTimeRecoverySpecification", + "traits": { + "smithy.api#documentation": "

Represents the settings used to enable point in time recovery.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TableNotFoundException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + } + } + }, + "com.amazonaws.dynamodb#UpdateContinuousBackupsOutput": { + "type": "structure", + "members": { + "ContinuousBackupsDescription": { + "target": "com.amazonaws.dynamodb#ContinuousBackupsDescription", "traits": { - "smithy.api#documentation": "

A source table with the name TableName does not currently exist within\n the subscriber's account or the subscriber is operating in the wrong Amazon Web Services Region.

", - "smithy.api#error": "client" - } - }, - "com.amazonaws.dynamodb#TableStatus": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "CREATING", - "name": "CREATING" - }, - { - "value": "UPDATING", - "name": "UPDATING" - }, - { - "value": "DELETING", - "name": "DELETING" - }, - { - "value": "ACTIVE", - "name": "ACTIVE" - }, - { - "value": "INACCESSIBLE_ENCRYPTION_CREDENTIALS", - "name": "INACCESSIBLE_ENCRYPTION_CREDENTIALS" - }, - { - "value": "ARCHIVING", - "name": "ARCHIVING" - }, - { - "value": "ARCHIVED", - "name": "ARCHIVED" - } - ] + "smithy.api#documentation": "

Represents the continuous backups and point in time recovery settings on the\n table.

" } - }, - "com.amazonaws.dynamodb#Tag": { - "type": "structure", - "members": { - "Key": { - "target": "com.amazonaws.dynamodb#TagKeyString", - "traits": { - "smithy.api#documentation": "

The key of the tag. Tag keys are case sensitive. Each DynamoDB table can\n only have up to one tag with the same key. If you try to add an existing tag (same key),\n the existing tag value will be updated to the new value.

", - "smithy.api#required": {} - } - }, - "Value": { - "target": "com.amazonaws.dynamodb#TagValueString", - "traits": { - "smithy.api#documentation": "

The value of the tag. Tag values are case-sensitive and can be null.

", - "smithy.api#required": {} - } - } - }, + } + } + }, + "com.amazonaws.dynamodb#UpdateContributorInsights": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#UpdateContributorInsightsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#UpdateContributorInsightsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Updates the status for contributor insights for a specific table or index. CloudWatch\n Contributor Insights for DynamoDB graphs display the partition key and (if applicable)\n sort key of frequently accessed items and frequently throttled items in plaintext. If\n you require the use of Amazon Web Services Key Management Service (KMS) to encrypt this\n table’s partition key and sort key data with an Amazon Web Services managed key or\n customer managed key, you should not enable CloudWatch Contributor Insights for DynamoDB\n for this table.

" + } + }, + "com.amazonaws.dynamodb#UpdateContributorInsightsInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

Describes a tag. A tag is a key-value pair. You can add up to 50 tags to a single\n DynamoDB table.

\n

Amazon Web Services-assigned tag names and values are automatically assigned the\n aws: prefix, which the user cannot assign. Amazon Web Services-assigned\n tag names do not count towards the tag limit of 50. User-assigned tag names have the\n prefix user: in the Cost Allocation Report. You cannot backdate the\n application of a tag.

\n

For an overview on tagging DynamoDB resources, see Tagging\n for DynamoDB in the Amazon DynamoDB Developer\n Guide.

" + "smithy.api#documentation": "

The name of the table.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TagKeyList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#TagKeyString" + }, + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The global secondary index name, if applicable.

" } - }, - "com.amazonaws.dynamodb#TagKeyString": { - "type": "string", + }, + "ContributorInsightsAction": { + "target": "com.amazonaws.dynamodb#ContributorInsightsAction", "traits": { - "smithy.api#length": { - "min": 1, - "max": 128 - } + "smithy.api#documentation": "

Represents the contributor insights action.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.dynamodb#UpdateContributorInsightsOutput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", + "traits": { + "smithy.api#documentation": "

The name of the table.

" } - }, - "com.amazonaws.dynamodb#TagList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#Tag" + }, + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index, if applicable.

" } - }, - "com.amazonaws.dynamodb#TagResource": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#TagResourceInput" - }, - "output": { - "target": "smithy.api#Unit" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceInUseException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "ContributorInsightsStatus": { + "target": "com.amazonaws.dynamodb#ContributorInsightsStatus", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Associate a set of tags with an Amazon DynamoDB resource. You can then activate these\n user-defined tags so that they appear on the Billing and Cost Management console for\n cost allocation tracking. You can call TagResource up to five times per second, per\n account.

\n

For an overview on tagging DynamoDB resources, see Tagging for DynamoDB\n in the Amazon DynamoDB Developer Guide.

" + "smithy.api#documentation": "

The status of contributor insights

" } - }, - "com.amazonaws.dynamodb#TagResourceInput": { - "type": "structure", - "members": { - "ResourceArn": { - "target": "com.amazonaws.dynamodb#ResourceArnString", - "traits": { - "smithy.api#documentation": "

Identifies the Amazon DynamoDB resource to which tags should be added. This value is\n an Amazon Resource Name (ARN).

", - "smithy.api#required": {} - } - }, - "Tags": { - "target": "com.amazonaws.dynamodb#TagList", - "traits": { - "smithy.api#documentation": "

The tags to be assigned to the Amazon DynamoDB resource.

", - "smithy.api#required": {} - } - } + } + } + }, + "com.amazonaws.dynamodb#UpdateExpression": { + "type": "string" + }, + "com.amazonaws.dynamodb#UpdateGlobalSecondaryIndexAction": { + "type": "structure", + "members": { + "IndexName": { + "target": "com.amazonaws.dynamodb#IndexName", + "traits": { + "smithy.api#documentation": "

The name of the global secondary index to be updated.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TagValueString": { - "type": "string", + }, + "ProvisionedThroughput": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughput", "traits": { - "smithy.api#length": { - "min": 0, - "max": 256 - } + "smithy.api#documentation": "

Represents the provisioned throughput settings for the specified global secondary\n index.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#TimeRangeLowerBound": { - "type": "timestamp" - }, - "com.amazonaws.dynamodb#TimeRangeUpperBound": { - "type": "timestamp" - }, - "com.amazonaws.dynamodb#TimeToLiveAttributeName": { - "type": "string", + "traits": { + "smithy.api#documentation": "

Represents the new provisioned throughput settings to be applied to a global secondary\n index.

" + } + }, + "com.amazonaws.dynamodb#UpdateGlobalTable": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#UpdateGlobalTableInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#UpdateGlobalTableOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#GlobalTableNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ReplicaAlreadyExistsException" + }, + { + "target": "com.amazonaws.dynamodb#ReplicaNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#TableNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Adds or removes replicas in the specified global table. The global table must already\n exist to be able to use this operation. Any replica to be added must be empty, have the\n same name as the global table, have the same key schema, have DynamoDB Streams enabled,\n and have the same provisioned and maximum write capacity units.

\n \n

Although you can use UpdateGlobalTable to add replicas and remove\n replicas in a single request, for simplicity we recommend that you issue separate\n requests for adding or removing replicas.

\n
\n

If global secondary indexes are specified, then the following conditions must also be\n met:

\n
    \n
  • \n

    The global secondary indexes must have the same name.

    \n
  • \n
  • \n

    The global secondary indexes must have the same hash key and sort key (if\n present).

    \n
  • \n
  • \n

    The global secondary indexes must have the same provisioned and maximum write\n capacity units.

    \n
  • \n
" + } + }, + "com.amazonaws.dynamodb#UpdateGlobalTableInput": { + "type": "structure", + "members": { + "GlobalTableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#length": { - "min": 1, - "max": 255 - } + "smithy.api#documentation": "

The global table name.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TimeToLiveDescription": { - "type": "structure", - "members": { - "TimeToLiveStatus": { - "target": "com.amazonaws.dynamodb#TimeToLiveStatus", - "traits": { - "smithy.api#documentation": "

The TTL status for the table.

" - } - }, - "AttributeName": { - "target": "com.amazonaws.dynamodb#TimeToLiveAttributeName", - "traits": { - "smithy.api#documentation": "

The name of the TTL attribute for items in the table.

" - } - } - }, + }, + "ReplicaUpdates": { + "target": "com.amazonaws.dynamodb#ReplicaUpdateList", "traits": { - "smithy.api#documentation": "

The description of the Time to Live (TTL) status on the specified table.

" + "smithy.api#documentation": "

A list of Regions that should be added or removed from the global table.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TimeToLiveEnabled": { - "type": "boolean", + } + } + }, + "com.amazonaws.dynamodb#UpdateGlobalTableOutput": { + "type": "structure", + "members": { + "GlobalTableDescription": { + "target": "com.amazonaws.dynamodb#GlobalTableDescription", "traits": { - "smithy.api#box": {} + "smithy.api#documentation": "

Contains the details of the global table.

" } - }, - "com.amazonaws.dynamodb#TimeToLiveSpecification": { - "type": "structure", - "members": { - "Enabled": { - "target": "com.amazonaws.dynamodb#TimeToLiveEnabled", - "traits": { - "smithy.api#documentation": "

Indicates whether TTL is to be enabled (true) or disabled (false) on the table.

", - "smithy.api#required": {} - } - }, - "AttributeName": { - "target": "com.amazonaws.dynamodb#TimeToLiveAttributeName", - "traits": { - "smithy.api#documentation": "

The name of the TTL attribute used to store the expiration time for items in the\n table.

", - "smithy.api#required": {} - } - } - }, + } + } + }, + "com.amazonaws.dynamodb#UpdateGlobalTableSettings": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#UpdateGlobalTableSettingsInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#UpdateGlobalTableSettingsOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#GlobalTableNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#IndexNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ReplicaNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceInUseException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Updates settings for a global table.

" + } + }, + "com.amazonaws.dynamodb#UpdateGlobalTableSettingsInput": { + "type": "structure", + "members": { + "GlobalTableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

Represents the settings used to enable or disable Time to Live (TTL) for the specified\n table.

" - } - }, - "com.amazonaws.dynamodb#TimeToLiveStatus": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "ENABLING", - "name": "ENABLING" - }, - { - "value": "DISABLING", - "name": "DISABLING" - }, - { - "value": "ENABLED", - "name": "ENABLED" - }, - { - "value": "DISABLED", - "name": "DISABLED" - } - ] + "smithy.api#documentation": "

The name of the global table

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TransactGetItem": { - "type": "structure", - "members": { - "Get": { - "target": "com.amazonaws.dynamodb#Get", - "traits": { - "smithy.api#documentation": "

Contains the primary key that identifies the item to get, together with the name of\n the table that contains the item, and optionally the specific attributes of the item to\n retrieve.

", - "smithy.api#required": {} - } - } - }, + }, + "GlobalTableBillingMode": { + "target": "com.amazonaws.dynamodb#BillingMode", "traits": { - "smithy.api#documentation": "

Specifies an item to be retrieved as part of the transaction.

" + "smithy.api#documentation": "

The billing mode of the global table. If GlobalTableBillingMode is not\n specified, the global table defaults to PROVISIONED capacity billing\n mode.

\n
    \n
  • \n

    \n PROVISIONED - We recommend using PROVISIONED for\n predictable workloads. PROVISIONED sets the billing mode to Provisioned Mode.

    \n
  • \n
  • \n

    \n PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST\n for unpredictable workloads. PAY_PER_REQUEST sets the billing mode\n to On-Demand Mode.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#TransactGetItemList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#TransactGetItem" - }, + }, + "GlobalTableProvisionedWriteCapacityUnits": { + "target": "com.amazonaws.dynamodb#PositiveLongObject", "traits": { - "smithy.api#length": { - "min": 1, - "max": 25 - } + "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException.\n

" } - }, - "com.amazonaws.dynamodb#TransactGetItems": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#TransactGetItemsInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#TransactGetItemsOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#TransactionCanceledException" - } - ], + }, + "GlobalTableProvisionedWriteCapacityAutoScalingSettingsUpdate": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

\n TransactGetItems is a synchronous operation that atomically retrieves\n multiple items from one or more tables (but not from indexes) in a single account and\n Region. A TransactGetItems call can contain up to 25\n TransactGetItem objects, each of which contains a Get\n structure that specifies an item to retrieve from a table in the account and Region. A\n call to TransactGetItems cannot retrieve items from tables in more than one\n Amazon Web Services account or Region. The aggregate size of the items in the\n transaction cannot exceed 4 MB.

\n

DynamoDB rejects the entire TransactGetItems request if any of\n the following is true:

\n
    \n
  • \n

    A conflicting operation is in the process of updating an item to be\n read.

    \n
  • \n
  • \n

    There is insufficient provisioned capacity for the transaction to be\n completed.

    \n
  • \n
  • \n

    There is a user error, such as an invalid data format.

    \n
  • \n
  • \n

    The aggregate size of the items in the transaction cannot exceed 4 MB.

    \n
  • \n
" + "smithy.api#documentation": "

Auto scaling settings for managing provisioned write capacity for the global\n table.

" } - }, - "com.amazonaws.dynamodb#TransactGetItemsInput": { - "type": "structure", - "members": { - "TransactItems": { - "target": "com.amazonaws.dynamodb#TransactGetItemList", - "traits": { - "smithy.api#documentation": "

An ordered array of up to 25 TransactGetItem objects, each of which\n contains a Get structure.

", - "smithy.api#required": {} - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity", - "traits": { - "smithy.api#documentation": "

A value of TOTAL causes consumed capacity information to be returned, and\n a value of NONE prevents that information from being returned. No other\n value is valid.

" - } - } + }, + "GlobalTableGlobalSecondaryIndexSettingsUpdate": { + "target": "com.amazonaws.dynamodb#GlobalTableGlobalSecondaryIndexSettingsUpdateList", + "traits": { + "smithy.api#documentation": "

Represents the settings of a global secondary index for a global table that will be\n modified.

" } - }, - "com.amazonaws.dynamodb#TransactGetItemsOutput": { - "type": "structure", - "members": { - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", - "traits": { - "smithy.api#documentation": "

If the ReturnConsumedCapacity value was TOTAL, this\n is an array of ConsumedCapacity objects, one for each table addressed by\n TransactGetItem objects in the TransactItems\n parameter. These ConsumedCapacity objects report the read-capacity units\n consumed by the TransactGetItems call in that table.

" - } - }, - "Responses": { - "target": "com.amazonaws.dynamodb#ItemResponseList", - "traits": { - "smithy.api#documentation": "

An ordered array of up to 25 ItemResponse objects, each of which\n corresponds to the TransactGetItem object in the same position in the\n TransactItems array. Each ItemResponse object\n contains a Map of the name-value pairs that are the projected attributes of the\n requested item.

\n

If a requested item could not be retrieved, the corresponding\n ItemResponse object is Null, or if the requested item has no projected\n attributes, the corresponding ItemResponse object is an empty Map.

" - } - } + }, + "ReplicaSettingsUpdate": { + "target": "com.amazonaws.dynamodb#ReplicaSettingsUpdateList", + "traits": { + "smithy.api#documentation": "

Represents the settings for a global table in a Region that will be modified.

" } - }, - "com.amazonaws.dynamodb#TransactWriteItem": { - "type": "structure", - "members": { - "ConditionCheck": { - "target": "com.amazonaws.dynamodb#ConditionCheck", - "traits": { - "smithy.api#documentation": "

A request to perform a check item operation.

" - } - }, - "Put": { - "target": "com.amazonaws.dynamodb#Put", - "traits": { - "smithy.api#documentation": "

A request to perform a PutItem operation.

" - } - }, - "Delete": { - "target": "com.amazonaws.dynamodb#Delete", - "traits": { - "smithy.api#documentation": "

A request to perform a DeleteItem operation.

" - } - }, - "Update": { - "target": "com.amazonaws.dynamodb#Update", - "traits": { - "smithy.api#documentation": "

A request to perform an UpdateItem operation.

" - } - } - }, + } + } + }, + "com.amazonaws.dynamodb#UpdateGlobalTableSettingsOutput": { + "type": "structure", + "members": { + "GlobalTableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

A list of requests that can perform update, put, delete, or check operations on\n multiple items in one or more tables atomically.

" + "smithy.api#documentation": "

The name of the global table.

" } - }, - "com.amazonaws.dynamodb#TransactWriteItemList": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#TransactWriteItem" - }, + }, + "ReplicaSettings": { + "target": "com.amazonaws.dynamodb#ReplicaSettingsDescriptionList", "traits": { - "smithy.api#length": { - "min": 1, - "max": 25 - } + "smithy.api#documentation": "

The Region-specific settings for the global table.

" } - }, - "com.amazonaws.dynamodb#TransactWriteItems": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#TransactWriteItemsInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#TransactWriteItemsOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#IdempotentParameterMismatchException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#TransactionCanceledException" - }, - { - "target": "com.amazonaws.dynamodb#TransactionInProgressException" - } - ], + } + } + }, + "com.amazonaws.dynamodb#UpdateItem": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#UpdateItemInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#UpdateItemOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#ConditionalCheckFailedException" + }, + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" + }, + { + "target": "com.amazonaws.dynamodb#RequestLimitExceeded" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + }, + { + "target": "com.amazonaws.dynamodb#TransactionConflictException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Edits an existing item's attributes, or adds a new item to the table if it does not\n already exist. You can put, delete, or add attribute values. You can also perform a\n conditional update on an existing item (insert a new attribute name-value pair if it\n doesn't exist, or replace an existing name-value pair if it has certain expected\n attribute values).

\n

You can also return the item's attribute values in the same UpdateItem\n operation using the ReturnValues parameter.

" + } + }, + "com.amazonaws.dynamodb#UpdateItemInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

\n TransactWriteItems is a synchronous write operation that groups up to 25\n action requests. These actions can target items in different tables, but not in\n different Amazon Web Services accounts or Regions, and no two actions can target the same\n item. For example, you cannot both ConditionCheck and Update\n the same item. The aggregate size of the items in the transaction cannot exceed 4\n MB.

\n\n

The actions are completed atomically so that either all of them succeed, or all of\n them fail. They are defined by the following objects:

\n\n
    \n
  • \n

    \n Put — Initiates a PutItem\n operation to write a new item. This structure specifies the primary key of the\n item to be written, the name of the table to write it in, an optional condition\n expression that must be satisfied for the write to succeed, a list of the item's\n attributes, and a field indicating whether to retrieve the item's attributes if\n the condition is not met.

    \n
  • \n
  • \n

    \n Update — Initiates an UpdateItem\n operation to update an existing item. This structure specifies the primary key\n of the item to be updated, the name of the table where it resides, an optional\n condition expression that must be satisfied for the update to succeed, an\n expression that defines one or more attributes to be updated, and a field\n indicating whether to retrieve the item's attributes if the condition is not\n met.

    \n
  • \n
  • \n

    \n Delete — Initiates a DeleteItem\n operation to delete an existing item. This structure specifies the primary key\n of the item to be deleted, the name of the table where it resides, an optional\n condition expression that must be satisfied for the deletion to succeed, and a\n field indicating whether to retrieve the item's attributes if the condition is\n not met.

    \n
  • \n
  • \n

    \n ConditionCheck — Applies a condition to an item\n that is not being modified by the transaction. This structure specifies the\n primary key of the item to be checked, the name of the table where it resides, a\n condition expression that must be satisfied for the transaction to succeed, and\n a field indicating whether to retrieve the item's attributes if the condition is\n not met.

    \n
  • \n
\n\n

DynamoDB rejects the entire TransactWriteItems request if any of the\n following is true:

\n
    \n
  • \n

    A condition in one of the condition expressions is not met.

    \n
  • \n
  • \n

    An ongoing operation is in the process of updating the same item.

    \n
  • \n
  • \n

    There is insufficient provisioned capacity for the transaction to be\n completed.

    \n
  • \n
  • \n

    An item size becomes too large (bigger than 400 KB), a local secondary index\n (LSI) becomes too large, or a similar validation error occurs because of changes\n made by the transaction.

    \n
  • \n
  • \n

    The aggregate size of the items in the transaction exceeds 4 MB.

    \n
  • \n
  • \n

    There is a user error, such as an invalid data format.

    \n
  • \n
" + "smithy.api#documentation": "

The name of the table containing the item to update.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TransactWriteItemsInput": { - "type": "structure", - "members": { - "TransactItems": { - "target": "com.amazonaws.dynamodb#TransactWriteItemList", - "traits": { - "smithy.api#documentation": "

An ordered array of up to 25 TransactWriteItem objects, each of which\n contains a ConditionCheck, Put, Update, or\n Delete object. These can operate on items in different tables, but the\n tables must reside in the same Amazon Web Services account and Region, and no two of them\n can operate on the same item.

", - "smithy.api#required": {} - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" - }, - "ReturnItemCollectionMetrics": { - "target": "com.amazonaws.dynamodb#ReturnItemCollectionMetrics", - "traits": { - "smithy.api#documentation": "

Determines whether item collection metrics are returned. If set to SIZE,\n the response includes statistics about item collections (if any), that were modified\n during the operation and are returned in the response. If set to NONE (the\n default), no statistics are returned.

" - } - }, - "ClientRequestToken": { - "target": "com.amazonaws.dynamodb#ClientRequestToken", - "traits": { - "smithy.api#documentation": "

Providing a ClientRequestToken makes the call to\n TransactWriteItems idempotent, meaning that multiple identical calls\n have the same effect as one single call.

\n

Although multiple identical calls using the same client request token produce the same\n result on the server (no side effects), the responses to the calls might not be the\n same. If the ReturnConsumedCapacity> parameter is set, then the initial\n TransactWriteItems call returns the amount of write capacity units\n consumed in making the changes. Subsequent TransactWriteItems calls with\n the same client token return the number of read capacity units consumed in reading the\n item.

\n

A client request token is valid for 10 minutes after the first request that uses it is\n completed. After 10 minutes, any request with the same client token is treated as a new\n request. Do not resubmit the same request with the same client token for more than 10\n minutes, or the result might not be idempotent.

\n

If you submit a request with the same client token but a change in other parameters\n within the 10-minute idempotency window, DynamoDB returns an\n IdempotentParameterMismatch exception.

", - "smithy.api#idempotencyToken": {} - } - } + }, + "Key": { + "target": "com.amazonaws.dynamodb#Key", + "traits": { + "smithy.api#documentation": "

The primary key of the item to be updated. Each element consists of an attribute name\n and a value for that attribute.

\n

For the primary key, you must provide all of the attributes. For example, with a\n simple primary key, you only need to provide a value for the partition key. For a\n composite primary key, you must provide values for both the partition key and the sort\n key.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#TransactWriteItemsOutput": { - "type": "structure", - "members": { - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacityMultiple", - "traits": { - "smithy.api#documentation": "

The capacity units consumed by the entire TransactWriteItems operation.\n The values of the list are ordered according to the ordering of the\n TransactItems request parameter.

" - } - }, - "ItemCollectionMetrics": { - "target": "com.amazonaws.dynamodb#ItemCollectionMetricsPerTable", - "traits": { - "smithy.api#documentation": "

A list of tables that were processed by TransactWriteItems and, for each\n table, information about any item collections that were affected by individual\n UpdateItem, PutItem, or DeleteItem\n operations.

" - } - } + }, + "AttributeUpdates": { + "target": "com.amazonaws.dynamodb#AttributeUpdates", + "traits": { + "smithy.api#documentation": "

This is a legacy parameter. Use UpdateExpression instead. For more\n information, see AttributeUpdates in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#TransactionCanceledException": { - "type": "structure", - "members": { - "Message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - }, - "CancellationReasons": { - "target": "com.amazonaws.dynamodb#CancellationReasonList", - "traits": { - "smithy.api#documentation": "

A list of cancellation reasons.

" - } - } - }, + }, + "Expected": { + "target": "com.amazonaws.dynamodb#ExpectedAttributeMap", "traits": { - "smithy.api#documentation": "

The entire transaction request was canceled.

\n

DynamoDB cancels a TransactWriteItems request under the following\n circumstances:

\n
    \n
  • \n

    A condition in one of the condition expressions is not met.

    \n
  • \n
  • \n

    A table in the TransactWriteItems request is in a different\n account or region.

    \n
  • \n
  • \n

    More than one action in the TransactWriteItems operation\n targets the same item.

    \n
  • \n
  • \n

    There is insufficient provisioned capacity for the transaction to be\n completed.

    \n
  • \n
  • \n

    An item size becomes too large (larger than 400 KB), or a local secondary\n index (LSI) becomes too large, or a similar validation error occurs because of\n changes made by the transaction.

    \n
  • \n
  • \n

    There is a user error, such as an invalid data format.

    \n
  • \n
\n\n

DynamoDB cancels a TransactGetItems request under the\n following circumstances:

\n
    \n
  • \n

    There is an ongoing TransactGetItems operation that conflicts\n with a concurrent PutItem, UpdateItem,\n DeleteItem or TransactWriteItems request. In this\n case the TransactGetItems operation fails with a\n TransactionCanceledException.

    \n
  • \n
  • \n

    A table in the TransactGetItems request is in a different\n account or region.

    \n
  • \n
  • \n

    There is insufficient provisioned capacity for the transaction to be\n completed.

    \n
  • \n
  • \n

    There is a user error, such as an invalid data format.

    \n
  • \n
\n\n \n

If using Java, DynamoDB lists the cancellation reasons on the\n CancellationReasons property. This property is not set for other\n languages. Transaction cancellation reasons are ordered in the order of requested\n items, if an item has no error it will have None code and\n Null message.

\n
\n

Cancellation reason codes and possible error messages:

\n
    \n
  • \n

    No Errors:

    \n
      \n
    • \n

      Code: None\n

      \n
    • \n
    • \n

      Message: null\n

      \n
    • \n
    \n
  • \n
  • \n

    Conditional Check Failed:

    \n
      \n
    • \n

      Code: ConditionalCheckFailed\n

      \n
    • \n
    • \n

      Message: The conditional request failed.

      \n
    • \n
    \n
  • \n
  • \n

    Item Collection Size Limit Exceeded:

    \n
      \n
    • \n

      Code: ItemCollectionSizeLimitExceeded\n

      \n
    • \n
    • \n

      Message: Collection size exceeded.

      \n
    • \n
    \n
  • \n
  • \n

    Transaction Conflict:

    \n
      \n
    • \n

      Code: TransactionConflict\n

      \n
    • \n
    • \n

      Message: Transaction is ongoing for the item.

      \n
    • \n
    \n
  • \n
  • \n

    Provisioned Throughput Exceeded:

    \n
      \n
    • \n

      Code: ProvisionedThroughputExceeded\n

      \n
    • \n
    • \n

      Messages:

      \n
        \n
      • \n

        The level of configured provisioned throughput for the\n table was exceeded. Consider increasing your provisioning level\n with the UpdateTable API.

        \n \n

        This Message is received when provisioned throughput is\n exceeded is on a provisioned DynamoDB\n table.

        \n
        \n
      • \n
      • \n

        The level of configured provisioned throughput for one or\n more global secondary indexes of the table was exceeded.\n Consider increasing your provisioning level for the\n under-provisioned global secondary indexes with the UpdateTable\n API.

        \n \n

        This message is returned when provisioned throughput is\n exceeded is on a provisioned GSI.

        \n
        \n
      • \n
      \n\n
    • \n
    \n
  • \n
  • \n

    Throttling Error:

    \n
      \n
    • \n

      Code: ThrottlingError\n

      \n
    • \n
    • \n

      Messages:

      \n
        \n
      • \n

        Throughput exceeds the current capacity of your table or\n index. DynamoDB is automatically scaling your table or\n index so please try again shortly. If exceptions persist, check\n if you have a hot key:\n https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/bp-partition-key-design.html.

        \n \n

        This message is returned when writes get throttled on an\n On-Demand table as DynamoDB is automatically\n scaling the table.

        \n
        \n
      • \n
      • \n

        Throughput exceeds the current capacity for one or more\n global secondary indexes. DynamoDB is automatically\n scaling your index so please try again shortly.

        \n \n

        This message is returned when when writes get throttled on\n an On-Demand GSI as DynamoDB is automatically\n scaling the GSI.

        \n
        \n
      • \n
      \n\n
    • \n
    \n
  • \n
  • \n

    Validation Error:

    \n
      \n
    • \n

      Code: ValidationError\n

      \n
    • \n
    • \n

      Messages:

      \n
        \n
      • \n

        One or more parameter values were invalid.

        \n
      • \n
      • \n

        The update expression attempted to update the secondary\n index key beyond allowed size limits.

        \n
      • \n
      • \n

        The update expression attempted to update the secondary\n index key to unsupported type.

        \n
      • \n
      • \n

        An operand in the update expression has an incorrect data\n type.

        \n
      • \n
      • \n

        Item size to update has exceeded the maximum allowed\n size.

        \n
      • \n
      • \n

        Number overflow. Attempting to store a number with\n magnitude larger than supported range.

        \n
      • \n
      • \n

        Type mismatch for attribute to update.

        \n
      • \n
      • \n

        Nesting Levels have exceeded supported limits.

        \n
      • \n
      • \n

        The document path provided in the update expression is\n invalid for update.

        \n
      • \n
      • \n

        The provided expression refers to an attribute that does\n not exist in the item.

        \n
      • \n
      \n\n
    • \n
    \n
  • \n
", - "smithy.api#error": "client" + "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see Expected in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#TransactionConflictException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "ConditionalOperator": { + "target": "com.amazonaws.dynamodb#ConditionalOperator", "traits": { - "smithy.api#documentation": "

Operation was rejected because there is an ongoing transaction for the\n item.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see ConditionalOperator in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#TransactionInProgressException": { - "type": "structure", - "members": { - "Message": { - "target": "com.amazonaws.dynamodb#ErrorMessage" - } - }, + }, + "ReturnValues": { + "target": "com.amazonaws.dynamodb#ReturnValue", "traits": { - "smithy.api#documentation": "

The transaction with the given request token is already in progress.

", - "smithy.api#error": "client" + "smithy.api#documentation": "

Use ReturnValues if you want to get the item attributes as they appear\n before or after they are updated. For UpdateItem, the valid values\n are:

\n
    \n
  • \n

    \n NONE - If ReturnValues is not specified, or if its\n value is NONE, then nothing is returned. (This setting is the\n default for ReturnValues.)

    \n
  • \n
  • \n

    \n ALL_OLD - Returns all of the attributes of the item, as they\n appeared before the UpdateItem operation.

    \n
  • \n
  • \n

    \n UPDATED_OLD - Returns only the updated attributes, as they appeared\n before the UpdateItem operation.

    \n
  • \n
  • \n

    \n ALL_NEW - Returns all of the attributes of the item, as they appear\n after the UpdateItem operation.

    \n
  • \n
  • \n

    \n UPDATED_NEW - Returns only the updated attributes, as they appear\n after the UpdateItem operation.

    \n
  • \n
\n

There is no additional cost associated with requesting a return value aside from the\n small network and processing overhead of receiving a larger response. No read capacity\n units are consumed.

\n

The values returned are strongly consistent.

" } - }, - "com.amazonaws.dynamodb#UntagResource": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#UntagResourceInput" - }, - "output": { - "target": "smithy.api#Unit" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceInUseException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "ReturnConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" + }, + "ReturnItemCollectionMetrics": { + "target": "com.amazonaws.dynamodb#ReturnItemCollectionMetrics", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Removes the association of tags from an Amazon DynamoDB resource. You can call\n UntagResource up to five times per second, per account.

\n

For an overview on tagging DynamoDB resources, see Tagging for DynamoDB\n in the Amazon DynamoDB Developer Guide.

" + "smithy.api#documentation": "

Determines whether item collection metrics are returned. If set to SIZE,\n the response includes statistics about item collections, if any, that were modified\n during the operation are returned in the response. If set to NONE (the\n default), no statistics are returned.

" } - }, - "com.amazonaws.dynamodb#UntagResourceInput": { - "type": "structure", - "members": { - "ResourceArn": { - "target": "com.amazonaws.dynamodb#ResourceArnString", - "traits": { - "smithy.api#documentation": "

The DynamoDB resource that the tags will be removed from. This value is an Amazon\n Resource Name (ARN).

", - "smithy.api#required": {} - } - }, - "TagKeys": { - "target": "com.amazonaws.dynamodb#TagKeyList", - "traits": { - "smithy.api#documentation": "

A list of tag keys. Existing tags of the resource whose keys are members of this list\n will be removed from the DynamoDB resource.

", - "smithy.api#required": {} - } - } + }, + "UpdateExpression": { + "target": "com.amazonaws.dynamodb#UpdateExpression", + "traits": { + "smithy.api#documentation": "

An expression that defines one or more attributes to be updated, the action to be\n performed on them, and new values for them.

\n

The following action values are available for UpdateExpression.

\n
    \n
  • \n

    \n SET - Adds one or more attributes and values to an item. If any of\n these attributes already exist, they are replaced by the new values. You can\n also use SET to add or subtract from an attribute that is of type\n Number. For example: SET myNum = myNum + :val\n

    \n

    \n SET supports the following functions:

    \n
      \n
    • \n

      \n if_not_exists (path, operand) - if the item does not\n contain an attribute at the specified path, then\n if_not_exists evaluates to operand; otherwise, it\n evaluates to path. You can use this function to avoid overwriting an\n attribute that may already be present in the item.

      \n
    • \n
    • \n

      \n list_append (operand, operand) - evaluates to a list with a\n new element added to it. You can append the new element to the start or\n the end of the list by reversing the order of the operands.

      \n
    • \n
    \n

    These function names are case-sensitive.

    \n
  • \n
  • \n

    \n REMOVE - Removes one or more attributes from an item.

    \n
  • \n
  • \n

    \n ADD - Adds the specified value to the item, if the attribute does\n not already exist. If the attribute does exist, then the behavior of\n ADD depends on the data type of the attribute:

    \n
      \n
    • \n

      If the existing attribute is a number, and if Value is\n also a number, then Value is mathematically added to the\n existing attribute. If Value is a negative number, then it\n is subtracted from the existing attribute.

      \n \n

      If you use ADD to increment or decrement a number\n value for an item that doesn't exist before the update, DynamoDB\n uses 0 as the initial value.

      \n

      Similarly, if you use ADD for an existing item to\n increment or decrement an attribute value that doesn't exist before\n the update, DynamoDB uses 0 as the initial value. For\n example, suppose that the item you want to update doesn't have an\n attribute named itemcount, but you decide to\n ADD the number 3 to this attribute\n anyway. DynamoDB will create the itemcount attribute,\n set its initial value to 0, and finally add\n 3 to it. The result will be a new\n itemcount attribute in the item, with a value of\n 3.

      \n
      \n
    • \n
    • \n

      If the existing data type is a set and if Value is also a\n set, then Value is added to the existing set. For example,\n if the attribute value is the set [1,2], and the\n ADD action specified [3], then the final\n attribute value is [1,2,3]. An error occurs if an\n ADD action is specified for a set attribute and the\n attribute type specified does not match the existing set type.

      \n

      Both sets must have the same primitive data type. For example, if the\n existing data type is a set of strings, the Value must also\n be a set of strings.

      \n
    • \n
    \n \n

    The ADD action only supports Number and set data types. In\n addition, ADD can only be used on top-level attributes, not\n nested attributes.

    \n
    \n
  • \n
  • \n

    \n DELETE - Deletes an element from a set.

    \n

    If a set of values is specified, then those values are subtracted from the old\n set. For example, if the attribute value was the set [a,b,c] and\n the DELETE action specifies [a,c], then the final\n attribute value is [b]. Specifying an empty set is an error.

    \n \n

    The DELETE action only supports set data types. In addition,\n DELETE can only be used on top-level attributes, not nested\n attributes.

    \n
    \n\n
  • \n
\n

You can have many actions in a single expression, such as the following: SET\n a=:value1, b=:value2 DELETE :value3, :value4, :value5\n

\n

For more information on update expressions, see Modifying\n Items and Attributes in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#Update": { - "type": "structure", - "members": { - "Key": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

The primary key of the item to be updated. Each element consists of an attribute name\n and a value for that attribute.

", - "smithy.api#required": {} - } - }, - "UpdateExpression": { - "target": "com.amazonaws.dynamodb#UpdateExpression", - "traits": { - "smithy.api#documentation": "

An expression that defines one or more attributes to be updated, the action to be\n performed on them, and new value(s) for them.

", - "smithy.api#required": {} - } - }, - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

Name of the table for the UpdateItem request.

", - "smithy.api#required": {} - } - }, - "ConditionExpression": { - "target": "com.amazonaws.dynamodb#ConditionExpression", - "traits": { - "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional update to\n succeed.

" - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression.

" - } - }, - "ExpressionAttributeValues": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", - "traits": { - "smithy.api#documentation": "

One or more values that can be substituted in an expression.

" - } - }, - "ReturnValuesOnConditionCheckFailure": { - "target": "com.amazonaws.dynamodb#ReturnValuesOnConditionCheckFailure", - "traits": { - "smithy.api#documentation": "

Use ReturnValuesOnConditionCheckFailure to get the item attributes if the\n Update condition fails. For\n ReturnValuesOnConditionCheckFailure, the valid values are: NONE,\n ALL_OLD, UPDATED_OLD, ALL_NEW, UPDATED_NEW.

" - } - } - }, + }, + "ConditionExpression": { + "target": "com.amazonaws.dynamodb#ConditionExpression", "traits": { - "smithy.api#documentation": "

Represents a request to perform an UpdateItem operation.

" + "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional update to\n succeed.

\n

An expression can contain any of the following:

\n
    \n
  • \n

    Functions: attribute_exists | attribute_not_exists | attribute_type |\n contains | begins_with | size\n

    \n

    These function names are case-sensitive.

    \n
  • \n
  • \n

    Comparison operators: = | <> |\n < | > | <= | >= |\n BETWEEN | IN \n

    \n
  • \n
  • \n

    Logical operators: AND | OR | NOT\n

    \n
  • \n
\n

For more information about condition expressions, see Specifying Conditions in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#UpdateContinuousBackups": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#UpdateContinuousBackupsInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#UpdateContinuousBackupsOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#ContinuousBackupsUnavailableException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#TableNotFoundException" - } - ], + }, + "ExpressionAttributeNames": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

\n UpdateContinuousBackups enables or disables point in time recovery for\n the specified table. A successful UpdateContinuousBackups call returns the\n current ContinuousBackupsDescription. Continuous backups are\n ENABLED on all tables at table creation. If point in time recovery is\n enabled, PointInTimeRecoveryStatus will be set to ENABLED.

\n

Once continuous backups and point in time recovery are enabled, you can restore to\n any point in time within EarliestRestorableDateTime and\n LatestRestorableDateTime.

\n

\n LatestRestorableDateTime is typically 5 minutes before the current time.\n You can restore your table to any point in time during the last 35 days.

" + "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide.) To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information about expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#UpdateContinuousBackupsInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table.

", - "smithy.api#required": {} - } - }, - "PointInTimeRecoverySpecification": { - "target": "com.amazonaws.dynamodb#PointInTimeRecoverySpecification", - "traits": { - "smithy.api#documentation": "

Represents the settings used to enable point in time recovery.

", - "smithy.api#required": {} - } - } + }, + "ExpressionAttributeValues": { + "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", + "traits": { + "smithy.api#documentation": "

One or more values that can be substituted in an expression.

\n

Use the : (colon) character in an expression to\n dereference an attribute value. For example, suppose that you wanted to check whether\n the value of the ProductStatus attribute was one of the following:

\n

\n Available | Backordered | Discontinued\n

\n

You would first need to specify ExpressionAttributeValues as\n follows:

\n

\n { \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"},\n \":disc\":{\"S\":\"Discontinued\"} }\n

\n

You could then use these values in an expression, such as this:

\n

\n ProductStatus IN (:avail, :back, :disc)\n

\n

For more information on expression attribute values, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" } + } }, - "com.amazonaws.dynamodb#UpdateContinuousBackupsOutput": { - "type": "structure", - "members": { - "ContinuousBackupsDescription": { - "target": "com.amazonaws.dynamodb#ContinuousBackupsDescription", - "traits": { - "smithy.api#documentation": "

Represents the continuous backups and point in time recovery settings on the\n table.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents the input of an UpdateItem operation.

" + } + }, + "com.amazonaws.dynamodb#UpdateItemOutput": { + "type": "structure", + "members": { + "Attributes": { + "target": "com.amazonaws.dynamodb#AttributeMap", + "traits": { + "smithy.api#documentation": "

A map of attribute values as they appear before or after the UpdateItem\n operation, as determined by the ReturnValues parameter.

\n

The Attributes map is only present if ReturnValues was\n specified as something other than NONE in the request. Each element\n represents one attribute.

" } - }, - "com.amazonaws.dynamodb#UpdateContributorInsights": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#UpdateContributorInsightsInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#UpdateContributorInsightsOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "ConsumedCapacity": { + "target": "com.amazonaws.dynamodb#ConsumedCapacity", "traits": { - "smithy.api#documentation": "

Updates the status for contributor insights for a specific table or index. CloudWatch\n Contributor Insights for DynamoDB graphs display the partition key and (if applicable)\n sort key of frequently accessed items and frequently throttled items in plaintext. If\n you require the use of Amazon Web Services Key Management Service (KMS) to encrypt this\n table’s partition key and sort key data with an Amazon Web Services managed key or\n customer managed key, you should not enable CloudWatch Contributor Insights for DynamoDB\n for this table.

" + "smithy.api#documentation": "

The capacity units consumed by the UpdateItem operation. The data\n returned includes the total provisioned throughput consumed, along with statistics for\n the table and any indexes involved in the operation. ConsumedCapacity is\n only returned if the ReturnConsumedCapacity parameter was specified. For\n more information, see Provisioned Throughput in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#UpdateContributorInsightsInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table.

", - "smithy.api#required": {} - } - }, - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The global secondary index name, if applicable.

" - } - }, - "ContributorInsightsAction": { - "target": "com.amazonaws.dynamodb#ContributorInsightsAction", - "traits": { - "smithy.api#documentation": "

Represents the contributor insights action.

", - "smithy.api#required": {} - } - } + }, + "ItemCollectionMetrics": { + "target": "com.amazonaws.dynamodb#ItemCollectionMetrics", + "traits": { + "smithy.api#documentation": "

Information about item collections, if any, that were affected by the\n UpdateItem operation. ItemCollectionMetrics is only\n returned if the ReturnItemCollectionMetrics parameter was specified. If the\n table does not have any local secondary indexes, this information is not returned in the\n response.

\n

Each ItemCollectionMetrics element consists of:

\n
    \n
  • \n

    \n ItemCollectionKey - The partition key value of the item collection.\n This is the same as the partition key value of the item itself.

    \n
  • \n
  • \n

    \n SizeEstimateRangeGB - An estimate of item collection size, in\n gigabytes. This value is a two-element array containing a lower bound and an\n upper bound for the estimate. The estimate includes the size of all the items in\n the table, plus the size of all attributes projected into all of the local\n secondary indexes on that table. Use this estimate to measure whether a local\n secondary index is approaching its size limit.

    \n

    The estimate is subject to change over time; therefore, do not rely on the\n precision or accuracy of the estimate.

    \n
  • \n
" } + } }, - "com.amazonaws.dynamodb#UpdateContributorInsightsOutput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table.

" - } - }, - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index, if applicable.

" - } - }, - "ContributorInsightsStatus": { - "target": "com.amazonaws.dynamodb#ContributorInsightsStatus", - "traits": { - "smithy.api#documentation": "

The status of contributor insights

" - } - } + "traits": { + "smithy.api#documentation": "

Represents the output of an UpdateItem operation.

" + } + }, + "com.amazonaws.dynamodb#UpdateReplicationGroupMemberAction": { + "type": "structure", + "members": { + "RegionName": { + "target": "com.amazonaws.dynamodb#RegionName", + "traits": { + "smithy.api#documentation": "

The Region where the replica exists.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#UpdateExpression": { - "type": "string" - }, - "com.amazonaws.dynamodb#UpdateGlobalSecondaryIndexAction": { - "type": "structure", - "members": { - "IndexName": { - "target": "com.amazonaws.dynamodb#IndexName", - "traits": { - "smithy.api#documentation": "

The name of the global secondary index to be updated.

", - "smithy.api#required": {} - } - }, - "ProvisionedThroughput": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughput", - "traits": { - "smithy.api#documentation": "

Represents the provisioned throughput settings for the specified global secondary\n index.

\n

For current minimum and maximum provisioned throughput values, see Service,\n Account, and Table Quotas in the Amazon DynamoDB Developer\n Guide.

", - "smithy.api#required": {} - } - } - }, + }, + "KMSMasterKeyId": { + "target": "com.amazonaws.dynamodb#KMSMasterKeyId", + "traits": { + "smithy.api#documentation": "

The KMS key of the replica that should be used\n for KMS encryption. To specify a key, use its key ID, Amazon Resource\n Name (ARN), alias name, or alias ARN. Note that you should only provide this parameter\n if the key is different from the default DynamoDB KMS key\n alias/aws/dynamodb.

" + } + }, + "ProvisionedThroughputOverride": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughputOverride", "traits": { - "smithy.api#documentation": "

Represents the new provisioned throughput settings to be applied to a global secondary\n index.

" + "smithy.api#documentation": "

Replica-specific provisioned throughput. If not specified, uses the source table's\n provisioned throughput settings.

" } - }, - "com.amazonaws.dynamodb#UpdateGlobalTable": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#UpdateGlobalTableInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#UpdateGlobalTableOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#GlobalTableNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ReplicaAlreadyExistsException" - }, - { - "target": "com.amazonaws.dynamodb#ReplicaNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#TableNotFoundException" - } - ], + }, + "GlobalSecondaryIndexes": { + "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexList", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Adds or removes replicas in the specified global table. The global table must already\n exist to be able to use this operation. Any replica to be added must be empty, have the\n same name as the global table, have the same key schema, have DynamoDB Streams enabled,\n and have the same provisioned and maximum write capacity units.

\n \n

Although you can use UpdateGlobalTable to add replicas and remove\n replicas in a single request, for simplicity we recommend that you issue separate\n requests for adding or removing replicas.

\n
\n

If global secondary indexes are specified, then the following conditions must also be\n met:

\n
    \n
  • \n

    The global secondary indexes must have the same name.

    \n
  • \n
  • \n

    The global secondary indexes must have the same hash key and sort key (if\n present).

    \n
  • \n
  • \n

    The global secondary indexes must have the same provisioned and maximum write\n capacity units.

    \n
  • \n
" + "smithy.api#documentation": "

Replica-specific global secondary index settings.

" } - }, - "com.amazonaws.dynamodb#UpdateGlobalTableInput": { - "type": "structure", - "members": { - "GlobalTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The global table name.

", - "smithy.api#required": {} - } - }, - "ReplicaUpdates": { - "target": "com.amazonaws.dynamodb#ReplicaUpdateList", - "traits": { - "smithy.api#documentation": "

A list of Regions that should be added or removed from the global table.

", - "smithy.api#required": {} - } - } + }, + "TableClassOverride": { + "target": "com.amazonaws.dynamodb#TableClass", + "traits": { + "smithy.api#documentation": "

Replica-specific table class. If not specified, uses the source table's\n table class.

" } + } }, - "com.amazonaws.dynamodb#UpdateGlobalTableOutput": { - "type": "structure", - "members": { - "GlobalTableDescription": { - "target": "com.amazonaws.dynamodb#GlobalTableDescription", - "traits": { - "smithy.api#documentation": "

Contains the details of the global table.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents a replica to be modified.

" + } + }, + "com.amazonaws.dynamodb#UpdateTable": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#UpdateTableInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#UpdateTableOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceInUseException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB\n Streams settings for a given table.

\n

You can only perform one of the following operations at once:

\n
    \n
  • \n

    Modify the provisioned throughput settings of the table.

    \n
  • \n
  • \n

    Remove a global secondary index from the table.

    \n
  • \n
  • \n

    Create a new global secondary index on the table. After the index begins\n backfilling, you can use UpdateTable to perform other\n operations.

    \n
  • \n
\n

\n UpdateTable is an asynchronous operation; while it is executing, the table\n status changes from ACTIVE to UPDATING. While it is\n UPDATING, you cannot issue another UpdateTable request.\n When the table returns to the ACTIVE state, the UpdateTable\n operation is complete.

" + } + }, + "com.amazonaws.dynamodb#UpdateTableInput": { + "type": "structure", + "members": { + "AttributeDefinitions": { + "target": "com.amazonaws.dynamodb#AttributeDefinitions", + "traits": { + "smithy.api#documentation": "

An array of attributes that describe the key schema for the table and indexes. If you\n are adding a new global secondary index to the table, AttributeDefinitions\n must include the key element(s) of the new index.

" } - }, - "com.amazonaws.dynamodb#UpdateGlobalTableSettings": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#UpdateGlobalTableSettingsInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#UpdateGlobalTableSettingsOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#GlobalTableNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#IndexNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ReplicaNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceInUseException" - } - ], + }, + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Updates settings for a global table.

" + "smithy.api#documentation": "

The name of the table to be updated.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#UpdateGlobalTableSettingsInput": { - "type": "structure", - "members": { - "GlobalTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the global table

", - "smithy.api#required": {} - } - }, - "GlobalTableBillingMode": { - "target": "com.amazonaws.dynamodb#BillingMode", - "traits": { - "smithy.api#documentation": "

The billing mode of the global table. If GlobalTableBillingMode is not\n specified, the global table defaults to PROVISIONED capacity billing\n mode.

\n
    \n
  • \n

    \n PROVISIONED - We recommend using PROVISIONED for\n predictable workloads. PROVISIONED sets the billing mode to Provisioned Mode.

    \n
  • \n
  • \n

    \n PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST\n for unpredictable workloads. PAY_PER_REQUEST sets the billing mode\n to On-Demand Mode.

    \n
  • \n
" - } - }, - "GlobalTableProvisionedWriteCapacityUnits": { - "target": "com.amazonaws.dynamodb#PositiveLongObject", - "traits": { - "smithy.api#documentation": "

The maximum number of writes consumed per second before DynamoDB returns a\n ThrottlingException.\n

" - } - }, - "GlobalTableProvisionedWriteCapacityAutoScalingSettingsUpdate": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate", - "traits": { - "smithy.api#documentation": "

Auto scaling settings for managing provisioned write capacity for the global\n table.

" - } - }, - "GlobalTableGlobalSecondaryIndexSettingsUpdate": { - "target": "com.amazonaws.dynamodb#GlobalTableGlobalSecondaryIndexSettingsUpdateList", - "traits": { - "smithy.api#documentation": "

Represents the settings of a global secondary index for a global table that will be\n modified.

" - } - }, - "ReplicaSettingsUpdate": { - "target": "com.amazonaws.dynamodb#ReplicaSettingsUpdateList", - "traits": { - "smithy.api#documentation": "

Represents the settings for a global table in a Region that will be modified.

" - } - } + }, + "BillingMode": { + "target": "com.amazonaws.dynamodb#BillingMode", + "traits": { + "smithy.api#documentation": "

Controls how you are charged for read and write throughput and how you manage\n capacity. When switching from pay-per-request to provisioned capacity, initial\n provisioned capacity values must be set. The initial provisioned capacity values are\n estimated based on the consumed read and write capacity of your table and global\n secondary indexes over the past 30 minutes.

\n
    \n
  • \n

    \n PROVISIONED - We recommend using PROVISIONED for\n predictable workloads. PROVISIONED sets the billing mode to Provisioned Mode.

    \n
  • \n
  • \n

    \n PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST\n for unpredictable workloads. PAY_PER_REQUEST sets the billing mode\n to On-Demand Mode.

    \n
  • \n
" } - }, - "com.amazonaws.dynamodb#UpdateGlobalTableSettingsOutput": { - "type": "structure", - "members": { - "GlobalTableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the global table.

" - } - }, - "ReplicaSettings": { - "target": "com.amazonaws.dynamodb#ReplicaSettingsDescriptionList", - "traits": { - "smithy.api#documentation": "

The Region-specific settings for the global table.

" - } - } + }, + "ProvisionedThroughput": { + "target": "com.amazonaws.dynamodb#ProvisionedThroughput", + "traits": { + "smithy.api#documentation": "

The new provisioned throughput settings for the specified table or index.

" } - }, - "com.amazonaws.dynamodb#UpdateItem": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#UpdateItemInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#UpdateItemOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#ConditionalCheckFailedException" - }, - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#ItemCollectionSizeLimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputExceededException" - }, - { - "target": "com.amazonaws.dynamodb#RequestLimitExceeded" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - }, - { - "target": "com.amazonaws.dynamodb#TransactionConflictException" - } - ], + }, + "GlobalSecondaryIndexUpdates": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexUpdateList", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Edits an existing item's attributes, or adds a new item to the table if it does not\n already exist. You can put, delete, or add attribute values. You can also perform a\n conditional update on an existing item (insert a new attribute name-value pair if it\n doesn't exist, or replace an existing name-value pair if it has certain expected\n attribute values).

\n

You can also return the item's attribute values in the same UpdateItem\n operation using the ReturnValues parameter.

" + "smithy.api#documentation": "

An array of one or more global secondary indexes for the table. For each index in the\n array, you can request one action:

\n
    \n
  • \n

    \n Create - add a new global secondary index to the table.

    \n
  • \n
  • \n

    \n Update - modify the provisioned throughput settings of an existing\n global secondary index.

    \n
  • \n
  • \n

    \n Delete - remove a global secondary index from the table.

    \n
  • \n
\n

You can create or delete only one global secondary index per UpdateTable\n operation.

\n

For more information, see Managing Global\n Secondary Indexes in the Amazon DynamoDB Developer\n Guide.

" } - }, - "com.amazonaws.dynamodb#UpdateItemInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table containing the item to update.

", - "smithy.api#required": {} - } - }, - "Key": { - "target": "com.amazonaws.dynamodb#Key", - "traits": { - "smithy.api#documentation": "

The primary key of the item to be updated. Each element consists of an attribute name\n and a value for that attribute.

\n

For the primary key, you must provide all of the attributes. For example, with a\n simple primary key, you only need to provide a value for the partition key. For a\n composite primary key, you must provide values for both the partition key and the sort\n key.

", - "smithy.api#required": {} - } - }, - "AttributeUpdates": { - "target": "com.amazonaws.dynamodb#AttributeUpdates", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use UpdateExpression instead. For more\n information, see AttributeUpdates in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "Expected": { - "target": "com.amazonaws.dynamodb#ExpectedAttributeMap", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see Expected in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ConditionalOperator": { - "target": "com.amazonaws.dynamodb#ConditionalOperator", - "traits": { - "smithy.api#documentation": "

This is a legacy parameter. Use ConditionExpression instead. For more\n information, see ConditionalOperator in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ReturnValues": { - "target": "com.amazonaws.dynamodb#ReturnValue", - "traits": { - "smithy.api#documentation": "

Use ReturnValues if you want to get the item attributes as they appear\n before or after they are updated. For UpdateItem, the valid values\n are:

\n
    \n
  • \n

    \n NONE - If ReturnValues is not specified, or if its\n value is NONE, then nothing is returned. (This setting is the\n default for ReturnValues.)

    \n
  • \n
  • \n

    \n ALL_OLD - Returns all of the attributes of the item, as they\n appeared before the UpdateItem operation.

    \n
  • \n
  • \n

    \n UPDATED_OLD - Returns only the updated attributes, as they appeared\n before the UpdateItem operation.

    \n
  • \n
  • \n

    \n ALL_NEW - Returns all of the attributes of the item, as they appear\n after the UpdateItem operation.

    \n
  • \n
  • \n

    \n UPDATED_NEW - Returns only the updated attributes, as they appear\n after the UpdateItem operation.

    \n
  • \n
\n

There is no additional cost associated with requesting a return value aside from the\n small network and processing overhead of receiving a larger response. No read capacity\n units are consumed.

\n

The values returned are strongly consistent.

" - } - }, - "ReturnConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ReturnConsumedCapacity" - }, - "ReturnItemCollectionMetrics": { - "target": "com.amazonaws.dynamodb#ReturnItemCollectionMetrics", - "traits": { - "smithy.api#documentation": "

Determines whether item collection metrics are returned. If set to SIZE,\n the response includes statistics about item collections, if any, that were modified\n during the operation are returned in the response. If set to NONE (the\n default), no statistics are returned.

" - } - }, - "UpdateExpression": { - "target": "com.amazonaws.dynamodb#UpdateExpression", - "traits": { - "smithy.api#documentation": "

An expression that defines one or more attributes to be updated, the action to be\n performed on them, and new values for them.

\n

The following action values are available for UpdateExpression.

\n
    \n
  • \n

    \n SET - Adds one or more attributes and values to an item. If any of\n these attributes already exist, they are replaced by the new values. You can\n also use SET to add or subtract from an attribute that is of type\n Number. For example: SET myNum = myNum + :val\n

    \n

    \n SET supports the following functions:

    \n
      \n
    • \n

      \n if_not_exists (path, operand) - if the item does not\n contain an attribute at the specified path, then\n if_not_exists evaluates to operand; otherwise, it\n evaluates to path. You can use this function to avoid overwriting an\n attribute that may already be present in the item.

      \n
    • \n
    • \n

      \n list_append (operand, operand) - evaluates to a list with a\n new element added to it. You can append the new element to the start or\n the end of the list by reversing the order of the operands.

      \n
    • \n
    \n

    These function names are case-sensitive.

    \n
  • \n
  • \n

    \n REMOVE - Removes one or more attributes from an item.

    \n
  • \n
  • \n

    \n ADD - Adds the specified value to the item, if the attribute does\n not already exist. If the attribute does exist, then the behavior of\n ADD depends on the data type of the attribute:

    \n
      \n
    • \n

      If the existing attribute is a number, and if Value is\n also a number, then Value is mathematically added to the\n existing attribute. If Value is a negative number, then it\n is subtracted from the existing attribute.

      \n \n

      If you use ADD to increment or decrement a number\n value for an item that doesn't exist before the update, DynamoDB\n uses 0 as the initial value.

      \n

      Similarly, if you use ADD for an existing item to\n increment or decrement an attribute value that doesn't exist before\n the update, DynamoDB uses 0 as the initial value. For\n example, suppose that the item you want to update doesn't have an\n attribute named itemcount, but you decide to\n ADD the number 3 to this attribute\n anyway. DynamoDB will create the itemcount attribute,\n set its initial value to 0, and finally add\n 3 to it. The result will be a new\n itemcount attribute in the item, with a value of\n 3.

      \n
      \n
    • \n
    • \n

      If the existing data type is a set and if Value is also a\n set, then Value is added to the existing set. For example,\n if the attribute value is the set [1,2], and the\n ADD action specified [3], then the final\n attribute value is [1,2,3]. An error occurs if an\n ADD action is specified for a set attribute and the\n attribute type specified does not match the existing set type.

      \n

      Both sets must have the same primitive data type. For example, if the\n existing data type is a set of strings, the Value must also\n be a set of strings.

      \n
    • \n
    \n \n

    The ADD action only supports Number and set data types. In\n addition, ADD can only be used on top-level attributes, not\n nested attributes.

    \n
    \n
  • \n
  • \n

    \n DELETE - Deletes an element from a set.

    \n

    If a set of values is specified, then those values are subtracted from the old\n set. For example, if the attribute value was the set [a,b,c] and\n the DELETE action specifies [a,c], then the final\n attribute value is [b]. Specifying an empty set is an error.

    \n \n

    The DELETE action only supports set data types. In addition,\n DELETE can only be used on top-level attributes, not nested\n attributes.

    \n
    \n\n
  • \n
\n

You can have many actions in a single expression, such as the following: SET\n a=:value1, b=:value2 DELETE :value3, :value4, :value5\n

\n

For more information on update expressions, see Modifying\n Items and Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ConditionExpression": { - "target": "com.amazonaws.dynamodb#ConditionExpression", - "traits": { - "smithy.api#documentation": "

A condition that must be satisfied in order for a conditional update to\n succeed.

\n

An expression can contain any of the following:

\n
    \n
  • \n

    Functions: attribute_exists | attribute_not_exists | attribute_type |\n contains | begins_with | size\n

    \n

    These function names are case-sensitive.

    \n
  • \n
  • \n

    Comparison operators: = | <> |\n < | > | <= | >= |\n BETWEEN | IN \n

    \n
  • \n
  • \n

    Logical operators: AND | OR | NOT\n

    \n
  • \n
\n

For more information about condition expressions, see Specifying Conditions in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExpressionAttributeNames": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeNameMap", - "traits": { - "smithy.api#documentation": "

One or more substitution tokens for attribute names in an expression. The following\n are some use cases for using ExpressionAttributeNames:

\n
    \n
  • \n

    To access an attribute whose name conflicts with a DynamoDB reserved\n word.

    \n
  • \n
  • \n

    To create a placeholder for repeating occurrences of an attribute name in an\n expression.

    \n
  • \n
  • \n

    To prevent special characters in an attribute name from being misinterpreted\n in an expression.

    \n
  • \n
\n

Use the # character in an expression to dereference\n an attribute name. For example, consider the following attribute name:

\n
    \n
  • \n

    \n Percentile\n

    \n
  • \n
\n

The name of this attribute conflicts with a reserved word, so it cannot be used\n directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer\n Guide.) To work around this, you could specify the following for\n ExpressionAttributeNames:

\n
    \n
  • \n

    \n {\"#P\":\"Percentile\"}\n

    \n
  • \n
\n

You could then use this substitution in an expression, as in this example:

\n
    \n
  • \n

    \n #P = :val\n

    \n
  • \n
\n \n

Tokens that begin with the : character are\n expression attribute values, which are placeholders for the\n actual value at runtime.

\n
\n

For more information about expression attribute names, see Specifying Item Attributes in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ExpressionAttributeValues": { - "target": "com.amazonaws.dynamodb#ExpressionAttributeValueMap", - "traits": { - "smithy.api#documentation": "

One or more values that can be substituted in an expression.

\n

Use the : (colon) character in an expression to\n dereference an attribute value. For example, suppose that you wanted to check whether\n the value of the ProductStatus attribute was one of the following:

\n

\n Available | Backordered | Discontinued\n

\n

You would first need to specify ExpressionAttributeValues as\n follows:

\n

\n { \":avail\":{\"S\":\"Available\"}, \":back\":{\"S\":\"Backordered\"},\n \":disc\":{\"S\":\"Discontinued\"} }\n

\n

You could then use these values in an expression, such as this:

\n

\n ProductStatus IN (:avail, :back, :disc)\n

\n

For more information on expression attribute values, see Condition Expressions in the Amazon DynamoDB Developer\n Guide.

" - } - } - }, + }, + "StreamSpecification": { + "target": "com.amazonaws.dynamodb#StreamSpecification", "traits": { - "smithy.api#documentation": "

Represents the input of an UpdateItem operation.

" + "smithy.api#documentation": "

Represents the DynamoDB Streams configuration for the table.

\n \n

You receive a ResourceInUseException if you try to enable a stream on\n a table that already has a stream, or if you try to disable a stream on a table that\n doesn't have a stream.

\n
" } - }, - "com.amazonaws.dynamodb#UpdateItemOutput": { - "type": "structure", - "members": { - "Attributes": { - "target": "com.amazonaws.dynamodb#AttributeMap", - "traits": { - "smithy.api#documentation": "

A map of attribute values as they appear before or after the UpdateItem\n operation, as determined by the ReturnValues parameter.

\n

The Attributes map is only present if ReturnValues was\n specified as something other than NONE in the request. Each element\n represents one attribute.

" - } - }, - "ConsumedCapacity": { - "target": "com.amazonaws.dynamodb#ConsumedCapacity", - "traits": { - "smithy.api#documentation": "

The capacity units consumed by the UpdateItem operation. The data\n returned includes the total provisioned throughput consumed, along with statistics for\n the table and any indexes involved in the operation. ConsumedCapacity is\n only returned if the ReturnConsumedCapacity parameter was specified. For\n more information, see Provisioned Throughput in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "ItemCollectionMetrics": { - "target": "com.amazonaws.dynamodb#ItemCollectionMetrics", - "traits": { - "smithy.api#documentation": "

Information about item collections, if any, that were affected by the\n UpdateItem operation. ItemCollectionMetrics is only\n returned if the ReturnItemCollectionMetrics parameter was specified. If the\n table does not have any local secondary indexes, this information is not returned in the\n response.

\n

Each ItemCollectionMetrics element consists of:

\n
    \n
  • \n

    \n ItemCollectionKey - The partition key value of the item collection.\n This is the same as the partition key value of the item itself.

    \n
  • \n
  • \n

    \n SizeEstimateRangeGB - An estimate of item collection size, in\n gigabytes. This value is a two-element array containing a lower bound and an\n upper bound for the estimate. The estimate includes the size of all the items in\n the table, plus the size of all attributes projected into all of the local\n secondary indexes on that table. Use this estimate to measure whether a local\n secondary index is approaching its size limit.

    \n

    The estimate is subject to change over time; therefore, do not rely on the\n precision or accuracy of the estimate.

    \n
  • \n
" - } - } - }, + }, + "SSESpecification": { + "target": "com.amazonaws.dynamodb#SSESpecification", "traits": { - "smithy.api#documentation": "

Represents the output of an UpdateItem operation.

" + "smithy.api#documentation": "

The new server-side encryption settings for the specified table.

" } - }, - "com.amazonaws.dynamodb#UpdateReplicationGroupMemberAction": { - "type": "structure", - "members": { - "RegionName": { - "target": "com.amazonaws.dynamodb#RegionName", - "traits": { - "smithy.api#documentation": "

The Region where the replica exists.

", - "smithy.api#required": {} - } - }, - "KMSMasterKeyId": { - "target": "com.amazonaws.dynamodb#KMSMasterKeyId", - "traits": { - "smithy.api#documentation": "

The KMS key of the replica that should be used\n for KMS encryption. To specify a key, use its key ID, Amazon Resource\n Name (ARN), alias name, or alias ARN. Note that you should only provide this parameter\n if the key is different from the default DynamoDB KMS key\n alias/aws/dynamodb.

" - } - }, - "ProvisionedThroughputOverride": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughputOverride", - "traits": { - "smithy.api#documentation": "

Replica-specific provisioned throughput. If not specified, uses the source table's\n provisioned throughput settings.

" - } - }, - "GlobalSecondaryIndexes": { - "target": "com.amazonaws.dynamodb#ReplicaGlobalSecondaryIndexList", - "traits": { - "smithy.api#documentation": "

Replica-specific global secondary index settings.

" - } - }, - "TableClassOverride": { - "target": "com.amazonaws.dynamodb#TableClass", - "traits": { - "smithy.api#documentation": "

Replica-specific table class. If not specified, uses the source table's\n table class.

" - } - } - }, + }, + "ReplicaUpdates": { + "target": "com.amazonaws.dynamodb#ReplicationGroupUpdateList", "traits": { - "smithy.api#documentation": "

Represents a replica to be modified.

" + "smithy.api#documentation": "

A list of replica update actions (create, delete, or update) for the table.

\n \n

This property only applies to Version\n 2019.11.21 of global tables.

\n
" } - }, - "com.amazonaws.dynamodb#UpdateTable": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#UpdateTableInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#UpdateTableOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceInUseException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "TableClass": { + "target": "com.amazonaws.dynamodb#TableClass", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB\n Streams settings for a given table.

\n

You can only perform one of the following operations at once:

\n
    \n
  • \n

    Modify the provisioned throughput settings of the table.

    \n
  • \n
  • \n

    Remove a global secondary index from the table.

    \n
  • \n
  • \n

    Create a new global secondary index on the table. After the index begins\n backfilling, you can use UpdateTable to perform other\n operations.

    \n
  • \n
\n

\n UpdateTable is an asynchronous operation; while it is executing, the table\n status changes from ACTIVE to UPDATING. While it is\n UPDATING, you cannot issue another UpdateTable request.\n When the table returns to the ACTIVE state, the UpdateTable\n operation is complete.

" + "smithy.api#documentation": "

The table class of the table to be updated. Valid values are STANDARD and\n STANDARD_INFREQUENT_ACCESS.

" } + } }, - "com.amazonaws.dynamodb#UpdateTableInput": { - "type": "structure", - "members": { - "AttributeDefinitions": { - "target": "com.amazonaws.dynamodb#AttributeDefinitions", - "traits": { - "smithy.api#documentation": "

An array of attributes that describe the key schema for the table and indexes. If you\n are adding a new global secondary index to the table, AttributeDefinitions\n must include the key element(s) of the new index.

" - } - }, - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table to be updated.

", - "smithy.api#required": {} - } - }, - "BillingMode": { - "target": "com.amazonaws.dynamodb#BillingMode", - "traits": { - "smithy.api#documentation": "

Controls how you are charged for read and write throughput and how you manage\n capacity. When switching from pay-per-request to provisioned capacity, initial\n provisioned capacity values must be set. The initial provisioned capacity values are\n estimated based on the consumed read and write capacity of your table and global\n secondary indexes over the past 30 minutes.

\n
    \n
  • \n

    \n PROVISIONED - We recommend using PROVISIONED for\n predictable workloads. PROVISIONED sets the billing mode to Provisioned Mode.

    \n
  • \n
  • \n

    \n PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST\n for unpredictable workloads. PAY_PER_REQUEST sets the billing mode\n to On-Demand Mode.

    \n
  • \n
" - } - }, - "ProvisionedThroughput": { - "target": "com.amazonaws.dynamodb#ProvisionedThroughput", - "traits": { - "smithy.api#documentation": "

The new provisioned throughput settings for the specified table or index.

" - } - }, - "GlobalSecondaryIndexUpdates": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexUpdateList", - "traits": { - "smithy.api#documentation": "

An array of one or more global secondary indexes for the table. For each index in the\n array, you can request one action:

\n
    \n
  • \n

    \n Create - add a new global secondary index to the table.

    \n
  • \n
  • \n

    \n Update - modify the provisioned throughput settings of an existing\n global secondary index.

    \n
  • \n
  • \n

    \n Delete - remove a global secondary index from the table.

    \n
  • \n
\n

You can create or delete only one global secondary index per UpdateTable\n operation.

\n

For more information, see Managing Global\n Secondary Indexes in the Amazon DynamoDB Developer\n Guide.

" - } - }, - "StreamSpecification": { - "target": "com.amazonaws.dynamodb#StreamSpecification", - "traits": { - "smithy.api#documentation": "

Represents the DynamoDB Streams configuration for the table.

\n \n

You receive a ResourceInUseException if you try to enable a stream on\n a table that already has a stream, or if you try to disable a stream on a table that\n doesn't have a stream.

\n
" - } - }, - "SSESpecification": { - "target": "com.amazonaws.dynamodb#SSESpecification", - "traits": { - "smithy.api#documentation": "

The new server-side encryption settings for the specified table.

" - } - }, - "ReplicaUpdates": { - "target": "com.amazonaws.dynamodb#ReplicationGroupUpdateList", - "traits": { - "smithy.api#documentation": "

A list of replica update actions (create, delete, or update) for the table.

\n \n

This property only applies to Version\n 2019.11.21 of global tables.

\n
" - } - }, - "TableClass": { - "target": "com.amazonaws.dynamodb#TableClass", - "traits": { - "smithy.api#documentation": "

The table class of the table to be updated. Valid values are STANDARD and\n STANDARD_INFREQUENT_ACCESS.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the input of an UpdateTable operation.

" + } + }, + "com.amazonaws.dynamodb#UpdateTableOutput": { + "type": "structure", + "members": { + "TableDescription": { + "target": "com.amazonaws.dynamodb#TableDescription", "traits": { - "smithy.api#documentation": "

Represents the input of an UpdateTable operation.

" + "smithy.api#documentation": "

Represents the properties of the table.

" } + } }, - "com.amazonaws.dynamodb#UpdateTableOutput": { - "type": "structure", - "members": { - "TableDescription": { - "target": "com.amazonaws.dynamodb#TableDescription", - "traits": { - "smithy.api#documentation": "

Represents the properties of the table.

" - } - } - }, + "traits": { + "smithy.api#documentation": "

Represents the output of an UpdateTable operation.

" + } + }, + "com.amazonaws.dynamodb#UpdateTableReplicaAutoScaling": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#UpdateTableReplicaAutoScalingInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#UpdateTableReplicaAutoScalingOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceInUseException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Updates auto scaling settings on your global tables at once.

\n \n

This operation only applies to Version\n 2019.11.21 of global tables.

\n
" + } + }, + "com.amazonaws.dynamodb#UpdateTableReplicaAutoScalingInput": { + "type": "structure", + "members": { + "GlobalSecondaryIndexUpdates": { + "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexAutoScalingUpdateList", "traits": { - "smithy.api#documentation": "

Represents the output of an UpdateTable operation.

" + "smithy.api#documentation": "

Represents the auto scaling settings of the global secondary indexes of the replica to\n be updated.

" } - }, - "com.amazonaws.dynamodb#UpdateTableReplicaAutoScaling": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#UpdateTableReplicaAutoScalingInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#UpdateTableReplicaAutoScalingOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceInUseException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + }, + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "smithy.api#documentation": "

Updates auto scaling settings on your global tables at once.

\n \n

This operation only applies to Version\n 2019.11.21 of global tables.

\n
" + "smithy.api#documentation": "

The name of the global table to be updated.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#UpdateTableReplicaAutoScalingInput": { - "type": "structure", - "members": { - "GlobalSecondaryIndexUpdates": { - "target": "com.amazonaws.dynamodb#GlobalSecondaryIndexAutoScalingUpdateList", - "traits": { - "smithy.api#documentation": "

Represents the auto scaling settings of the global secondary indexes of the replica to\n be updated.

" - } - }, - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the global table to be updated.

", - "smithy.api#required": {} - } - }, - "ProvisionedWriteCapacityAutoScalingUpdate": { - "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate" - }, - "ReplicaUpdates": { - "target": "com.amazonaws.dynamodb#ReplicaAutoScalingUpdateList", - "traits": { - "smithy.api#documentation": "

Represents the auto scaling settings of replicas of the table that will be\n modified.

" - } - } + }, + "ProvisionedWriteCapacityAutoScalingUpdate": { + "target": "com.amazonaws.dynamodb#AutoScalingSettingsUpdate" + }, + "ReplicaUpdates": { + "target": "com.amazonaws.dynamodb#ReplicaAutoScalingUpdateList", + "traits": { + "smithy.api#documentation": "

Represents the auto scaling settings of replicas of the table that will be\n modified.

" } - }, - "com.amazonaws.dynamodb#UpdateTableReplicaAutoScalingOutput": { - "type": "structure", - "members": { - "TableAutoScalingDescription": { - "target": "com.amazonaws.dynamodb#TableAutoScalingDescription", - "traits": { - "smithy.api#documentation": "

Returns information about the auto scaling settings of a table with replicas.

" - } - } + } + } + }, + "com.amazonaws.dynamodb#UpdateTableReplicaAutoScalingOutput": { + "type": "structure", + "members": { + "TableAutoScalingDescription": { + "target": "com.amazonaws.dynamodb#TableAutoScalingDescription", + "traits": { + "smithy.api#documentation": "

Returns information about the auto scaling settings of a table with replicas.

" } - }, - "com.amazonaws.dynamodb#UpdateTimeToLive": { - "type": "operation", - "input": { - "target": "com.amazonaws.dynamodb#UpdateTimeToLiveInput" - }, - "output": { - "target": "com.amazonaws.dynamodb#UpdateTimeToLiveOutput" - }, - "errors": [ - { - "target": "com.amazonaws.dynamodb#InternalServerError" - }, - { - "target": "com.amazonaws.dynamodb#InvalidEndpointException" - }, - { - "target": "com.amazonaws.dynamodb#LimitExceededException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceInUseException" - }, - { - "target": "com.amazonaws.dynamodb#ResourceNotFoundException" - } - ], + } + } + }, + "com.amazonaws.dynamodb#UpdateTimeToLive": { + "type": "operation", + "input": { + "target": "com.amazonaws.dynamodb#UpdateTimeToLiveInput" + }, + "output": { + "target": "com.amazonaws.dynamodb#UpdateTimeToLiveOutput" + }, + "errors": [ + { + "target": "com.amazonaws.dynamodb#InternalServerError" + }, + { + "target": "com.amazonaws.dynamodb#InvalidEndpointException" + }, + { + "target": "com.amazonaws.dynamodb#LimitExceededException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceInUseException" + }, + { + "target": "com.amazonaws.dynamodb#ResourceNotFoundException" + } + ], + "traits": { + "aws.api#clientDiscoveredEndpoint": { + "required": false + }, + "smithy.api#documentation": "

The UpdateTimeToLive method enables or disables Time to Live (TTL) for\n the specified table. A successful UpdateTimeToLive call returns the current\n TimeToLiveSpecification. It can take up to one hour for the change to\n fully process. Any additional UpdateTimeToLive calls for the same table\n during this one hour duration result in a ValidationException.

\n

TTL compares the current time in epoch time format to the time stored in the TTL\n attribute of an item. If the epoch time value stored in the attribute is less than the\n current time, the item is marked as expired and subsequently deleted.

\n \n

The epoch time format is the number of seconds elapsed since 12:00:00 AM January\n 1, 1970 UTC.

\n
\n

DynamoDB deletes expired items on a best-effort basis to ensure availability of\n throughput for other data operations.

\n \n

DynamoDB typically deletes expired items within two days of expiration. The exact\n duration within which an item gets deleted after expiration is specific to the\n nature of the workload. Items that have expired and not been deleted will still show\n up in reads, queries, and scans.

\n
\n

As items are deleted, they are removed from any local secondary index and global\n secondary index immediately in the same eventually consistent way as a standard delete\n operation.

\n

For more information, see Time To Live in the\n Amazon DynamoDB Developer Guide.

" + } + }, + "com.amazonaws.dynamodb#UpdateTimeToLiveInput": { + "type": "structure", + "members": { + "TableName": { + "target": "com.amazonaws.dynamodb#TableName", "traits": { - "aws.api#clientDiscoveredEndpoint": { - "required": false - }, - "smithy.api#documentation": "

The UpdateTimeToLive method enables or disables Time to Live (TTL) for\n the specified table. A successful UpdateTimeToLive call returns the current\n TimeToLiveSpecification. It can take up to one hour for the change to\n fully process. Any additional UpdateTimeToLive calls for the same table\n during this one hour duration result in a ValidationException.

\n

TTL compares the current time in epoch time format to the time stored in the TTL\n attribute of an item. If the epoch time value stored in the attribute is less than the\n current time, the item is marked as expired and subsequently deleted.

\n \n

The epoch time format is the number of seconds elapsed since 12:00:00 AM January\n 1, 1970 UTC.

\n
\n

DynamoDB deletes expired items on a best-effort basis to ensure availability of\n throughput for other data operations.

\n \n

DynamoDB typically deletes expired items within two days of expiration. The exact\n duration within which an item gets deleted after expiration is specific to the\n nature of the workload. Items that have expired and not been deleted will still show\n up in reads, queries, and scans.

\n
\n

As items are deleted, they are removed from any local secondary index and global\n secondary index immediately in the same eventually consistent way as a standard delete\n operation.

\n

For more information, see Time To Live in the\n Amazon DynamoDB Developer Guide.

" + "smithy.api#documentation": "

The name of the table to be configured.

", + "smithy.api#required": {} } - }, - "com.amazonaws.dynamodb#UpdateTimeToLiveInput": { - "type": "structure", - "members": { - "TableName": { - "target": "com.amazonaws.dynamodb#TableName", - "traits": { - "smithy.api#documentation": "

The name of the table to be configured.

", - "smithy.api#required": {} - } - }, - "TimeToLiveSpecification": { - "target": "com.amazonaws.dynamodb#TimeToLiveSpecification", - "traits": { - "smithy.api#documentation": "

Represents the settings used to enable or disable Time to Live for the specified\n table.

", - "smithy.api#required": {} - } - } - }, + }, + "TimeToLiveSpecification": { + "target": "com.amazonaws.dynamodb#TimeToLiveSpecification", "traits": { - "smithy.api#documentation": "

Represents the input of an UpdateTimeToLive operation.

" + "smithy.api#documentation": "

Represents the settings used to enable or disable Time to Live for the specified\n table.

", + "smithy.api#required": {} } + } }, - "com.amazonaws.dynamodb#UpdateTimeToLiveOutput": { - "type": "structure", - "members": { - "TimeToLiveSpecification": { - "target": "com.amazonaws.dynamodb#TimeToLiveSpecification", - "traits": { - "smithy.api#documentation": "

Represents the output of an UpdateTimeToLive operation.

" - } - } + "traits": { + "smithy.api#documentation": "

Represents the input of an UpdateTimeToLive operation.

" + } + }, + "com.amazonaws.dynamodb#UpdateTimeToLiveOutput": { + "type": "structure", + "members": { + "TimeToLiveSpecification": { + "target": "com.amazonaws.dynamodb#TimeToLiveSpecification", + "traits": { + "smithy.api#documentation": "

Represents the output of an UpdateTimeToLive operation.

" } - }, - "com.amazonaws.dynamodb#WriteRequest": { - "type": "structure", - "members": { - "PutRequest": { - "target": "com.amazonaws.dynamodb#PutRequest", - "traits": { - "smithy.api#documentation": "

A request to perform a PutItem operation.

" - } - }, - "DeleteRequest": { - "target": "com.amazonaws.dynamodb#DeleteRequest", - "traits": { - "smithy.api#documentation": "

A request to perform a DeleteItem operation.

" - } - } - }, + } + } + }, + "com.amazonaws.dynamodb#WriteRequest": { + "type": "structure", + "members": { + "PutRequest": { + "target": "com.amazonaws.dynamodb#PutRequest", "traits": { - "smithy.api#documentation": "

Represents an operation to perform - either DeleteItem or\n PutItem. You can only request one of these operations, not both, in a\n single WriteRequest. If you do need to perform both of these operations,\n you need to provide two separate WriteRequest objects.

" + "smithy.api#documentation": "

A request to perform a PutItem operation.

" } - }, - "com.amazonaws.dynamodb#WriteRequests": { - "type": "list", - "member": { - "target": "com.amazonaws.dynamodb#WriteRequest" - }, + }, + "DeleteRequest": { + "target": "com.amazonaws.dynamodb#DeleteRequest", "traits": { - "smithy.api#length": { - "min": 1, - "max": 25 - } + "smithy.api#documentation": "

A request to perform a DeleteItem operation.

" } + } + }, + "traits": { + "smithy.api#documentation": "

Represents an operation to perform - either DeleteItem or\n PutItem. You can only request one of these operations, not both, in a\n single WriteRequest. If you do need to perform both of these operations,\n you need to provide two separate WriteRequest objects.

" + } + }, + "com.amazonaws.dynamodb#WriteRequests": { + "type": "list", + "member": { + "target": "com.amazonaws.dynamodb#WriteRequest" + }, + "traits": { + "smithy.api#length": { + "min": 1, + "max": 25 + } } + } } } diff --git a/TestModels/aws-sdks/ddb/README.md b/TestModels/aws-sdks/ddb/README.md index 703d5c66c7..fd1c464054 100644 --- a/TestModels/aws-sdks/ddb/README.md +++ b/TestModels/aws-sdks/ddb/README.md @@ -5,27 +5,33 @@ This project tests the [AWS DynamoDB](https://aws.amazon.com/dynamodb/) Operatio NOTE: The `model.json` in this project comes from [private-aws-encryption-sdk-dafny-staging/ComAmazonawsDynamodb/Model/dynamodb](https://github.com/aws/private-aws-encryption-sdk-dafny-staging/tree/v4-seperate-modules/ComAmazonawsDynamodb/Model/dynamodb), and is different from the standard model at https://github.com/aws/aws-models/ddb/ ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dafny polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ -`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. \ No newline at end of file +`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/aws-sdks/ddb/runtimes/java/src/main/java/software/amazon/cryptography/services/dynamodb/internaldafny/__default.java b/TestModels/aws-sdks/ddb/runtimes/java/src/main/java/software/amazon/cryptography/services/dynamodb/internaldafny/__default.java index 1f69a2ff64..45b68cdcc3 100644 --- a/TestModels/aws-sdks/ddb/runtimes/java/src/main/java/software/amazon/cryptography/services/dynamodb/internaldafny/__default.java +++ b/TestModels/aws-sdks/ddb/runtimes/java/src/main/java/software/amazon/cryptography/services/dynamodb/internaldafny/__default.java @@ -2,35 +2,38 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.cryptography.services.dynamodb.internaldafny; -import software.amazon.cryptography.services.dynamodb.internaldafny.types.IDynamoDBClient; -import software.amazon.cryptography.services.dynamodb.internaldafny.types.Error; +import static software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence; +import static software.amazon.smithy.dafny.conversion.ToNative.Simple.String; + import StandardLibraryInterop_Compile.WrappersInterop; import Wrappers_Compile.Option; import Wrappers_Compile.Result; +import dafny.DafnySequence; import software.amazon.awssdk.auth.credentials.ProfileCredentialsProvider; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain; import software.amazon.awssdk.services.dynamodb.DynamoDbClient; -import dafny.DafnySequence; - +import software.amazon.cryptography.services.dynamodb.internaldafny.types.Error; +import software.amazon.cryptography.services.dynamodb.internaldafny.types.IDynamoDBClient; -import static software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence; -import static software.amazon.smithy.dafny.conversion.ToNative.Simple.String; +public class __default + extends software.amazon.cryptography.services.dynamodb.internaldafny._ExternBase___default { -public class __default extends software.amazon.cryptography.services.dynamodb.internaldafny._ExternBase___default{ - public static Result DynamoDBClient() { - try { - Region region = new DefaultAwsRegionProviderChain().getRegion(); - final DynamoDbClient ddbClient = DynamoDbClient.builder() - .region(region) - .build(); + public static Result DynamoDBClient() { + try { + Region region = new DefaultAwsRegionProviderChain().getRegion(); + final DynamoDbClient ddbClient = DynamoDbClient + .builder() + .region(region) + .build(); - IDynamoDBClient shim = new Shim(ddbClient, region.toString()); - return CreateSuccessOfClient(shim); - } catch (Exception e) { - Error dafny_error = Error.create_InternalServerError( - WrappersInterop.CreateStringSome(CharacterSequence(e.getMessage()))); - return CreateFailureOfError(dafny_error); - } + IDynamoDBClient shim = new Shim(ddbClient, region.toString()); + return CreateSuccessOfClient(shim); + } catch (Exception e) { + Error dafny_error = Error.create_InternalServerError( + WrappersInterop.CreateStringSome(CharacterSequence(e.getMessage())) + ); + return CreateFailureOfError(dafny_error); } + } } diff --git a/TestModels/aws-sdks/ddb/runtimes/java/src/main/java/software/amazon/cryptography/services/dynamodb/internaldafny/types/__default.java b/TestModels/aws-sdks/ddb/runtimes/java/src/main/java/software/amazon/cryptography/services/dynamodb/internaldafny/types/__default.java index 658f28847d..9c8b51b460 100644 --- a/TestModels/aws-sdks/ddb/runtimes/java/src/main/java/software/amazon/cryptography/services/dynamodb/internaldafny/types/__default.java +++ b/TestModels/aws-sdks/ddb/runtimes/java/src/main/java/software/amazon/cryptography/services/dynamodb/internaldafny/types/__default.java @@ -2,4 +2,5 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.cryptography.services.dynamodb.internaldafny.types; -public class __default extends software.amazon.cryptography.services.dynamodb.internaldafny.types._ExternBase___default {} +public class __default + extends software.amazon.cryptography.services.dynamodb.internaldafny.types._ExternBase___default {} diff --git a/TestModels/aws-sdks/kms/Model/model.json b/TestModels/aws-sdks/kms/Model/model.json index 1cf533aa9c..512c7f2628 100644 --- a/TestModels/aws-sdks/kms/Model/model.json +++ b/TestModels/aws-sdks/kms/Model/model.json @@ -1,5332 +1,5332 @@ { - "smithy": "1.0", - "metadata": { - "suppressions": [ - { - "id": "HttpMethodSemantics", - "namespace": "*" - }, - { - "id": "HttpResponseCodeSemantics", - "namespace": "*" - }, - { - "id": "PaginatedTrait", - "namespace": "*" - }, - { - "id": "HttpHeaderTrait", - "namespace": "*" - }, - { - "id": "HttpUriConflict", - "namespace": "*" - }, - { - "id": "Service", - "namespace": "*" - } + "smithy": "1.0", + "metadata": { + "suppressions": [ + { + "id": "HttpMethodSemantics", + "namespace": "*" + }, + { + "id": "HttpResponseCodeSemantics", + "namespace": "*" + }, + { + "id": "PaginatedTrait", + "namespace": "*" + }, + { + "id": "HttpHeaderTrait", + "namespace": "*" + }, + { + "id": "HttpUriConflict", + "namespace": "*" + }, + { + "id": "Service", + "namespace": "*" + } + ] + }, + "shapes": { + "com.amazonaws.kms#AWSAccountIdType": { + "type": "string" + }, + "com.amazonaws.kms#AlgorithmSpec": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "RSAES_PKCS1_V1_5", + "name": "RSAES_PKCS1_V1_5" + }, + { + "value": "RSAES_OAEP_SHA_1", + "name": "RSAES_OAEP_SHA_1" + }, + { + "value": "RSAES_OAEP_SHA_256", + "name": "RSAES_OAEP_SHA_256" + } ] + } }, - "shapes": { - "com.amazonaws.kms#AWSAccountIdType": { - "type": "string" - }, - "com.amazonaws.kms#AlgorithmSpec": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "RSAES_PKCS1_V1_5", - "name": "RSAES_PKCS1_V1_5" - }, - { - "value": "RSAES_OAEP_SHA_1", - "name": "RSAES_OAEP_SHA_1" - }, - { - "value": "RSAES_OAEP_SHA_256", - "name": "RSAES_OAEP_SHA_256" - } - ] - } - }, - "com.amazonaws.kms#AliasList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#AliasListEntry" - } - }, - "com.amazonaws.kms#AliasListEntry": { - "type": "structure", - "members": { - "AliasName": { - "target": "com.amazonaws.kms#AliasNameType", - "traits": { - "smithy.api#documentation": "

String that contains the alias. This value begins with alias/.

" - } - }, - "AliasArn": { - "target": "com.amazonaws.kms#ArnType", - "traits": { - "smithy.api#documentation": "

String that contains the key ARN.

" - } - }, - "TargetKeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

String that contains the key identifier of the KMS key associated with the alias.

" - } - }, - "CreationDate": { - "target": "com.amazonaws.kms#DateType", - "traits": { - "smithy.api#documentation": "

Date and time that the alias was most recently created in the account and Region.\n Formatted as Unix time.

" - } - }, - "LastUpdatedDate": { - "target": "com.amazonaws.kms#DateType", - "traits": { - "smithy.api#documentation": "

Date and time that the alias was most recently associated with a KMS key in the account\n and Region. Formatted as Unix time.

" - } - } - }, - "traits": { - "smithy.api#documentation": "

Contains information about an alias.

" - } - }, - "com.amazonaws.kms#AliasNameType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 256 - }, - "smithy.api#pattern": "^[a-zA-Z0-9:/_-]+$" - } - }, - "com.amazonaws.kms#AlreadyExistsException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "AlreadyExists", - "httpResponseCode": 409 - }, - "smithy.api#documentation": "

The request was rejected because it attempted to create a resource that already\n exists.

", - "smithy.api#error": "client", - "smithy.api#httpError": 409 - } - }, - "com.amazonaws.kms#ArnType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 20, - "max": 2048 - } - } - }, - "com.amazonaws.kms#BooleanType": { - "type": "boolean" - }, - "com.amazonaws.kms#CancelKeyDeletion": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#CancelKeyDeletionRequest" - }, - "output": { - "target": "com.amazonaws.kms#CancelKeyDeletionResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Cancels the deletion of a KMS key. When this operation succeeds, the key state of the KMS\n key is Disabled. To enable the KMS key, use EnableKey.

\n

For more information about scheduling and canceling deletion of a KMS key, see Deleting KMS keys in the\n Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n

\n Required permissions: kms:CancelKeyDeletion (key policy)

\n

\n Related operations: ScheduleKeyDeletion\n

" - } - }, - "com.amazonaws.kms#CancelKeyDeletionRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the KMS key whose deletion is being canceled.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#CancelKeyDeletionResponse": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key whose deletion is canceled.

" - } - } - } - }, - "com.amazonaws.kms#CiphertextType": { - "type": "blob", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 6144 - } - } - }, - "com.amazonaws.kms#CloudHsmClusterIdType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 19, - "max": 24 - } - } - }, - "com.amazonaws.kms#CloudHsmClusterInUseException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "CloudHsmClusterInUseException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the specified CloudHSM cluster is already associated with a\n custom key store or it shares a backup history with a cluster that is associated with a custom\n key store. Each custom key store must be associated with a different CloudHSM cluster.

\n

Clusters that share a backup history have the same cluster certificate. To view the\n cluster certificate of a cluster, use the DescribeClusters operation.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#CloudHsmClusterInvalidConfigurationException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "CloudHsmClusterInvalidConfigurationException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the associated CloudHSM cluster did not meet the\n configuration requirements for a custom key store.

\n\n
    \n
  • \n

    The cluster must be configured with private subnets in at least two different\n Availability Zones in the Region.

    \n
  • \n
  • \n

    The security group for\n the cluster (cloudhsm-cluster--sg) must\n include inbound rules and outbound rules that allow TCP traffic on ports 2223-2225. The\n Source in the inbound rules and the Destination in the outbound rules must match the security group\n ID. These rules are set by default when you create the cluster. Do not delete or change\n them. To get information about a particular security group, use the DescribeSecurityGroups operation.

    \n
  • \n
  • \n

    The cluster must contain at least as many HSMs as the operation requires. To add HSMs,\n use the CloudHSM CreateHsm operation.

    \n

    For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey operations, the CloudHSM cluster must have at least two\n active HSMs, each in a different Availability Zone. For the ConnectCustomKeyStore operation, the CloudHSM must contain at least one active\n HSM.

    \n
  • \n
\n

For information about the requirements for an CloudHSM cluster that is associated with a\n custom key store, see Assemble the Prerequisites\n in the Key Management Service Developer Guide. For information about creating a private subnet for an CloudHSM cluster,\n see Create a Private\n Subnet in the CloudHSM User Guide. For information about cluster security groups, see\n Configure a Default Security\n Group in the \n CloudHSM User Guide\n .

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#CloudHsmClusterNotActiveException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "CloudHsmClusterNotActiveException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the CloudHSM cluster that is associated with the custom key\n store is not active. Initialize and activate the cluster and try the command again. For\n detailed instructions, see Getting Started in the CloudHSM User Guide.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#CloudHsmClusterNotFoundException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "CloudHsmClusterNotFoundException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because KMS cannot find the CloudHSM cluster with the specified\n cluster ID. Retry the request with a different cluster ID.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#CloudHsmClusterNotRelatedException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "CloudHsmClusterNotRelatedException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the specified CloudHSM cluster has a different cluster\n certificate than the original cluster. You cannot use the operation to specify an unrelated\n cluster.

\n

Specify a cluster that shares a backup history with the original cluster. This includes\n clusters that were created from a backup of the current cluster, and clusters that were\n created from the same backup that produced the current cluster.

\n

Clusters that share a backup history have the same cluster certificate. To view the\n cluster certificate of a cluster, use the DescribeClusters operation.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#ConnectCustomKeyStore": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#ConnectCustomKeyStoreRequest" - }, - "output": { - "target": "com.amazonaws.kms#ConnectCustomKeyStoreResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#CloudHsmClusterInvalidConfigurationException" - }, - { - "target": "com.amazonaws.kms#CloudHsmClusterNotActiveException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - } - ], - "traits": { - "smithy.api#documentation": "

Connects or reconnects a custom key store to its associated CloudHSM cluster.

\n

The custom key store must be connected before you can create KMS keys in the key store or\n use the KMS keys it contains. You can disconnect and reconnect a custom key store at any\n time.

\n

To connect a custom key store, its associated CloudHSM cluster must have at least one active\n HSM. To get the number of active HSMs in a cluster, use the DescribeClusters operation. To add HSMs\n to the cluster, use the CreateHsm operation. Also, the \n kmsuser crypto\n user (CU) must not be logged into the cluster. This prevents KMS from using this\n account to log in.

\n

The connection process can take an extended amount of time to complete; up to 20 minutes.\n This operation starts the connection process, but it does not wait for it to complete. When it\n succeeds, this operation quickly returns an HTTP 200 response and a JSON object with no\n properties. However, this response does not indicate that the custom key store is connected.\n To get the connection state of the custom key store, use the DescribeCustomKeyStores operation.

\n

During the connection process, KMS finds the CloudHSM cluster that is associated with the\n custom key store, creates the connection infrastructure, connects to the cluster, logs into\n the CloudHSM client as the kmsuser CU, and rotates its password.

\n

The ConnectCustomKeyStore operation might fail for various reasons. To find\n the reason, use the DescribeCustomKeyStores operation and see the\n ConnectionErrorCode in the response. For help interpreting the\n ConnectionErrorCode, see CustomKeyStoresListEntry.

\n

To fix the failure, use the DisconnectCustomKeyStore operation to\n disconnect the custom key store, correct the error, use the UpdateCustomKeyStore operation if necessary, and then use\n ConnectCustomKeyStore again.

\n

If you are having trouble connecting or disconnecting a custom key store, see Troubleshooting a Custom Key\n Store in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:ConnectCustomKeyStore (IAM policy)

\n

\n Related operations\n

\n " - } - }, - "com.amazonaws.kms#ConnectCustomKeyStoreRequest": { - "type": "structure", - "members": { - "CustomKeyStoreId": { - "target": "com.amazonaws.kms#CustomKeyStoreIdType", - "traits": { - "smithy.api#documentation": "

Enter the key store ID of the custom key store that you want to connect.\n To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#ConnectCustomKeyStoreResponse": { - "type": "structure", - "members": {} - }, - "com.amazonaws.kms#ConnectionErrorCodeType": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "INVALID_CREDENTIALS", - "name": "INVALID_CREDENTIALS" - }, - { - "value": "CLUSTER_NOT_FOUND", - "name": "CLUSTER_NOT_FOUND" - }, - { - "value": "NETWORK_ERRORS", - "name": "NETWORK_ERRORS" - }, - { - "value": "INTERNAL_ERROR", - "name": "INTERNAL_ERROR" - }, - { - "value": "INSUFFICIENT_CLOUDHSM_HSMS", - "name": "INSUFFICIENT_CLOUDHSM_HSMS" - }, - { - "value": "USER_LOCKED_OUT", - "name": "USER_LOCKED_OUT" - }, - { - "value": "USER_NOT_FOUND", - "name": "USER_NOT_FOUND" - }, - { - "value": "USER_LOGGED_IN", - "name": "USER_LOGGED_IN" - }, - { - "value": "SUBNET_NOT_FOUND", - "name": "SUBNET_NOT_FOUND" - } - ] - } - }, - "com.amazonaws.kms#ConnectionStateType": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "CONNECTED", - "name": "CONNECTED" - }, - { - "value": "CONNECTING", - "name": "CONNECTING" - }, - { - "value": "FAILED", - "name": "FAILED" - }, - { - "value": "DISCONNECTED", - "name": "DISCONNECTED" - }, - { - "value": "DISCONNECTING", - "name": "DISCONNECTING" - } - ] - } - }, - "com.amazonaws.kms#CreateAlias": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#CreateAliasRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#AlreadyExistsException" - }, - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidAliasNameException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#LimitExceededException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Creates a friendly name for a KMS key.

\n \n

Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

You can use an alias to identify a KMS key in the KMS console, in the DescribeKey operation and in cryptographic operations, such as Encrypt and\n GenerateDataKey. You can also change the KMS key that's associated with\n the alias (UpdateAlias) or delete the alias (DeleteAlias)\n at any time. These operations don't affect the underlying KMS key.

\n

You can associate the alias with any customer managed key in the same Amazon Web Services Region. Each\n alias is associated with only one KMS key at a time, but a KMS key can have multiple aliases.\n A valid KMS key is required. You can't create an alias without a KMS key.

\n

The alias must be unique in the account and Region, but you can have aliases with the same\n name in different Regions. For detailed information about aliases, see Using aliases in the\n Key Management Service Developer Guide.

\n

This operation does not return a response. To get the alias that you created, use the\n ListAliases operation.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on an alias in a different Amazon Web Services account.

\n\n

\n Required permissions\n

\n \n

For details, see Controlling access to aliases in the\n Key Management Service Developer Guide.

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#CreateAliasRequest": { - "type": "structure", - "members": { - "AliasName": { - "target": "com.amazonaws.kms#AliasNameType", - "traits": { - "smithy.api#documentation": "

Specifies the alias name. This value must begin with alias/ followed by a\n name, such as alias/ExampleAlias.

\n

The AliasName value must be string of 1-256 characters. It can contain only\n alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). The alias name\n cannot begin with alias/aws/. The alias/aws/ prefix is reserved for\n Amazon Web Services managed\n keys.

", - "smithy.api#required": {} - } - }, - "TargetKeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Associates the alias with the specified customer managed key. The KMS key must\n be in the same Amazon Web Services Region.

\n

A valid key ID is required. If you supply a null or empty string value, this operation\n returns an error.

\n

For help finding the key ID and ARN, see Finding the Key ID and\n ARN in the \n Key Management Service Developer Guide\n .

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#CreateCustomKeyStore": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#CreateCustomKeyStoreRequest" - }, - "output": { - "target": "com.amazonaws.kms#CreateCustomKeyStoreResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#CloudHsmClusterInUseException" - }, - { - "target": "com.amazonaws.kms#CloudHsmClusterInvalidConfigurationException" - }, - { - "target": "com.amazonaws.kms#CloudHsmClusterNotActiveException" - }, - { - "target": "com.amazonaws.kms#CloudHsmClusterNotFoundException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreNameInUseException" - }, - { - "target": "com.amazonaws.kms#IncorrectTrustAnchorException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - } - ], - "traits": { - "smithy.api#documentation": "

Creates a custom key store that is associated with an CloudHSM cluster that you own and\n manage.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

\n

Before you create the custom key store, you must assemble\n the required elements, including an CloudHSM cluster that fulfills the requirements for a custom\n key store. For details about the required elements, see Assemble the Prerequisites\n in the Key Management Service Developer Guide.

\n

When the operation completes successfully, it returns the ID of the new custom key store.\n Before you can use your new custom key store, you need to use the ConnectCustomKeyStore operation to connect the new key store to its CloudHSM\n cluster. Even if you are not going to use your custom key store immediately, you might want to\n connect it to verify that all settings are correct and then disconnect it until you are ready\n to use it.

\n

For help with failures, see Troubleshooting a Custom Key Store in the\n Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n

\n Required permissions: kms:CreateCustomKeyStore (IAM policy).

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#CreateCustomKeyStoreRequest": { - "type": "structure", - "members": { - "CustomKeyStoreName": { - "target": "com.amazonaws.kms#CustomKeyStoreNameType", - "traits": { - "smithy.api#documentation": "

Specifies a friendly name for the custom key store. The name must be unique in your\n Amazon Web Services account.

", - "smithy.api#required": {} - } - }, - "CloudHsmClusterId": { - "target": "com.amazonaws.kms#CloudHsmClusterIdType", - "traits": { - "smithy.api#documentation": "

Identifies the CloudHSM cluster for the custom key store. Enter the cluster ID of any active\n CloudHSM cluster that is not already associated with a custom key store. To find the cluster ID,\n use the DescribeClusters operation.

", - "smithy.api#required": {} - } - }, - "TrustAnchorCertificate": { - "target": "com.amazonaws.kms#TrustAnchorCertificateType", - "traits": { - "smithy.api#documentation": "

Enter the content of the trust anchor certificate for the cluster. This is the content of\n the customerCA.crt file that you created when you initialized the cluster.

", - "smithy.api#required": {} - } - }, - "KeyStorePassword": { - "target": "com.amazonaws.kms#KeyStorePasswordType", - "traits": { - "smithy.api#documentation": "

Enter the password of the \n kmsuser crypto user\n (CU) account in the specified CloudHSM cluster. KMS logs into the cluster as this\n user to manage key material on your behalf.

\n

The password must be a string of 7 to 32 characters. Its value is case sensitive.

\n

This parameter tells KMS the kmsuser account password; it does not change\n the password in the CloudHSM cluster.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#CreateCustomKeyStoreResponse": { - "type": "structure", - "members": { - "CustomKeyStoreId": { - "target": "com.amazonaws.kms#CustomKeyStoreIdType", - "traits": { - "smithy.api#documentation": "

A unique identifier for the new custom key store.

" - } - } - } - }, - "com.amazonaws.kms#CreateGrant": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#CreateGrantRequest" - }, - "output": { - "target": "com.amazonaws.kms#CreateGrantResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#LimitExceededException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Adds a grant to a KMS key.

\n

A grant is a policy instrument that allows Amazon Web Services principals to use\n KMS keys in cryptographic operations. It also can allow them to view a KMS key (DescribeKey) and create and manage grants. When authorizing access to a KMS key,\n grants are considered along with key policies and IAM policies. Grants are often used for\n temporary permissions because you can create one, use its permissions, and delete it without\n changing your key policies or IAM policies.

\n

For detailed information about grants, including grant terminology, see Using grants in the\n \n Key Management Service Developer Guide\n . For examples of working with grants in several\n programming languages, see Programming grants.

\n

The CreateGrant operation returns a GrantToken and a\n GrantId.

\n
    \n
  • \n

    When you create, retire, or revoke a grant, there might be a brief delay, usually less than five minutes, until the grant is available throughout KMS. This state is known as eventual consistency. Once the grant has achieved eventual consistency, the grantee\n principal can use the permissions in the grant without identifying the grant.

    \n

    However, to use the permissions in the grant immediately, use the\n GrantToken that CreateGrant returns. For details, see Using a\n grant token in the \n Key Management Service Developer Guide\n .

    \n
  • \n
  • \n

    The CreateGrant operation also returns a GrantId. You can\n use the GrantId and a key identifier to identify the grant in the RetireGrant and RevokeGrant operations. To find the grant\n ID, use the ListGrants or ListRetirableGrants\n operations.

    \n
  • \n
\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: Yes.\n To perform this operation on a KMS key in a different Amazon Web Services account, specify the key\n ARN in the value of the KeyId parameter.

\n

\n Required permissions: kms:CreateGrant (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#CreateGrantRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the KMS key for the grant. The grant gives principals permission to use this\n KMS key.

\n

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a\ndifferent Amazon Web Services account, you must use the key ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "GranteePrincipal": { - "target": "com.amazonaws.kms#PrincipalIdType", - "traits": { - "smithy.api#documentation": "

The identity that gets the permissions specified in the grant.

\n

To specify the principal, use the Amazon Resource Name (ARN) of an\n Amazon Web Services principal. Valid Amazon Web Services principals include Amazon Web Services accounts (root), IAM users, IAM roles,\n federated users, and assumed role users. For examples of the ARN syntax to use for specifying\n a principal, see Amazon Web Services Identity and Access\n Management (IAM) in the Example ARNs section of the Amazon Web Services General\n Reference.

", - "smithy.api#required": {} - } - }, - "RetiringPrincipal": { - "target": "com.amazonaws.kms#PrincipalIdType", - "traits": { - "smithy.api#documentation": "

The principal that has permission to use the RetireGrant operation to\n retire the grant.

\n

To specify the principal, use the Amazon Resource Name (ARN) of an\n Amazon Web Services principal. Valid Amazon Web Services principals include Amazon Web Services accounts (root), IAM users, federated\n users, and assumed role users. For examples of the ARN syntax to use for specifying a\n principal, see Amazon Web Services Identity and Access\n Management (IAM) in the Example ARNs section of the Amazon Web Services General\n Reference.

\n

The grant determines the retiring principal. Other principals might have permission to\n retire the grant or revoke the grant. For details, see RevokeGrant and\n Retiring and\n revoking grants in the Key Management Service Developer Guide.

" - } - }, - "Operations": { - "target": "com.amazonaws.kms#GrantOperationList", - "traits": { - "smithy.api#documentation": "

A list of operations that the grant permits.

\n

The operation must be supported on the KMS key. For example, you cannot create a grant for\n a symmetric KMS key that allows the Sign operation, or a grant for an\n asymmetric KMS key that allows the GenerateDataKey operation. If you try,\n KMS returns a ValidationError exception. For details, see Grant\n operations in the Key Management Service Developer Guide.

", - "smithy.api#required": {} - } - }, - "Constraints": { - "target": "com.amazonaws.kms#GrantConstraints", - "traits": { - "smithy.api#documentation": "

Specifies a grant constraint.

\n

KMS supports the EncryptionContextEquals and\n EncryptionContextSubset grant constraints. Each constraint value can include up\n to 8 encryption context pairs. The encryption context value in each constraint cannot exceed\n 384 characters.

\n

These grant constraints allow the permissions in the grant only when the encryption\n context in the request matches (EncryptionContextEquals) or includes\n (EncryptionContextSubset) the encryption context specified in this structure.\n For information about grant constraints, see Using grant\n constraints in the Key Management Service Developer Guide. For more information about encryption context,\n see Encryption\n Context in the \n Key Management Service Developer Guide\n .

\n

The encryption context grant constraints are supported only on operations that include an\n encryption context. You cannot use an encryption context grant constraint for cryptographic\n operations with asymmetric KMS keys or for management operations, such as DescribeKey or RetireGrant.

" - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - }, - "Name": { - "target": "com.amazonaws.kms#GrantNameType", - "traits": { - "smithy.api#documentation": "

A friendly name for the grant. Use this value to prevent the unintended creation of\n duplicate grants when retrying this request.

\n

When this value is absent, all CreateGrant requests result in a new grant\n with a unique GrantId even if all the supplied parameters are identical. This can\n result in unintended duplicates when you retry the CreateGrant request.

\n

When this value is present, you can retry a CreateGrant request with\n identical parameters; if the grant already exists, the original GrantId is\n returned without creating a new grant. Note that the returned grant token is unique with every\n CreateGrant request, even when a duplicate GrantId is returned.\n All grant tokens for the same grant ID can be used interchangeably.

" - } - } - } - }, - "com.amazonaws.kms#CreateGrantResponse": { - "type": "structure", - "members": { - "GrantToken": { - "target": "com.amazonaws.kms#GrantTokenType", - "traits": { - "smithy.api#documentation": "

The grant token.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - }, - "GrantId": { - "target": "com.amazonaws.kms#GrantIdType", - "traits": { - "smithy.api#documentation": "

The unique identifier for the grant.

\n

You can use the GrantId in a ListGrants, RetireGrant, or RevokeGrant operation.

" - } - } - } - }, - "com.amazonaws.kms#CreateKey": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#CreateKeyRequest" - }, - "output": { - "target": "com.amazonaws.kms#CreateKeyResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#CloudHsmClusterInvalidConfigurationException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" - }, - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#LimitExceededException" - }, - { - "target": "com.amazonaws.kms#MalformedPolicyDocumentException" - }, - { - "target": "com.amazonaws.kms#TagException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Creates a unique customer managed KMS key in your Amazon Web Services account and\n Region.

\n \n

KMS is replacing the term customer master key (CMK) with KMS key and KMS key. The concept has not changed. To prevent breaking changes, KMS is keeping some variations of this term.

\n
\n\n

You can use the CreateKey operation to create symmetric or asymmetric KMS\n keys.

\n
    \n
  • \n

    \n Symmetric KMS keys contain a 256-bit symmetric key\n that never leaves KMS unencrypted. To use the KMS key, you must call KMS. You can use\n a symmetric KMS key to encrypt and decrypt small amounts of data, but they are typically\n used to generate data keys and data keys pairs. For details,\n see GenerateDataKey and GenerateDataKeyPair.

    \n
  • \n
  • \n

    \n Asymmetric KMS keys can contain an RSA key pair or an\n Elliptic Curve (ECC) key pair. The private key in an asymmetric KMS key never leaves KMS\n unencrypted. However, you can use the GetPublicKey operation to download\n the public key so it can be used outside of KMS. KMS keys with RSA key pairs can be used\n to encrypt or decrypt data or sign and verify messages (but not both). KMS keys with ECC\n key pairs can be used only to sign and verify messages.

    \n
  • \n
\n

For information about symmetric and asymmetric KMS keys, see Using Symmetric and Asymmetric KMS keys in the Key Management Service Developer Guide.

\n\n\n

To create different types of KMS keys, use the following guidance:

\n\n
\n
Asymmetric KMS keys
\n
\n

To create an asymmetric KMS key, use the KeySpec parameter to specify\n the type of key material in the KMS key. Then, use the KeyUsage parameter\n to determine whether the KMS key will be used to encrypt and decrypt or sign and verify.\n You can't change these properties after the KMS key is created.

\n

\n
\n
Symmetric KMS keys
\n
\n

When creating a symmetric KMS key, you don't need to specify the\n KeySpec or KeyUsage parameters. The default value for\n KeySpec, SYMMETRIC_DEFAULT, and the default value for\n KeyUsage, ENCRYPT_DECRYPT, are the only valid values for\n symmetric KMS keys.

\n

\n
\n
Multi-Region primary keys
\n
Imported key material
\n
\n

To create a multi-Region primary key in the local Amazon Web Services Region,\n use the MultiRegion parameter with a value of True. To create\n a multi-Region replica key, that is, a KMS key with the same key ID\n and key material as a primary key, but in a different Amazon Web Services Region, use the ReplicateKey operation. To change a replica key to a primary key, and its\n primary key to a replica key, use the UpdatePrimaryRegion\n operation.

\n

This operation supports multi-Region keys, an KMS feature that lets you create multiple\n interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key\n material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt\n it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

\n

You can create symmetric and asymmetric multi-Region keys and multi-Region keys with\n imported key material. You cannot create multi-Region keys in a custom key store.

\n

\n
\n
\n

To import your own key material, begin by creating a symmetric KMS key with no key\n material. To do this, use the Origin parameter of CreateKey\n with a value of EXTERNAL. Next, use GetParametersForImport operation to get a public key and import token, and use the public key to encrypt\n your key material. Then, use ImportKeyMaterial with your import token\n to import the key material. For step-by-step instructions, see Importing Key Material in the \n Key Management Service Developer Guide\n . You\n cannot import the key material into an asymmetric KMS key.

\n

To create a multi-Region primary key with imported key material, use the\n Origin parameter of CreateKey with a value of\n EXTERNAL and the MultiRegion parameter with a value of\n True. To create replicas of the multi-Region primary key, use the ReplicateKey operation. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

\n

\n
\n
Custom key store
\n
\n

To create a symmetric KMS key in a custom key store, use the\n CustomKeyStoreId parameter to specify the custom key store. You must also\n use the Origin parameter with a value of AWS_CLOUDHSM. The\n CloudHSM cluster that is associated with the custom key store must have at least two active\n HSMs in different Availability Zones in the Amazon Web Services Region.

\n

You cannot create an asymmetric KMS key in a custom key store. For information about\n custom key stores in KMS see Using Custom Key Stores in\n the \n Key Management Service Developer Guide\n .

\n
\n
\n

\n Cross-account use: No. You cannot use this operation to\n create a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:CreateKey (IAM policy). To use the\n Tags parameter, kms:TagResource (IAM policy). For examples and information about related\n permissions, see Allow a user to create\n KMS keys in the Key Management Service Developer Guide.

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#CreateKeyRequest": { - "type": "structure", - "members": { - "Policy": { - "target": "com.amazonaws.kms#PolicyType", - "traits": { - "smithy.api#documentation": "

The key policy to attach to the KMS key.

\n

If you provide a key policy, it must meet the following criteria:

\n
    \n
  • \n

    If you don't set BypassPolicyLockoutSafetyCheck to true, the key policy\n must allow the principal that is making the CreateKey request to make a\n subsequent PutKeyPolicy request on the KMS key. This reduces the risk\n that the KMS key becomes unmanageable. For more information, refer to the scenario in the\n Default Key Policy section of the \n Key Management Service Developer Guide\n .

    \n
  • \n
  • \n

    Each statement in the key policy must contain one or more principals. The principals\n in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services\n principal (for example, an IAM user or role), you might need to enforce a delay before\n including the new principal in a key policy because the new principal might not be\n immediately visible to KMS. For more information, see Changes that I make are not always immediately visible in the Amazon Web Services\n Identity and Access Management User Guide.

    \n
  • \n
\n

If you do not provide a key policy, KMS attaches a default key policy to the KMS key.\n For more information, see Default Key Policy in the\n Key Management Service Developer Guide.

\n

The key policy size quota is 32 kilobytes (32768 bytes).

\n

For help writing and formatting a JSON policy document, see the IAM JSON Policy Reference in the \n Identity and Access Management User Guide\n .

" - } - }, - "Description": { - "target": "com.amazonaws.kms#DescriptionType", - "traits": { - "smithy.api#documentation": "

A description of the KMS key.

\n

Use a description that helps you decide whether the KMS key is appropriate for a task. The\n default value is an empty string (no description).

\n

To set or change the description after the key is created, use UpdateKeyDescription.

" - } - }, - "KeyUsage": { - "target": "com.amazonaws.kms#KeyUsageType", - "traits": { - "smithy.api#documentation": "

Determines the cryptographic operations for which you can use the KMS key. The default value is\n ENCRYPT_DECRYPT. This parameter is required only for asymmetric KMS keys. You\n can't change the KeyUsage value after the KMS key is created.

\n

Select only one valid value.

\n
    \n
  • \n

    For symmetric KMS keys, omit the parameter or specify\n ENCRYPT_DECRYPT.

    \n
  • \n
  • \n

    For asymmetric KMS keys with RSA key material, specify ENCRYPT_DECRYPT or\n SIGN_VERIFY.

    \n
  • \n
  • \n

    For asymmetric KMS keys with ECC key material, specify\n SIGN_VERIFY.

    \n
  • \n
" - } - }, - "CustomerMasterKeySpec": { - "target": "com.amazonaws.kms#CustomerMasterKeySpec", - "traits": { - "smithy.api#deprecated": { - "message": "This parameter has been deprecated. Instead, use the KeySpec parameter." - }, - "smithy.api#documentation": "

Instead, use the KeySpec parameter.

\n

The KeySpec and CustomerMasterKeySpec parameters work the same\n way. Only the names differ. We recommend that you use KeySpec parameter in your\n code. However, to avoid breaking changes, KMS will support both parameters.

" - } - }, - "KeySpec": { - "target": "com.amazonaws.kms#KeySpec", - "traits": { - "smithy.api#documentation": "

Specifies the type of KMS key to create. The default value,\n SYMMETRIC_DEFAULT, creates a KMS key with a 256-bit symmetric key for encryption\n and decryption. For help choosing a key spec for your KMS key, see How to Choose Your KMS key\n Configuration in the \n Key Management Service Developer Guide\n .

\n

The KeySpec determines whether the KMS key contains a symmetric key or an\n asymmetric key pair. It also determines the encryption algorithms or signing algorithms that\n the KMS key supports. You can't change the KeySpec after the KMS key is created.\n To further restrict the algorithms that can be used with the KMS key, use a condition key in\n its key policy or IAM policy. For more information, see kms:EncryptionAlgorithm or kms:Signing Algorithm in the \n Key Management Service Developer Guide\n .

\n \n

\n Amazon Web Services services that\n are integrated with KMS use symmetric KMS keys to protect your data. These\n services do not support asymmetric KMS keys. For help determining whether a KMS key is\n symmetric or asymmetric, see Identifying Symmetric and Asymmetric\n KMS keys in the Key Management Service Developer Guide.

\n
\n

KMS supports the following key specs for KMS keys:

\n
    \n
  • \n

    Symmetric key (default)

    \n
      \n
    • \n

      \n SYMMETRIC_DEFAULT (AES-256-GCM)

      \n
    • \n
    \n
  • \n
  • \n

    Asymmetric RSA key pairs

    \n
      \n
    • \n

      \n RSA_2048\n

      \n
    • \n
    • \n

      \n RSA_3072\n

      \n
    • \n
    • \n

      \n RSA_4096\n

      \n
    • \n
    \n
  • \n
  • \n

    Asymmetric NIST-recommended elliptic curve key pairs

    \n
      \n
    • \n

      \n ECC_NIST_P256 (secp256r1)

      \n
    • \n
    • \n

      \n ECC_NIST_P384 (secp384r1)

      \n
    • \n
    • \n

      \n ECC_NIST_P521 (secp521r1)

      \n
    • \n
    \n
  • \n
  • \n

    Other asymmetric elliptic curve key pairs

    \n
      \n
    • \n

      \n ECC_SECG_P256K1 (secp256k1), commonly used for\n cryptocurrencies.

      \n
    • \n
    \n
  • \n
" - } - }, - "Origin": { - "target": "com.amazonaws.kms#OriginType", - "traits": { - "smithy.api#documentation": "

The source of the key material for the KMS key. You cannot change the origin after you\n create the KMS key. The default is AWS_KMS, which means that KMS creates the\n key material.

\n

To create a KMS key with no key material (for imported key material), set the value to\n EXTERNAL. For more information about importing key material into KMS, see\n Importing Key\n Material in the Key Management Service Developer Guide. This value is valid only for symmetric KMS\n keys.

\n

To create a KMS key in an KMS custom key store and create its key material in the\n associated CloudHSM cluster, set this value to AWS_CLOUDHSM. You must also use the\n CustomKeyStoreId parameter to identify the custom key store. This value is\n valid only for symmetric KMS keys.

" - } - }, - "CustomKeyStoreId": { - "target": "com.amazonaws.kms#CustomKeyStoreIdType", - "traits": { - "smithy.api#documentation": "

Creates the KMS key in the specified custom key store and the key material in its\n associated CloudHSM cluster. To create a KMS key in a custom key store, you must also specify the\n Origin parameter with a value of AWS_CLOUDHSM. The CloudHSM cluster\n that is associated with the custom key store must have at least two active HSMs, each in a\n different Availability Zone in the Region.

\n

This parameter is valid only for symmetric KMS keys and regional KMS keys. You cannot\n create an asymmetric KMS key or a multi-Region key in a custom key store.

\n

To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

\n

The response includes the custom key store ID and the ID of the CloudHSM cluster.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

" - } - }, - "BypassPolicyLockoutSafetyCheck": { - "target": "com.amazonaws.kms#BooleanType", - "traits": { - "smithy.api#documentation": "

A flag to indicate whether to bypass the key policy lockout safety check.

\n \n

Setting this value to true increases the risk that the KMS key becomes unmanageable. Do\n not set this value to true indiscriminately.

\n

For more information, refer to the scenario in the Default Key Policy section in the \n Key Management Service Developer Guide\n .

\n
\n

Use this parameter only when you include a policy in the request and you intend to prevent\n the principal that is making the request from making a subsequent PutKeyPolicy request on the KMS key.

\n

The default value is false.

" - } - }, - "Tags": { - "target": "com.amazonaws.kms#TagList", - "traits": { - "smithy.api#documentation": "

Assigns one or more tags to the KMS key. Use this parameter to tag the KMS key when it is\n created. To tag an existing KMS key, use the TagResource operation.

\n \n

Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

To use this parameter, you must have kms:TagResource permission in an IAM policy.

\n

Each tag consists of a tag key and a tag value. Both the tag key and the tag value are\n required, but the tag value can be an empty (null) string. You cannot have more than one tag\n on a KMS key with the same tag key. If you specify an existing tag key with a different tag\n value, KMS replaces the current tag value with the specified one.

\n

When you add tags to an Amazon Web Services resource, Amazon Web Services generates a cost allocation\n report with usage and costs aggregated by tags. Tags can also be used to control access to a KMS key. For details,\n see Tagging Keys.

" - } - }, - "MultiRegion": { - "target": "com.amazonaws.kms#NullableBooleanType", - "traits": { - "smithy.api#documentation": "

Creates a multi-Region primary key that you can replicate into other Amazon Web Services Regions. You\n cannot change this value after you create the KMS key.

\n

For a multi-Region key, set this parameter to True. For a single-Region KMS\n key, omit this parameter or set it to False. The default value is\n False.

\n

This operation supports multi-Region keys, an KMS feature that lets you create multiple\n interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key\n material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt\n it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

\n

This value creates a primary key, not a replica. To create a\n replica key, use the ReplicateKey operation.

\n

You can create a symmetric or asymmetric multi-Region key, and you can create a\n multi-Region key with imported key material. However, you cannot create a multi-Region key in\n a custom key store.

" - } - } - } - }, - "com.amazonaws.kms#CreateKeyResponse": { - "type": "structure", - "members": { - "KeyMetadata": { - "target": "com.amazonaws.kms#KeyMetadata", - "traits": { - "smithy.api#documentation": "

Metadata associated with the KMS key.

" - } - } - } - }, - "com.amazonaws.kms#CustomKeyStoreHasCMKsException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "CustomKeyStoreHasCMKsException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the custom key store contains KMS keys. After verifying\n that you do not need to use the KMS keys, use the ScheduleKeyDeletion\n operation to delete the KMS keys. After they are deleted, you can delete the custom key\n store.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#CustomKeyStoreIdType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 64 - } - } - }, - "com.amazonaws.kms#CustomKeyStoreInvalidStateException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "CustomKeyStoreInvalidStateException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because of the ConnectionState of the custom key\n store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores operation.

\n

This exception is thrown under the following conditions:

\n
    \n
  • \n

    You requested the CreateKey or GenerateRandom\n operation in a custom key store that is not connected. These operations are valid only\n when the custom key store ConnectionState is CONNECTED.

    \n
  • \n
  • \n

    You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation on a custom key store that is not\n disconnected. This operation is valid only when the custom key store\n ConnectionState is DISCONNECTED.

    \n
  • \n
  • \n

    You requested the ConnectCustomKeyStore operation on a custom key\n store with a ConnectionState of DISCONNECTING or\n FAILED. This operation is valid for all other ConnectionState\n values.

    \n
  • \n
", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#CustomKeyStoreNameInUseException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "CustomKeyStoreNameInUseException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the specified custom key store name is already assigned\n to another custom key store in the account. Try again with a custom key store name that is\n unique in the account.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#CustomKeyStoreNameType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 256 - } - } - }, - "com.amazonaws.kms#CustomKeyStoreNotFoundException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "CustomKeyStoreNotFoundException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because KMS cannot find a custom key store with the specified\n key store name or ID.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#CustomKeyStoresList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#CustomKeyStoresListEntry" - } - }, - "com.amazonaws.kms#CustomKeyStoresListEntry": { - "type": "structure", - "members": { - "CustomKeyStoreId": { - "target": "com.amazonaws.kms#CustomKeyStoreIdType", - "traits": { - "smithy.api#documentation": "

A unique identifier for the custom key store.

" - } - }, - "CustomKeyStoreName": { - "target": "com.amazonaws.kms#CustomKeyStoreNameType", - "traits": { - "smithy.api#documentation": "

The user-specified friendly name for the custom key store.

" - } - }, - "CloudHsmClusterId": { - "target": "com.amazonaws.kms#CloudHsmClusterIdType", - "traits": { - "smithy.api#documentation": "

A unique identifier for the CloudHSM cluster that is associated with the custom key\n store.

" - } - }, - "TrustAnchorCertificate": { - "target": "com.amazonaws.kms#TrustAnchorCertificateType", - "traits": { - "smithy.api#documentation": "

The trust anchor certificate of the associated CloudHSM cluster. When you initialize the\n cluster, you create this certificate and save it in the customerCA.crt\n file.

" - } - }, - "ConnectionState": { - "target": "com.amazonaws.kms#ConnectionStateType", - "traits": { - "smithy.api#documentation": "

Indicates whether the custom key store is connected to its CloudHSM cluster.

\n

You can create and use KMS keys in your custom key stores only when its connection state\n is CONNECTED.

\n

The value is DISCONNECTED if the key store has never been connected or you\n use the DisconnectCustomKeyStore operation to disconnect it. If the value is\n CONNECTED but you are having trouble using the custom key store, make sure that\n its associated CloudHSM cluster is active and contains at least one active HSM.

\n

A value of FAILED indicates that an attempt to connect was unsuccessful. The\n ConnectionErrorCode field in the response indicates the cause of the failure.\n For help resolving a connection failure, see Troubleshooting a Custom Key Store in the\n Key Management Service Developer Guide.

" - } - }, - "ConnectionErrorCode": { - "target": "com.amazonaws.kms#ConnectionErrorCodeType", - "traits": { - "smithy.api#documentation": "

Describes the connection error. This field appears in the response only when the\n ConnectionState is FAILED. For help resolving these errors, see\n How to\n Fix a Connection Failure in Key Management Service Developer Guide.

\n

Valid values are:

\n
    \n
  • \n

    \n CLUSTER_NOT_FOUND - KMS cannot find the CloudHSM cluster with the\n specified cluster ID.

    \n
  • \n
  • \n

    \n INSUFFICIENT_CLOUDHSM_HSMS - The associated CloudHSM cluster does not\n contain any active HSMs. To connect a custom key store to its CloudHSM cluster, the cluster\n must contain at least one active HSM.

    \n
  • \n
  • \n

    \n INTERNAL_ERROR - KMS could not complete the request due to an internal\n error. Retry the request. For ConnectCustomKeyStore requests, disconnect the\n custom key store before trying to connect again.

    \n
  • \n
  • \n

    \n INVALID_CREDENTIALS - KMS does not have the correct password for the\n kmsuser crypto user in the CloudHSM cluster. Before you can connect your\n custom key store to its CloudHSM cluster, you must change the kmsuser account\n password and update the key store password value for the custom key store.

    \n
  • \n
  • \n

    \n NETWORK_ERRORS - Network errors are preventing KMS from connecting to\n the custom key store.

    \n
  • \n
  • \n

    \n SUBNET_NOT_FOUND - A subnet in the CloudHSM cluster configuration was\n deleted. If KMS cannot find all of the subnets in the cluster configuration, attempts to\n connect the custom key store to the CloudHSM cluster fail. To fix this error, create a\n cluster from a recent backup and associate it with your custom key store. (This process\n creates a new cluster configuration with a VPC and private subnets.) For details, see\n How\n to Fix a Connection Failure in the Key Management Service Developer Guide.

    \n
  • \n
  • \n

    \n USER_LOCKED_OUT - The kmsuser CU account is locked out of\n the associated CloudHSM cluster due to too many failed password attempts. Before you can\n connect your custom key store to its CloudHSM cluster, you must change the\n kmsuser account password and update the key store password value for the\n custom key store.

    \n
  • \n
  • \n

    \n USER_LOGGED_IN - The kmsuser CU account is logged into the\n the associated CloudHSM cluster. This prevents KMS from rotating the kmsuser\n account password and logging into the cluster. Before you can connect your custom key\n store to its CloudHSM cluster, you must log the kmsuser CU out of the cluster.\n If you changed the kmsuser password to log into the cluster, you must also\n and update the key store password value for the custom key store. For help, see How to Log Out\n and Reconnect in the Key Management Service Developer Guide.

    \n
  • \n
  • \n

    \n USER_NOT_FOUND - KMS cannot find a kmsuser CU account in\n the associated CloudHSM cluster. Before you can connect your custom key store to its CloudHSM\n cluster, you must create a kmsuser CU account in the cluster, and then update\n the key store password value for the custom key store.

    \n
  • \n
" - } - }, - "CreationDate": { - "target": "com.amazonaws.kms#DateType", - "traits": { - "smithy.api#documentation": "

The date and time when the custom key store was created.

" - } - } - }, - "traits": { - "smithy.api#documentation": "

Contains information about each custom key store in the custom key store list.

" - } - }, - "com.amazonaws.kms#CustomerMasterKeySpec": { - "type": "string", - "traits": { - "smithy.api#deprecated": { - "message": "This enum has been deprecated. Instead, use the KeySpec enum." - }, - "smithy.api#enum": [ - { - "value": "RSA_2048", - "name": "RSA_2048" - }, - { - "value": "RSA_3072", - "name": "RSA_3072" - }, - { - "value": "RSA_4096", - "name": "RSA_4096" - }, - { - "value": "ECC_NIST_P256", - "name": "ECC_NIST_P256" - }, - { - "value": "ECC_NIST_P384", - "name": "ECC_NIST_P384" - }, - { - "value": "ECC_NIST_P521", - "name": "ECC_NIST_P521" - }, - { - "value": "ECC_SECG_P256K1", - "name": "ECC_SECG_P256K1" - }, - { - "value": "SYMMETRIC_DEFAULT", - "name": "SYMMETRIC_DEFAULT" - } - ] - } - }, - "com.amazonaws.kms#DataKeyPairSpec": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "RSA_2048", - "name": "RSA_2048" - }, - { - "value": "RSA_3072", - "name": "RSA_3072" - }, - { - "value": "RSA_4096", - "name": "RSA_4096" - }, - { - "value": "ECC_NIST_P256", - "name": "ECC_NIST_P256" - }, - { - "value": "ECC_NIST_P384", - "name": "ECC_NIST_P384" - }, - { - "value": "ECC_NIST_P521", - "name": "ECC_NIST_P521" - }, - { - "value": "ECC_SECG_P256K1", - "name": "ECC_SECG_P256K1" - } - ] - } - }, - "com.amazonaws.kms#DataKeySpec": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "AES_256", - "name": "AES_256" - }, - { - "value": "AES_128", - "name": "AES_128" - } - ] - } - }, - "com.amazonaws.kms#DateType": { - "type": "timestamp" - }, - "com.amazonaws.kms#Decrypt": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#DecryptRequest" - }, - "output": { - "target": "com.amazonaws.kms#DecryptResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#IncorrectKeyException" - }, - { - "target": "com.amazonaws.kms#InvalidCiphertextException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#InvalidKeyUsageException" - }, - { - "target": "com.amazonaws.kms#KeyUnavailableException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Decrypts ciphertext that was encrypted by a KMS key using any of the following\n operations:

\n \n

You can use this operation to decrypt ciphertext that was encrypted under a symmetric or\n asymmetric KMS key. When the KMS key is asymmetric, you must specify the KMS key and the\n encryption algorithm that was used to encrypt the ciphertext. For information about symmetric and asymmetric KMS keys, see Using Symmetric and Asymmetric KMS keys in the Key Management Service Developer Guide.

\n

The Decrypt operation also decrypts ciphertext that was encrypted outside of KMS by the\n public key in an KMS asymmetric KMS key. However, it cannot decrypt ciphertext produced by\n other libraries, such as the Amazon Web Services\n Encryption SDK or Amazon S3 client-side encryption.\n These libraries return a ciphertext format that is incompatible with KMS.

\n

If the ciphertext was encrypted under a symmetric KMS key, the KeyId\n parameter is optional. KMS can get this information from metadata that it adds to the\n symmetric ciphertext blob. This feature adds durability to your implementation by ensuring\n that authorized users can decrypt ciphertext decades after it was encrypted, even if they've\n lost track of the key ID. However, specifying the KMS key is always recommended as a best\n practice. When you use the KeyId parameter to specify a KMS key, KMS only uses\n the KMS key you specify. If the ciphertext was encrypted under a different KMS key, the\n Decrypt operation fails. This practice ensures that you use the KMS key that\n you intend.

\n

Whenever possible, use key policies to give users permission to call the\n Decrypt operation on a particular KMS key, instead of using IAM policies.\n Otherwise, you might create an IAM user policy that gives the user Decrypt\n permission on all KMS keys. This user could decrypt ciphertext that was encrypted by KMS keys\n in other accounts if the key policy for the cross-account KMS key permits it. If you must use\n an IAM policy for Decrypt permissions, limit the user to particular KMS keys or\n particular trusted accounts. For details, see Best practices for IAM\n policies in the Key Management Service Developer Guide.

\n

Applications in Amazon Web Services Nitro Enclaves can call this operation by using the Amazon Web Services Nitro Enclaves Development Kit. For information about the supporting parameters, see How Amazon Web Services Nitro Enclaves use KMS in the Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:Decrypt (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#DecryptRequest": { - "type": "structure", - "members": { - "CiphertextBlob": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

Ciphertext to be decrypted. The blob includes metadata.

", - "smithy.api#required": {} - } - }, - "EncryptionContext": { - "target": "com.amazonaws.kms#EncryptionContextType", - "traits": { - "smithy.api#documentation": "

Specifies the encryption context to use when decrypting the data.\n An encryption context is valid only for cryptographic operations with a symmetric KMS key. The standard asymmetric encryption algorithms that KMS uses do not support an encryption context.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Specifies the KMS key that KMS uses to decrypt the ciphertext. Enter a key ID of the KMS\n key that was used to encrypt the ciphertext.

\n\n

This parameter is required only when the ciphertext was encrypted under an asymmetric KMS\n key. If you used a symmetric KMS key, KMS can get the KMS key from metadata that it adds to\n the symmetric ciphertext blob. However, it is always recommended as a best practice. This\n practice ensures that you use the KMS key that you intend.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

" - } - }, - "EncryptionAlgorithm": { - "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

Specifies the encryption algorithm that will be used to decrypt the ciphertext. Specify\n the same algorithm that was used to encrypt the data. If you specify a different algorithm,\n the Decrypt operation fails.

\n

This parameter is required only when the ciphertext was encrypted under an asymmetric KMS\n key. The default value, SYMMETRIC_DEFAULT, represents the only supported\n algorithm that is valid for symmetric KMS keys.

" - } - } - } - }, - "com.amazonaws.kms#DecryptResponse": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that was used to decrypt the ciphertext.

" - } - }, - "Plaintext": { - "target": "com.amazonaws.kms#PlaintextType", - "traits": { - "smithy.api#documentation": "

Decrypted plaintext data. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" - } - }, - "EncryptionAlgorithm": { - "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

The encryption algorithm that was used to decrypt the ciphertext.

" - } - } - } - }, - "com.amazonaws.kms#DeleteAlias": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#DeleteAliasRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Deletes the specified alias.

\n \n

Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

Because an alias is not a property of a KMS key, you can delete and change the aliases of\n a KMS key without affecting the KMS key. Also, aliases do not appear in the response from the\n DescribeKey operation. To get the aliases of all KMS keys, use the ListAliases operation.

\n

Each KMS key can have multiple aliases. To change the alias of a KMS key, use DeleteAlias to delete the current alias and CreateAlias to\n create a new alias. To associate an existing alias with a different KMS key, call UpdateAlias.

\n

\n Cross-account use: No. You cannot perform this operation on an alias in a different Amazon Web Services account.

\n

\n Required permissions\n

\n \n

For details, see Controlling access to aliases in the\n Key Management Service Developer Guide.

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#DeleteAliasRequest": { - "type": "structure", - "members": { - "AliasName": { - "target": "com.amazonaws.kms#AliasNameType", - "traits": { - "smithy.api#documentation": "

The alias to be deleted. The alias name must begin with alias/ followed by\n the alias name, such as alias/ExampleAlias.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#DeleteCustomKeyStore": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#DeleteCustomKeyStoreRequest" - }, - "output": { - "target": "com.amazonaws.kms#DeleteCustomKeyStoreResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#CustomKeyStoreHasCMKsException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - } - ], - "traits": { - "smithy.api#documentation": "

Deletes a custom key store. This operation does not delete the CloudHSM cluster that is\n associated with the custom key store, or affect any users or keys in the cluster.

\n

The custom key store that you delete cannot contain any KMS KMS keys. Before deleting the key store,\n verify that you will never need to use any of the KMS keys in the key store for any\n cryptographic operations. Then, use ScheduleKeyDeletion to delete the KMS keys from the\n key store. When the scheduled waiting period expires, the ScheduleKeyDeletion\n operation deletes the KMS keys. Then it makes a best effort to delete the key material from\n the associated cluster. However, you might need to manually delete the orphaned key\n material from the cluster and its backups.

\n

After all KMS keys are deleted from KMS, use DisconnectCustomKeyStore\n to disconnect the key store from KMS. Then, you can delete the custom key store.

\n

Instead of deleting the custom key store, consider using DisconnectCustomKeyStore to disconnect it from KMS. While the key store is\n disconnected, you cannot create or use the KMS keys in the key store. But, you do not need to\n delete KMS keys and you can reconnect a disconnected custom key store at any time.

\n

If the operation succeeds, it returns a JSON object with no\nproperties.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

\n

\n Cross-account use: No.\n You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:DeleteCustomKeyStore (IAM policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#DeleteCustomKeyStoreRequest": { - "type": "structure", - "members": { - "CustomKeyStoreId": { - "target": "com.amazonaws.kms#CustomKeyStoreIdType", - "traits": { - "smithy.api#documentation": "

Enter the ID of the custom key store you want to delete. To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#DeleteCustomKeyStoreResponse": { - "type": "structure", - "members": {} - }, - "com.amazonaws.kms#DeleteImportedKeyMaterial": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#DeleteImportedKeyMaterialRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Deletes key material that you previously imported. This operation makes the specified KMS\n key unusable. For more information about importing key material into KMS, see Importing Key Material\n in the Key Management Service Developer Guide.

\n

When the specified KMS key is in the PendingDeletion state, this operation\n does not change the KMS key's state. Otherwise, it changes the KMS key's state to\n PendingImport.

\n

After you delete key material, you can use ImportKeyMaterial to reimport\n the same key material into the KMS key.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:DeleteImportedKeyMaterial (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#DeleteImportedKeyMaterialRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the KMS key from which you are deleting imported key material. The\n Origin of the KMS key must be EXTERNAL.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#DependencyTimeoutException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "DependencyTimeout", - "httpResponseCode": 503 - }, - "smithy.api#documentation": "

The system timed out while trying to fulfill the request. The request can be\n retried.

", - "smithy.api#error": "server", - "smithy.api#httpError": 503 - } - }, - "com.amazonaws.kms#DescribeCustomKeyStores": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#DescribeCustomKeyStoresRequest" - }, - "output": { - "target": "com.amazonaws.kms#DescribeCustomKeyStoresResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" - }, - { - "target": "com.amazonaws.kms#InvalidMarkerException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - } - ], - "traits": { - "smithy.api#documentation": "

Gets information about custom key stores in the account and Region.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

\n

By default, this operation returns information about all custom key\n stores in the account and Region. To get only information about a particular custom key store,\n use either the CustomKeyStoreName or CustomKeyStoreId parameter (but\n not both).

\n

To determine whether the custom key store is connected to its CloudHSM cluster, use the\n ConnectionState element in the response. If an attempt to connect the custom\n key store failed, the ConnectionState value is FAILED and the\n ConnectionErrorCode element in the response indicates the cause of the failure.\n For help interpreting the ConnectionErrorCode, see CustomKeyStoresListEntry.

\n

Custom key stores have a DISCONNECTED connection state if the key store has\n never been connected or you use the DisconnectCustomKeyStore operation to\n disconnect it. If your custom key store state is CONNECTED but you are having\n trouble using it, make sure that its associated CloudHSM cluster is active and contains the\n minimum number of HSMs required for the operation, if any.

\n

For help repairing your custom key store, see the Troubleshooting Custom Key Stores topic in the\n Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n

\n Required permissions: kms:DescribeCustomKeyStores (IAM policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#DescribeCustomKeyStoresRequest": { - "type": "structure", - "members": { - "CustomKeyStoreId": { - "target": "com.amazonaws.kms#CustomKeyStoreIdType", - "traits": { - "smithy.api#documentation": "

Gets only information about the specified custom key store. Enter the key store ID.

\n

By default, this operation gets information about all custom key stores in the account and\n Region. To limit the output to a particular custom key store, you can use either the\n CustomKeyStoreId or CustomKeyStoreName parameter, but not\n both.

" - } - }, - "CustomKeyStoreName": { - "target": "com.amazonaws.kms#CustomKeyStoreNameType", - "traits": { - "smithy.api#documentation": "

Gets only information about the specified custom key store. Enter the friendly name of the\n custom key store.

\n

By default, this operation gets information about all custom key stores in the account and\n Region. To limit the output to a particular custom key store, you can use either the\n CustomKeyStoreId or CustomKeyStoreName parameter, but not\n both.

" - } - }, - "Limit": { - "target": "com.amazonaws.kms#LimitType", - "traits": { - "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

" - } - }, - "Marker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" - } - } - } - }, - "com.amazonaws.kms#DescribeCustomKeyStoresResponse": { - "type": "structure", - "members": { - "CustomKeyStores": { - "target": "com.amazonaws.kms#CustomKeyStoresList", - "traits": { - "smithy.api#documentation": "

Contains metadata about each custom key store.

" - } - }, - "NextMarker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

When Truncated is true, this element is present and contains the\n value to use for the Marker parameter in a subsequent request.

" - } - }, - "Truncated": { - "target": "com.amazonaws.kms#BooleanType", - "traits": { - "smithy.api#documentation": "

A flag that indicates whether there are more items in the list. When this\n value is true, the list in this response is truncated. To get more items, pass the value of\n the NextMarker element in thisresponse to the Marker parameter in a\n subsequent request.

" - } - } - } - }, - "com.amazonaws.kms#DescribeKey": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#DescribeKeyRequest" - }, - "output": { - "target": "com.amazonaws.kms#DescribeKeyResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Provides detailed information about a KMS key. You can run DescribeKey on a\n customer managed\n key or an Amazon Web Services managed key.

\n

This detailed information includes the key ARN, creation date (and deletion date, if\n applicable), the key state, and the origin and expiration date (if any) of the key material.\n It includes fields, like KeySpec, that help you distinguish symmetric from\n asymmetric KMS keys. It also provides information that is particularly important to asymmetric\n keys, such as the key usage (encryption or signing) and the encryption algorithms or signing\n algorithms that the KMS key supports. For KMS keys in custom key stores, it includes\n information about the custom key store, such as the key store ID and the CloudHSM cluster ID. For\n multi-Region keys, it displays the primary key and all related replica keys.

\n

\n DescribeKey does not return the following information:

\n
    \n
  • \n

    Aliases associated with the KMS key. To get this information, use ListAliases.

    \n
  • \n
  • \n

    Whether automatic key rotation is enabled on the KMS key. To get this information, use\n GetKeyRotationStatus. Also, some key states prevent a KMS key from\n being automatically rotated. For details, see How Automatic Key Rotation\n Works in Key Management Service Developer Guide.

    \n
  • \n
  • \n

    Tags on the KMS key. To get this information, use ListResourceTags.

    \n
  • \n
  • \n

    Key policies and grants on the KMS key. To get this information, use GetKeyPolicy and ListGrants.

    \n
  • \n
\n

If you call the DescribeKey operation on a predefined Amazon Web Services\n alias, that is, an Amazon Web Services alias with no key ID, KMS creates an Amazon Web Services managed\n key. Then, it associates the alias with the new KMS key, and returns the\n KeyId and Arn of the new KMS key in the response.

\n

\n Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:DescribeKey (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#DescribeKeyRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Describes the specified KMS key.

\n

If you specify a predefined Amazon Web Services alias (an Amazon Web Services alias with no key ID), KMS associates\n the alias with an Amazon Web Services managed key and returns its\n KeyId and Arn in the response.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", - "smithy.api#required": {} - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - } - } - }, - "com.amazonaws.kms#DescribeKeyResponse": { - "type": "structure", - "members": { - "KeyMetadata": { - "target": "com.amazonaws.kms#KeyMetadata", - "traits": { - "smithy.api#documentation": "

Metadata associated with the key.

" - } - } - } - }, - "com.amazonaws.kms#DescriptionType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 0, - "max": 8192 - } - } - }, - "com.amazonaws.kms#DisableKey": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#DisableKeyRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Sets the state of a KMS key to disabled. This change temporarily prevents use of the KMS\n key for cryptographic operations.

\n

For more information about how key state affects the use of a KMS key, see Key state: Effect on your KMS\n key in the \n Key Management Service Developer Guide\n .

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:DisableKey (key policy)

\n

\n Related operations: EnableKey\n

" - } - }, - "com.amazonaws.kms#DisableKeyRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the KMS key to disable.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#DisableKeyRotation": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#DisableKeyRotationRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Disables automatic\n rotation of the key material for the specified symmetric KMS key.

\n

You cannot enable automatic rotation of asymmetric KMS keys, KMS keys with imported key material, or KMS keys in a custom key store. To enable or disable automatic rotation of a set of related multi-Region keys, set the property on the primary key.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:DisableKeyRotation (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#DisableKeyRotationRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies a symmetric KMS key. You cannot enable or disable automatic rotation of asymmetric\n KMS keys, KMS keys with imported key material, or KMS keys in a\n custom key store.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#DisabledException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "Disabled", - "httpResponseCode": 409 - }, - "smithy.api#documentation": "

The request was rejected because the specified KMS key is not enabled.

", - "smithy.api#error": "client", - "smithy.api#httpError": 409 - } - }, - "com.amazonaws.kms#DisconnectCustomKeyStore": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#DisconnectCustomKeyStoreRequest" - }, - "output": { - "target": "com.amazonaws.kms#DisconnectCustomKeyStoreResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - } - ], - "traits": { - "smithy.api#documentation": "

Disconnects the custom key store from its associated CloudHSM cluster. While a custom key\n store is disconnected, you can manage the custom key store and its KMS keys, but you cannot\n create or use KMS keys in the custom key store. You can reconnect the custom key store at any\n time.

\n \n

While a custom key store is disconnected, all attempts to create KMS keys in the custom key store or to use existing KMS keys in cryptographic operations will\n fail. This action can prevent users from storing and accessing sensitive data.

\n
\n

\n

To find the connection state of a custom key store, use the DescribeCustomKeyStores operation. To reconnect a custom key store, use the\n ConnectCustomKeyStore operation.

\n

If the operation succeeds, it returns a JSON object with no\nproperties.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

\n\n

\n Cross-account use: No.\n You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:DisconnectCustomKeyStore (IAM policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#DisconnectCustomKeyStoreRequest": { - "type": "structure", - "members": { - "CustomKeyStoreId": { - "target": "com.amazonaws.kms#CustomKeyStoreIdType", - "traits": { - "smithy.api#documentation": "

Enter the ID of the custom key store you want to disconnect. To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#DisconnectCustomKeyStoreResponse": { - "type": "structure", - "members": {} - }, - "com.amazonaws.kms#EnableKey": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#EnableKeyRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#LimitExceededException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Sets the key state of a KMS key to enabled. This allows you to use the KMS key for\n cryptographic operations.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:EnableKey (key policy)

\n

\n Related operations: DisableKey\n

" - } - }, - "com.amazonaws.kms#EnableKeyRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the KMS key to enable.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#EnableKeyRotation": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#EnableKeyRotationRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Enables automatic rotation\n of the key material for the specified symmetric KMS key.

\n

You cannot enable automatic rotation of asymmetric KMS keys, KMS keys with imported key material, or KMS keys in a custom key store. To enable or disable automatic rotation of a set of related multi-Region keys, set the property on the primary key.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:EnableKeyRotation (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#EnableKeyRotationRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies a symmetric KMS key. You cannot enable automatic rotation of asymmetric KMS keys, KMS keys with imported key material, or KMS keys in a custom key store. To enable or disable automatic rotation of a set of related multi-Region keys, set the property on the primary key.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#Encrypt": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#EncryptRequest" - }, - "output": { - "target": "com.amazonaws.kms#EncryptResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#InvalidKeyUsageException" - }, - { - "target": "com.amazonaws.kms#KeyUnavailableException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Encrypts plaintext into ciphertext by using a KMS key. The Encrypt operation\n has two primary use cases:

\n
    \n
  • \n

    You can encrypt small amounts of arbitrary data, such as a personal identifier or\n database password, or other sensitive information.

    \n
  • \n
  • \n

    You can use the Encrypt operation to move encrypted data from one Amazon Web Services\n Region to another. For example, in Region A, generate a data key and use the plaintext key\n to encrypt your data. Then, in Region A, use the Encrypt operation to encrypt\n the plaintext data key under a KMS key in Region B. Now, you can move the encrypted data\n and the encrypted data key to Region B. When necessary, you can decrypt the encrypted data\n key and the encrypted data entirely within in Region B.

    \n
  • \n
\n\n

You don't need to use the Encrypt operation to encrypt a data key. The GenerateDataKey and GenerateDataKeyPair operations return a\n plaintext data key and an encrypted copy of that data key.

\n\n

When you encrypt data, you must specify a symmetric or asymmetric KMS key to use in the\n encryption operation. The KMS key must have a KeyUsage value of\n ENCRYPT_DECRYPT. To find the KeyUsage of a KMS key, use the DescribeKey operation.

\n\n

If you use a symmetric KMS key, you can use an encryption context to add additional\n security to your encryption operation. If you specify an EncryptionContext when\n encrypting data, you must specify the same encryption context (a case-sensitive exact match)\n when decrypting the data. Otherwise, the request to decrypt fails with an\n InvalidCiphertextException. For more information, see Encryption\n Context in the Key Management Service Developer Guide.

\n

If you specify an asymmetric KMS key, you must also specify the encryption algorithm. The\n algorithm must be compatible with the KMS key type.

\n \n

When you use an asymmetric KMS key to encrypt or reencrypt data, be sure to record the KMS key and encryption algorithm that you choose. You will be required to provide the same KMS key and encryption algorithm when you decrypt the data. If the KMS key and algorithm do not match the values used to encrypt the data, the decrypt operation fails.

\n

You are not required to supply the key ID and encryption algorithm when you decrypt with symmetric KMS keys because KMS stores this information in the ciphertext blob. KMS cannot store metadata in ciphertext generated with asymmetric keys. The standard format for asymmetric key ciphertext does not include configurable fields.

\n
\n\n\n

The maximum size of the data that you can encrypt varies with the type of KMS key and the\n encryption algorithm that you choose.

\n
    \n
  • \n

    Symmetric KMS keys

    \n
      \n
    • \n

      \n SYMMETRIC_DEFAULT: 4096 bytes

      \n
    • \n
    \n
  • \n
  • \n

    \n RSA_2048\n

    \n
      \n
    • \n

      \n RSAES_OAEP_SHA_1: 214 bytes

      \n
    • \n
    • \n

      \n RSAES_OAEP_SHA_256: 190 bytes

      \n
    • \n
    \n
  • \n
  • \n

    \n RSA_3072\n

    \n
      \n
    • \n

      \n RSAES_OAEP_SHA_1: 342 bytes

      \n
    • \n
    • \n

      \n RSAES_OAEP_SHA_256: 318 bytes

      \n
    • \n
    \n
  • \n
  • \n

    \n RSA_4096\n

    \n
      \n
    • \n

      \n RSAES_OAEP_SHA_1: 470 bytes

      \n
    • \n
    • \n

      \n RSAES_OAEP_SHA_256: 446 bytes

      \n
    • \n
    \n
  • \n
\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: Yes.\n To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:Encrypt (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#EncryptRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the KMS key to use in the encryption operation.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", - "smithy.api#required": {} - } - }, - "Plaintext": { - "target": "com.amazonaws.kms#PlaintextType", - "traits": { - "smithy.api#documentation": "

Data to be encrypted.

", - "smithy.api#required": {} - } - }, - "EncryptionContext": { - "target": "com.amazonaws.kms#EncryptionContextType", - "traits": { - "smithy.api#documentation": "

Specifies the encryption context that will be used to encrypt the data.\n An encryption context is valid only for cryptographic operations with a symmetric KMS key. The standard asymmetric encryption algorithms that KMS uses do not support an encryption context.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - }, - "EncryptionAlgorithm": { - "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

Specifies the encryption algorithm that KMS will use to encrypt the plaintext message.\n The algorithm must be compatible with the KMS key that you specify.

\n

This parameter is required only for asymmetric KMS keys. The default value,\n SYMMETRIC_DEFAULT, is the algorithm used for symmetric KMS keys. If you are\n using an asymmetric KMS key, we recommend RSAES_OAEP_SHA_256.

" - } - } - } - }, - "com.amazonaws.kms#EncryptResponse": { - "type": "structure", - "members": { - "CiphertextBlob": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

The encrypted plaintext. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that was used to encrypt the plaintext.

" - } - }, - "EncryptionAlgorithm": { - "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

The encryption algorithm that was used to encrypt the plaintext.

" - } - } - } - }, - "com.amazonaws.kms#EncryptionAlgorithmSpec": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "SYMMETRIC_DEFAULT", - "name": "SYMMETRIC_DEFAULT" - }, - { - "value": "RSAES_OAEP_SHA_1", - "name": "RSAES_OAEP_SHA_1" - }, - { - "value": "RSAES_OAEP_SHA_256", - "name": "RSAES_OAEP_SHA_256" - } - ] - } - }, - "com.amazonaws.kms#EncryptionAlgorithmSpecList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#EncryptionAlgorithmSpec" - } - }, - "com.amazonaws.kms#EncryptionContextKey": { - "type": "string" - }, - "com.amazonaws.kms#EncryptionContextType": { - "type": "map", - "key": { - "target": "com.amazonaws.kms#EncryptionContextKey" - }, - "value": { - "target": "com.amazonaws.kms#EncryptionContextValue" - } - }, - "com.amazonaws.kms#EncryptionContextValue": { - "type": "string" - }, - "com.amazonaws.kms#ErrorMessageType": { - "type": "string" - }, - "com.amazonaws.kms#ExpirationModelType": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "KEY_MATERIAL_EXPIRES", - "name": "KEY_MATERIAL_EXPIRES" - }, - { - "value": "KEY_MATERIAL_DOES_NOT_EXPIRE", - "name": "KEY_MATERIAL_DOES_NOT_EXPIRE" - } - ] - } - }, - "com.amazonaws.kms#ExpiredImportTokenException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "ExpiredImportTokenException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the specified import token is expired. Use GetParametersForImport to get a new import token and public key, use the new\n public key to encrypt the key material, and then try the request again.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#GenerateDataKey": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#GenerateDataKeyRequest" - }, - "output": { - "target": "com.amazonaws.kms#GenerateDataKeyResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#InvalidKeyUsageException" - }, - { - "target": "com.amazonaws.kms#KeyUnavailableException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Generates a unique symmetric data key for client-side encryption. This operation returns a\n plaintext copy of the data key and a copy that is encrypted under a KMS key that you specify.\n You can use the plaintext key to encrypt your data outside of KMS and store the encrypted\n data key with the encrypted data.

\n\n

\n GenerateDataKey returns a unique data key for each request. The bytes in the\n plaintext key are not related to the caller or the KMS key.

\n\n

To generate a data key, specify the symmetric KMS key that will be used to encrypt the\n data key. You cannot use an asymmetric KMS key to generate data keys. To get the type of your\n KMS key, use the DescribeKey operation. You must also specify the length of\n the data key. Use either the KeySpec or NumberOfBytes parameters\n (but not both). For 128-bit and 256-bit data keys, use the KeySpec parameter.

\n\n

To get only an encrypted copy of the data key, use GenerateDataKeyWithoutPlaintext. To generate an asymmetric data key pair, use\n the GenerateDataKeyPair or GenerateDataKeyPairWithoutPlaintext operation. To get a cryptographically secure\n random byte string, use GenerateRandom.

\n\n

You can use the optional encryption context to add additional security to the encryption\n operation. If you specify an EncryptionContext, you must specify the same\n encryption context (a case-sensitive exact match) when decrypting the encrypted data key.\n Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context in the\n Key Management Service Developer Guide.

\n

Applications in Amazon Web Services Nitro Enclaves can call this operation by using the Amazon Web Services Nitro Enclaves Development Kit. For information about the supporting parameters, see How Amazon Web Services Nitro Enclaves use KMS in the Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n How to use your data\n key\n

\n

We recommend that you use the following pattern to encrypt data locally in your\n application. You can write your own code or use a client-side encryption library, such as the\n Amazon Web Services Encryption SDK, the\n Amazon DynamoDB Encryption Client,\n or Amazon S3\n client-side encryption to do these tasks for you.

\n

To encrypt data outside of KMS:

\n
    \n
  1. \n

    Use the GenerateDataKey operation to get a data key.

    \n
  2. \n
  3. \n

    Use the plaintext data key (in the Plaintext field of the response) to\n encrypt your data outside of KMS. Then erase the plaintext data key from memory.

    \n
  4. \n
  5. \n

    Store the encrypted data key (in the CiphertextBlob field of the\n response) with the encrypted data.

    \n
  6. \n
\n

To decrypt data outside of KMS:

\n
    \n
  1. \n

    Use the Decrypt operation to decrypt the encrypted data key. The\n operation returns a plaintext copy of the data key.

    \n
  2. \n
  3. \n

    Use the plaintext data key to decrypt data outside of KMS, then erase the plaintext\n data key from memory.

    \n
  4. \n
\n

\n Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GenerateDataKey (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#GenerateDataKeyPair": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#GenerateDataKeyPairRequest" - }, - "output": { - "target": "com.amazonaws.kms#GenerateDataKeyPairResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#InvalidKeyUsageException" - }, - { - "target": "com.amazonaws.kms#KeyUnavailableException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Generates a unique asymmetric data key pair. The GenerateDataKeyPair\n operation returns a plaintext public key, a plaintext private key, and a copy of the private\n key that is encrypted under the symmetric KMS key you specify. You can use the data key pair\n to perform asymmetric cryptography and implement digital signatures outside of KMS.

\n\n

You can use the public key that GenerateDataKeyPair returns to encrypt data\n or verify a signature outside of KMS. Then, store the encrypted private key with the data.\n When you are ready to decrypt data or sign a message, you can use the Decrypt operation to decrypt the encrypted private key.

\n\n

To generate a data key pair, you must specify a symmetric KMS key to encrypt the private\n key in a data key pair. You cannot use an asymmetric KMS key or a KMS key in a custom key\n store. To get the type and origin of your KMS key, use the DescribeKey\n operation.

\n

Use the KeyPairSpec parameter to choose an RSA or Elliptic Curve (ECC) data\n key pair. KMS recommends that your use ECC key pairs for signing, and use RSA key pairs for\n either encryption or signing, but not both. However, KMS cannot enforce any restrictions on\n the use of data key pairs outside of KMS.

\n\n

If you are using the data key pair to encrypt data, or for any operation where you don't\n immediately need a private key, consider using the GenerateDataKeyPairWithoutPlaintext operation.\n GenerateDataKeyPairWithoutPlaintext returns a plaintext public key and an\n encrypted private key, but omits the plaintext private key that you need only to decrypt\n ciphertext or sign a message. Later, when you need to decrypt the data or sign a message, use\n the Decrypt operation to decrypt the encrypted private key in the data key\n pair.

\n\n

\n GenerateDataKeyPair returns a unique data key pair for each request. The\n bytes in the keys are not related to the caller or the KMS key that is used to encrypt the\n private key. The public key is a DER-encoded X.509 SubjectPublicKeyInfo, as specified in\n RFC 5280. The private key is a\n DER-encoded PKCS8 PrivateKeyInfo, as specified in RFC 5958.

\n\n

You can use the optional encryption context to add additional security to the encryption\n operation. If you specify an EncryptionContext, you must specify the same\n encryption context (a case-sensitive exact match) when decrypting the encrypted data key.\n Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context in the\n Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GenerateDataKeyPair (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#GenerateDataKeyPairRequest": { - "type": "structure", - "members": { - "EncryptionContext": { - "target": "com.amazonaws.kms#EncryptionContextType", - "traits": { - "smithy.api#documentation": "

Specifies the encryption context that will be used when encrypting the private key in the\n data key pair.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Specifies the symmetric KMS key that encrypts the private key in the data key pair. You\n cannot specify an asymmetric KMS key or a KMS key in a custom key store. To get the type and\n origin of your KMS key, use the DescribeKey operation.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", - "smithy.api#required": {} - } - }, - "KeyPairSpec": { - "target": "com.amazonaws.kms#DataKeyPairSpec", - "traits": { - "smithy.api#documentation": "

Determines the type of data key pair that is generated.

\n

The KMS rule that restricts the use of asymmetric RSA KMS keys to encrypt and decrypt or to sign and verify (but not both), and the rule that permits you to use ECC KMS keys only to sign and verify, are not effective on data key pairs, which are used outside of KMS.

", - "smithy.api#required": {} - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - } - } - }, - "com.amazonaws.kms#GenerateDataKeyPairResponse": { - "type": "structure", - "members": { - "PrivateKeyCiphertextBlob": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

The encrypted copy of the private key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" - } - }, - "PrivateKeyPlaintext": { - "target": "com.amazonaws.kms#PlaintextType", - "traits": { - "smithy.api#documentation": "

The plaintext copy of the private key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" - } - }, - "PublicKey": { - "target": "com.amazonaws.kms#PublicKeyType", - "traits": { - "smithy.api#documentation": "

The public key (in plaintext).

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that encrypted the private key.

" - } - }, - "KeyPairSpec": { - "target": "com.amazonaws.kms#DataKeyPairSpec", - "traits": { - "smithy.api#documentation": "

The type of data key pair that was generated.

" - } - } - } - }, - "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintext": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintextRequest" - }, - "output": { - "target": "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintextResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#InvalidKeyUsageException" - }, - { - "target": "com.amazonaws.kms#KeyUnavailableException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Generates a unique asymmetric data key pair. The\n GenerateDataKeyPairWithoutPlaintext operation returns a plaintext public key\n and a copy of the private key that is encrypted under the symmetric KMS key you specify.\n Unlike GenerateDataKeyPair, this operation does not return a plaintext\n private key.

\n

You can use the public key that GenerateDataKeyPairWithoutPlaintext returns\n to encrypt data or verify a signature outside of KMS. Then, store the encrypted private key\n with the data. When you are ready to decrypt data or sign a message, you can use the Decrypt operation to decrypt the encrypted private key.

\n

To generate a data key pair, you must specify a symmetric KMS key to encrypt the private\n key in a data key pair. You cannot use an asymmetric KMS key or a KMS key in a custom key\n store. To get the type and origin of your KMS key, use the DescribeKey\n operation.

\n

Use the KeyPairSpec parameter to choose an RSA or Elliptic Curve (ECC) data\n key pair. KMS recommends that your use ECC key pairs for signing, and use RSA key pairs for\n either encryption or signing, but not both. However, KMS cannot enforce any restrictions on\n the use of data key pairs outside of KMS.

\n

\n GenerateDataKeyPairWithoutPlaintext returns a unique data key pair for each\n request. The bytes in the key are not related to the caller or KMS key that is used to encrypt\n the private key. The public key is a DER-encoded X.509 SubjectPublicKeyInfo, as specified in\n RFC 5280.

\n\n

You can use the optional encryption context to add additional security to the encryption\n operation. If you specify an EncryptionContext, you must specify the same\n encryption context (a case-sensitive exact match) when decrypting the encrypted data key.\n Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context in the\n Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GenerateDataKeyPairWithoutPlaintext (key\n policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintextRequest": { - "type": "structure", - "members": { - "EncryptionContext": { - "target": "com.amazonaws.kms#EncryptionContextType", - "traits": { - "smithy.api#documentation": "

Specifies the encryption context that will be used when encrypting the private key in the\n data key pair.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Specifies the KMS key that encrypts the private key in the data key pair. You must specify\n a symmetric KMS key. You cannot use an asymmetric KMS key or a KMS key in a custom key store.\n To get the type and origin of your KMS key, use the DescribeKey operation.\n

\n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", - "smithy.api#required": {} - } - }, - "KeyPairSpec": { - "target": "com.amazonaws.kms#DataKeyPairSpec", - "traits": { - "smithy.api#documentation": "

Determines the type of data key pair that is generated.

\n

The KMS rule that restricts the use of asymmetric RSA KMS keys to encrypt and decrypt or to sign and verify (but not both), and the rule that permits you to use ECC KMS keys only to sign and verify, are not effective on data key pairs, which are used outside of KMS.

", - "smithy.api#required": {} - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - } - } - }, - "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintextResponse": { - "type": "structure", - "members": { - "PrivateKeyCiphertextBlob": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

The encrypted copy of the private key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" - } - }, - "PublicKey": { - "target": "com.amazonaws.kms#PublicKeyType", - "traits": { - "smithy.api#documentation": "

The public key (in plaintext).

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that encrypted the private key.

" - } - }, - "KeyPairSpec": { - "target": "com.amazonaws.kms#DataKeyPairSpec", - "traits": { - "smithy.api#documentation": "

The type of data key pair that was generated.

" - } - } - } - }, - "com.amazonaws.kms#GenerateDataKeyRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the symmetric KMS key that encrypts the data key.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", - "smithy.api#required": {} - } - }, - "EncryptionContext": { - "target": "com.amazonaws.kms#EncryptionContextType", - "traits": { - "smithy.api#documentation": "

Specifies the encryption context that will be used when encrypting the data key.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" - } - }, - "NumberOfBytes": { - "target": "com.amazonaws.kms#NumberOfBytesType", - "traits": { - "smithy.api#documentation": "

Specifies the length of the data key in bytes. For example, use the value 64 to generate a\n 512-bit data key (64 bytes is 512 bits). For 128-bit (16-byte) and 256-bit (32-byte) data\n keys, use the KeySpec parameter.

\n

You must specify either the KeySpec or the NumberOfBytes\n parameter (but not both) in every GenerateDataKey request.

" - } - }, - "KeySpec": { - "target": "com.amazonaws.kms#DataKeySpec", - "traits": { - "smithy.api#documentation": "

Specifies the length of the data key. Use AES_128 to generate a 128-bit\n symmetric key, or AES_256 to generate a 256-bit symmetric key.

\n

You must specify either the KeySpec or the NumberOfBytes\n parameter (but not both) in every GenerateDataKey request.

" - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - } - } - }, - "com.amazonaws.kms#GenerateDataKeyResponse": { - "type": "structure", - "members": { - "CiphertextBlob": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

The encrypted copy of the data key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" - } - }, - "Plaintext": { - "target": "com.amazonaws.kms#PlaintextType", - "traits": { - "smithy.api#documentation": "

The plaintext data key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. Use this data key to encrypt your data outside of\n KMS. Then, remove it from memory as soon as possible.

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that encrypted the data key.

" - } - } - } - }, - "com.amazonaws.kms#GenerateDataKeyWithoutPlaintext": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#GenerateDataKeyWithoutPlaintextRequest" - }, - "output": { - "target": "com.amazonaws.kms#GenerateDataKeyWithoutPlaintextResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#InvalidKeyUsageException" - }, - { - "target": "com.amazonaws.kms#KeyUnavailableException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Generates a unique symmetric data key. This operation returns a data key that is encrypted\n under a KMS key that you specify. To request an asymmetric data key pair, use the GenerateDataKeyPair or GenerateDataKeyPairWithoutPlaintext\n operations.

\n

\n GenerateDataKeyWithoutPlaintext is identical to the GenerateDataKey operation except that returns only the encrypted copy of the\n data key. This operation is useful for systems that need to encrypt data at some point, but\n not immediately. When you need to encrypt the data, you call the Decrypt\n operation on the encrypted copy of the key.

\n

It's also useful in distributed systems with different levels of trust. For example, you\n might store encrypted data in containers. One component of your system creates new containers\n and stores an encrypted data key with each container. Then, a different component puts the\n data into the containers. That component first decrypts the data key, uses the plaintext data\n key to encrypt data, puts the encrypted data into the container, and then destroys the\n plaintext data key. In this system, the component that creates the containers never sees the\n plaintext data key.

\n

\n GenerateDataKeyWithoutPlaintext returns a unique data key for each request.\n The bytes in the keys are not related to the caller or KMS key that is used to encrypt the\n private key.

\n\n

To generate a data key, you must specify the symmetric KMS key that is used to encrypt the\n data key. You cannot use an asymmetric KMS key to generate a data key. To get the type of your\n KMS key, use the DescribeKey operation.

\n\n

If the operation succeeds, you will find the encrypted copy of the data key in the\n CiphertextBlob field.

\n\n

You can use the optional encryption context to add additional security to the encryption\n operation. If you specify an EncryptionContext, you must specify the same\n encryption context (a case-sensitive exact match) when decrypting the encrypted data key.\n Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context in the\n Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GenerateDataKeyWithoutPlaintext (key\n policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#GenerateDataKeyWithoutPlaintextRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The identifier of the symmetric KMS key that encrypts the data key.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", - "smithy.api#required": {} - } - }, - "EncryptionContext": { - "target": "com.amazonaws.kms#EncryptionContextType", - "traits": { - "smithy.api#documentation": "

Specifies the encryption context that will be used when encrypting the data key.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" - } - }, - "KeySpec": { - "target": "com.amazonaws.kms#DataKeySpec", - "traits": { - "smithy.api#documentation": "

The length of the data key. Use AES_128 to generate a 128-bit symmetric key,\n or AES_256 to generate a 256-bit symmetric key.

" - } - }, - "NumberOfBytes": { - "target": "com.amazonaws.kms#NumberOfBytesType", - "traits": { - "smithy.api#documentation": "

The length of the data key in bytes. For example, use the value 64 to generate a 512-bit\n data key (64 bytes is 512 bits). For common key lengths (128-bit and 256-bit symmetric keys),\n we recommend that you use the KeySpec field instead of this one.

" - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - } - } - }, - "com.amazonaws.kms#GenerateDataKeyWithoutPlaintextResponse": { - "type": "structure", - "members": { - "CiphertextBlob": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

The encrypted data key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that encrypted the data key.

" - } - } - } - }, - "com.amazonaws.kms#GenerateRandom": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#GenerateRandomRequest" - }, - "output": { - "target": "com.amazonaws.kms#GenerateRandomResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" - }, - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - } - ], - "traits": { - "smithy.api#documentation": "

Returns a random byte string that is cryptographically secure.

\n

By default, the random byte string is generated in KMS. To generate the byte string in\n the CloudHSM cluster that is associated with a custom key store, specify the custom key store\n ID.

\n

Applications in Amazon Web Services Nitro Enclaves can call this operation by using the Amazon Web Services Nitro Enclaves Development Kit. For information about the supporting parameters, see How Amazon Web Services Nitro Enclaves use KMS in the Key Management Service Developer Guide.

\n

For more information about entropy and random number generation, see\n Key Management Service Cryptographic Details.

\n\n

\n Required permissions: kms:GenerateRandom (IAM policy)

" - } - }, - "com.amazonaws.kms#GenerateRandomRequest": { - "type": "structure", - "members": { - "NumberOfBytes": { - "target": "com.amazonaws.kms#NumberOfBytesType", - "traits": { - "smithy.api#documentation": "

The length of the byte string.

" - } - }, - "CustomKeyStoreId": { - "target": "com.amazonaws.kms#CustomKeyStoreIdType", - "traits": { - "smithy.api#documentation": "

Generates the random byte string in the CloudHSM cluster that is associated with the\n specified custom key store. To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

" - } - } - } - }, - "com.amazonaws.kms#GenerateRandomResponse": { - "type": "structure", - "members": { - "Plaintext": { - "target": "com.amazonaws.kms#PlaintextType", - "traits": { - "smithy.api#documentation": "

The random byte string. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" - } - } - } - }, - "com.amazonaws.kms#GetKeyPolicy": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#GetKeyPolicyRequest" - }, - "output": { - "target": "com.amazonaws.kms#GetKeyPolicyResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Gets a key policy attached to the specified KMS key.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:GetKeyPolicy (key policy)

\n

\n Related operations: PutKeyPolicy\n

" - } - }, - "com.amazonaws.kms#GetKeyPolicyRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Gets the key policy for the specified KMS key.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "PolicyName": { - "target": "com.amazonaws.kms#PolicyNameType", - "traits": { - "smithy.api#documentation": "

Specifies the name of the key policy. The only valid name is default. To get\n the names of key policies, use ListKeyPolicies.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#GetKeyPolicyResponse": { - "type": "structure", - "members": { - "Policy": { - "target": "com.amazonaws.kms#PolicyType", - "traits": { - "smithy.api#documentation": "

A key policy document in JSON format.

" - } - } - } - }, - "com.amazonaws.kms#GetKeyRotationStatus": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#GetKeyRotationStatusRequest" - }, - "output": { - "target": "com.amazonaws.kms#GetKeyRotationStatusResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Gets a Boolean value that indicates whether automatic rotation of the key material is\n enabled for the specified KMS key.

\n

You cannot enable automatic rotation of asymmetric KMS keys, KMS keys with imported key material, or KMS keys in a custom key store. To enable or disable automatic rotation of a set of related multi-Region keys, set the property on the primary key. The key rotation status for these KMS keys is always\n false.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n
    \n
  • \n

    Disabled: The key rotation status does not change when you disable a KMS key. However,\n while the KMS key is disabled, KMS does not rotate the key material.

    \n
  • \n
  • \n

    Pending deletion: While a KMS key is pending deletion, its key rotation status is\n false and KMS does not rotate the key material. If you cancel the\n deletion, the original key rotation status is restored.

    \n
  • \n
\n

\n Cross-account use: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key\n ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GetKeyRotationStatus (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#GetKeyRotationStatusRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Gets the rotation status for the specified KMS key.

\n \n

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a\ndifferent Amazon Web Services account, you must use the key ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#GetKeyRotationStatusResponse": { - "type": "structure", - "members": { - "KeyRotationEnabled": { - "target": "com.amazonaws.kms#BooleanType", - "traits": { - "smithy.api#documentation": "

A Boolean value that specifies whether key rotation is enabled.

" - } - } - } - }, - "com.amazonaws.kms#GetParametersForImport": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#GetParametersForImportRequest" - }, - "output": { - "target": "com.amazonaws.kms#GetParametersForImportResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Returns the items you need to import key material into a symmetric, customer managed KMS\n key. For more information about importing key material into KMS, see Importing Key Material\n in the Key Management Service Developer Guide.

\n

This operation returns a public key and an import token. Use the public key to encrypt the\n symmetric key material. Store the import token to send with a subsequent ImportKeyMaterial request.

\n

You must specify the key ID of the symmetric KMS key into which you will import key\n material. This KMS key's Origin must be EXTERNAL. You must also\n specify the wrapping algorithm and type of wrapping key (public key) that you will use to\n encrypt the key material. You cannot perform this operation on an asymmetric KMS key or on any KMS key in a different Amazon Web Services account.

\n

To import key material, you must use the public key and import token from the same\n response. These items are valid for 24 hours. The expiration date and time appear in the\n GetParametersForImport response. You cannot use an expired token in an ImportKeyMaterial request. If your key and token expire, send another\n GetParametersForImport request.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:GetParametersForImport (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#GetParametersForImportRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The identifier of the symmetric KMS key into which you will import key material. The\n Origin of the KMS key must be EXTERNAL.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "WrappingAlgorithm": { - "target": "com.amazonaws.kms#AlgorithmSpec", - "traits": { - "smithy.api#documentation": "

The algorithm you will use to encrypt the key material before importing it with ImportKeyMaterial. For more information, see Encrypt the Key Material\n in the Key Management Service Developer Guide.

", - "smithy.api#required": {} - } - }, - "WrappingKeySpec": { - "target": "com.amazonaws.kms#WrappingKeySpec", - "traits": { - "smithy.api#documentation": "

The type of wrapping key (public key) to return in the response. Only 2048-bit RSA public\n keys are supported.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#GetParametersForImportResponse": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key to use in a subsequent ImportKeyMaterial request. This is the same KMS key specified in the GetParametersForImport\n request.

" - } - }, - "ImportToken": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

The import token to send in a subsequent ImportKeyMaterial\n request.

" - } - }, - "PublicKey": { - "target": "com.amazonaws.kms#PlaintextType", - "traits": { - "smithy.api#documentation": "

The public key to use to encrypt the key material before importing it with ImportKeyMaterial.

" - } - }, - "ParametersValidTo": { - "target": "com.amazonaws.kms#DateType", - "traits": { - "smithy.api#documentation": "

The time at which the import token and public key are no longer valid. After this time,\n you cannot use them to make an ImportKeyMaterial request and you must send\n another GetParametersForImport request to get new ones.

" - } - } - } - }, - "com.amazonaws.kms#GetPublicKey": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#GetPublicKeyRequest" - }, - "output": { - "target": "com.amazonaws.kms#GetPublicKeyResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#InvalidKeyUsageException" - }, - { - "target": "com.amazonaws.kms#KeyUnavailableException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Returns the public key of an asymmetric KMS key. Unlike the private key of a asymmetric\n KMS key, which never leaves KMS unencrypted, callers with kms:GetPublicKey\n permission can download the public key of an asymmetric KMS key. You can share the public key\n to allow others to encrypt messages and verify signatures outside of KMS.\n For information about symmetric and asymmetric KMS keys, see Using Symmetric and Asymmetric KMS keys in the Key Management Service Developer Guide.

\n

You do not need to download the public key. Instead, you can use the public key within\n KMS by calling the Encrypt, ReEncrypt, or Verify operations with the identifier of an asymmetric KMS key. When you use the\n public key within KMS, you benefit from the authentication, authorization, and logging that\n are part of every KMS operation. You also reduce of risk of encrypting data that cannot be\n decrypted. These features are not effective outside of KMS. For details, see Special\n Considerations for Downloading Public Keys.

\n

To help you use the public key safely outside of KMS, GetPublicKey returns\n important information about the public key in the response, including:

\n
    \n
  • \n

    \n KeySpec: The type of key material in the public key, such as\n RSA_4096 or ECC_NIST_P521.

    \n
  • \n
  • \n

    \n KeyUsage: Whether the key is used for encryption or signing.

    \n
  • \n
  • \n

    \n EncryptionAlgorithms or SigningAlgorithms: A list of the encryption algorithms or the signing\n algorithms for the key.

    \n
  • \n
\n

Although KMS cannot enforce these restrictions on external operations, it is crucial\n that you use this information to prevent the public key from being used improperly. For\n example, you can prevent a public signing key from being used encrypt data, or prevent a\n public key from being used with an encryption algorithm that is not supported by KMS. You\n can also avoid errors, such as using the wrong signing algorithm in a verification\n operation.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use:\n Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GetPublicKey (key policy)

\n

\n Related operations: CreateKey\n

" - } - }, - "com.amazonaws.kms#GetPublicKeyRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the asymmetric KMS key that includes the public key.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", - "smithy.api#required": {} - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - } - } - }, - "com.amazonaws.kms#GetPublicKeyResponse": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the asymmetric KMS key from which the public key was\n downloaded.

" - } - }, - "PublicKey": { - "target": "com.amazonaws.kms#PublicKeyType", - "traits": { - "smithy.api#documentation": "

The exported public key.

\n

The value is a DER-encoded X.509 public key, also known as\n SubjectPublicKeyInfo (SPKI), as defined in RFC 5280. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

\n

" - } - }, - "CustomerMasterKeySpec": { - "target": "com.amazonaws.kms#CustomerMasterKeySpec", - "traits": { - "smithy.api#deprecated": { - "message": "This field has been deprecated. Instead, use the KeySpec field." - }, - "smithy.api#documentation": "

Instead, use the KeySpec field in the GetPublicKey\n response.

\n

The KeySpec and CustomerMasterKeySpec fields have the same\n value. We recommend that you use the KeySpec field in your code. However, to\n avoid breaking changes, KMS will support both fields.

" - } - }, - "KeySpec": { - "target": "com.amazonaws.kms#KeySpec", - "traits": { - "smithy.api#documentation": "

The type of the of the public key that was downloaded.

" - } - }, - "KeyUsage": { - "target": "com.amazonaws.kms#KeyUsageType", - "traits": { - "smithy.api#documentation": "

The permitted use of the public key. Valid values are ENCRYPT_DECRYPT or\n SIGN_VERIFY.

\n

This information is critical. If a public key with SIGN_VERIFY key usage\n encrypts data outside of KMS, the ciphertext cannot be decrypted.

" - } - }, - "EncryptionAlgorithms": { - "target": "com.amazonaws.kms#EncryptionAlgorithmSpecList", - "traits": { - "smithy.api#documentation": "

The encryption algorithms that KMS supports for this key.

\n

This information is critical. If a public key encrypts data outside of KMS by using an\n unsupported encryption algorithm, the ciphertext cannot be decrypted.

\n

This field appears in the response only when the KeyUsage of the public key\n is ENCRYPT_DECRYPT.

" - } - }, - "SigningAlgorithms": { - "target": "com.amazonaws.kms#SigningAlgorithmSpecList", - "traits": { - "smithy.api#documentation": "

The signing algorithms that KMS supports for this key.

\n

This field appears in the response only when the KeyUsage of the public key\n is SIGN_VERIFY.

" - } - } - } - }, - "com.amazonaws.kms#GrantConstraints": { - "type": "structure", - "members": { - "EncryptionContextSubset": { - "target": "com.amazonaws.kms#EncryptionContextType", - "traits": { - "smithy.api#documentation": "

A list of key-value pairs that must be included in the encryption context of the\n cryptographic operation request. The grant allows the cryptographic operation only when the encryption\n context in the request includes the key-value pairs specified in this constraint, although it\n can include additional key-value pairs.

" - } - }, - "EncryptionContextEquals": { - "target": "com.amazonaws.kms#EncryptionContextType", - "traits": { - "smithy.api#documentation": "

A list of key-value pairs that must match the encryption context in the cryptographic operation\n request. The grant allows the operation only when the encryption context in the request is the\n same as the encryption context specified in this constraint.

" - } - } - }, - "traits": { - "smithy.api#documentation": "

Use this structure to allow cryptographic operations in the grant only when the operation request\n includes the specified encryption context.

\n

KMS applies the grant constraints only to cryptographic operations that support an\n encryption context, that is, all cryptographic operations with a symmetric KMS key. Grant\n constraints are not applied to operations that do not support an encryption context, such as\n cryptographic operations with asymmetric KMS keys and management operations, such as DescribeKey or RetireGrant.

\n \n

In a cryptographic operation, the encryption context in the decryption operation must be\n an exact, case-sensitive match for the keys and values in the encryption context of the\n encryption operation. Only the order of the pairs can vary.

\n

However, in a grant constraint, the key in each key-value pair is not case sensitive,\n but the value is case sensitive.

\n

To avoid confusion, do not use multiple encryption context pairs that differ only by\n case. To require a fully case-sensitive encryption context, use the\n kms:EncryptionContext: and kms:EncryptionContextKeys conditions\n in an IAM or key policy. For details, see kms:EncryptionContext: in the \n Key Management Service Developer Guide\n .

\n
" - } - }, - "com.amazonaws.kms#GrantIdType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 128 - } - } - }, - "com.amazonaws.kms#GrantList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#GrantListEntry" - } - }, - "com.amazonaws.kms#GrantListEntry": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The unique identifier for the KMS key to which the grant applies.

" - } - }, - "GrantId": { - "target": "com.amazonaws.kms#GrantIdType", - "traits": { - "smithy.api#documentation": "

The unique identifier for the grant.

" - } - }, - "Name": { - "target": "com.amazonaws.kms#GrantNameType", - "traits": { - "smithy.api#documentation": "

The friendly name that identifies the grant. If a name was provided in the CreateGrant request, that name is returned. Otherwise this value is null.

" - } - }, - "CreationDate": { - "target": "com.amazonaws.kms#DateType", - "traits": { - "smithy.api#documentation": "

The date and time when the grant was created.

" - } - }, - "GranteePrincipal": { - "target": "com.amazonaws.kms#PrincipalIdType", - "traits": { - "smithy.api#documentation": "

The identity that gets the permissions in the grant.

\n

The GranteePrincipal field in the ListGrants response usually contains the\n user or role designated as the grantee principal in the grant. However, when the grantee\n principal in the grant is an Amazon Web Services service, the GranteePrincipal field contains\n the service\n principal, which might represent several different grantee principals.

" - } - }, - "RetiringPrincipal": { - "target": "com.amazonaws.kms#PrincipalIdType", - "traits": { - "smithy.api#documentation": "

The principal that can retire the grant.

" - } - }, - "IssuingAccount": { - "target": "com.amazonaws.kms#PrincipalIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Web Services account under which the grant was issued.

" - } - }, - "Operations": { - "target": "com.amazonaws.kms#GrantOperationList", - "traits": { - "smithy.api#documentation": "

The list of operations permitted by the grant.

" - } - }, - "Constraints": { - "target": "com.amazonaws.kms#GrantConstraints", - "traits": { - "smithy.api#documentation": "

A list of key-value pairs that must be present in the encryption context of certain\n subsequent operations that the grant allows.

" - } - } - }, - "traits": { - "smithy.api#documentation": "

Contains information about a grant.

" - } - }, - "com.amazonaws.kms#GrantNameType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 256 - }, - "smithy.api#pattern": "^[a-zA-Z0-9:/_-]+$" - } - }, - "com.amazonaws.kms#GrantOperation": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "Decrypt", - "name": "Decrypt" - }, - { - "value": "Encrypt", - "name": "Encrypt" - }, - { - "value": "GenerateDataKey", - "name": "GenerateDataKey" - }, - { - "value": "GenerateDataKeyWithoutPlaintext", - "name": "GenerateDataKeyWithoutPlaintext" - }, - { - "value": "ReEncryptFrom", - "name": "ReEncryptFrom" - }, - { - "value": "ReEncryptTo", - "name": "ReEncryptTo" - }, - { - "value": "Sign", - "name": "Sign" - }, - { - "value": "Verify", - "name": "Verify" - }, - { - "value": "GetPublicKey", - "name": "GetPublicKey" - }, - { - "value": "CreateGrant", - "name": "CreateGrant" - }, - { - "value": "RetireGrant", - "name": "RetireGrant" - }, - { - "value": "DescribeKey", - "name": "DescribeKey" - }, - { - "value": "GenerateDataKeyPair", - "name": "GenerateDataKeyPair" - }, - { - "value": "GenerateDataKeyPairWithoutPlaintext", - "name": "GenerateDataKeyPairWithoutPlaintext" - } - ] - } - }, - "com.amazonaws.kms#GrantOperationList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#GrantOperation" - } - }, - "com.amazonaws.kms#GrantTokenList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#GrantTokenType" - }, - "traits": { - "smithy.api#length": { - "min": 0, - "max": 10 - } - } - }, - "com.amazonaws.kms#GrantTokenType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 8192 - } - } - }, - "com.amazonaws.kms#ImportKeyMaterial": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#ImportKeyMaterialRequest" - }, - "output": { - "target": "com.amazonaws.kms#ImportKeyMaterialResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#ExpiredImportTokenException" - }, - { - "target": "com.amazonaws.kms#IncorrectKeyMaterialException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#InvalidCiphertextException" - }, - { - "target": "com.amazonaws.kms#InvalidImportTokenException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Imports key material into an existing symmetric KMS KMS key that was created without key\n material. After you successfully import key material into a KMS key, you can reimport\n the same key material into that KMS key, but you cannot import different key\n material.

\n

You cannot perform this operation on an asymmetric KMS key or on any KMS key in a different Amazon Web Services account. For more information about creating KMS keys with no key material\n and then importing key material, see Importing Key Material in the\n Key Management Service Developer Guide.

\n

Before using this operation, call GetParametersForImport. Its response\n includes a public key and an import token. Use the public key to encrypt the key material.\n Then, submit the import token from the same GetParametersForImport\n response.

\n

When calling this operation, you must specify the following values:

\n
    \n
  • \n

    The key ID or key ARN of a KMS key with no key material. Its Origin must\n be EXTERNAL.

    \n

    To create a KMS key with no key material, call CreateKey and set the\n value of its Origin parameter to EXTERNAL. To get the\n Origin of a KMS key, call DescribeKey.)

    \n
  • \n
  • \n

    The encrypted key material. To get the public key to encrypt the key material, call\n GetParametersForImport.

    \n
  • \n
  • \n

    The import token that GetParametersForImport returned. You must use\n a public key and token from the same GetParametersForImport response.

    \n
  • \n
  • \n

    Whether the key material expires and if so, when. If you set an expiration date, KMS\n deletes the key material from the KMS key on the specified date, and the KMS key becomes\n unusable. To use the KMS key again, you must reimport the same key material. The only way\n to change an expiration date is by reimporting the same key material and specifying a new\n expiration date.

    \n
  • \n
\n

When this operation is successful, the key state of the KMS key changes from\n PendingImport to Enabled, and you can use the KMS key.

\n

If this operation fails, use the exception to help determine the problem. If the error is\n related to the key material, the import token, or wrapping key, use GetParametersForImport to get a new public key and import token for the KMS key\n and repeat the import procedure. For help, see How To Import Key\n Material in the Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:ImportKeyMaterial (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#ImportKeyMaterialRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The identifier of the symmetric KMS key that receives the imported key material. The KMS\n key's Origin must be EXTERNAL. This must be the same KMS key\n specified in the KeyID parameter of the corresponding GetParametersForImport request.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "ImportToken": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

The import token that you received in the response to a previous GetParametersForImport request. It must be from the same response that contained\n the public key that you used to encrypt the key material.

", - "smithy.api#required": {} - } - }, - "EncryptedKeyMaterial": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

The encrypted key material to import. The key material must be encrypted with the public\n wrapping key that GetParametersForImport returned, using the wrapping\n algorithm that you specified in the same GetParametersForImport request.

", - "smithy.api#required": {} - } - }, - "ValidTo": { - "target": "com.amazonaws.kms#DateType", - "traits": { - "smithy.api#documentation": "

The time at which the imported key material expires. When the key material expires, KMS\n deletes the key material and the KMS key becomes unusable. You must omit this parameter when\n the ExpirationModel parameter is set to\n KEY_MATERIAL_DOES_NOT_EXPIRE. Otherwise it is required.

" - } - }, - "ExpirationModel": { - "target": "com.amazonaws.kms#ExpirationModelType", - "traits": { - "smithy.api#documentation": "

Specifies whether the key material expires. The default is\n KEY_MATERIAL_EXPIRES, in which case you must include the ValidTo\n parameter. When this parameter is set to KEY_MATERIAL_DOES_NOT_EXPIRE, you must\n omit the ValidTo parameter.

" - } - } - } - }, - "com.amazonaws.kms#ImportKeyMaterialResponse": { - "type": "structure", - "members": {} - }, - "com.amazonaws.kms#IncorrectKeyException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "IncorrectKeyException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the specified KMS key cannot decrypt the data. The\n KeyId in a Decrypt request and the SourceKeyId\n in a ReEncrypt request must identify the same KMS key that was used to\n encrypt the ciphertext.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#IncorrectKeyMaterialException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "IncorrectKeyMaterialException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the key material in the request is, expired, invalid, or\n is not the same key material that was previously imported into this KMS key.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#IncorrectTrustAnchorException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "IncorrectTrustAnchorException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the trust anchor certificate in the request is not the\n trust anchor certificate for the specified CloudHSM cluster.

\n

When you initialize the cluster, you create the trust anchor certificate and save it in the\n customerCA.crt file.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#InvalidAliasNameException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "InvalidAliasName", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the specified alias name is not valid.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#InvalidArnException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "InvalidArn", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because a specified ARN, or an ARN in a key policy, is not\n valid.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#InvalidCiphertextException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "InvalidCiphertext", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

From the Decrypt or ReEncrypt operation, the request\n was rejected because the specified ciphertext, or additional authenticated data incorporated\n into the ciphertext, such as the encryption context, is corrupted, missing, or otherwise\n invalid.

\n

From the ImportKeyMaterial operation, the request was rejected because\n KMS could not decrypt the encrypted (wrapped) key material.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#InvalidGrantIdException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "InvalidGrantId", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the specified GrantId is not valid.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#InvalidGrantTokenException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "InvalidGrantToken", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the specified grant token is not valid.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#InvalidImportTokenException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "InvalidImportTokenException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the provided import token is invalid or is associated\n with a different KMS key.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#InvalidKeyUsageException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "InvalidKeyUsage", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected for one of the following reasons:

\n
    \n
  • \n

    The KeyUsage value of the KMS key is incompatible with the API\n operation.

    \n
  • \n
  • \n

    The encryption algorithm or signing algorithm specified for the operation is\n incompatible with the type of key material in the KMS key (KeySpec).

    \n
  • \n
\n

For encrypting, decrypting, re-encrypting, and generating data keys, the\n KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying, the\n KeyUsage must be SIGN_VERIFY. To find the KeyUsage of\n a KMS key, use the DescribeKey operation.

\n

To find the encryption or signing algorithms supported for a particular KMS key, use the\n DescribeKey operation.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#InvalidMarkerException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "InvalidMarker", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the marker that specifies where pagination should next\n begin is not valid.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#KMSInternalException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "KMSInternal", - "httpResponseCode": 500 - }, - "smithy.api#documentation": "

The request was rejected because an internal exception occurred. The request can be\n retried.

", - "smithy.api#error": "server", - "smithy.api#httpError": 500 - } - }, - "com.amazonaws.kms#KMSInvalidSignatureException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "KMSInvalidSignature", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the signature verification failed. Signature verification\n fails when it cannot confirm that signature was produced by signing the specified message with\n the specified KMS key and signing algorithm.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#KMSInvalidStateException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "KMSInvalidStateException", - "httpResponseCode": 409 - }, - "smithy.api#documentation": "

The request was rejected because the state of the specified resource is not valid for this\n request.

\n

For more information about how key state affects the use of a KMS key, see Key state: Effect on your KMS\n key in the \n Key Management Service Developer Guide\n .

", - "smithy.api#error": "client", - "smithy.api#httpError": 409 - } - }, - "com.amazonaws.kms#KeyIdType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 2048 - } - } - }, - "com.amazonaws.kms#KeyList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#KeyListEntry" - } - }, - "com.amazonaws.kms#KeyListEntry": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Unique identifier of the key.

" - } - }, - "KeyArn": { - "target": "com.amazonaws.kms#ArnType", - "traits": { - "smithy.api#documentation": "

ARN of the key.

" - } - } - }, - "traits": { - "smithy.api#documentation": "

Contains information about each entry in the key list.

" - } - }, - "com.amazonaws.kms#KeyManagerType": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "AWS", - "name": "AWS" - }, - { - "value": "CUSTOMER", - "name": "CUSTOMER" - } - ] - } - }, - "com.amazonaws.kms#KeyMetadata": { - "type": "structure", - "members": { - "AWSAccountId": { - "target": "com.amazonaws.kms#AWSAccountIdType", - "traits": { - "smithy.api#documentation": "

The twelve-digit account ID of the Amazon Web Services account that owns the KMS key.

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The globally unique identifier for the KMS key.

", - "smithy.api#required": {} - } - }, - "Arn": { - "target": "com.amazonaws.kms#ArnType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the KMS key. For examples, see Key Management Service (KMS) in the Example ARNs section of the Amazon Web Services General\n Reference.

" - } - }, - "CreationDate": { - "target": "com.amazonaws.kms#DateType", - "traits": { - "smithy.api#documentation": "

The date and time when the KMS key was created.

" - } - }, - "Enabled": { - "target": "com.amazonaws.kms#BooleanType", - "traits": { - "smithy.api#documentation": "

Specifies whether the KMS key is enabled. When KeyState is\n Enabled this value is true, otherwise it is false.

" - } - }, - "Description": { - "target": "com.amazonaws.kms#DescriptionType", - "traits": { - "smithy.api#documentation": "

The description of the KMS key.

" - } - }, - "KeyUsage": { - "target": "com.amazonaws.kms#KeyUsageType", - "traits": { - "smithy.api#documentation": "

The cryptographic operations for which you can use the KMS key.

" - } - }, - "KeyState": { - "target": "com.amazonaws.kms#KeyState", - "traits": { - "smithy.api#documentation": "

The current status of the KMS key.

\n

For more information about how key state affects the use of a KMS key, see Key state: Effect on your KMS\n key in the Key Management Service Developer Guide.

" - } - }, - "DeletionDate": { - "target": "com.amazonaws.kms#DateType", - "traits": { - "smithy.api#documentation": "

The date and time after which KMS deletes this KMS key. This value is present only when\n the KMS key is scheduled for deletion, that is, when its KeyState is\n PendingDeletion.

\n

When the primary key in a multi-Region key is scheduled for deletion but still has replica\n keys, its key state is PendingReplicaDeletion and the length of its waiting\n period is displayed in the PendingDeletionWindowInDays field.

" - } - }, - "ValidTo": { - "target": "com.amazonaws.kms#DateType", - "traits": { - "smithy.api#documentation": "

The time at which the imported key material expires. When the key material expires, KMS\n deletes the key material and the KMS key becomes unusable. This value is present only for KMS\n keys whose Origin is EXTERNAL and whose ExpirationModel\n is KEY_MATERIAL_EXPIRES, otherwise this value is omitted.

" - } - }, - "Origin": { - "target": "com.amazonaws.kms#OriginType", - "traits": { - "smithy.api#documentation": "

The source of the key material for the KMS key. When this value is AWS_KMS,\n KMS created the key material. When this value is EXTERNAL, the key material was\n imported or the KMS key doesn't have any key material. When this value is\n AWS_CLOUDHSM, the key material was created in the CloudHSM cluster associated with\n a custom key store.

" - } - }, - "CustomKeyStoreId": { - "target": "com.amazonaws.kms#CustomKeyStoreIdType", - "traits": { - "smithy.api#documentation": "

A unique identifier for the custom key store that contains the KMS key. This value is\n present only when the KMS key is created in a custom key store.

" - } - }, - "CloudHsmClusterId": { - "target": "com.amazonaws.kms#CloudHsmClusterIdType", - "traits": { - "smithy.api#documentation": "

The cluster ID of the CloudHSM cluster that contains the key material for the KMS key. When\n you create a KMS key in a custom key store, KMS creates the key material for the KMS key in\n the associated CloudHSM cluster. This value is present only when the KMS key is created in a\n custom key store.

" - } - }, - "ExpirationModel": { - "target": "com.amazonaws.kms#ExpirationModelType", - "traits": { - "smithy.api#documentation": "

Specifies whether the KMS key's key material expires. This value is present only when\n Origin is EXTERNAL, otherwise this value is omitted.

" - } - }, - "KeyManager": { - "target": "com.amazonaws.kms#KeyManagerType", - "traits": { - "smithy.api#documentation": "

The manager of the KMS key. KMS keys in your Amazon Web Services account are either customer managed or\n Amazon Web Services managed. For more information about the difference, see KMS keys in the Key Management Service Developer Guide.

" - } - }, - "CustomerMasterKeySpec": { - "target": "com.amazonaws.kms#CustomerMasterKeySpec", - "traits": { - "smithy.api#deprecated": { - "message": "This field has been deprecated. Instead, use the KeySpec field." - }, - "smithy.api#documentation": "

Instead, use the KeySpec field.

\n

The KeySpec and CustomerMasterKeySpec fields have the same\n value. We recommend that you use the KeySpec field in your code. However, to\n avoid breaking changes, KMS will support both fields.

" - } - }, - "KeySpec": { - "target": "com.amazonaws.kms#KeySpec", - "traits": { - "smithy.api#documentation": "

Describes the type of key material in the KMS key.

" - } - }, - "EncryptionAlgorithms": { - "target": "com.amazonaws.kms#EncryptionAlgorithmSpecList", - "traits": { - "smithy.api#documentation": "

The encryption algorithms that the KMS key supports. You cannot use the KMS key with other\n encryption algorithms within KMS.

\n

This value is present only when the KeyUsage of the KMS key is\n ENCRYPT_DECRYPT.

" - } - }, - "SigningAlgorithms": { - "target": "com.amazonaws.kms#SigningAlgorithmSpecList", - "traits": { - "smithy.api#documentation": "

The signing algorithms that the KMS key supports. You cannot use the KMS key with other\n signing algorithms within KMS.

\n

This field appears only when the KeyUsage of the KMS key is\n SIGN_VERIFY.

" - } - }, - "MultiRegion": { - "target": "com.amazonaws.kms#NullableBooleanType", - "traits": { - "smithy.api#documentation": "

Indicates whether the KMS key is a multi-Region (True) or regional\n (False) key. This value is True for multi-Region primary and\n replica keys and False for regional KMS keys.

\n

For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

" - } - }, - "MultiRegionConfiguration": { - "target": "com.amazonaws.kms#MultiRegionConfiguration", - "traits": { - "smithy.api#documentation": "

Lists the primary and replica keys in same multi-Region key. This field is present only\n when the value of the MultiRegion field is True.

\n

For more information about any listed KMS key, use the DescribeKey\n operation.

\n
    \n
  • \n

    \n MultiRegionKeyType indicates whether the KMS key is a\n PRIMARY or REPLICA key.

    \n
  • \n
  • \n

    \n PrimaryKey displays the key ARN and Region of the primary key. This field\n displays the current KMS key if it is the primary key.

    \n
  • \n
  • \n

    \n ReplicaKeys displays the key ARNs and Regions of all replica keys. This\n field includes the current KMS key if it is a replica key.

    \n
  • \n
" - } - }, - "PendingDeletionWindowInDays": { - "target": "com.amazonaws.kms#PendingWindowInDaysType", - "traits": { - "smithy.api#documentation": "

The waiting period before the primary key in a multi-Region key is deleted. This waiting\n period begins when the last of its replica keys is deleted. This value is present only when\n the KeyState of the KMS key is PendingReplicaDeletion. That\n indicates that the KMS key is the primary key in a multi-Region key, it is scheduled for\n deletion, and it still has existing replica keys.

\n

When a single-Region KMS key or a multi-Region replica key is scheduled for deletion, its\n deletion date is displayed in the DeletionDate field. However, when the primary\n key in a multi-Region key is scheduled for deletion, its waiting period doesn't begin until\n all of its replica keys are deleted. This value displays that waiting period. When the last\n replica key in the multi-Region key is deleted, the KeyState of the scheduled\n primary key changes from PendingReplicaDeletion to PendingDeletion\n and the deletion date appears in the DeletionDate field.

" - } - } - }, - "traits": { - "smithy.api#documentation": "

Contains metadata about a KMS key.

\n

This data type is used as a response element for the CreateKey and DescribeKey operations.

" - } - }, - "com.amazonaws.kms#KeySpec": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "RSA_2048", - "name": "RSA_2048" - }, - { - "value": "RSA_3072", - "name": "RSA_3072" - }, - { - "value": "RSA_4096", - "name": "RSA_4096" - }, - { - "value": "ECC_NIST_P256", - "name": "ECC_NIST_P256" - }, - { - "value": "ECC_NIST_P384", - "name": "ECC_NIST_P384" - }, - { - "value": "ECC_NIST_P521", - "name": "ECC_NIST_P521" - }, - { - "value": "ECC_SECG_P256K1", - "name": "ECC_SECG_P256K1" - }, - { - "value": "SYMMETRIC_DEFAULT", - "name": "SYMMETRIC_DEFAULT" - } - ] - } - }, - "com.amazonaws.kms#KeyState": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "Creating", - "name": "Creating" - }, - { - "value": "Enabled", - "name": "Enabled" - }, - { - "value": "Disabled", - "name": "Disabled" - }, - { - "value": "PendingDeletion", - "name": "PendingDeletion" - }, - { - "value": "PendingImport", - "name": "PendingImport" - }, - { - "value": "PendingReplicaDeletion", - "name": "PendingReplicaDeletion" - }, - { - "value": "Unavailable", - "name": "Unavailable" - }, - { - "value": "Updating", - "name": "Updating" - } - ] - } - }, - "com.amazonaws.kms#KeyStorePasswordType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 7, - "max": 32 - }, - "smithy.api#sensitive": {} - } - }, - "com.amazonaws.kms#KeyUnavailableException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "KeyUnavailable", - "httpResponseCode": 500 - }, - "smithy.api#documentation": "

The request was rejected because the specified KMS key was not available. You can retry\n the request.

", - "smithy.api#error": "server", - "smithy.api#httpError": 500 - } - }, - "com.amazonaws.kms#KeyUsageType": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "SIGN_VERIFY", - "name": "SIGN_VERIFY" - }, - { - "value": "ENCRYPT_DECRYPT", - "name": "ENCRYPT_DECRYPT" - } - ] - } - }, - "com.amazonaws.kms#LimitExceededException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "LimitExceeded", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because a quota was exceeded. For more information, see Quotas in the\n Key Management Service Developer Guide.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#LimitType": { - "type": "integer", - "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 1, - "max": 1000 - } - } - }, - "com.amazonaws.kms#ListAliases": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#ListAliasesRequest" - }, - "output": { - "target": "com.amazonaws.kms#ListAliasesResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#InvalidMarkerException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Gets a list of aliases in the caller's Amazon Web Services account and region. For more information\n about aliases, see CreateAlias.

\n

By default, the ListAliases operation returns all aliases in the account and\n region. To get only the aliases associated with a particular KMS key, use the\n KeyId parameter.

\n

The ListAliases response can include aliases that you created and associated\n with your customer managed keys, and aliases that Amazon Web Services created and associated with Amazon Web Services\n managed keys in your account. You can recognize Amazon Web Services aliases because their names have the\n format aws/, such as aws/dynamodb.

\n

The response might also include aliases that have no TargetKeyId field. These\n are predefined aliases that Amazon Web Services has created but has not yet associated with a KMS key.\n Aliases that Amazon Web Services creates in your account, including predefined aliases, do not count against\n your KMS aliases\n quota.

\n

\n Cross-account use: No. ListAliases does not\n return aliases in other Amazon Web Services accounts.

\n \n\n

\n Required permissions: kms:ListAliases (IAM policy)

\n

For details, see Controlling access to aliases in the\n Key Management Service Developer Guide.

\n

\n Related operations:\n

\n ", - "smithy.api#paginated": { - "inputToken": "Marker", - "outputToken": "NextMarker", - "items": "Aliases", - "pageSize": "Limit" - } - } - }, - "com.amazonaws.kms#ListAliasesRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Lists only aliases that are associated with the specified KMS key. Enter a KMS key in your\n Amazon Web Services account.

\n

This parameter is optional. If you omit it, ListAliases returns all aliases\n in the account and Region.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

" - } - }, - "Limit": { - "target": "com.amazonaws.kms#LimitType", - "traits": { - "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between 1\n and 100, inclusive. If you do not include a value, it defaults to 50.

" - } - }, - "Marker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" - } - } - } - }, - "com.amazonaws.kms#ListAliasesResponse": { - "type": "structure", - "members": { - "Aliases": { - "target": "com.amazonaws.kms#AliasList", - "traits": { - "smithy.api#documentation": "

A list of aliases.

" - } - }, - "NextMarker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

When Truncated is true, this element is present and contains the\n value to use for the Marker parameter in a subsequent request.

" - } - }, - "Truncated": { - "target": "com.amazonaws.kms#BooleanType", - "traits": { - "smithy.api#documentation": "

A flag that indicates whether there are more items in the list. When this\n value is true, the list in this response is truncated. To get more items, pass the value of\n the NextMarker element in thisresponse to the Marker parameter in a\n subsequent request.

" - } - } - } - }, - "com.amazonaws.kms#ListGrants": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#ListGrantsRequest" - }, - "output": { - "target": "com.amazonaws.kms#ListGrantsResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantIdException" - }, - { - "target": "com.amazonaws.kms#InvalidMarkerException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Gets a list of all grants for the specified KMS key.

\n

You must specify the KMS key in all requests. You can filter the grant list by grant ID or\n grantee principal.

\n

For detailed information about grants, including grant terminology, see Using grants in the\n \n Key Management Service Developer Guide\n . For examples of working with grants in several\n programming languages, see Programming grants.

\n \n

The GranteePrincipal field in the ListGrants response usually contains the\n user or role designated as the grantee principal in the grant. However, when the grantee\n principal in the grant is an Amazon Web Services service, the GranteePrincipal field contains\n the service\n principal, which might represent several different grantee principals.

\n
\n

\n Cross-account use: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key\n ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:ListGrants (key policy)

\n

\n Related operations:\n

\n ", - "smithy.api#paginated": { - "inputToken": "Marker", - "outputToken": "NextMarker", - "items": "Grants", - "pageSize": "Limit" - } - } - }, - "com.amazonaws.kms#ListGrantsRequest": { - "type": "structure", - "members": { - "Limit": { - "target": "com.amazonaws.kms#LimitType", - "traits": { - "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between 1\n and 100, inclusive. If you do not include a value, it defaults to 50.

" - } - }, - "Marker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Returns only grants for the specified KMS key. This parameter is required.

\n \n

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a\ndifferent Amazon Web Services account, you must use the key ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "GrantId": { - "target": "com.amazonaws.kms#GrantIdType", - "traits": { - "smithy.api#documentation": "

Returns only the grant with the specified grant ID. The grant ID uniquely identifies the\n grant.

" - } - }, - "GranteePrincipal": { - "target": "com.amazonaws.kms#PrincipalIdType", - "traits": { - "smithy.api#documentation": "

Returns only grants where the specified principal is the grantee principal for the\n grant.

" - } - } - } - }, - "com.amazonaws.kms#ListGrantsResponse": { - "type": "structure", - "members": { - "Grants": { - "target": "com.amazonaws.kms#GrantList", - "traits": { - "smithy.api#documentation": "

A list of grants.

" - } - }, - "NextMarker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

When Truncated is true, this element is present and contains the\n value to use for the Marker parameter in a subsequent request.

" - } - }, - "Truncated": { - "target": "com.amazonaws.kms#BooleanType", - "traits": { - "smithy.api#documentation": "

A flag that indicates whether there are more items in the list. When this\n value is true, the list in this response is truncated. To get more items, pass the value of\n the NextMarker element in thisresponse to the Marker parameter in a\n subsequent request.

" - } - } - } - }, - "com.amazonaws.kms#ListKeyPolicies": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#ListKeyPoliciesRequest" - }, - "output": { - "target": "com.amazonaws.kms#ListKeyPoliciesResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Gets the names of the key policies that are attached to a KMS key. This operation is\n designed to get policy names that you can use in a GetKeyPolicy operation.\n However, the only valid policy name is default.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:ListKeyPolicies (key policy)

\n

\n Related operations:\n

\n ", - "smithy.api#paginated": { - "inputToken": "Marker", - "outputToken": "NextMarker", - "items": "PolicyNames", - "pageSize": "Limit" - } - } - }, - "com.amazonaws.kms#ListKeyPoliciesRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Gets the names of key policies for the specified KMS key.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "Limit": { - "target": "com.amazonaws.kms#LimitType", - "traits": { - "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between\n 1 and 1000, inclusive. If you do not include a value, it defaults to 100.

\n

Only one policy can be attached to a key.

" - } - }, - "Marker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" - } - } - } - }, - "com.amazonaws.kms#ListKeyPoliciesResponse": { - "type": "structure", - "members": { - "PolicyNames": { - "target": "com.amazonaws.kms#PolicyNameList", - "traits": { - "smithy.api#documentation": "

A list of key policy names. The only valid value is default.

" - } - }, - "NextMarker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

When Truncated is true, this element is present and contains the\n value to use for the Marker parameter in a subsequent request.

" - } - }, - "Truncated": { - "target": "com.amazonaws.kms#BooleanType", - "traits": { - "smithy.api#documentation": "

A flag that indicates whether there are more items in the list. When this\n value is true, the list in this response is truncated. To get more items, pass the value of\n the NextMarker element in thisresponse to the Marker parameter in a\n subsequent request.

" - } - } - } - }, - "com.amazonaws.kms#ListKeysRequest": { - "type": "structure", - "members": { - "Limit": { - "target": "com.amazonaws.kms#LimitType", - "traits": { - "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between\n 1 and 1000, inclusive. If you do not include a value, it defaults to 100.

" - } - }, - "Marker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" - } - } - } - }, - "com.amazonaws.kms#ListResourceTags": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#ListResourceTagsRequest" - }, - "output": { - "target": "com.amazonaws.kms#ListResourceTagsResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#InvalidMarkerException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Returns all tags on the specified KMS key.

\n

For general information about tags, including the format and syntax, see Tagging Amazon Web Services resources in\n the Amazon Web Services General Reference. For information about using\n tags in KMS, see Tagging\n keys.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:ListResourceTags (key policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#ListResourceTagsRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Gets tags on the specified KMS key.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "Limit": { - "target": "com.amazonaws.kms#LimitType", - "traits": { - "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between 1 and 50, inclusive. If\n you do not include a value, it defaults to 50.

" - } - }, - "Marker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

\n

Do not attempt to construct this value. Use only the value of NextMarker from\n the truncated response you just received.

" - } - } - } - }, - "com.amazonaws.kms#ListResourceTagsResponse": { - "type": "structure", - "members": { - "Tags": { - "target": "com.amazonaws.kms#TagList", - "traits": { - "smithy.api#documentation": "

A list of tags. Each tag consists of a tag key and a tag value.

\n \n

Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
" - } - }, - "NextMarker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

When Truncated is true, this element is present and contains the\n value to use for the Marker parameter in a subsequent request.

\n

Do not assume or infer any information from this value.

" - } - }, - "Truncated": { - "target": "com.amazonaws.kms#BooleanType", - "traits": { - "smithy.api#documentation": "

A flag that indicates whether there are more items in the list. When this\n value is true, the list in this response is truncated. To get more items, pass the value of\n the NextMarker element in thisresponse to the Marker parameter in a\n subsequent request.

" - } - } - } - }, - "com.amazonaws.kms#ListRetirableGrantsRequest": { - "type": "structure", - "members": { - "Limit": { - "target": "com.amazonaws.kms#LimitType", - "traits": { - "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between 1\n and 100, inclusive. If you do not include a value, it defaults to 50.

" - } - }, - "Marker": { - "target": "com.amazonaws.kms#MarkerType", - "traits": { - "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" - } - }, - "RetiringPrincipal": { - "target": "com.amazonaws.kms#PrincipalIdType", - "traits": { - "smithy.api#documentation": "

The retiring principal for which to list grants. Enter a principal in your\n Amazon Web Services account.

\n

To specify the retiring principal, use the Amazon Resource Name (ARN) of an\n Amazon Web Services principal. Valid Amazon Web Services principals include Amazon Web Services accounts (root), IAM users, federated\n users, and assumed role users. For examples of the ARN syntax for specifying a principal, see\n Amazon Web Services Identity and Access Management (IAM) in the Example ARNs section of the\n Amazon Web Services General Reference.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#MalformedPolicyDocumentException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "MalformedPolicyDocument", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because the specified policy is not syntactically or semantically\n correct.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#MarkerType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 1024 - }, - "smithy.api#pattern": "^[\\u0020-\\u00FF]*$" - } - }, - "com.amazonaws.kms#MessageType": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "RAW", - "name": "RAW" - }, - { - "value": "DIGEST", - "name": "DIGEST" - } - ] - } - }, - "com.amazonaws.kms#MultiRegionConfiguration": { - "type": "structure", - "members": { - "MultiRegionKeyType": { - "target": "com.amazonaws.kms#MultiRegionKeyType", - "traits": { - "smithy.api#documentation": "

Indicates whether the KMS key is a PRIMARY or REPLICA\n key.

" - } - }, - "PrimaryKey": { - "target": "com.amazonaws.kms#MultiRegionKey", - "traits": { - "smithy.api#documentation": "

Displays the key ARN and Region of the primary key. This field includes the current KMS\n key if it is the primary key.

" - } - }, - "ReplicaKeys": { - "target": "com.amazonaws.kms#MultiRegionKeyList", - "traits": { - "smithy.api#documentation": "

displays the key ARNs and Regions of all replica keys. This field includes the current KMS\n key if it is a replica key.

" - } - } - }, - "traits": { - "smithy.api#documentation": "

Describes the configuration of this multi-Region key. This field appears only when the KMS\n key is a primary or replica of a multi-Region key.

\n

For more information about any listed KMS key, use the DescribeKey\n operation.

" - } - }, - "com.amazonaws.kms#MultiRegionKey": { - "type": "structure", - "members": { - "Arn": { - "target": "com.amazonaws.kms#ArnType", - "traits": { - "smithy.api#documentation": "

Displays the key ARN of a primary or replica key of a multi-Region key.

" - } - }, - "Region": { - "target": "com.amazonaws.kms#RegionType", - "traits": { - "smithy.api#documentation": "

Displays the Amazon Web Services Region of a primary or replica key in a multi-Region key.

" - } - } - }, - "traits": { - "smithy.api#documentation": "

Describes the primary or replica key in a multi-Region key.

" - } - }, - "com.amazonaws.kms#MultiRegionKeyList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#MultiRegionKey" - } - }, - "com.amazonaws.kms#MultiRegionKeyType": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "PRIMARY", - "name": "PRIMARY" - }, - { - "value": "REPLICA", - "name": "REPLICA" - } - ] - } - }, - "com.amazonaws.kms#NotFoundException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "NotFound", - "httpResponseCode": 404 - }, - "smithy.api#documentation": "

The request was rejected because the specified entity or resource could not be\n found.

", - "smithy.api#error": "client", - "smithy.api#httpError": 404 - } - }, - "com.amazonaws.kms#NullableBooleanType": { - "type": "boolean", - "traits": { - "smithy.api#box": {} - } - }, - "com.amazonaws.kms#NumberOfBytesType": { - "type": "integer", - "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 1, - "max": 1024 - } - } - }, - "com.amazonaws.kms#OriginType": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "AWS_KMS", - "name": "AWS_KMS" - }, - { - "value": "EXTERNAL", - "name": "EXTERNAL" - }, - { - "value": "AWS_CLOUDHSM", - "name": "AWS_CLOUDHSM" - } - ] - } - }, - "com.amazonaws.kms#PendingWindowInDaysType": { - "type": "integer", - "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 1, - "max": 365 - } - } - }, - "com.amazonaws.kms#PlaintextType": { - "type": "blob", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 4096 - }, - "smithy.api#sensitive": {} - } - }, - "com.amazonaws.kms#PolicyNameList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#PolicyNameType" - } - }, - "com.amazonaws.kms#PolicyNameType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 128 - }, - "smithy.api#pattern": "^[\\w]+$" - } - }, - "com.amazonaws.kms#PolicyType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 131072 - }, - "smithy.api#pattern": "^[\\u0009\\u000A\\u000D\\u0020-\\u00FF]+$" - } - }, - "com.amazonaws.kms#PrincipalIdType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 256 - }, - "smithy.api#pattern": "^[\\w+=,.@:/-]+$" - } - }, - "com.amazonaws.kms#PublicKeyType": { - "type": "blob", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 8192 - } - } - }, - "com.amazonaws.kms#PutKeyPolicy": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#PutKeyPolicyRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#LimitExceededException" - }, - { - "target": "com.amazonaws.kms#MalformedPolicyDocumentException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Attaches a key policy to the specified KMS key.

\n

For more information about key policies, see Key Policies in the Key Management Service Developer Guide.\n For help writing and formatting a JSON policy document, see the IAM JSON Policy Reference in the \n Identity and Access Management User Guide\n . For examples of adding a key policy in multiple programming languages,\n see Setting a key policy in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:PutKeyPolicy (key policy)

\n

\n Related operations: GetKeyPolicy\n

" - } - }, - "com.amazonaws.kms#PutKeyPolicyRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Sets the key policy on the specified KMS key.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "PolicyName": { - "target": "com.amazonaws.kms#PolicyNameType", - "traits": { - "smithy.api#documentation": "

The name of the key policy. The only valid value is default.

", - "smithy.api#required": {} - } - }, - "Policy": { - "target": "com.amazonaws.kms#PolicyType", - "traits": { - "smithy.api#documentation": "

The key policy to attach to the KMS key.

\n

The key policy must meet the following criteria:

\n
    \n
  • \n

    If you don't set BypassPolicyLockoutSafetyCheck to true, the key policy\n must allow the principal that is making the PutKeyPolicy request to make a\n subsequent PutKeyPolicy request on the KMS key. This reduces the risk that\n the KMS key becomes unmanageable. For more information, refer to the scenario in the\n Default Key Policy section of the Key Management Service Developer Guide.

    \n
  • \n
  • \n

    Each statement in the key policy must contain one or more principals. The principals\n in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services\n principal (for example, an IAM user or role), you might need to enforce a delay before\n including the new principal in a key policy because the new principal might not be\n immediately visible to KMS. For more information, see Changes that I make are not always immediately visible in the Amazon Web Services\n Identity and Access Management User Guide.

    \n
  • \n
\n

The key policy cannot exceed 32 kilobytes (32768 bytes). For more information, see Resource Quotas in the\n Key Management Service Developer Guide.

", - "smithy.api#required": {} - } - }, - "BypassPolicyLockoutSafetyCheck": { - "target": "com.amazonaws.kms#BooleanType", - "traits": { - "smithy.api#documentation": "

A flag to indicate whether to bypass the key policy lockout safety check.

\n \n

Setting this value to true increases the risk that the KMS key becomes unmanageable. Do\n not set this value to true indiscriminately.

\n

For more information, refer to the scenario in the Default Key Policy section in the Key Management Service Developer Guide.

\n
\n

Use this parameter only when you intend to prevent the principal that is making the\n request from making a subsequent PutKeyPolicy request on the KMS key.

\n

The default value is false.

" - } - } - } - }, - "com.amazonaws.kms#ReEncrypt": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#ReEncryptRequest" - }, - "output": { - "target": "com.amazonaws.kms#ReEncryptResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#IncorrectKeyException" - }, - { - "target": "com.amazonaws.kms#InvalidCiphertextException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#InvalidKeyUsageException" - }, - { - "target": "com.amazonaws.kms#KeyUnavailableException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Decrypts ciphertext and then reencrypts it entirely within KMS. You can use this\n operation to change the KMS key under which data is encrypted, such as when you manually\n rotate a KMS key or change the KMS key that protects a ciphertext. You can also use\n it to reencrypt ciphertext under the same KMS key, such as to change the encryption\n context of a ciphertext.

\n

The ReEncrypt operation can decrypt ciphertext that was encrypted by using an\n KMS KMS key in an KMS operation, such as Encrypt or GenerateDataKey. It can also decrypt ciphertext that was encrypted by using the\n public key of an asymmetric KMS key\n outside of KMS. However, it cannot decrypt ciphertext produced by other libraries, such as\n the Amazon Web Services Encryption SDK or\n Amazon S3\n client-side encryption. These libraries return a ciphertext format that is\n incompatible with KMS.

\n

When you use the ReEncrypt operation, you need to provide information for the\n decrypt operation and the subsequent encrypt operation.

\n
    \n
  • \n

    If your ciphertext was encrypted under an asymmetric KMS key, you must use the\n SourceKeyId parameter to identify the KMS key that encrypted the\n ciphertext. You must also supply the encryption algorithm that was used. This information\n is required to decrypt the data.

    \n
  • \n
  • \n

    If your ciphertext was encrypted under a symmetric KMS key, the\n SourceKeyId parameter is optional. KMS can get this information from\n metadata that it adds to the symmetric ciphertext blob. This feature adds durability to\n your implementation by ensuring that authorized users can decrypt ciphertext decades after\n it was encrypted, even if they've lost track of the key ID. However, specifying the source\n KMS key is always recommended as a best practice. When you use the\n SourceKeyId parameter to specify a KMS key, KMS uses only the KMS key you\n specify. If the ciphertext was encrypted under a different KMS key, the\n ReEncrypt operation fails. This practice ensures that you use the KMS key\n that you intend.

    \n
  • \n
  • \n

    To reencrypt the data, you must use the DestinationKeyId parameter\n specify the KMS key that re-encrypts the data after it is decrypted. You can select a\n symmetric or asymmetric KMS key. If the destination KMS key is an asymmetric KMS key, you\n must also provide the encryption algorithm. The algorithm that you choose must be\n compatible with the KMS key.

    \n\n \n

    When you use an asymmetric KMS key to encrypt or reencrypt data, be sure to record the KMS key and encryption algorithm that you choose. You will be required to provide the same KMS key and encryption algorithm when you decrypt the data. If the KMS key and algorithm do not match the values used to encrypt the data, the decrypt operation fails.

    \n

    You are not required to supply the key ID and encryption algorithm when you decrypt with symmetric KMS keys because KMS stores this information in the ciphertext blob. KMS cannot store metadata in ciphertext generated with asymmetric keys. The standard format for asymmetric key ciphertext does not include configurable fields.

    \n
    \n
  • \n
\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: Yes.\n The source KMS key and destination KMS key can be in different Amazon Web Services accounts. Either or both\n KMS keys can be in a different account than the caller. To specify a KMS key in a different\n account, you must use its key ARN or alias ARN.

\n\n

\n Required permissions:

\n
    \n
  • \n

    \n kms:ReEncryptFrom\n permission on the source KMS key (key policy)

    \n
  • \n
  • \n

    \n kms:ReEncryptTo\n permission on the destination KMS key (key policy)

    \n
  • \n
\n

To permit reencryption from or to a KMS key, include the \"kms:ReEncrypt*\"\n permission in your key policy. This permission is\n automatically included in the key policy when you use the console to create a KMS key. But you\n must include it manually when you create a KMS key programmatically or when you use the PutKeyPolicy operation to set a key policy.

\n\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#ReEncryptRequest": { - "type": "structure", - "members": { - "CiphertextBlob": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

Ciphertext of the data to reencrypt.

", - "smithy.api#required": {} - } - }, - "SourceEncryptionContext": { - "target": "com.amazonaws.kms#EncryptionContextType", - "traits": { - "smithy.api#documentation": "

Specifies the encryption context to use to decrypt the ciphertext. Enter the same\n encryption context that was used to encrypt the ciphertext.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" - } - }, - "SourceKeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Specifies the KMS key that KMS will use to decrypt the ciphertext before it is\n re-encrypted. Enter a key ID of the KMS key that was used to encrypt the ciphertext.

\n

This parameter is required only when the ciphertext was encrypted under an asymmetric KMS\n key. If you used a symmetric KMS key, KMS can get the KMS key from metadata that it adds to\n the symmetric ciphertext blob. However, it is always recommended as a best practice. This\n practice ensures that you use the KMS key that you intend.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

" - } - }, - "DestinationKeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

A unique identifier for the KMS key that is used to reencrypt the data. Specify a\n symmetric or asymmetric KMS key with a KeyUsage value of\n ENCRYPT_DECRYPT. To find the KeyUsage value of a KMS key, use the\n DescribeKey operation.

\n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", - "smithy.api#required": {} - } - }, - "DestinationEncryptionContext": { - "target": "com.amazonaws.kms#EncryptionContextType", - "traits": { - "smithy.api#documentation": "

Specifies that encryption context to use when the reencrypting the data.

\n

A destination encryption context is valid only when the destination KMS key is a symmetric\n KMS key. The standard ciphertext format for asymmetric KMS keys does not include fields for\n metadata.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" - } - }, - "SourceEncryptionAlgorithm": { - "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

Specifies the encryption algorithm that KMS will use to decrypt the ciphertext before it\n is reencrypted. The default value, SYMMETRIC_DEFAULT, represents the algorithm\n used for symmetric KMS keys.

\n

Specify the same algorithm that was used to encrypt the ciphertext. If you specify a\n different algorithm, the decrypt attempt fails.

\n

This parameter is required only when the ciphertext was encrypted under an asymmetric KMS\n key.

" - } - }, - "DestinationEncryptionAlgorithm": { - "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

Specifies the encryption algorithm that KMS will use to reecrypt the data after it has\n decrypted it. The default value, SYMMETRIC_DEFAULT, represents the encryption\n algorithm used for symmetric KMS keys.

\n

This parameter is required only when the destination KMS key is an asymmetric KMS\n key.

" - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - } - } - }, - "com.amazonaws.kms#ReEncryptResponse": { - "type": "structure", - "members": { - "CiphertextBlob": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

The reencrypted data. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" - } - }, - "SourceKeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Unique identifier of the KMS key used to originally encrypt the data.

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that was used to reencrypt the data.

" - } - }, - "SourceEncryptionAlgorithm": { - "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

The encryption algorithm that was used to decrypt the ciphertext before it was\n reencrypted.

" - } - }, - "DestinationEncryptionAlgorithm": { - "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

The encryption algorithm that was used to reencrypt the data.

" - } - } - } - }, - "com.amazonaws.kms#RegionType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 32 - }, - "smithy.api#pattern": "^([a-z]+-){2,3}\\d+$" - } - }, - "com.amazonaws.kms#ReplicateKey": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#ReplicateKeyRequest" - }, - "output": { - "target": "com.amazonaws.kms#ReplicateKeyResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#AlreadyExistsException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#LimitExceededException" - }, - { - "target": "com.amazonaws.kms#MalformedPolicyDocumentException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#TagException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Replicates a multi-Region key into the specified Region. This operation creates a\n multi-Region replica key based on a multi-Region primary key in a different Region of the same\n Amazon Web Services partition. You can create multiple replicas of a primary key, but each must be in a\n different Region. To create a multi-Region primary key, use the CreateKey\n operation.

\n

This operation supports multi-Region keys, an KMS feature that lets you create multiple\n interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key\n material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt\n it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

\n

A replica key is a fully-functional KMS key that can be used\n independently of its primary and peer replica keys. A primary key and its replica keys share\n properties that make them interoperable. They have the same key ID and key material. They also\n have the same key\n spec, key\n usage, key\n material origin, and automatic key rotation status. KMS automatically synchronizes these shared\n properties among related multi-Region keys. All other properties of a replica key can differ,\n including its key\n policy, tags, aliases, and key\n state. KMS pricing and quotas for KMS keys apply to each primary key and replica\n key.

\n

When this operation completes, the new replica key has a transient key state of\n Creating. This key state changes to Enabled (or\n PendingImport) after a few seconds when the process of creating the new replica\n key is complete. While the key state is Creating, you can manage key, but you\n cannot yet use it in cryptographic operations. If you are creating and using the replica key\n programmatically, retry on KMSInvalidStateException or call\n DescribeKey to check its KeyState value before using it. For\n details about the Creating key state, see Key state: Effect on your KMS key in the\n Key Management Service Developer Guide.

\n

The CloudTrail log of a ReplicateKey operation records a\n ReplicateKey operation in the primary key's Region and a CreateKey operation in the replica key's Region.

\n

If you replicate a multi-Region primary key with imported key material, the replica key is\n created with no key material. You must import the same key material that you imported into the\n primary key. For details, see Importing key material into multi-Region keys in the Key Management Service Developer Guide.

\n

To convert a replica key to a primary key, use the UpdatePrimaryRegion\n operation.

\n \n

\n ReplicateKey uses different default values for the KeyPolicy\n and Tags parameters than those used in the KMS console. For details, see the\n parameter descriptions.

\n
\n

\n Cross-account use: No. You cannot use this operation to\n create a replica key in a different Amazon Web Services account.

\n

\n Required permissions:

\n
    \n
  • \n

    \n kms:ReplicateKey on the primary key (in the primary key's Region).\n Include this permission in the primary key's key policy.

    \n
  • \n
  • \n

    \n kms:CreateKey in an IAM policy in the replica Region.

    \n
  • \n
  • \n

    To use the Tags parameter, kms:TagResource in an IAM policy\n in the replica Region.

    \n
  • \n
\n

\n Related operations\n

\n " - } - }, - "com.amazonaws.kms#ReplicateKeyRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the multi-Region primary key that is being replicated. To determine whether a\n KMS key is a multi-Region primary key, use the DescribeKey operation to\n check the value of the MultiRegionKeyType property.

\n \n

Specify the key ID or key ARN of a multi-Region primary key.

\n

For example:

\n
    \n
  • \n

    Key ID: mrk-1234abcd12ab34cd56ef1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "ReplicaRegion": { - "target": "com.amazonaws.kms#RegionType", - "traits": { - "smithy.api#documentation": "

The Region ID of the Amazon Web Services Region for this replica key.

\n

Enter the Region ID, such as us-east-1 or ap-southeast-2. For a\n list of Amazon Web Services Regions in which KMS is supported, see KMS service endpoints in the\n Amazon Web Services General Reference.

\n

The replica must be in a different Amazon Web Services Region than its primary key and other replicas of\n that primary key, but in the same Amazon Web Services partition. KMS must be available in the replica\n Region. If the Region is not enabled by default, the Amazon Web Services account must be enabled in the\n Region.

\n

For information about Amazon Web Services partitions, see Amazon Resource Names (ARNs) in the\n Amazon Web Services General Reference. For information about enabling and disabling Regions, see Enabling a\n Region and Disabling a Region in the\n Amazon Web Services General Reference.

", - "smithy.api#required": {} - } - }, - "Policy": { - "target": "com.amazonaws.kms#PolicyType", - "traits": { - "smithy.api#documentation": "

The key policy to attach to the KMS key. This parameter is optional. If you do not provide\n a key policy, KMS attaches the default key policy to the\n KMS key.

\n

The key policy is not a shared property of multi-Region keys. You can specify the same key\n policy or a different key policy for each key in a set of related multi-Region keys. KMS\n does not synchronize this property.

\n

If you provide a key policy, it must meet the following criteria:

\n
    \n
  • \n

    If you don't set BypassPolicyLockoutSafetyCheck to true, the key policy\n must give the caller kms:PutKeyPolicy permission on the replica key. This\n reduces the risk that the KMS key becomes unmanageable. For more information, refer to the\n scenario in the Default Key Policy section of the \n Key Management Service Developer Guide\n .

    \n
  • \n
  • \n

    Each statement in the key policy must contain one or more principals. The principals\n in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services\n principal (for example, an IAM user or role), you might need to enforce a delay before\n including the new principal in a key policy because the new principal might not be\n immediately visible to KMS. For more information, see Changes that I make are not always immediately visible in the\n \n Identity and Access Management User Guide\n .

    \n
  • \n
  • \n

    The key policy size quota is 32 kilobytes (32768 bytes).

    \n
  • \n
" - } - }, - "BypassPolicyLockoutSafetyCheck": { - "target": "com.amazonaws.kms#BooleanType", - "traits": { - "smithy.api#documentation": "

A flag to indicate whether to bypass the key policy lockout safety check.

\n \n

Setting this value to true increases the risk that the KMS key becomes unmanageable. Do\n not set this value to true indiscriminately.

\n

For more information, refer to the scenario in the Default Key Policy section in the Key Management Service Developer Guide.

\n
\n

Use this parameter only when you intend to prevent the principal that is making the\n request from making a subsequent PutKeyPolicy request on the KMS key.

\n

The default value is false.

" - } - }, - "Description": { - "target": "com.amazonaws.kms#DescriptionType", - "traits": { - "smithy.api#documentation": "

A description of the KMS key. The default value is an empty string (no\n description).

\n

The description is not a shared property of multi-Region keys. You can specify the same\n description or a different description for each key in a set of related multi-Region keys.\n KMS does not synchronize this property.

" - } - }, - "Tags": { - "target": "com.amazonaws.kms#TagList", - "traits": { - "smithy.api#documentation": "

Assigns one or more tags to the replica key. Use this parameter to tag the KMS key when it\n is created. To tag an existing KMS key, use the TagResource\n operation.

\n \n

Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

To use this parameter, you must have kms:TagResource permission in an IAM policy.

\n

Tags are not a shared property of multi-Region keys. You can specify the same tags or\n different tags for each key in a set of related multi-Region keys. KMS does not synchronize\n this property.

\n

Each tag consists of a tag key and a tag value. Both the tag key and the tag value are\n required, but the tag value can be an empty (null) string. You cannot have more than one tag\n on a KMS key with the same tag key. If you specify an existing tag key with a different tag\n value, KMS replaces the current tag value with the specified one.

\n

When you add tags to an Amazon Web Services resource, Amazon Web Services generates a cost allocation\n report with usage and costs aggregated by tags. Tags can also be used to control access to a KMS key. For details,\n see Tagging Keys.

" - } - } - } - }, - "com.amazonaws.kms#ReplicateKeyResponse": { - "type": "structure", - "members": { - "ReplicaKeyMetadata": { - "target": "com.amazonaws.kms#KeyMetadata", - "traits": { - "smithy.api#documentation": "

Displays details about the new replica key, including its Amazon Resource Name (key ARN) and\n key state. It also\n includes the ARN and Amazon Web Services Region of its primary key and other replica keys.

" - } - }, - "ReplicaPolicy": { - "target": "com.amazonaws.kms#PolicyType", - "traits": { - "smithy.api#documentation": "

The key policy of the new replica key. The value is a key policy document in JSON\n format.

" - } - }, - "ReplicaTags": { - "target": "com.amazonaws.kms#TagList", - "traits": { - "smithy.api#documentation": "

The tags on the new replica key. The value is a list of tag key and tag value\n pairs.

" - } - } - } - }, - "com.amazonaws.kms#RetireGrant": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#RetireGrantRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantIdException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Deletes a grant. Typically, you retire a grant when you no longer need its permissions. To\n identify the grant to retire, use a grant token, or both the grant ID and a\n key identifier (key ID or key ARN) of the KMS key. The CreateGrant operation\n returns both values.

\n

This operation can be called by the retiring principal for a grant,\n by the grantee principal if the grant allows the RetireGrant\n operation, and by the Amazon Web Services account (root user) in which the grant is created. It can also be\n called by principals to whom permission for retiring a grant is delegated. For details, see\n Retiring and\n revoking grants in the Key Management Service Developer Guide.

\n

For detailed information about grants, including grant terminology, see Using grants in the\n \n Key Management Service Developer Guide\n . For examples of working with grants in several\n programming languages, see Programming grants.

\n

\n Cross-account use: Yes. You can retire a grant on a KMS\n key in a different Amazon Web Services account.

\n

\n Required permissions::Permission to retire a grant is\n determined primarily by the grant. For details, see Retiring and revoking grants in\n the Key Management Service Developer Guide.

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#RetireGrantRequest": { - "type": "structure", - "members": { - "GrantToken": { - "target": "com.amazonaws.kms#GrantTokenType", - "traits": { - "smithy.api#documentation": "

Identifies the grant to be retired. You can use a grant token to identify a new grant even\n before it has achieved eventual consistency.

\n

Only the CreateGrant operation returns a grant token. For details, see\n Grant token\n and Eventual consistency in the Key Management Service Developer Guide.

" - } - }, - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The key ARN KMS key associated with the grant. To find the key ARN, use the ListKeys operation.

\n

For example: arn:aws:kms:us-east-2:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

" - } - }, - "GrantId": { - "target": "com.amazonaws.kms#GrantIdType", - "traits": { - "smithy.api#documentation": "

Identifies the grant to retire. To get the grant ID, use CreateGrant,\n ListGrants, or ListRetirableGrants.

\n
    \n
  • \n

    Grant ID Example -\n 0123456789012345678901234567890123456789012345678901234567890123

    \n
  • \n
" - } - } - } - }, - "com.amazonaws.kms#RevokeGrant": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#RevokeGrantRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantIdException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Deletes the specified grant. You revoke a grant to terminate the permissions that the\n grant allows. For more information, see Retiring and revoking grants in\n the \n Key Management Service Developer Guide\n .

\n

When you create, retire, or revoke a grant, there might be a brief delay, usually less than five minutes, until the grant is available throughout KMS. This state is known as eventual consistency. For details, see Eventual consistency in\n the \n Key Management Service Developer Guide\n .

\n

For detailed information about grants, including grant terminology, see Using grants in the\n \n Key Management Service Developer Guide\n . For examples of working with grants in several\n programming languages, see Programming grants.

\n

\n Cross-account use: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key\n ARN in the value of the KeyId parameter.

\n

\n Required permissions: kms:RevokeGrant (key policy).

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#RevokeGrantRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

A unique identifier for the KMS key associated with the grant. To get the key ID and key\n ARN for a KMS key, use ListKeys or DescribeKey.

\n \n

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a\ndifferent Amazon Web Services account, you must use the key ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "GrantId": { - "target": "com.amazonaws.kms#GrantIdType", - "traits": { - "smithy.api#documentation": "

Identifies the grant to revoke. To get the grant ID, use CreateGrant,\n ListGrants, or ListRetirableGrants.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#ScheduleKeyDeletion": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#ScheduleKeyDeletionRequest" - }, - "output": { - "target": "com.amazonaws.kms#ScheduleKeyDeletionResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Schedules the deletion of a KMS key. By default, KMS applies a waiting period of 30\n days, but you can specify a waiting period of 7-30 days. When this operation is successful,\n the key state of the KMS key changes to PendingDeletion and the key can't be used\n in any cryptographic operations. It remains in this state for the duration of the waiting\n period. Before the waiting period ends, you can use CancelKeyDeletion to\n cancel the deletion of the KMS key. After the waiting period ends, KMS deletes the KMS key,\n its key material, and all KMS data associated with it, including all aliases that refer to\n it.

\n \n

Deleting a KMS key is a destructive and potentially dangerous operation. When a KMS key\n is deleted, all data that was encrypted under the KMS key is unrecoverable. (The only\n exception is a multi-Region replica key.) To prevent the use of a KMS key without deleting\n it, use DisableKey.

\n
\n

If you schedule deletion of a KMS key from a custom key store, when the waiting period\n expires, ScheduleKeyDeletion deletes the KMS key from KMS. Then KMS makes a\n best effort to delete the key material from the associated CloudHSM cluster. However, you might\n need to manually delete the orphaned key\n material from the cluster and its backups.

\n

You can schedule the deletion of a multi-Region primary key and its replica keys at any\n time. However, KMS will not delete a multi-Region primary key with existing replica keys. If\n you schedule the deletion of a primary key with replicas, its key state changes to\n PendingReplicaDeletion and it cannot be replicated or used in cryptographic\n operations. This status can continue indefinitely. When the last of its replicas keys is\n deleted (not just scheduled), the key state of the primary key changes to\n PendingDeletion and its waiting period (PendingWindowInDays)\n begins. For details, see Deleting multi-Region keys in the\n Key Management Service Developer Guide.

\n

For more information about scheduling a KMS key for deletion, see Deleting KMS keys in the\n Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n\n

\n Required permissions: kms:ScheduleKeyDeletion (key\n policy)

\n

\n Related operations\n

\n " - } - }, - "com.amazonaws.kms#ScheduleKeyDeletionRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The unique identifier of the KMS key to delete.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "PendingWindowInDays": { - "target": "com.amazonaws.kms#PendingWindowInDaysType", - "traits": { - "smithy.api#documentation": "

The waiting period, specified in number of days. After the waiting period ends, KMS\n deletes the KMS key.

\n

If the KMS key is a multi-Region primary key with replicas, the waiting period begins when\n the last of its replica keys is deleted. Otherwise, the waiting period begins\n immediately.

\n

This value is optional. If you include a value, it must be between 7 and 30, inclusive. If\n you do not include a value, it defaults to 30.

" - } - } - } - }, - "com.amazonaws.kms#ScheduleKeyDeletionResponse": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key whose deletion is scheduled.

" - } - }, - "DeletionDate": { - "target": "com.amazonaws.kms#DateType", - "traits": { - "smithy.api#documentation": "

The date and time after which KMS deletes the KMS key.

\n

If the KMS key is a multi-Region primary key with replica keys, this field does not\n appear. The deletion date for the primary key isn't known until its last replica key is\n deleted.

" - } - }, - "KeyState": { - "target": "com.amazonaws.kms#KeyState", - "traits": { - "smithy.api#documentation": "

The current status of the KMS key.

\n

For more information about how key state affects the use of a KMS key, see Key state: Effect on your KMS\n key in the Key Management Service Developer Guide.

" - } - }, - "PendingWindowInDays": { - "target": "com.amazonaws.kms#PendingWindowInDaysType", - "traits": { - "smithy.api#documentation": "

The waiting period before the KMS key is deleted.

\n

If the KMS key is a multi-Region primary key with replicas, the waiting period begins when\n the last of its replica keys is deleted. Otherwise, the waiting period begins\n immediately.

" - } - } - } - }, - "com.amazonaws.kms#Sign": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#SignRequest" - }, - "output": { - "target": "com.amazonaws.kms#SignResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#InvalidKeyUsageException" - }, - { - "target": "com.amazonaws.kms#KeyUnavailableException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Creates a digital\n signature for a message or message digest by using the private key in an asymmetric\n KMS key. To verify the signature, use the Verify operation, or use the\n public key in the same asymmetric KMS key outside of KMS. For information about symmetric and asymmetric KMS keys, see Using Symmetric and Asymmetric KMS keys in the Key Management Service Developer Guide.

\n

Digital signatures are generated and verified by using asymmetric key pair, such as an RSA\n or ECC pair that is represented by an asymmetric KMS key. The key owner (or an authorized\n user) uses their private key to sign a message. Anyone with the public key can verify that the\n message was signed with that particular private key and that the message hasn't changed since\n it was signed.

\n

To use the Sign operation, provide the following information:

\n
    \n
  • \n

    Use the KeyId parameter to identify an asymmetric KMS key with a\n KeyUsage value of SIGN_VERIFY. To get the\n KeyUsage value of a KMS key, use the DescribeKey\n operation. The caller must have kms:Sign permission on the KMS key.

    \n
  • \n
  • \n

    Use the Message parameter to specify the message or message digest to\n sign. You can submit messages of up to 4096 bytes. To sign a larger message, generate a\n hash digest of the message, and then provide the hash digest in the Message\n parameter. To indicate whether the message is a full message or a digest, use the\n MessageType parameter.

    \n
  • \n
  • \n

    Choose a signing algorithm that is compatible with the KMS key.

    \n
  • \n
\n \n

When signing a message, be sure to record the KMS key and the signing algorithm. This\n information is required to verify the signature.

\n
\n

To verify the signature that this operation generates, use the Verify\n operation. Or use the GetPublicKey operation to download the public key and\n then use the public key to verify the signature outside of KMS.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:Sign (key policy)

\n

\n Related operations: Verify\n

" - } - }, - "com.amazonaws.kms#SignRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies an asymmetric KMS key. KMS uses the private key in the asymmetric KMS key to\n sign the message. The KeyUsage type of the KMS key must be\n SIGN_VERIFY. To find the KeyUsage of a KMS key, use the DescribeKey operation.

\n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", - "smithy.api#required": {} - } - }, - "Message": { - "target": "com.amazonaws.kms#PlaintextType", - "traits": { - "smithy.api#documentation": "

Specifies the message or message digest to sign. Messages can be 0-4096 bytes. To sign a\n larger message, provide the message digest.

\n

If you provide a message, KMS generates a hash digest of the message and then signs\n it.

", - "smithy.api#required": {} - } - }, - "MessageType": { - "target": "com.amazonaws.kms#MessageType", - "traits": { - "smithy.api#documentation": "

Tells KMS whether the value of the Message parameter is a message or\n message digest. The default value, RAW, indicates a message. To indicate a message digest,\n enter DIGEST.

" - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - }, - "SigningAlgorithm": { - "target": "com.amazonaws.kms#SigningAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

Specifies the signing algorithm to use when signing the message.

\n

Choose an algorithm that is compatible with the type and size of the specified asymmetric\n KMS key.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#SignResponse": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the asymmetric KMS key that was used to sign the message.

" - } - }, - "Signature": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

The cryptographic signature that was generated for the message.

\n
    \n
  • \n

    When used with the supported RSA signing algorithms, the encoding of this value is\n defined by PKCS #1 in RFC\n 8017.

    \n
  • \n
  • \n

    When used with the ECDSA_SHA_256, ECDSA_SHA_384, or\n ECDSA_SHA_512 signing algorithms, this value is a DER-encoded object as\n defined by ANS X9.62–2005 and RFC 3279 Section 2.2.3.\n This is the most commonly used signature format and is appropriate for most uses.\n

    \n
  • \n
\n

When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" - } - }, - "SigningAlgorithm": { - "target": "com.amazonaws.kms#SigningAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

The signing algorithm that was used to sign the message.

" - } - } - } - }, - "com.amazonaws.kms#SigningAlgorithmSpec": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "RSASSA_PSS_SHA_256", - "name": "RSASSA_PSS_SHA_256" - }, - { - "value": "RSASSA_PSS_SHA_384", - "name": "RSASSA_PSS_SHA_384" - }, - { - "value": "RSASSA_PSS_SHA_512", - "name": "RSASSA_PSS_SHA_512" - }, - { - "value": "RSASSA_PKCS1_V1_5_SHA_256", - "name": "RSASSA_PKCS1_V1_5_SHA_256" - }, - { - "value": "RSASSA_PKCS1_V1_5_SHA_384", - "name": "RSASSA_PKCS1_V1_5_SHA_384" - }, - { - "value": "RSASSA_PKCS1_V1_5_SHA_512", - "name": "RSASSA_PKCS1_V1_5_SHA_512" - }, - { - "value": "ECDSA_SHA_256", - "name": "ECDSA_SHA_256" - }, - { - "value": "ECDSA_SHA_384", - "name": "ECDSA_SHA_384" - }, - { - "value": "ECDSA_SHA_512", - "name": "ECDSA_SHA_512" - } - ] - } - }, - "com.amazonaws.kms#SigningAlgorithmSpecList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#SigningAlgorithmSpec" - } - }, - "com.amazonaws.kms#Tag": { - "type": "structure", - "members": { - "TagKey": { - "target": "com.amazonaws.kms#TagKeyType", - "traits": { - "smithy.api#documentation": "

The key of the tag.

", - "smithy.api#required": {} - } - }, - "TagValue": { - "target": "com.amazonaws.kms#TagValueType", - "traits": { - "smithy.api#documentation": "

The value of the tag.

", - "smithy.api#required": {} - } - } - }, - "traits": { - "smithy.api#documentation": "

A key-value pair. A tag consists of a tag key and a tag value. Tag keys and tag values are\n both required, but tag values can be empty (null) strings.

\n

For information about the rules that apply to tag keys and tag values, see User-Defined Tag Restrictions in the Amazon Web Services Billing and Cost Management\n User Guide.

" - } - }, - "com.amazonaws.kms#TagException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "TagException", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because one or more tags are not valid.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#TagKeyList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#TagKeyType" - } - }, - "com.amazonaws.kms#TagKeyType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 128 - } - } - }, - "com.amazonaws.kms#TagList": { - "type": "list", - "member": { - "target": "com.amazonaws.kms#Tag" - } - }, - "com.amazonaws.kms#TagResource": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#TagResourceRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#LimitExceededException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#TagException" - } - ], - "traits": { - "smithy.api#documentation": "

Adds or edits tags on a customer managed key.

\n \n

Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

Each tag consists of a tag key and a tag value, both of which are case-sensitive strings.\n The tag value can be an empty (null) string. To add a tag, specify a new tag key and a tag\n value. To edit a tag, specify an existing tag key and a new tag value.

\n

You can use this operation to tag a customer managed key, but you cannot\n tag an Amazon Web Services\n managed key, an Amazon Web Services owned key, a custom key\n store, or an alias.

\n

You can also add tags to a KMS key while creating it (CreateKey) or\n replicating it (ReplicateKey).

\n

For information about using tags in KMS, see Tagging keys. For general information about\n tags, including the format and syntax, see Tagging Amazon Web Services resources in the Amazon\n Web Services General Reference.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:TagResource (key policy)

\n

\n Related operations\n

\n " - } - }, - "com.amazonaws.kms#TagResourceRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies a customer managed key in the account and Region.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "Tags": { - "target": "com.amazonaws.kms#TagList", - "traits": { - "smithy.api#documentation": "

One or more tags.

\n

Each tag consists of a tag key and a tag value. The tag value can be an empty (null)\n string.

\n

You cannot have more than one tag on a KMS key with the same tag key. If you specify an\n existing tag key with a different tag value, KMS replaces the current tag value with the\n specified one.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#TagValueType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 0, - "max": 256 - } - } - }, - "com.amazonaws.kms#TrentService": { - "type": "service", - "version": "2014-11-01", - "operations": [ - { - "target": "com.amazonaws.kms#CancelKeyDeletion" - }, - { - "target": "com.amazonaws.kms#ConnectCustomKeyStore" - }, - { - "target": "com.amazonaws.kms#CreateAlias" - }, - { - "target": "com.amazonaws.kms#CreateCustomKeyStore" - }, - { - "target": "com.amazonaws.kms#CreateGrant" - }, - { - "target": "com.amazonaws.kms#CreateKey" - }, - { - "target": "com.amazonaws.kms#Decrypt" - }, - { - "target": "com.amazonaws.kms#DeleteAlias" - }, - { - "target": "com.amazonaws.kms#DeleteCustomKeyStore" - }, - { - "target": "com.amazonaws.kms#DeleteImportedKeyMaterial" - }, - { - "target": "com.amazonaws.kms#DescribeCustomKeyStores" - }, - { - "target": "com.amazonaws.kms#DescribeKey" - }, - { - "target": "com.amazonaws.kms#DisableKey" - }, - { - "target": "com.amazonaws.kms#DisableKeyRotation" - }, - { - "target": "com.amazonaws.kms#DisconnectCustomKeyStore" - }, - { - "target": "com.amazonaws.kms#EnableKey" - }, - { - "target": "com.amazonaws.kms#EnableKeyRotation" - }, - { - "target": "com.amazonaws.kms#Encrypt" - }, - { - "target": "com.amazonaws.kms#GenerateDataKey" - }, - { - "target": "com.amazonaws.kms#GenerateDataKeyPair" - }, - { - "target": "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintext" - }, - { - "target": "com.amazonaws.kms#GenerateDataKeyWithoutPlaintext" - }, - { - "target": "com.amazonaws.kms#GenerateRandom" - }, - { - "target": "com.amazonaws.kms#GetKeyPolicy" - }, - { - "target": "com.amazonaws.kms#GetKeyRotationStatus" - }, - { - "target": "com.amazonaws.kms#GetParametersForImport" - }, - { - "target": "com.amazonaws.kms#GetPublicKey" - }, - { - "target": "com.amazonaws.kms#ImportKeyMaterial" - }, - { - "target": "com.amazonaws.kms#ListAliases" - }, - { - "target": "com.amazonaws.kms#ListGrants" - }, - { - "target": "com.amazonaws.kms#ListKeyPolicies" - }, - { - "target": "com.amazonaws.kms#ListResourceTags" - }, - { - "target": "com.amazonaws.kms#PutKeyPolicy" - }, - { - "target": "com.amazonaws.kms#ReEncrypt" - }, - { - "target": "com.amazonaws.kms#ReplicateKey" - }, - { - "target": "com.amazonaws.kms#RetireGrant" - }, - { - "target": "com.amazonaws.kms#RevokeGrant" - }, - { - "target": "com.amazonaws.kms#ScheduleKeyDeletion" - }, - { - "target": "com.amazonaws.kms#Sign" - }, - { - "target": "com.amazonaws.kms#TagResource" - }, - { - "target": "com.amazonaws.kms#UntagResource" - }, - { - "target": "com.amazonaws.kms#UpdateAlias" - }, - { - "target": "com.amazonaws.kms#UpdateCustomKeyStore" - }, - { - "target": "com.amazonaws.kms#UpdateKeyDescription" - }, - { - "target": "com.amazonaws.kms#UpdatePrimaryRegion" - }, - { - "target": "com.amazonaws.kms#Verify" - } - ], - "traits": { - "aws.api#service": { - "sdkId": "KMS", - "arnNamespace": "kms", - "cloudFormationName": "KMS", - "cloudTrailEventSource": "kms.amazonaws.com", - "endpointPrefix": "kms" - }, - "aws.auth#sigv4": { - "name": "kms" - }, - "aws.protocols#awsJson1_1": {}, - "smithy.api#documentation": "Key Management Service\n

Key Management Service (KMS) is an encryption and key management web service. This guide describes\n the KMS operations that you can call programmatically. For general information about KMS,\n see the \n Key Management Service Developer Guide\n .

\n \n

KMS is replacing the term customer master key (CMK) with KMS key and KMS key. The concept has not changed. To prevent breaking changes, KMS is keeping some variations of this term.

\n

Amazon Web Services provides SDKs that consist of libraries and sample code for various programming\n languages and platforms (Java, Ruby, .Net, macOS, Android, etc.). The SDKs provide a\n convenient way to create programmatic access to KMS and other Amazon Web Services services. For example,\n the SDKs take care of tasks such as signing requests (see below), managing errors, and\n retrying requests automatically. For more information about the Amazon Web Services SDKs, including how to\n download and install them, see Tools for Amazon Web\n Services.

\n
\n

We recommend that you use the Amazon Web Services SDKs to make programmatic API calls to KMS.

\n

Clients must support TLS (Transport Layer Security) 1.0. We recommend TLS 1.2. Clients\n must also support cipher suites with Perfect Forward Secrecy (PFS) such as Ephemeral\n Diffie-Hellman (DHE) or Elliptic Curve Ephemeral Diffie-Hellman (ECDHE). Most modern systems\n such as Java 7 and later support these modes.

\n

\n Signing Requests\n

\n

Requests must be signed by using an access key ID and a secret access key. We strongly\n recommend that you do not use your Amazon Web Services account (root) access key ID and\n secret key for everyday work with KMS. Instead, use the access key ID and secret access key\n for an IAM user. You can also use the Amazon Web Services Security Token Service to generate temporary\n security credentials that you can use to sign requests.

\n

All KMS operations require Signature Version 4.

\n

\n Logging API Requests\n

\n

KMS supports CloudTrail, a service that logs Amazon Web Services API calls and related events for your\n Amazon Web Services account and delivers them to an Amazon S3 bucket that you specify. By using the\n information collected by CloudTrail, you can determine what requests were made to KMS, who made\n the request, when it was made, and so on. To learn more about CloudTrail, including how to turn it\n on and find your log files, see the CloudTrail User Guide.

\n

\n Additional Resources\n

\n

For more information about credentials and request signing, see the following:

\n \n

\n Commonly Used API Operations\n

\n

Of the API operations discussed in this guide, the following will prove the most useful\n for most applications. You will likely perform operations other than these, such as creating\n keys and assigning policies, by using the console.

\n ", - "smithy.api#title": "AWS Key Management Service", - "smithy.api#xmlNamespace": { - "uri": "https://trent.amazonaws.com/doc/2014-11-01/" - } - } - }, - "com.amazonaws.kms#TrustAnchorCertificateType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 5000 - } - } - }, - "com.amazonaws.kms#UnsupportedOperationException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.kms#ErrorMessageType" - } - }, - "traits": { - "aws.protocols#awsQueryError": { - "code": "UnsupportedOperation", - "httpResponseCode": 400 - }, - "smithy.api#documentation": "

The request was rejected because a specified parameter is not supported or a specified\n resource is not valid for this operation.

", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.kms#UntagResource": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#UntagResourceRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#TagException" - } - ], - "traits": { - "smithy.api#documentation": "

Deletes tags from a customer managed key. To delete a tag,\n specify the tag key and the KMS key.

\n \n

Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

When it succeeds, the UntagResource operation doesn't return any output.\n Also, if the specified tag key isn't found on the KMS key, it doesn't throw an exception or\n return a response. To confirm that the operation worked, use the ListResourceTags operation.

\n\n

For information about using tags in KMS, see Tagging keys. For general information about\n tags, including the format and syntax, see Tagging Amazon Web Services resources in the Amazon\n Web Services General Reference.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:UntagResource (key policy)

\n

\n Related operations\n

\n " - } - }, - "com.amazonaws.kms#UntagResourceRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the KMS key from which you are removing tags.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "TagKeys": { - "target": "com.amazonaws.kms#TagKeyList", - "traits": { - "smithy.api#documentation": "

One or more tag keys. Specify only the tag keys, not the tag values.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#UpdateAlias": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#UpdateAliasRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#LimitExceededException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Associates an existing KMS alias with a different KMS key. Each alias is associated with\n only one KMS key at a time, although a KMS key can have multiple aliases. The alias and the\n KMS key must be in the same Amazon Web Services account and Region.

\n \n

Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

The current and new KMS key must be the same type (both symmetric or both asymmetric), and\n they must have the same key usage (ENCRYPT_DECRYPT or SIGN_VERIFY).\n This restriction prevents errors in code that uses aliases. If you must assign an alias to a\n different type of KMS key, use DeleteAlias to delete the old alias and CreateAlias to create a new alias.

\n

You cannot use UpdateAlias to change an alias name. To change an alias name,\n use DeleteAlias to delete the old alias and CreateAlias to\n create a new alias.

\n

Because an alias is not a property of a KMS key, you can create, update, and delete the\n aliases of a KMS key without affecting the KMS key. Also, aliases do not appear in the\n response from the DescribeKey operation. To get the aliases of all KMS keys\n in the account, use the ListAliases operation.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n

\n Required permissions\n

\n \n

For details, see Controlling access to aliases in the\n Key Management Service Developer Guide.

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#UpdateAliasRequest": { - "type": "structure", - "members": { - "AliasName": { - "target": "com.amazonaws.kms#AliasNameType", - "traits": { - "smithy.api#documentation": "

Identifies the alias that is changing its KMS key. This value must begin with\n alias/ followed by the alias name, such as alias/ExampleAlias. You\n cannot use UpdateAlias to change the alias name.

", - "smithy.api#required": {} - } - }, - "TargetKeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the customer managed key to associate with the alias. You don't have permission to\n associate an alias with an Amazon Web Services managed key.

\n

The KMS key must be in the same Amazon Web Services account and Region as the alias. Also, the new\n target KMS key must be the same type as the current target KMS key (both symmetric or both\n asymmetric) and they must have the same key usage.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

\n

To\n verify that the alias is mapped to the correct KMS key, use ListAliases.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#UpdateCustomKeyStore": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#UpdateCustomKeyStoreRequest" - }, - "output": { - "target": "com.amazonaws.kms#UpdateCustomKeyStoreResponse" - }, - "errors": [ - { - "target": "com.amazonaws.kms#CloudHsmClusterInvalidConfigurationException" - }, - { - "target": "com.amazonaws.kms#CloudHsmClusterNotActiveException" - }, - { - "target": "com.amazonaws.kms#CloudHsmClusterNotFoundException" - }, - { - "target": "com.amazonaws.kms#CloudHsmClusterNotRelatedException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreNameInUseException" - }, - { - "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - } - ], - "traits": { - "smithy.api#documentation": "

Changes the properties of a custom key store. Use the CustomKeyStoreId\n parameter to identify the custom key store you want to edit. Use the remaining parameters to\n change the properties of the custom key store.

\n

You can only update a custom key store that is disconnected. To disconnect the custom key\n store, use DisconnectCustomKeyStore. To reconnect the custom key store after\n the update completes, use ConnectCustomKeyStore. To find the connection\n state of a custom key store, use the DescribeCustomKeyStores\n operation.

\n

The CustomKeyStoreId parameter is required in all commands. Use the other\n parameters of UpdateCustomKeyStore to edit your key store settings.

\n
    \n
  • \n

    Use the NewCustomKeyStoreName parameter to change the friendly name of\n the custom key store to the value that you specify.

    \n

    \n
  • \n
  • \n

    Use the KeyStorePassword parameter tell KMS the current password of the\n \n kmsuser crypto user (CU) in the associated CloudHSM cluster. You\n can use this parameter to fix connection\n failures that occur when KMS cannot log into the associated cluster because\n the kmsuser password has changed. This value does not change the password in\n the CloudHSM cluster.

    \n

    \n
  • \n
  • \n

    Use the CloudHsmClusterId parameter to associate the custom key store\n with a different, but related, CloudHSM cluster. You can use this parameter to repair a\n custom key store if its CloudHSM cluster becomes corrupted or is deleted, or when you need to\n create or restore a cluster from a backup.

    \n
  • \n
\n

If the operation succeeds, it returns a JSON object with no\nproperties.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

\n

\n Cross-account\n use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n

\n Required permissions: kms:UpdateCustomKeyStore (IAM policy)

\n

\n Related operations:\n

\n " - } - }, - "com.amazonaws.kms#UpdateCustomKeyStoreRequest": { - "type": "structure", - "members": { - "CustomKeyStoreId": { - "target": "com.amazonaws.kms#CustomKeyStoreIdType", - "traits": { - "smithy.api#documentation": "

Identifies the custom key store that you want to update. Enter the ID of the custom key\n store. To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

", - "smithy.api#required": {} - } - }, - "NewCustomKeyStoreName": { - "target": "com.amazonaws.kms#CustomKeyStoreNameType", - "traits": { - "smithy.api#documentation": "

Changes the friendly name of the custom key store to the value that you specify. The\n custom key store name must be unique in the Amazon Web Services account.

" - } - }, - "KeyStorePassword": { - "target": "com.amazonaws.kms#KeyStorePasswordType", - "traits": { - "smithy.api#documentation": "

Enter the current password of the kmsuser crypto user (CU) in the CloudHSM\n cluster that is associated with the custom key store.

\n

This parameter tells KMS the current password of the kmsuser crypto user\n (CU). It does not set or change the password of any users in the CloudHSM cluster.

" - } - }, - "CloudHsmClusterId": { - "target": "com.amazonaws.kms#CloudHsmClusterIdType", - "traits": { - "smithy.api#documentation": "

Associates the custom key store with a related CloudHSM cluster.

\n

Enter the cluster ID of the cluster that you used to create the custom key store or a\n cluster that shares a backup history and has the same cluster certificate as the original\n cluster. You cannot use this parameter to associate a custom key store with an unrelated\n cluster. In addition, the replacement cluster must fulfill the requirements for\n a cluster associated with a custom key store. To view the cluster certificate of a cluster,\n use the DescribeClusters operation.

" - } - } - } - }, - "com.amazonaws.kms#UpdateCustomKeyStoreResponse": { - "type": "structure", - "members": {} - }, - "com.amazonaws.kms#UpdateKeyDescription": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#UpdateKeyDescriptionRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Updates the description of a KMS key. To see the description of a KMS key, use DescribeKey.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:UpdateKeyDescription (key policy)

\n

\n Related operations\n

\n " - } - }, - "com.amazonaws.kms#UpdateKeyDescriptionRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Updates the description of the specified KMS key.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "Description": { - "target": "com.amazonaws.kms#DescriptionType", - "traits": { - "smithy.api#documentation": "

New description for the KMS key.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#UpdatePrimaryRegion": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#UpdatePrimaryRegionRequest" - }, - "errors": [ - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidArnException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - }, - { - "target": "com.amazonaws.kms#UnsupportedOperationException" - } - ], - "traits": { - "smithy.api#documentation": "

Changes the primary key of a multi-Region key.

\n

This operation changes the replica key in the specified Region to a primary key and\n changes the former primary key to a replica key. For example, suppose you have a primary key\n in us-east-1 and a replica key in eu-west-2. If you run\n UpdatePrimaryRegion with a PrimaryRegion value of\n eu-west-2, the primary key is now the key in eu-west-2, and the\n key in us-east-1 becomes a replica key. For details, see Updating the primary Region in the Key Management Service Developer Guide.

\n

This operation supports multi-Region keys, an KMS feature that lets you create multiple\n interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key\n material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt\n it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

\n

The primary key of a multi-Region key is the source for properties\n that are always shared by primary and replica keys, including the key material, key ID, key spec, key usage, key material\n origin, and automatic\n key rotation. It's the only key that can be replicated. You cannot delete the primary\n key until all replica keys are deleted.

\n

The key ID and primary Region that you specify uniquely identify the replica key that will\n become the primary key. The primary Region must already have a replica key. This operation\n does not create a KMS key in the specified Region. To find the replica keys, use the DescribeKey operation on the primary key or any replica key. To create a replica\n key, use the ReplicateKey operation.

\n

You can run this operation while using the affected multi-Region keys in cryptographic\n operations. This operation should not delay, interrupt, or cause failures in cryptographic\n operations.

\n

Even after this operation completes, the process of updating the primary Region might\n still be in progress for a few more seconds. Operations such as DescribeKey might\n display both the old and new primary keys as replicas. The old and new primary keys have a\n transient key state of Updating. The original key state is restored when the\n update is complete. While the key state is Updating, you can use the keys in\n cryptographic operations, but you cannot replicate the new primary key or perform certain\n management operations, such as enabling or disabling these keys. For details about the\n Updating key state, see Key state:\n Effect on your KMS key in the Key Management Service Developer Guide.

\n

This operation does not return any output. To verify that primary key is changed, use the\n DescribeKey operation.

\n

\n Cross-account use: No. You cannot use this operation in a\n different Amazon Web Services account.

\n

\n Required permissions:

\n
    \n
  • \n

    \n kms:UpdatePrimaryRegion on the current primary key (in the primary key's\n Region). Include this permission primary key's key policy.

    \n
  • \n
  • \n

    \n kms:UpdatePrimaryRegion on the current replica key (in the replica key's\n Region). Include this permission in the replica key's key policy.

    \n
  • \n
\n

\n Related operations\n

\n " - } - }, - "com.amazonaws.kms#UpdatePrimaryRegionRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the current primary key. When the operation completes, this KMS key will be a\n replica key.

\n

Specify the key ID or key ARN of a multi-Region primary key.

\n

For example:

\n
    \n
  • \n

    Key ID: mrk-1234abcd12ab34cd56ef1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", - "smithy.api#required": {} - } - }, - "PrimaryRegion": { - "target": "com.amazonaws.kms#RegionType", - "traits": { - "smithy.api#documentation": "

The Amazon Web Services Region of the new primary key. Enter the Region ID, such as\n us-east-1 or ap-southeast-2. There must be an existing replica key\n in this Region.

\n

When the operation completes, the multi-Region key in this Region will be the primary\n key.

", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.kms#Verify": { - "type": "operation", - "input": { - "target": "com.amazonaws.kms#VerifyRequest" - }, - "output": { - "target": "com.amazonaws.kms#VerifyResponse" + "com.amazonaws.kms#AliasList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#AliasListEntry" + } + }, + "com.amazonaws.kms#AliasListEntry": { + "type": "structure", + "members": { + "AliasName": { + "target": "com.amazonaws.kms#AliasNameType", + "traits": { + "smithy.api#documentation": "

String that contains the alias. This value begins with alias/.

" + } + }, + "AliasArn": { + "target": "com.amazonaws.kms#ArnType", + "traits": { + "smithy.api#documentation": "

String that contains the key ARN.

" + } + }, + "TargetKeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

String that contains the key identifier of the KMS key associated with the alias.

" + } + }, + "CreationDate": { + "target": "com.amazonaws.kms#DateType", + "traits": { + "smithy.api#documentation": "

Date and time that the alias was most recently created in the account and Region.\n Formatted as Unix time.

" + } + }, + "LastUpdatedDate": { + "target": "com.amazonaws.kms#DateType", + "traits": { + "smithy.api#documentation": "

Date and time that the alias was most recently associated with a KMS key in the account\n and Region. Formatted as Unix time.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains information about an alias.

" + } + }, + "com.amazonaws.kms#AliasNameType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 256 + }, + "smithy.api#pattern": "^[a-zA-Z0-9:/_-]+$" + } + }, + "com.amazonaws.kms#AlreadyExistsException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "AlreadyExists", + "httpResponseCode": 409 + }, + "smithy.api#documentation": "

The request was rejected because it attempted to create a resource that already\n exists.

", + "smithy.api#error": "client", + "smithy.api#httpError": 409 + } + }, + "com.amazonaws.kms#ArnType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 20, + "max": 2048 + } + } + }, + "com.amazonaws.kms#BooleanType": { + "type": "boolean" + }, + "com.amazonaws.kms#CancelKeyDeletion": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#CancelKeyDeletionRequest" + }, + "output": { + "target": "com.amazonaws.kms#CancelKeyDeletionResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Cancels the deletion of a KMS key. When this operation succeeds, the key state of the KMS\n key is Disabled. To enable the KMS key, use EnableKey.

\n

For more information about scheduling and canceling deletion of a KMS key, see Deleting KMS keys in the\n Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n

\n Required permissions: kms:CancelKeyDeletion (key policy)

\n

\n Related operations: ScheduleKeyDeletion\n

" + } + }, + "com.amazonaws.kms#CancelKeyDeletionRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the KMS key whose deletion is being canceled.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#CancelKeyDeletionResponse": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key whose deletion is canceled.

" + } + } + } + }, + "com.amazonaws.kms#CiphertextType": { + "type": "blob", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 6144 + } + } + }, + "com.amazonaws.kms#CloudHsmClusterIdType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 19, + "max": 24 + } + } + }, + "com.amazonaws.kms#CloudHsmClusterInUseException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "CloudHsmClusterInUseException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the specified CloudHSM cluster is already associated with a\n custom key store or it shares a backup history with a cluster that is associated with a custom\n key store. Each custom key store must be associated with a different CloudHSM cluster.

\n

Clusters that share a backup history have the same cluster certificate. To view the\n cluster certificate of a cluster, use the DescribeClusters operation.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#CloudHsmClusterInvalidConfigurationException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "CloudHsmClusterInvalidConfigurationException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the associated CloudHSM cluster did not meet the\n configuration requirements for a custom key store.

\n\n
    \n
  • \n

    The cluster must be configured with private subnets in at least two different\n Availability Zones in the Region.

    \n
  • \n
  • \n

    The security group for\n the cluster (cloudhsm-cluster--sg) must\n include inbound rules and outbound rules that allow TCP traffic on ports 2223-2225. The\n Source in the inbound rules and the Destination in the outbound rules must match the security group\n ID. These rules are set by default when you create the cluster. Do not delete or change\n them. To get information about a particular security group, use the DescribeSecurityGroups operation.

    \n
  • \n
  • \n

    The cluster must contain at least as many HSMs as the operation requires. To add HSMs,\n use the CloudHSM CreateHsm operation.

    \n

    For the CreateCustomKeyStore, UpdateCustomKeyStore, and CreateKey operations, the CloudHSM cluster must have at least two\n active HSMs, each in a different Availability Zone. For the ConnectCustomKeyStore operation, the CloudHSM must contain at least one active\n HSM.

    \n
  • \n
\n

For information about the requirements for an CloudHSM cluster that is associated with a\n custom key store, see Assemble the Prerequisites\n in the Key Management Service Developer Guide. For information about creating a private subnet for an CloudHSM cluster,\n see Create a Private\n Subnet in the CloudHSM User Guide. For information about cluster security groups, see\n Configure a Default Security\n Group in the \n CloudHSM User Guide\n .

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#CloudHsmClusterNotActiveException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "CloudHsmClusterNotActiveException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the CloudHSM cluster that is associated with the custom key\n store is not active. Initialize and activate the cluster and try the command again. For\n detailed instructions, see Getting Started in the CloudHSM User Guide.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#CloudHsmClusterNotFoundException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "CloudHsmClusterNotFoundException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because KMS cannot find the CloudHSM cluster with the specified\n cluster ID. Retry the request with a different cluster ID.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#CloudHsmClusterNotRelatedException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "CloudHsmClusterNotRelatedException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the specified CloudHSM cluster has a different cluster\n certificate than the original cluster. You cannot use the operation to specify an unrelated\n cluster.

\n

Specify a cluster that shares a backup history with the original cluster. This includes\n clusters that were created from a backup of the current cluster, and clusters that were\n created from the same backup that produced the current cluster.

\n

Clusters that share a backup history have the same cluster certificate. To view the\n cluster certificate of a cluster, use the DescribeClusters operation.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#ConnectCustomKeyStore": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#ConnectCustomKeyStoreRequest" + }, + "output": { + "target": "com.amazonaws.kms#ConnectCustomKeyStoreResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#CloudHsmClusterInvalidConfigurationException" + }, + { + "target": "com.amazonaws.kms#CloudHsmClusterNotActiveException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + } + ], + "traits": { + "smithy.api#documentation": "

Connects or reconnects a custom key store to its associated CloudHSM cluster.

\n

The custom key store must be connected before you can create KMS keys in the key store or\n use the KMS keys it contains. You can disconnect and reconnect a custom key store at any\n time.

\n

To connect a custom key store, its associated CloudHSM cluster must have at least one active\n HSM. To get the number of active HSMs in a cluster, use the DescribeClusters operation. To add HSMs\n to the cluster, use the CreateHsm operation. Also, the \n kmsuser crypto\n user (CU) must not be logged into the cluster. This prevents KMS from using this\n account to log in.

\n

The connection process can take an extended amount of time to complete; up to 20 minutes.\n This operation starts the connection process, but it does not wait for it to complete. When it\n succeeds, this operation quickly returns an HTTP 200 response and a JSON object with no\n properties. However, this response does not indicate that the custom key store is connected.\n To get the connection state of the custom key store, use the DescribeCustomKeyStores operation.

\n

During the connection process, KMS finds the CloudHSM cluster that is associated with the\n custom key store, creates the connection infrastructure, connects to the cluster, logs into\n the CloudHSM client as the kmsuser CU, and rotates its password.

\n

The ConnectCustomKeyStore operation might fail for various reasons. To find\n the reason, use the DescribeCustomKeyStores operation and see the\n ConnectionErrorCode in the response. For help interpreting the\n ConnectionErrorCode, see CustomKeyStoresListEntry.

\n

To fix the failure, use the DisconnectCustomKeyStore operation to\n disconnect the custom key store, correct the error, use the UpdateCustomKeyStore operation if necessary, and then use\n ConnectCustomKeyStore again.

\n

If you are having trouble connecting or disconnecting a custom key store, see Troubleshooting a Custom Key\n Store in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:ConnectCustomKeyStore (IAM policy)

\n

\n Related operations\n

\n " + } + }, + "com.amazonaws.kms#ConnectCustomKeyStoreRequest": { + "type": "structure", + "members": { + "CustomKeyStoreId": { + "target": "com.amazonaws.kms#CustomKeyStoreIdType", + "traits": { + "smithy.api#documentation": "

Enter the key store ID of the custom key store that you want to connect.\n To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#ConnectCustomKeyStoreResponse": { + "type": "structure", + "members": {} + }, + "com.amazonaws.kms#ConnectionErrorCodeType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "INVALID_CREDENTIALS", + "name": "INVALID_CREDENTIALS" + }, + { + "value": "CLUSTER_NOT_FOUND", + "name": "CLUSTER_NOT_FOUND" + }, + { + "value": "NETWORK_ERRORS", + "name": "NETWORK_ERRORS" + }, + { + "value": "INTERNAL_ERROR", + "name": "INTERNAL_ERROR" + }, + { + "value": "INSUFFICIENT_CLOUDHSM_HSMS", + "name": "INSUFFICIENT_CLOUDHSM_HSMS" + }, + { + "value": "USER_LOCKED_OUT", + "name": "USER_LOCKED_OUT" + }, + { + "value": "USER_NOT_FOUND", + "name": "USER_NOT_FOUND" + }, + { + "value": "USER_LOGGED_IN", + "name": "USER_LOGGED_IN" + }, + { + "value": "SUBNET_NOT_FOUND", + "name": "SUBNET_NOT_FOUND" + } + ] + } + }, + "com.amazonaws.kms#ConnectionStateType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "CONNECTED", + "name": "CONNECTED" + }, + { + "value": "CONNECTING", + "name": "CONNECTING" + }, + { + "value": "FAILED", + "name": "FAILED" + }, + { + "value": "DISCONNECTED", + "name": "DISCONNECTED" + }, + { + "value": "DISCONNECTING", + "name": "DISCONNECTING" + } + ] + } + }, + "com.amazonaws.kms#CreateAlias": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#CreateAliasRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#AlreadyExistsException" + }, + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidAliasNameException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#LimitExceededException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Creates a friendly name for a KMS key.

\n \n

Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

You can use an alias to identify a KMS key in the KMS console, in the DescribeKey operation and in cryptographic operations, such as Encrypt and\n GenerateDataKey. You can also change the KMS key that's associated with\n the alias (UpdateAlias) or delete the alias (DeleteAlias)\n at any time. These operations don't affect the underlying KMS key.

\n

You can associate the alias with any customer managed key in the same Amazon Web Services Region. Each\n alias is associated with only one KMS key at a time, but a KMS key can have multiple aliases.\n A valid KMS key is required. You can't create an alias without a KMS key.

\n

The alias must be unique in the account and Region, but you can have aliases with the same\n name in different Regions. For detailed information about aliases, see Using aliases in the\n Key Management Service Developer Guide.

\n

This operation does not return a response. To get the alias that you created, use the\n ListAliases operation.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on an alias in a different Amazon Web Services account.

\n\n

\n Required permissions\n

\n \n

For details, see Controlling access to aliases in the\n Key Management Service Developer Guide.

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#CreateAliasRequest": { + "type": "structure", + "members": { + "AliasName": { + "target": "com.amazonaws.kms#AliasNameType", + "traits": { + "smithy.api#documentation": "

Specifies the alias name. This value must begin with alias/ followed by a\n name, such as alias/ExampleAlias.

\n

The AliasName value must be string of 1-256 characters. It can contain only\n alphanumeric characters, forward slashes (/), underscores (_), and dashes (-). The alias name\n cannot begin with alias/aws/. The alias/aws/ prefix is reserved for\n Amazon Web Services managed\n keys.

", + "smithy.api#required": {} + } + }, + "TargetKeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Associates the alias with the specified customer managed key. The KMS key must\n be in the same Amazon Web Services Region.

\n

A valid key ID is required. If you supply a null or empty string value, this operation\n returns an error.

\n

For help finding the key ID and ARN, see Finding the Key ID and\n ARN in the \n Key Management Service Developer Guide\n .

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#CreateCustomKeyStore": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#CreateCustomKeyStoreRequest" + }, + "output": { + "target": "com.amazonaws.kms#CreateCustomKeyStoreResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#CloudHsmClusterInUseException" + }, + { + "target": "com.amazonaws.kms#CloudHsmClusterInvalidConfigurationException" + }, + { + "target": "com.amazonaws.kms#CloudHsmClusterNotActiveException" + }, + { + "target": "com.amazonaws.kms#CloudHsmClusterNotFoundException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreNameInUseException" + }, + { + "target": "com.amazonaws.kms#IncorrectTrustAnchorException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + } + ], + "traits": { + "smithy.api#documentation": "

Creates a custom key store that is associated with an CloudHSM cluster that you own and\n manage.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

\n

Before you create the custom key store, you must assemble\n the required elements, including an CloudHSM cluster that fulfills the requirements for a custom\n key store. For details about the required elements, see Assemble the Prerequisites\n in the Key Management Service Developer Guide.

\n

When the operation completes successfully, it returns the ID of the new custom key store.\n Before you can use your new custom key store, you need to use the ConnectCustomKeyStore operation to connect the new key store to its CloudHSM\n cluster. Even if you are not going to use your custom key store immediately, you might want to\n connect it to verify that all settings are correct and then disconnect it until you are ready\n to use it.

\n

For help with failures, see Troubleshooting a Custom Key Store in the\n Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n

\n Required permissions: kms:CreateCustomKeyStore (IAM policy).

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#CreateCustomKeyStoreRequest": { + "type": "structure", + "members": { + "CustomKeyStoreName": { + "target": "com.amazonaws.kms#CustomKeyStoreNameType", + "traits": { + "smithy.api#documentation": "

Specifies a friendly name for the custom key store. The name must be unique in your\n Amazon Web Services account.

", + "smithy.api#required": {} + } + }, + "CloudHsmClusterId": { + "target": "com.amazonaws.kms#CloudHsmClusterIdType", + "traits": { + "smithy.api#documentation": "

Identifies the CloudHSM cluster for the custom key store. Enter the cluster ID of any active\n CloudHSM cluster that is not already associated with a custom key store. To find the cluster ID,\n use the DescribeClusters operation.

", + "smithy.api#required": {} + } + }, + "TrustAnchorCertificate": { + "target": "com.amazonaws.kms#TrustAnchorCertificateType", + "traits": { + "smithy.api#documentation": "

Enter the content of the trust anchor certificate for the cluster. This is the content of\n the customerCA.crt file that you created when you initialized the cluster.

", + "smithy.api#required": {} + } + }, + "KeyStorePassword": { + "target": "com.amazonaws.kms#KeyStorePasswordType", + "traits": { + "smithy.api#documentation": "

Enter the password of the \n kmsuser crypto user\n (CU) account in the specified CloudHSM cluster. KMS logs into the cluster as this\n user to manage key material on your behalf.

\n

The password must be a string of 7 to 32 characters. Its value is case sensitive.

\n

This parameter tells KMS the kmsuser account password; it does not change\n the password in the CloudHSM cluster.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#CreateCustomKeyStoreResponse": { + "type": "structure", + "members": { + "CustomKeyStoreId": { + "target": "com.amazonaws.kms#CustomKeyStoreIdType", + "traits": { + "smithy.api#documentation": "

A unique identifier for the new custom key store.

" + } + } + } + }, + "com.amazonaws.kms#CreateGrant": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#CreateGrantRequest" + }, + "output": { + "target": "com.amazonaws.kms#CreateGrantResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#LimitExceededException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Adds a grant to a KMS key.

\n

A grant is a policy instrument that allows Amazon Web Services principals to use\n KMS keys in cryptographic operations. It also can allow them to view a KMS key (DescribeKey) and create and manage grants. When authorizing access to a KMS key,\n grants are considered along with key policies and IAM policies. Grants are often used for\n temporary permissions because you can create one, use its permissions, and delete it without\n changing your key policies or IAM policies.

\n

For detailed information about grants, including grant terminology, see Using grants in the\n \n Key Management Service Developer Guide\n . For examples of working with grants in several\n programming languages, see Programming grants.

\n

The CreateGrant operation returns a GrantToken and a\n GrantId.

\n
    \n
  • \n

    When you create, retire, or revoke a grant, there might be a brief delay, usually less than five minutes, until the grant is available throughout KMS. This state is known as eventual consistency. Once the grant has achieved eventual consistency, the grantee\n principal can use the permissions in the grant without identifying the grant.

    \n

    However, to use the permissions in the grant immediately, use the\n GrantToken that CreateGrant returns. For details, see Using a\n grant token in the \n Key Management Service Developer Guide\n .

    \n
  • \n
  • \n

    The CreateGrant operation also returns a GrantId. You can\n use the GrantId and a key identifier to identify the grant in the RetireGrant and RevokeGrant operations. To find the grant\n ID, use the ListGrants or ListRetirableGrants\n operations.

    \n
  • \n
\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: Yes.\n To perform this operation on a KMS key in a different Amazon Web Services account, specify the key\n ARN in the value of the KeyId parameter.

\n

\n Required permissions: kms:CreateGrant (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#CreateGrantRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the KMS key for the grant. The grant gives principals permission to use this\n KMS key.

\n

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a\ndifferent Amazon Web Services account, you must use the key ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "GranteePrincipal": { + "target": "com.amazonaws.kms#PrincipalIdType", + "traits": { + "smithy.api#documentation": "

The identity that gets the permissions specified in the grant.

\n

To specify the principal, use the Amazon Resource Name (ARN) of an\n Amazon Web Services principal. Valid Amazon Web Services principals include Amazon Web Services accounts (root), IAM users, IAM roles,\n federated users, and assumed role users. For examples of the ARN syntax to use for specifying\n a principal, see Amazon Web Services Identity and Access\n Management (IAM) in the Example ARNs section of the Amazon Web Services General\n Reference.

", + "smithy.api#required": {} + } + }, + "RetiringPrincipal": { + "target": "com.amazonaws.kms#PrincipalIdType", + "traits": { + "smithy.api#documentation": "

The principal that has permission to use the RetireGrant operation to\n retire the grant.

\n

To specify the principal, use the Amazon Resource Name (ARN) of an\n Amazon Web Services principal. Valid Amazon Web Services principals include Amazon Web Services accounts (root), IAM users, federated\n users, and assumed role users. For examples of the ARN syntax to use for specifying a\n principal, see Amazon Web Services Identity and Access\n Management (IAM) in the Example ARNs section of the Amazon Web Services General\n Reference.

\n

The grant determines the retiring principal. Other principals might have permission to\n retire the grant or revoke the grant. For details, see RevokeGrant and\n Retiring and\n revoking grants in the Key Management Service Developer Guide.

" + } + }, + "Operations": { + "target": "com.amazonaws.kms#GrantOperationList", + "traits": { + "smithy.api#documentation": "

A list of operations that the grant permits.

\n

The operation must be supported on the KMS key. For example, you cannot create a grant for\n a symmetric KMS key that allows the Sign operation, or a grant for an\n asymmetric KMS key that allows the GenerateDataKey operation. If you try,\n KMS returns a ValidationError exception. For details, see Grant\n operations in the Key Management Service Developer Guide.

", + "smithy.api#required": {} + } + }, + "Constraints": { + "target": "com.amazonaws.kms#GrantConstraints", + "traits": { + "smithy.api#documentation": "

Specifies a grant constraint.

\n

KMS supports the EncryptionContextEquals and\n EncryptionContextSubset grant constraints. Each constraint value can include up\n to 8 encryption context pairs. The encryption context value in each constraint cannot exceed\n 384 characters.

\n

These grant constraints allow the permissions in the grant only when the encryption\n context in the request matches (EncryptionContextEquals) or includes\n (EncryptionContextSubset) the encryption context specified in this structure.\n For information about grant constraints, see Using grant\n constraints in the Key Management Service Developer Guide. For more information about encryption context,\n see Encryption\n Context in the \n Key Management Service Developer Guide\n .

\n

The encryption context grant constraints are supported only on operations that include an\n encryption context. You cannot use an encryption context grant constraint for cryptographic\n operations with asymmetric KMS keys or for management operations, such as DescribeKey or RetireGrant.

" + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + }, + "Name": { + "target": "com.amazonaws.kms#GrantNameType", + "traits": { + "smithy.api#documentation": "

A friendly name for the grant. Use this value to prevent the unintended creation of\n duplicate grants when retrying this request.

\n

When this value is absent, all CreateGrant requests result in a new grant\n with a unique GrantId even if all the supplied parameters are identical. This can\n result in unintended duplicates when you retry the CreateGrant request.

\n

When this value is present, you can retry a CreateGrant request with\n identical parameters; if the grant already exists, the original GrantId is\n returned without creating a new grant. Note that the returned grant token is unique with every\n CreateGrant request, even when a duplicate GrantId is returned.\n All grant tokens for the same grant ID can be used interchangeably.

" + } + } + } + }, + "com.amazonaws.kms#CreateGrantResponse": { + "type": "structure", + "members": { + "GrantToken": { + "target": "com.amazonaws.kms#GrantTokenType", + "traits": { + "smithy.api#documentation": "

The grant token.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + }, + "GrantId": { + "target": "com.amazonaws.kms#GrantIdType", + "traits": { + "smithy.api#documentation": "

The unique identifier for the grant.

\n

You can use the GrantId in a ListGrants, RetireGrant, or RevokeGrant operation.

" + } + } + } + }, + "com.amazonaws.kms#CreateKey": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#CreateKeyRequest" + }, + "output": { + "target": "com.amazonaws.kms#CreateKeyResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#CloudHsmClusterInvalidConfigurationException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" + }, + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#LimitExceededException" + }, + { + "target": "com.amazonaws.kms#MalformedPolicyDocumentException" + }, + { + "target": "com.amazonaws.kms#TagException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Creates a unique customer managed KMS key in your Amazon Web Services account and\n Region.

\n \n

KMS is replacing the term customer master key (CMK) with KMS key and KMS key. The concept has not changed. To prevent breaking changes, KMS is keeping some variations of this term.

\n
\n\n

You can use the CreateKey operation to create symmetric or asymmetric KMS\n keys.

\n
    \n
  • \n

    \n Symmetric KMS keys contain a 256-bit symmetric key\n that never leaves KMS unencrypted. To use the KMS key, you must call KMS. You can use\n a symmetric KMS key to encrypt and decrypt small amounts of data, but they are typically\n used to generate data keys and data keys pairs. For details,\n see GenerateDataKey and GenerateDataKeyPair.

    \n
  • \n
  • \n

    \n Asymmetric KMS keys can contain an RSA key pair or an\n Elliptic Curve (ECC) key pair. The private key in an asymmetric KMS key never leaves KMS\n unencrypted. However, you can use the GetPublicKey operation to download\n the public key so it can be used outside of KMS. KMS keys with RSA key pairs can be used\n to encrypt or decrypt data or sign and verify messages (but not both). KMS keys with ECC\n key pairs can be used only to sign and verify messages.

    \n
  • \n
\n

For information about symmetric and asymmetric KMS keys, see Using Symmetric and Asymmetric KMS keys in the Key Management Service Developer Guide.

\n\n\n

To create different types of KMS keys, use the following guidance:

\n\n
\n
Asymmetric KMS keys
\n
\n

To create an asymmetric KMS key, use the KeySpec parameter to specify\n the type of key material in the KMS key. Then, use the KeyUsage parameter\n to determine whether the KMS key will be used to encrypt and decrypt or sign and verify.\n You can't change these properties after the KMS key is created.

\n

\n
\n
Symmetric KMS keys
\n
\n

When creating a symmetric KMS key, you don't need to specify the\n KeySpec or KeyUsage parameters. The default value for\n KeySpec, SYMMETRIC_DEFAULT, and the default value for\n KeyUsage, ENCRYPT_DECRYPT, are the only valid values for\n symmetric KMS keys.

\n

\n
\n
Multi-Region primary keys
\n
Imported key material
\n
\n

To create a multi-Region primary key in the local Amazon Web Services Region,\n use the MultiRegion parameter with a value of True. To create\n a multi-Region replica key, that is, a KMS key with the same key ID\n and key material as a primary key, but in a different Amazon Web Services Region, use the ReplicateKey operation. To change a replica key to a primary key, and its\n primary key to a replica key, use the UpdatePrimaryRegion\n operation.

\n

This operation supports multi-Region keys, an KMS feature that lets you create multiple\n interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key\n material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt\n it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

\n

You can create symmetric and asymmetric multi-Region keys and multi-Region keys with\n imported key material. You cannot create multi-Region keys in a custom key store.

\n

\n
\n
\n

To import your own key material, begin by creating a symmetric KMS key with no key\n material. To do this, use the Origin parameter of CreateKey\n with a value of EXTERNAL. Next, use GetParametersForImport operation to get a public key and import token, and use the public key to encrypt\n your key material. Then, use ImportKeyMaterial with your import token\n to import the key material. For step-by-step instructions, see Importing Key Material in the \n Key Management Service Developer Guide\n . You\n cannot import the key material into an asymmetric KMS key.

\n

To create a multi-Region primary key with imported key material, use the\n Origin parameter of CreateKey with a value of\n EXTERNAL and the MultiRegion parameter with a value of\n True. To create replicas of the multi-Region primary key, use the ReplicateKey operation. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

\n

\n
\n
Custom key store
\n
\n

To create a symmetric KMS key in a custom key store, use the\n CustomKeyStoreId parameter to specify the custom key store. You must also\n use the Origin parameter with a value of AWS_CLOUDHSM. The\n CloudHSM cluster that is associated with the custom key store must have at least two active\n HSMs in different Availability Zones in the Amazon Web Services Region.

\n

You cannot create an asymmetric KMS key in a custom key store. For information about\n custom key stores in KMS see Using Custom Key Stores in\n the \n Key Management Service Developer Guide\n .

\n
\n
\n

\n Cross-account use: No. You cannot use this operation to\n create a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:CreateKey (IAM policy). To use the\n Tags parameter, kms:TagResource (IAM policy). For examples and information about related\n permissions, see Allow a user to create\n KMS keys in the Key Management Service Developer Guide.

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#CreateKeyRequest": { + "type": "structure", + "members": { + "Policy": { + "target": "com.amazonaws.kms#PolicyType", + "traits": { + "smithy.api#documentation": "

The key policy to attach to the KMS key.

\n

If you provide a key policy, it must meet the following criteria:

\n
    \n
  • \n

    If you don't set BypassPolicyLockoutSafetyCheck to true, the key policy\n must allow the principal that is making the CreateKey request to make a\n subsequent PutKeyPolicy request on the KMS key. This reduces the risk\n that the KMS key becomes unmanageable. For more information, refer to the scenario in the\n Default Key Policy section of the \n Key Management Service Developer Guide\n .

    \n
  • \n
  • \n

    Each statement in the key policy must contain one or more principals. The principals\n in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services\n principal (for example, an IAM user or role), you might need to enforce a delay before\n including the new principal in a key policy because the new principal might not be\n immediately visible to KMS. For more information, see Changes that I make are not always immediately visible in the Amazon Web Services\n Identity and Access Management User Guide.

    \n
  • \n
\n

If you do not provide a key policy, KMS attaches a default key policy to the KMS key.\n For more information, see Default Key Policy in the\n Key Management Service Developer Guide.

\n

The key policy size quota is 32 kilobytes (32768 bytes).

\n

For help writing and formatting a JSON policy document, see the IAM JSON Policy Reference in the \n Identity and Access Management User Guide\n .

" + } + }, + "Description": { + "target": "com.amazonaws.kms#DescriptionType", + "traits": { + "smithy.api#documentation": "

A description of the KMS key.

\n

Use a description that helps you decide whether the KMS key is appropriate for a task. The\n default value is an empty string (no description).

\n

To set or change the description after the key is created, use UpdateKeyDescription.

" + } + }, + "KeyUsage": { + "target": "com.amazonaws.kms#KeyUsageType", + "traits": { + "smithy.api#documentation": "

Determines the cryptographic operations for which you can use the KMS key. The default value is\n ENCRYPT_DECRYPT. This parameter is required only for asymmetric KMS keys. You\n can't change the KeyUsage value after the KMS key is created.

\n

Select only one valid value.

\n
    \n
  • \n

    For symmetric KMS keys, omit the parameter or specify\n ENCRYPT_DECRYPT.

    \n
  • \n
  • \n

    For asymmetric KMS keys with RSA key material, specify ENCRYPT_DECRYPT or\n SIGN_VERIFY.

    \n
  • \n
  • \n

    For asymmetric KMS keys with ECC key material, specify\n SIGN_VERIFY.

    \n
  • \n
" + } + }, + "CustomerMasterKeySpec": { + "target": "com.amazonaws.kms#CustomerMasterKeySpec", + "traits": { + "smithy.api#deprecated": { + "message": "This parameter has been deprecated. Instead, use the KeySpec parameter." }, - "errors": [ - { - "target": "com.amazonaws.kms#DependencyTimeoutException" - }, - { - "target": "com.amazonaws.kms#DisabledException" - }, - { - "target": "com.amazonaws.kms#InvalidGrantTokenException" - }, - { - "target": "com.amazonaws.kms#InvalidKeyUsageException" - }, - { - "target": "com.amazonaws.kms#KeyUnavailableException" - }, - { - "target": "com.amazonaws.kms#KMSInternalException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidSignatureException" - }, - { - "target": "com.amazonaws.kms#KMSInvalidStateException" - }, - { - "target": "com.amazonaws.kms#NotFoundException" - } - ], - "traits": { - "smithy.api#documentation": "

Verifies a digital signature that was generated by the Sign operation.

\n

\n

Verification confirms that an authorized user signed the message with the specified KMS\n key and signing algorithm, and the message hasn't changed since it was signed. If the\n signature is verified, the value of the SignatureValid field in the response is\n True. If the signature verification fails, the Verify operation\n fails with an KMSInvalidSignatureException exception.

\n

A digital signature is generated by using the private key in an asymmetric KMS key. The\n signature is verified by using the public key in the same asymmetric KMS key.\n For information about symmetric and asymmetric KMS keys, see Using Symmetric and Asymmetric KMS keys in the Key Management Service Developer Guide.

\n

To verify a digital signature, you can use the Verify operation. Specify the\n same asymmetric KMS key, message, and signing algorithm that were used to produce the\n signature.

\n

You can also verify the digital signature by using the public key of the KMS key outside\n of KMS. Use the GetPublicKey operation to download the public key in the\n asymmetric KMS key and then use the public key to verify the signature outside of KMS. The\n advantage of using the Verify operation is that it is performed within KMS. As\n a result, it's easy to call, the operation is performed within the FIPS boundary, it is logged\n in CloudTrail, and you can use key policy and IAM policy to determine who is authorized to use\n the KMS key to verify signatures.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:Verify (key policy)

\n

\n Related operations: Sign\n

" - } - }, - "com.amazonaws.kms#VerifyRequest": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

Identifies the asymmetric KMS key that will be used to verify the signature. This must be\n the same KMS key that was used to generate the signature. If you specify a different KMS key,\n the signature verification fails.

\n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", - "smithy.api#required": {} - } - }, - "Message": { - "target": "com.amazonaws.kms#PlaintextType", - "traits": { - "smithy.api#documentation": "

Specifies the message that was signed. You can submit a raw message of up to 4096 bytes,\n or a hash digest of the message. If you submit a digest, use the MessageType\n parameter with a value of DIGEST.

\n

If the message specified here is different from the message that was signed, the signature\n verification fails. A message and its hash digest are considered to be the same\n message.

", - "smithy.api#required": {} - } - }, - "MessageType": { - "target": "com.amazonaws.kms#MessageType", - "traits": { - "smithy.api#documentation": "

Tells KMS whether the value of the Message parameter is a message or\n message digest. The default value, RAW, indicates a message. To indicate a message digest,\n enter DIGEST.

\n \n

Use the DIGEST value only when the value of the Message\n parameter is a message digest. If you use the DIGEST value with a raw message,\n the security of the verification operation can be compromised.

\n
" - } - }, - "Signature": { - "target": "com.amazonaws.kms#CiphertextType", - "traits": { - "smithy.api#documentation": "

The signature that the Sign operation generated.

", - "smithy.api#required": {} - } - }, - "SigningAlgorithm": { - "target": "com.amazonaws.kms#SigningAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

The signing algorithm that was used to sign the message. If you submit a different\n algorithm, the signature verification fails.

", - "smithy.api#required": {} - } - }, - "GrantTokens": { - "target": "com.amazonaws.kms#GrantTokenList", - "traits": { - "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" - } - } - } - }, - "com.amazonaws.kms#VerifyResponse": { - "type": "structure", - "members": { - "KeyId": { - "target": "com.amazonaws.kms#KeyIdType", - "traits": { - "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the asymmetric KMS key that was used to verify the signature.

" - } - }, - "SignatureValid": { - "target": "com.amazonaws.kms#BooleanType", - "traits": { - "smithy.api#documentation": "

A Boolean value that indicates whether the signature was verified. A value of\n True indicates that the Signature was produced by signing the\n Message with the specified KeyID and\n SigningAlgorithm. If the signature is not verified, the Verify\n operation fails with a KMSInvalidSignatureException exception.

" - } - }, - "SigningAlgorithm": { - "target": "com.amazonaws.kms#SigningAlgorithmSpec", - "traits": { - "smithy.api#documentation": "

The signing algorithm that was used to verify the signature.

" - } - } - } - }, - "com.amazonaws.kms#WrappingKeySpec": { - "type": "string", - "traits": { - "smithy.api#enum": [ - { - "value": "RSA_2048", - "name": "RSA_2048" - } - ] - } + "smithy.api#documentation": "

Instead, use the KeySpec parameter.

\n

The KeySpec and CustomerMasterKeySpec parameters work the same\n way. Only the names differ. We recommend that you use KeySpec parameter in your\n code. However, to avoid breaking changes, KMS will support both parameters.

" + } + }, + "KeySpec": { + "target": "com.amazonaws.kms#KeySpec", + "traits": { + "smithy.api#documentation": "

Specifies the type of KMS key to create. The default value,\n SYMMETRIC_DEFAULT, creates a KMS key with a 256-bit symmetric key for encryption\n and decryption. For help choosing a key spec for your KMS key, see How to Choose Your KMS key\n Configuration in the \n Key Management Service Developer Guide\n .

\n

The KeySpec determines whether the KMS key contains a symmetric key or an\n asymmetric key pair. It also determines the encryption algorithms or signing algorithms that\n the KMS key supports. You can't change the KeySpec after the KMS key is created.\n To further restrict the algorithms that can be used with the KMS key, use a condition key in\n its key policy or IAM policy. For more information, see kms:EncryptionAlgorithm or kms:Signing Algorithm in the \n Key Management Service Developer Guide\n .

\n \n

\n Amazon Web Services services that\n are integrated with KMS use symmetric KMS keys to protect your data. These\n services do not support asymmetric KMS keys. For help determining whether a KMS key is\n symmetric or asymmetric, see Identifying Symmetric and Asymmetric\n KMS keys in the Key Management Service Developer Guide.

\n
\n

KMS supports the following key specs for KMS keys:

\n
    \n
  • \n

    Symmetric key (default)

    \n
      \n
    • \n

      \n SYMMETRIC_DEFAULT (AES-256-GCM)

      \n
    • \n
    \n
  • \n
  • \n

    Asymmetric RSA key pairs

    \n
      \n
    • \n

      \n RSA_2048\n

      \n
    • \n
    • \n

      \n RSA_3072\n

      \n
    • \n
    • \n

      \n RSA_4096\n

      \n
    • \n
    \n
  • \n
  • \n

    Asymmetric NIST-recommended elliptic curve key pairs

    \n
      \n
    • \n

      \n ECC_NIST_P256 (secp256r1)

      \n
    • \n
    • \n

      \n ECC_NIST_P384 (secp384r1)

      \n
    • \n
    • \n

      \n ECC_NIST_P521 (secp521r1)

      \n
    • \n
    \n
  • \n
  • \n

    Other asymmetric elliptic curve key pairs

    \n
      \n
    • \n

      \n ECC_SECG_P256K1 (secp256k1), commonly used for\n cryptocurrencies.

      \n
    • \n
    \n
  • \n
" + } + }, + "Origin": { + "target": "com.amazonaws.kms#OriginType", + "traits": { + "smithy.api#documentation": "

The source of the key material for the KMS key. You cannot change the origin after you\n create the KMS key. The default is AWS_KMS, which means that KMS creates the\n key material.

\n

To create a KMS key with no key material (for imported key material), set the value to\n EXTERNAL. For more information about importing key material into KMS, see\n Importing Key\n Material in the Key Management Service Developer Guide. This value is valid only for symmetric KMS\n keys.

\n

To create a KMS key in an KMS custom key store and create its key material in the\n associated CloudHSM cluster, set this value to AWS_CLOUDHSM. You must also use the\n CustomKeyStoreId parameter to identify the custom key store. This value is\n valid only for symmetric KMS keys.

" + } + }, + "CustomKeyStoreId": { + "target": "com.amazonaws.kms#CustomKeyStoreIdType", + "traits": { + "smithy.api#documentation": "

Creates the KMS key in the specified custom key store and the key material in its\n associated CloudHSM cluster. To create a KMS key in a custom key store, you must also specify the\n Origin parameter with a value of AWS_CLOUDHSM. The CloudHSM cluster\n that is associated with the custom key store must have at least two active HSMs, each in a\n different Availability Zone in the Region.

\n

This parameter is valid only for symmetric KMS keys and regional KMS keys. You cannot\n create an asymmetric KMS key or a multi-Region key in a custom key store.

\n

To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

\n

The response includes the custom key store ID and the ID of the CloudHSM cluster.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

" + } + }, + "BypassPolicyLockoutSafetyCheck": { + "target": "com.amazonaws.kms#BooleanType", + "traits": { + "smithy.api#documentation": "

A flag to indicate whether to bypass the key policy lockout safety check.

\n \n

Setting this value to true increases the risk that the KMS key becomes unmanageable. Do\n not set this value to true indiscriminately.

\n

For more information, refer to the scenario in the Default Key Policy section in the \n Key Management Service Developer Guide\n .

\n
\n

Use this parameter only when you include a policy in the request and you intend to prevent\n the principal that is making the request from making a subsequent PutKeyPolicy request on the KMS key.

\n

The default value is false.

" + } + }, + "Tags": { + "target": "com.amazonaws.kms#TagList", + "traits": { + "smithy.api#documentation": "

Assigns one or more tags to the KMS key. Use this parameter to tag the KMS key when it is\n created. To tag an existing KMS key, use the TagResource operation.

\n \n

Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

To use this parameter, you must have kms:TagResource permission in an IAM policy.

\n

Each tag consists of a tag key and a tag value. Both the tag key and the tag value are\n required, but the tag value can be an empty (null) string. You cannot have more than one tag\n on a KMS key with the same tag key. If you specify an existing tag key with a different tag\n value, KMS replaces the current tag value with the specified one.

\n

When you add tags to an Amazon Web Services resource, Amazon Web Services generates a cost allocation\n report with usage and costs aggregated by tags. Tags can also be used to control access to a KMS key. For details,\n see Tagging Keys.

" + } + }, + "MultiRegion": { + "target": "com.amazonaws.kms#NullableBooleanType", + "traits": { + "smithy.api#documentation": "

Creates a multi-Region primary key that you can replicate into other Amazon Web Services Regions. You\n cannot change this value after you create the KMS key.

\n

For a multi-Region key, set this parameter to True. For a single-Region KMS\n key, omit this parameter or set it to False. The default value is\n False.

\n

This operation supports multi-Region keys, an KMS feature that lets you create multiple\n interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key\n material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt\n it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

\n

This value creates a primary key, not a replica. To create a\n replica key, use the ReplicateKey operation.

\n

You can create a symmetric or asymmetric multi-Region key, and you can create a\n multi-Region key with imported key material. However, you cannot create a multi-Region key in\n a custom key store.

" + } + } + } + }, + "com.amazonaws.kms#CreateKeyResponse": { + "type": "structure", + "members": { + "KeyMetadata": { + "target": "com.amazonaws.kms#KeyMetadata", + "traits": { + "smithy.api#documentation": "

Metadata associated with the KMS key.

" + } + } + } + }, + "com.amazonaws.kms#CustomKeyStoreHasCMKsException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "CustomKeyStoreHasCMKsException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the custom key store contains KMS keys. After verifying\n that you do not need to use the KMS keys, use the ScheduleKeyDeletion\n operation to delete the KMS keys. After they are deleted, you can delete the custom key\n store.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#CustomKeyStoreIdType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 64 + } + } + }, + "com.amazonaws.kms#CustomKeyStoreInvalidStateException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "CustomKeyStoreInvalidStateException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because of the ConnectionState of the custom key\n store. To get the ConnectionState of a custom key store, use the DescribeCustomKeyStores operation.

\n

This exception is thrown under the following conditions:

\n
    \n
  • \n

    You requested the CreateKey or GenerateRandom\n operation in a custom key store that is not connected. These operations are valid only\n when the custom key store ConnectionState is CONNECTED.

    \n
  • \n
  • \n

    You requested the UpdateCustomKeyStore or DeleteCustomKeyStore operation on a custom key store that is not\n disconnected. This operation is valid only when the custom key store\n ConnectionState is DISCONNECTED.

    \n
  • \n
  • \n

    You requested the ConnectCustomKeyStore operation on a custom key\n store with a ConnectionState of DISCONNECTING or\n FAILED. This operation is valid for all other ConnectionState\n values.

    \n
  • \n
", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#CustomKeyStoreNameInUseException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "CustomKeyStoreNameInUseException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the specified custom key store name is already assigned\n to another custom key store in the account. Try again with a custom key store name that is\n unique in the account.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#CustomKeyStoreNameType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 256 + } + } + }, + "com.amazonaws.kms#CustomKeyStoreNotFoundException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "CustomKeyStoreNotFoundException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because KMS cannot find a custom key store with the specified\n key store name or ID.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#CustomKeyStoresList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#CustomKeyStoresListEntry" + } + }, + "com.amazonaws.kms#CustomKeyStoresListEntry": { + "type": "structure", + "members": { + "CustomKeyStoreId": { + "target": "com.amazonaws.kms#CustomKeyStoreIdType", + "traits": { + "smithy.api#documentation": "

A unique identifier for the custom key store.

" + } + }, + "CustomKeyStoreName": { + "target": "com.amazonaws.kms#CustomKeyStoreNameType", + "traits": { + "smithy.api#documentation": "

The user-specified friendly name for the custom key store.

" + } + }, + "CloudHsmClusterId": { + "target": "com.amazonaws.kms#CloudHsmClusterIdType", + "traits": { + "smithy.api#documentation": "

A unique identifier for the CloudHSM cluster that is associated with the custom key\n store.

" + } + }, + "TrustAnchorCertificate": { + "target": "com.amazonaws.kms#TrustAnchorCertificateType", + "traits": { + "smithy.api#documentation": "

The trust anchor certificate of the associated CloudHSM cluster. When you initialize the\n cluster, you create this certificate and save it in the customerCA.crt\n file.

" + } + }, + "ConnectionState": { + "target": "com.amazonaws.kms#ConnectionStateType", + "traits": { + "smithy.api#documentation": "

Indicates whether the custom key store is connected to its CloudHSM cluster.

\n

You can create and use KMS keys in your custom key stores only when its connection state\n is CONNECTED.

\n

The value is DISCONNECTED if the key store has never been connected or you\n use the DisconnectCustomKeyStore operation to disconnect it. If the value is\n CONNECTED but you are having trouble using the custom key store, make sure that\n its associated CloudHSM cluster is active and contains at least one active HSM.

\n

A value of FAILED indicates that an attempt to connect was unsuccessful. The\n ConnectionErrorCode field in the response indicates the cause of the failure.\n For help resolving a connection failure, see Troubleshooting a Custom Key Store in the\n Key Management Service Developer Guide.

" + } + }, + "ConnectionErrorCode": { + "target": "com.amazonaws.kms#ConnectionErrorCodeType", + "traits": { + "smithy.api#documentation": "

Describes the connection error. This field appears in the response only when the\n ConnectionState is FAILED. For help resolving these errors, see\n How to\n Fix a Connection Failure in Key Management Service Developer Guide.

\n

Valid values are:

\n
    \n
  • \n

    \n CLUSTER_NOT_FOUND - KMS cannot find the CloudHSM cluster with the\n specified cluster ID.

    \n
  • \n
  • \n

    \n INSUFFICIENT_CLOUDHSM_HSMS - The associated CloudHSM cluster does not\n contain any active HSMs. To connect a custom key store to its CloudHSM cluster, the cluster\n must contain at least one active HSM.

    \n
  • \n
  • \n

    \n INTERNAL_ERROR - KMS could not complete the request due to an internal\n error. Retry the request. For ConnectCustomKeyStore requests, disconnect the\n custom key store before trying to connect again.

    \n
  • \n
  • \n

    \n INVALID_CREDENTIALS - KMS does not have the correct password for the\n kmsuser crypto user in the CloudHSM cluster. Before you can connect your\n custom key store to its CloudHSM cluster, you must change the kmsuser account\n password and update the key store password value for the custom key store.

    \n
  • \n
  • \n

    \n NETWORK_ERRORS - Network errors are preventing KMS from connecting to\n the custom key store.

    \n
  • \n
  • \n

    \n SUBNET_NOT_FOUND - A subnet in the CloudHSM cluster configuration was\n deleted. If KMS cannot find all of the subnets in the cluster configuration, attempts to\n connect the custom key store to the CloudHSM cluster fail. To fix this error, create a\n cluster from a recent backup and associate it with your custom key store. (This process\n creates a new cluster configuration with a VPC and private subnets.) For details, see\n How\n to Fix a Connection Failure in the Key Management Service Developer Guide.

    \n
  • \n
  • \n

    \n USER_LOCKED_OUT - The kmsuser CU account is locked out of\n the associated CloudHSM cluster due to too many failed password attempts. Before you can\n connect your custom key store to its CloudHSM cluster, you must change the\n kmsuser account password and update the key store password value for the\n custom key store.

    \n
  • \n
  • \n

    \n USER_LOGGED_IN - The kmsuser CU account is logged into the\n the associated CloudHSM cluster. This prevents KMS from rotating the kmsuser\n account password and logging into the cluster. Before you can connect your custom key\n store to its CloudHSM cluster, you must log the kmsuser CU out of the cluster.\n If you changed the kmsuser password to log into the cluster, you must also\n and update the key store password value for the custom key store. For help, see How to Log Out\n and Reconnect in the Key Management Service Developer Guide.

    \n
  • \n
  • \n

    \n USER_NOT_FOUND - KMS cannot find a kmsuser CU account in\n the associated CloudHSM cluster. Before you can connect your custom key store to its CloudHSM\n cluster, you must create a kmsuser CU account in the cluster, and then update\n the key store password value for the custom key store.

    \n
  • \n
" + } + }, + "CreationDate": { + "target": "com.amazonaws.kms#DateType", + "traits": { + "smithy.api#documentation": "

The date and time when the custom key store was created.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains information about each custom key store in the custom key store list.

" + } + }, + "com.amazonaws.kms#CustomerMasterKeySpec": { + "type": "string", + "traits": { + "smithy.api#deprecated": { + "message": "This enum has been deprecated. Instead, use the KeySpec enum." + }, + "smithy.api#enum": [ + { + "value": "RSA_2048", + "name": "RSA_2048" + }, + { + "value": "RSA_3072", + "name": "RSA_3072" + }, + { + "value": "RSA_4096", + "name": "RSA_4096" + }, + { + "value": "ECC_NIST_P256", + "name": "ECC_NIST_P256" + }, + { + "value": "ECC_NIST_P384", + "name": "ECC_NIST_P384" + }, + { + "value": "ECC_NIST_P521", + "name": "ECC_NIST_P521" + }, + { + "value": "ECC_SECG_P256K1", + "name": "ECC_SECG_P256K1" + }, + { + "value": "SYMMETRIC_DEFAULT", + "name": "SYMMETRIC_DEFAULT" + } + ] + } + }, + "com.amazonaws.kms#DataKeyPairSpec": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "RSA_2048", + "name": "RSA_2048" + }, + { + "value": "RSA_3072", + "name": "RSA_3072" + }, + { + "value": "RSA_4096", + "name": "RSA_4096" + }, + { + "value": "ECC_NIST_P256", + "name": "ECC_NIST_P256" + }, + { + "value": "ECC_NIST_P384", + "name": "ECC_NIST_P384" + }, + { + "value": "ECC_NIST_P521", + "name": "ECC_NIST_P521" + }, + { + "value": "ECC_SECG_P256K1", + "name": "ECC_SECG_P256K1" + } + ] + } + }, + "com.amazonaws.kms#DataKeySpec": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "AES_256", + "name": "AES_256" + }, + { + "value": "AES_128", + "name": "AES_128" + } + ] + } + }, + "com.amazonaws.kms#DateType": { + "type": "timestamp" + }, + "com.amazonaws.kms#Decrypt": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#DecryptRequest" + }, + "output": { + "target": "com.amazonaws.kms#DecryptResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#IncorrectKeyException" + }, + { + "target": "com.amazonaws.kms#InvalidCiphertextException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#InvalidKeyUsageException" + }, + { + "target": "com.amazonaws.kms#KeyUnavailableException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Decrypts ciphertext that was encrypted by a KMS key using any of the following\n operations:

\n \n

You can use this operation to decrypt ciphertext that was encrypted under a symmetric or\n asymmetric KMS key. When the KMS key is asymmetric, you must specify the KMS key and the\n encryption algorithm that was used to encrypt the ciphertext. For information about symmetric and asymmetric KMS keys, see Using Symmetric and Asymmetric KMS keys in the Key Management Service Developer Guide.

\n

The Decrypt operation also decrypts ciphertext that was encrypted outside of KMS by the\n public key in an KMS asymmetric KMS key. However, it cannot decrypt ciphertext produced by\n other libraries, such as the Amazon Web Services\n Encryption SDK or Amazon S3 client-side encryption.\n These libraries return a ciphertext format that is incompatible with KMS.

\n

If the ciphertext was encrypted under a symmetric KMS key, the KeyId\n parameter is optional. KMS can get this information from metadata that it adds to the\n symmetric ciphertext blob. This feature adds durability to your implementation by ensuring\n that authorized users can decrypt ciphertext decades after it was encrypted, even if they've\n lost track of the key ID. However, specifying the KMS key is always recommended as a best\n practice. When you use the KeyId parameter to specify a KMS key, KMS only uses\n the KMS key you specify. If the ciphertext was encrypted under a different KMS key, the\n Decrypt operation fails. This practice ensures that you use the KMS key that\n you intend.

\n

Whenever possible, use key policies to give users permission to call the\n Decrypt operation on a particular KMS key, instead of using IAM policies.\n Otherwise, you might create an IAM user policy that gives the user Decrypt\n permission on all KMS keys. This user could decrypt ciphertext that was encrypted by KMS keys\n in other accounts if the key policy for the cross-account KMS key permits it. If you must use\n an IAM policy for Decrypt permissions, limit the user to particular KMS keys or\n particular trusted accounts. For details, see Best practices for IAM\n policies in the Key Management Service Developer Guide.

\n

Applications in Amazon Web Services Nitro Enclaves can call this operation by using the Amazon Web Services Nitro Enclaves Development Kit. For information about the supporting parameters, see How Amazon Web Services Nitro Enclaves use KMS in the Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:Decrypt (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#DecryptRequest": { + "type": "structure", + "members": { + "CiphertextBlob": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

Ciphertext to be decrypted. The blob includes metadata.

", + "smithy.api#required": {} + } + }, + "EncryptionContext": { + "target": "com.amazonaws.kms#EncryptionContextType", + "traits": { + "smithy.api#documentation": "

Specifies the encryption context to use when decrypting the data.\n An encryption context is valid only for cryptographic operations with a symmetric KMS key. The standard asymmetric encryption algorithms that KMS uses do not support an encryption context.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Specifies the KMS key that KMS uses to decrypt the ciphertext. Enter a key ID of the KMS\n key that was used to encrypt the ciphertext.

\n\n

This parameter is required only when the ciphertext was encrypted under an asymmetric KMS\n key. If you used a symmetric KMS key, KMS can get the KMS key from metadata that it adds to\n the symmetric ciphertext blob. However, it is always recommended as a best practice. This\n practice ensures that you use the KMS key that you intend.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

" + } + }, + "EncryptionAlgorithm": { + "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

Specifies the encryption algorithm that will be used to decrypt the ciphertext. Specify\n the same algorithm that was used to encrypt the data. If you specify a different algorithm,\n the Decrypt operation fails.

\n

This parameter is required only when the ciphertext was encrypted under an asymmetric KMS\n key. The default value, SYMMETRIC_DEFAULT, represents the only supported\n algorithm that is valid for symmetric KMS keys.

" + } + } + } + }, + "com.amazonaws.kms#DecryptResponse": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that was used to decrypt the ciphertext.

" + } + }, + "Plaintext": { + "target": "com.amazonaws.kms#PlaintextType", + "traits": { + "smithy.api#documentation": "

Decrypted plaintext data. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" + } + }, + "EncryptionAlgorithm": { + "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

The encryption algorithm that was used to decrypt the ciphertext.

" + } + } + } + }, + "com.amazonaws.kms#DeleteAlias": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#DeleteAliasRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Deletes the specified alias.

\n \n

Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

Because an alias is not a property of a KMS key, you can delete and change the aliases of\n a KMS key without affecting the KMS key. Also, aliases do not appear in the response from the\n DescribeKey operation. To get the aliases of all KMS keys, use the ListAliases operation.

\n

Each KMS key can have multiple aliases. To change the alias of a KMS key, use DeleteAlias to delete the current alias and CreateAlias to\n create a new alias. To associate an existing alias with a different KMS key, call UpdateAlias.

\n

\n Cross-account use: No. You cannot perform this operation on an alias in a different Amazon Web Services account.

\n

\n Required permissions\n

\n \n

For details, see Controlling access to aliases in the\n Key Management Service Developer Guide.

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#DeleteAliasRequest": { + "type": "structure", + "members": { + "AliasName": { + "target": "com.amazonaws.kms#AliasNameType", + "traits": { + "smithy.api#documentation": "

The alias to be deleted. The alias name must begin with alias/ followed by\n the alias name, such as alias/ExampleAlias.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#DeleteCustomKeyStore": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#DeleteCustomKeyStoreRequest" + }, + "output": { + "target": "com.amazonaws.kms#DeleteCustomKeyStoreResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#CustomKeyStoreHasCMKsException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + } + ], + "traits": { + "smithy.api#documentation": "

Deletes a custom key store. This operation does not delete the CloudHSM cluster that is\n associated with the custom key store, or affect any users or keys in the cluster.

\n

The custom key store that you delete cannot contain any KMS KMS keys. Before deleting the key store,\n verify that you will never need to use any of the KMS keys in the key store for any\n cryptographic operations. Then, use ScheduleKeyDeletion to delete the KMS keys from the\n key store. When the scheduled waiting period expires, the ScheduleKeyDeletion\n operation deletes the KMS keys. Then it makes a best effort to delete the key material from\n the associated cluster. However, you might need to manually delete the orphaned key\n material from the cluster and its backups.

\n

After all KMS keys are deleted from KMS, use DisconnectCustomKeyStore\n to disconnect the key store from KMS. Then, you can delete the custom key store.

\n

Instead of deleting the custom key store, consider using DisconnectCustomKeyStore to disconnect it from KMS. While the key store is\n disconnected, you cannot create or use the KMS keys in the key store. But, you do not need to\n delete KMS keys and you can reconnect a disconnected custom key store at any time.

\n

If the operation succeeds, it returns a JSON object with no\nproperties.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

\n

\n Cross-account use: No.\n You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:DeleteCustomKeyStore (IAM policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#DeleteCustomKeyStoreRequest": { + "type": "structure", + "members": { + "CustomKeyStoreId": { + "target": "com.amazonaws.kms#CustomKeyStoreIdType", + "traits": { + "smithy.api#documentation": "

Enter the ID of the custom key store you want to delete. To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#DeleteCustomKeyStoreResponse": { + "type": "structure", + "members": {} + }, + "com.amazonaws.kms#DeleteImportedKeyMaterial": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#DeleteImportedKeyMaterialRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Deletes key material that you previously imported. This operation makes the specified KMS\n key unusable. For more information about importing key material into KMS, see Importing Key Material\n in the Key Management Service Developer Guide.

\n

When the specified KMS key is in the PendingDeletion state, this operation\n does not change the KMS key's state. Otherwise, it changes the KMS key's state to\n PendingImport.

\n

After you delete key material, you can use ImportKeyMaterial to reimport\n the same key material into the KMS key.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:DeleteImportedKeyMaterial (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#DeleteImportedKeyMaterialRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the KMS key from which you are deleting imported key material. The\n Origin of the KMS key must be EXTERNAL.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#DependencyTimeoutException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "DependencyTimeout", + "httpResponseCode": 503 + }, + "smithy.api#documentation": "

The system timed out while trying to fulfill the request. The request can be\n retried.

", + "smithy.api#error": "server", + "smithy.api#httpError": 503 + } + }, + "com.amazonaws.kms#DescribeCustomKeyStores": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#DescribeCustomKeyStoresRequest" + }, + "output": { + "target": "com.amazonaws.kms#DescribeCustomKeyStoresResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" + }, + { + "target": "com.amazonaws.kms#InvalidMarkerException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + } + ], + "traits": { + "smithy.api#documentation": "

Gets information about custom key stores in the account and Region.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

\n

By default, this operation returns information about all custom key\n stores in the account and Region. To get only information about a particular custom key store,\n use either the CustomKeyStoreName or CustomKeyStoreId parameter (but\n not both).

\n

To determine whether the custom key store is connected to its CloudHSM cluster, use the\n ConnectionState element in the response. If an attempt to connect the custom\n key store failed, the ConnectionState value is FAILED and the\n ConnectionErrorCode element in the response indicates the cause of the failure.\n For help interpreting the ConnectionErrorCode, see CustomKeyStoresListEntry.

\n

Custom key stores have a DISCONNECTED connection state if the key store has\n never been connected or you use the DisconnectCustomKeyStore operation to\n disconnect it. If your custom key store state is CONNECTED but you are having\n trouble using it, make sure that its associated CloudHSM cluster is active and contains the\n minimum number of HSMs required for the operation, if any.

\n

For help repairing your custom key store, see the Troubleshooting Custom Key Stores topic in the\n Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n

\n Required permissions: kms:DescribeCustomKeyStores (IAM policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#DescribeCustomKeyStoresRequest": { + "type": "structure", + "members": { + "CustomKeyStoreId": { + "target": "com.amazonaws.kms#CustomKeyStoreIdType", + "traits": { + "smithy.api#documentation": "

Gets only information about the specified custom key store. Enter the key store ID.

\n

By default, this operation gets information about all custom key stores in the account and\n Region. To limit the output to a particular custom key store, you can use either the\n CustomKeyStoreId or CustomKeyStoreName parameter, but not\n both.

" + } + }, + "CustomKeyStoreName": { + "target": "com.amazonaws.kms#CustomKeyStoreNameType", + "traits": { + "smithy.api#documentation": "

Gets only information about the specified custom key store. Enter the friendly name of the\n custom key store.

\n

By default, this operation gets information about all custom key stores in the account and\n Region. To limit the output to a particular custom key store, you can use either the\n CustomKeyStoreId or CustomKeyStoreName parameter, but not\n both.

" + } + }, + "Limit": { + "target": "com.amazonaws.kms#LimitType", + "traits": { + "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

" + } + }, + "Marker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" + } + } + } + }, + "com.amazonaws.kms#DescribeCustomKeyStoresResponse": { + "type": "structure", + "members": { + "CustomKeyStores": { + "target": "com.amazonaws.kms#CustomKeyStoresList", + "traits": { + "smithy.api#documentation": "

Contains metadata about each custom key store.

" + } + }, + "NextMarker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

When Truncated is true, this element is present and contains the\n value to use for the Marker parameter in a subsequent request.

" + } + }, + "Truncated": { + "target": "com.amazonaws.kms#BooleanType", + "traits": { + "smithy.api#documentation": "

A flag that indicates whether there are more items in the list. When this\n value is true, the list in this response is truncated. To get more items, pass the value of\n the NextMarker element in thisresponse to the Marker parameter in a\n subsequent request.

" + } + } + } + }, + "com.amazonaws.kms#DescribeKey": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#DescribeKeyRequest" + }, + "output": { + "target": "com.amazonaws.kms#DescribeKeyResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Provides detailed information about a KMS key. You can run DescribeKey on a\n customer managed\n key or an Amazon Web Services managed key.

\n

This detailed information includes the key ARN, creation date (and deletion date, if\n applicable), the key state, and the origin and expiration date (if any) of the key material.\n It includes fields, like KeySpec, that help you distinguish symmetric from\n asymmetric KMS keys. It also provides information that is particularly important to asymmetric\n keys, such as the key usage (encryption or signing) and the encryption algorithms or signing\n algorithms that the KMS key supports. For KMS keys in custom key stores, it includes\n information about the custom key store, such as the key store ID and the CloudHSM cluster ID. For\n multi-Region keys, it displays the primary key and all related replica keys.

\n

\n DescribeKey does not return the following information:

\n
    \n
  • \n

    Aliases associated with the KMS key. To get this information, use ListAliases.

    \n
  • \n
  • \n

    Whether automatic key rotation is enabled on the KMS key. To get this information, use\n GetKeyRotationStatus. Also, some key states prevent a KMS key from\n being automatically rotated. For details, see How Automatic Key Rotation\n Works in Key Management Service Developer Guide.

    \n
  • \n
  • \n

    Tags on the KMS key. To get this information, use ListResourceTags.

    \n
  • \n
  • \n

    Key policies and grants on the KMS key. To get this information, use GetKeyPolicy and ListGrants.

    \n
  • \n
\n

If you call the DescribeKey operation on a predefined Amazon Web Services\n alias, that is, an Amazon Web Services alias with no key ID, KMS creates an Amazon Web Services managed\n key. Then, it associates the alias with the new KMS key, and returns the\n KeyId and Arn of the new KMS key in the response.

\n

\n Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:DescribeKey (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#DescribeKeyRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Describes the specified KMS key.

\n

If you specify a predefined Amazon Web Services alias (an Amazon Web Services alias with no key ID), KMS associates\n the alias with an Amazon Web Services managed key and returns its\n KeyId and Arn in the response.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", + "smithy.api#required": {} + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + } + } + }, + "com.amazonaws.kms#DescribeKeyResponse": { + "type": "structure", + "members": { + "KeyMetadata": { + "target": "com.amazonaws.kms#KeyMetadata", + "traits": { + "smithy.api#documentation": "

Metadata associated with the key.

" + } + } + } + }, + "com.amazonaws.kms#DescriptionType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 0, + "max": 8192 + } + } + }, + "com.amazonaws.kms#DisableKey": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#DisableKeyRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Sets the state of a KMS key to disabled. This change temporarily prevents use of the KMS\n key for cryptographic operations.

\n

For more information about how key state affects the use of a KMS key, see Key state: Effect on your KMS\n key in the \n Key Management Service Developer Guide\n .

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:DisableKey (key policy)

\n

\n Related operations: EnableKey\n

" + } + }, + "com.amazonaws.kms#DisableKeyRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the KMS key to disable.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#DisableKeyRotation": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#DisableKeyRotationRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Disables automatic\n rotation of the key material for the specified symmetric KMS key.

\n

You cannot enable automatic rotation of asymmetric KMS keys, KMS keys with imported key material, or KMS keys in a custom key store. To enable or disable automatic rotation of a set of related multi-Region keys, set the property on the primary key.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:DisableKeyRotation (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#DisableKeyRotationRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies a symmetric KMS key. You cannot enable or disable automatic rotation of asymmetric\n KMS keys, KMS keys with imported key material, or KMS keys in a\n custom key store.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#DisabledException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "Disabled", + "httpResponseCode": 409 + }, + "smithy.api#documentation": "

The request was rejected because the specified KMS key is not enabled.

", + "smithy.api#error": "client", + "smithy.api#httpError": 409 + } + }, + "com.amazonaws.kms#DisconnectCustomKeyStore": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#DisconnectCustomKeyStoreRequest" + }, + "output": { + "target": "com.amazonaws.kms#DisconnectCustomKeyStoreResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + } + ], + "traits": { + "smithy.api#documentation": "

Disconnects the custom key store from its associated CloudHSM cluster. While a custom key\n store is disconnected, you can manage the custom key store and its KMS keys, but you cannot\n create or use KMS keys in the custom key store. You can reconnect the custom key store at any\n time.

\n \n

While a custom key store is disconnected, all attempts to create KMS keys in the custom key store or to use existing KMS keys in cryptographic operations will\n fail. This action can prevent users from storing and accessing sensitive data.

\n
\n

\n

To find the connection state of a custom key store, use the DescribeCustomKeyStores operation. To reconnect a custom key store, use the\n ConnectCustomKeyStore operation.

\n

If the operation succeeds, it returns a JSON object with no\nproperties.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

\n\n

\n Cross-account use: No.\n You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:DisconnectCustomKeyStore (IAM policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#DisconnectCustomKeyStoreRequest": { + "type": "structure", + "members": { + "CustomKeyStoreId": { + "target": "com.amazonaws.kms#CustomKeyStoreIdType", + "traits": { + "smithy.api#documentation": "

Enter the ID of the custom key store you want to disconnect. To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#DisconnectCustomKeyStoreResponse": { + "type": "structure", + "members": {} + }, + "com.amazonaws.kms#EnableKey": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#EnableKeyRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#LimitExceededException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Sets the key state of a KMS key to enabled. This allows you to use the KMS key for\n cryptographic operations.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:EnableKey (key policy)

\n

\n Related operations: DisableKey\n

" + } + }, + "com.amazonaws.kms#EnableKeyRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the KMS key to enable.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#EnableKeyRotation": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#EnableKeyRotationRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Enables automatic rotation\n of the key material for the specified symmetric KMS key.

\n

You cannot enable automatic rotation of asymmetric KMS keys, KMS keys with imported key material, or KMS keys in a custom key store. To enable or disable automatic rotation of a set of related multi-Region keys, set the property on the primary key.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:EnableKeyRotation (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#EnableKeyRotationRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies a symmetric KMS key. You cannot enable automatic rotation of asymmetric KMS keys, KMS keys with imported key material, or KMS keys in a custom key store. To enable or disable automatic rotation of a set of related multi-Region keys, set the property on the primary key.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#Encrypt": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#EncryptRequest" + }, + "output": { + "target": "com.amazonaws.kms#EncryptResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#InvalidKeyUsageException" + }, + { + "target": "com.amazonaws.kms#KeyUnavailableException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Encrypts plaintext into ciphertext by using a KMS key. The Encrypt operation\n has two primary use cases:

\n
    \n
  • \n

    You can encrypt small amounts of arbitrary data, such as a personal identifier or\n database password, or other sensitive information.

    \n
  • \n
  • \n

    You can use the Encrypt operation to move encrypted data from one Amazon Web Services\n Region to another. For example, in Region A, generate a data key and use the plaintext key\n to encrypt your data. Then, in Region A, use the Encrypt operation to encrypt\n the plaintext data key under a KMS key in Region B. Now, you can move the encrypted data\n and the encrypted data key to Region B. When necessary, you can decrypt the encrypted data\n key and the encrypted data entirely within in Region B.

    \n
  • \n
\n\n

You don't need to use the Encrypt operation to encrypt a data key. The GenerateDataKey and GenerateDataKeyPair operations return a\n plaintext data key and an encrypted copy of that data key.

\n\n

When you encrypt data, you must specify a symmetric or asymmetric KMS key to use in the\n encryption operation. The KMS key must have a KeyUsage value of\n ENCRYPT_DECRYPT. To find the KeyUsage of a KMS key, use the DescribeKey operation.

\n\n

If you use a symmetric KMS key, you can use an encryption context to add additional\n security to your encryption operation. If you specify an EncryptionContext when\n encrypting data, you must specify the same encryption context (a case-sensitive exact match)\n when decrypting the data. Otherwise, the request to decrypt fails with an\n InvalidCiphertextException. For more information, see Encryption\n Context in the Key Management Service Developer Guide.

\n

If you specify an asymmetric KMS key, you must also specify the encryption algorithm. The\n algorithm must be compatible with the KMS key type.

\n \n

When you use an asymmetric KMS key to encrypt or reencrypt data, be sure to record the KMS key and encryption algorithm that you choose. You will be required to provide the same KMS key and encryption algorithm when you decrypt the data. If the KMS key and algorithm do not match the values used to encrypt the data, the decrypt operation fails.

\n

You are not required to supply the key ID and encryption algorithm when you decrypt with symmetric KMS keys because KMS stores this information in the ciphertext blob. KMS cannot store metadata in ciphertext generated with asymmetric keys. The standard format for asymmetric key ciphertext does not include configurable fields.

\n
\n\n\n

The maximum size of the data that you can encrypt varies with the type of KMS key and the\n encryption algorithm that you choose.

\n
    \n
  • \n

    Symmetric KMS keys

    \n
      \n
    • \n

      \n SYMMETRIC_DEFAULT: 4096 bytes

      \n
    • \n
    \n
  • \n
  • \n

    \n RSA_2048\n

    \n
      \n
    • \n

      \n RSAES_OAEP_SHA_1: 214 bytes

      \n
    • \n
    • \n

      \n RSAES_OAEP_SHA_256: 190 bytes

      \n
    • \n
    \n
  • \n
  • \n

    \n RSA_3072\n

    \n
      \n
    • \n

      \n RSAES_OAEP_SHA_1: 342 bytes

      \n
    • \n
    • \n

      \n RSAES_OAEP_SHA_256: 318 bytes

      \n
    • \n
    \n
  • \n
  • \n

    \n RSA_4096\n

    \n
      \n
    • \n

      \n RSAES_OAEP_SHA_1: 470 bytes

      \n
    • \n
    • \n

      \n RSAES_OAEP_SHA_256: 446 bytes

      \n
    • \n
    \n
  • \n
\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: Yes.\n To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:Encrypt (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#EncryptRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the KMS key to use in the encryption operation.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", + "smithy.api#required": {} + } + }, + "Plaintext": { + "target": "com.amazonaws.kms#PlaintextType", + "traits": { + "smithy.api#documentation": "

Data to be encrypted.

", + "smithy.api#required": {} + } + }, + "EncryptionContext": { + "target": "com.amazonaws.kms#EncryptionContextType", + "traits": { + "smithy.api#documentation": "

Specifies the encryption context that will be used to encrypt the data.\n An encryption context is valid only for cryptographic operations with a symmetric KMS key. The standard asymmetric encryption algorithms that KMS uses do not support an encryption context.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + }, + "EncryptionAlgorithm": { + "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

Specifies the encryption algorithm that KMS will use to encrypt the plaintext message.\n The algorithm must be compatible with the KMS key that you specify.

\n

This parameter is required only for asymmetric KMS keys. The default value,\n SYMMETRIC_DEFAULT, is the algorithm used for symmetric KMS keys. If you are\n using an asymmetric KMS key, we recommend RSAES_OAEP_SHA_256.

" + } + } + } + }, + "com.amazonaws.kms#EncryptResponse": { + "type": "structure", + "members": { + "CiphertextBlob": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

The encrypted plaintext. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that was used to encrypt the plaintext.

" + } + }, + "EncryptionAlgorithm": { + "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

The encryption algorithm that was used to encrypt the plaintext.

" + } + } + } + }, + "com.amazonaws.kms#EncryptionAlgorithmSpec": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "SYMMETRIC_DEFAULT", + "name": "SYMMETRIC_DEFAULT" + }, + { + "value": "RSAES_OAEP_SHA_1", + "name": "RSAES_OAEP_SHA_1" + }, + { + "value": "RSAES_OAEP_SHA_256", + "name": "RSAES_OAEP_SHA_256" + } + ] + } + }, + "com.amazonaws.kms#EncryptionAlgorithmSpecList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#EncryptionAlgorithmSpec" + } + }, + "com.amazonaws.kms#EncryptionContextKey": { + "type": "string" + }, + "com.amazonaws.kms#EncryptionContextType": { + "type": "map", + "key": { + "target": "com.amazonaws.kms#EncryptionContextKey" + }, + "value": { + "target": "com.amazonaws.kms#EncryptionContextValue" + } + }, + "com.amazonaws.kms#EncryptionContextValue": { + "type": "string" + }, + "com.amazonaws.kms#ErrorMessageType": { + "type": "string" + }, + "com.amazonaws.kms#ExpirationModelType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "KEY_MATERIAL_EXPIRES", + "name": "KEY_MATERIAL_EXPIRES" + }, + { + "value": "KEY_MATERIAL_DOES_NOT_EXPIRE", + "name": "KEY_MATERIAL_DOES_NOT_EXPIRE" + } + ] + } + }, + "com.amazonaws.kms#ExpiredImportTokenException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "ExpiredImportTokenException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the specified import token is expired. Use GetParametersForImport to get a new import token and public key, use the new\n public key to encrypt the key material, and then try the request again.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#GenerateDataKey": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#GenerateDataKeyRequest" + }, + "output": { + "target": "com.amazonaws.kms#GenerateDataKeyResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#InvalidKeyUsageException" + }, + { + "target": "com.amazonaws.kms#KeyUnavailableException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Generates a unique symmetric data key for client-side encryption. This operation returns a\n plaintext copy of the data key and a copy that is encrypted under a KMS key that you specify.\n You can use the plaintext key to encrypt your data outside of KMS and store the encrypted\n data key with the encrypted data.

\n\n

\n GenerateDataKey returns a unique data key for each request. The bytes in the\n plaintext key are not related to the caller or the KMS key.

\n\n

To generate a data key, specify the symmetric KMS key that will be used to encrypt the\n data key. You cannot use an asymmetric KMS key to generate data keys. To get the type of your\n KMS key, use the DescribeKey operation. You must also specify the length of\n the data key. Use either the KeySpec or NumberOfBytes parameters\n (but not both). For 128-bit and 256-bit data keys, use the KeySpec parameter.

\n\n

To get only an encrypted copy of the data key, use GenerateDataKeyWithoutPlaintext. To generate an asymmetric data key pair, use\n the GenerateDataKeyPair or GenerateDataKeyPairWithoutPlaintext operation. To get a cryptographically secure\n random byte string, use GenerateRandom.

\n\n

You can use the optional encryption context to add additional security to the encryption\n operation. If you specify an EncryptionContext, you must specify the same\n encryption context (a case-sensitive exact match) when decrypting the encrypted data key.\n Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context in the\n Key Management Service Developer Guide.

\n

Applications in Amazon Web Services Nitro Enclaves can call this operation by using the Amazon Web Services Nitro Enclaves Development Kit. For information about the supporting parameters, see How Amazon Web Services Nitro Enclaves use KMS in the Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n How to use your data\n key\n

\n

We recommend that you use the following pattern to encrypt data locally in your\n application. You can write your own code or use a client-side encryption library, such as the\n Amazon Web Services Encryption SDK, the\n Amazon DynamoDB Encryption Client,\n or Amazon S3\n client-side encryption to do these tasks for you.

\n

To encrypt data outside of KMS:

\n
    \n
  1. \n

    Use the GenerateDataKey operation to get a data key.

    \n
  2. \n
  3. \n

    Use the plaintext data key (in the Plaintext field of the response) to\n encrypt your data outside of KMS. Then erase the plaintext data key from memory.

    \n
  4. \n
  5. \n

    Store the encrypted data key (in the CiphertextBlob field of the\n response) with the encrypted data.

    \n
  6. \n
\n

To decrypt data outside of KMS:

\n
    \n
  1. \n

    Use the Decrypt operation to decrypt the encrypted data key. The\n operation returns a plaintext copy of the data key.

    \n
  2. \n
  3. \n

    Use the plaintext data key to decrypt data outside of KMS, then erase the plaintext\n data key from memory.

    \n
  4. \n
\n

\n Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GenerateDataKey (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#GenerateDataKeyPair": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#GenerateDataKeyPairRequest" + }, + "output": { + "target": "com.amazonaws.kms#GenerateDataKeyPairResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#InvalidKeyUsageException" + }, + { + "target": "com.amazonaws.kms#KeyUnavailableException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Generates a unique asymmetric data key pair. The GenerateDataKeyPair\n operation returns a plaintext public key, a plaintext private key, and a copy of the private\n key that is encrypted under the symmetric KMS key you specify. You can use the data key pair\n to perform asymmetric cryptography and implement digital signatures outside of KMS.

\n\n

You can use the public key that GenerateDataKeyPair returns to encrypt data\n or verify a signature outside of KMS. Then, store the encrypted private key with the data.\n When you are ready to decrypt data or sign a message, you can use the Decrypt operation to decrypt the encrypted private key.

\n\n

To generate a data key pair, you must specify a symmetric KMS key to encrypt the private\n key in a data key pair. You cannot use an asymmetric KMS key or a KMS key in a custom key\n store. To get the type and origin of your KMS key, use the DescribeKey\n operation.

\n

Use the KeyPairSpec parameter to choose an RSA or Elliptic Curve (ECC) data\n key pair. KMS recommends that your use ECC key pairs for signing, and use RSA key pairs for\n either encryption or signing, but not both. However, KMS cannot enforce any restrictions on\n the use of data key pairs outside of KMS.

\n\n

If you are using the data key pair to encrypt data, or for any operation where you don't\n immediately need a private key, consider using the GenerateDataKeyPairWithoutPlaintext operation.\n GenerateDataKeyPairWithoutPlaintext returns a plaintext public key and an\n encrypted private key, but omits the plaintext private key that you need only to decrypt\n ciphertext or sign a message. Later, when you need to decrypt the data or sign a message, use\n the Decrypt operation to decrypt the encrypted private key in the data key\n pair.

\n\n

\n GenerateDataKeyPair returns a unique data key pair for each request. The\n bytes in the keys are not related to the caller or the KMS key that is used to encrypt the\n private key. The public key is a DER-encoded X.509 SubjectPublicKeyInfo, as specified in\n RFC 5280. The private key is a\n DER-encoded PKCS8 PrivateKeyInfo, as specified in RFC 5958.

\n\n

You can use the optional encryption context to add additional security to the encryption\n operation. If you specify an EncryptionContext, you must specify the same\n encryption context (a case-sensitive exact match) when decrypting the encrypted data key.\n Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context in the\n Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GenerateDataKeyPair (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#GenerateDataKeyPairRequest": { + "type": "structure", + "members": { + "EncryptionContext": { + "target": "com.amazonaws.kms#EncryptionContextType", + "traits": { + "smithy.api#documentation": "

Specifies the encryption context that will be used when encrypting the private key in the\n data key pair.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Specifies the symmetric KMS key that encrypts the private key in the data key pair. You\n cannot specify an asymmetric KMS key or a KMS key in a custom key store. To get the type and\n origin of your KMS key, use the DescribeKey operation.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", + "smithy.api#required": {} + } + }, + "KeyPairSpec": { + "target": "com.amazonaws.kms#DataKeyPairSpec", + "traits": { + "smithy.api#documentation": "

Determines the type of data key pair that is generated.

\n

The KMS rule that restricts the use of asymmetric RSA KMS keys to encrypt and decrypt or to sign and verify (but not both), and the rule that permits you to use ECC KMS keys only to sign and verify, are not effective on data key pairs, which are used outside of KMS.

", + "smithy.api#required": {} + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + } + } + }, + "com.amazonaws.kms#GenerateDataKeyPairResponse": { + "type": "structure", + "members": { + "PrivateKeyCiphertextBlob": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

The encrypted copy of the private key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" + } + }, + "PrivateKeyPlaintext": { + "target": "com.amazonaws.kms#PlaintextType", + "traits": { + "smithy.api#documentation": "

The plaintext copy of the private key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" + } + }, + "PublicKey": { + "target": "com.amazonaws.kms#PublicKeyType", + "traits": { + "smithy.api#documentation": "

The public key (in plaintext).

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that encrypted the private key.

" + } + }, + "KeyPairSpec": { + "target": "com.amazonaws.kms#DataKeyPairSpec", + "traits": { + "smithy.api#documentation": "

The type of data key pair that was generated.

" + } + } + } + }, + "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintext": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintextRequest" + }, + "output": { + "target": "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintextResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#InvalidKeyUsageException" + }, + { + "target": "com.amazonaws.kms#KeyUnavailableException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Generates a unique asymmetric data key pair. The\n GenerateDataKeyPairWithoutPlaintext operation returns a plaintext public key\n and a copy of the private key that is encrypted under the symmetric KMS key you specify.\n Unlike GenerateDataKeyPair, this operation does not return a plaintext\n private key.

\n

You can use the public key that GenerateDataKeyPairWithoutPlaintext returns\n to encrypt data or verify a signature outside of KMS. Then, store the encrypted private key\n with the data. When you are ready to decrypt data or sign a message, you can use the Decrypt operation to decrypt the encrypted private key.

\n

To generate a data key pair, you must specify a symmetric KMS key to encrypt the private\n key in a data key pair. You cannot use an asymmetric KMS key or a KMS key in a custom key\n store. To get the type and origin of your KMS key, use the DescribeKey\n operation.

\n

Use the KeyPairSpec parameter to choose an RSA or Elliptic Curve (ECC) data\n key pair. KMS recommends that your use ECC key pairs for signing, and use RSA key pairs for\n either encryption or signing, but not both. However, KMS cannot enforce any restrictions on\n the use of data key pairs outside of KMS.

\n

\n GenerateDataKeyPairWithoutPlaintext returns a unique data key pair for each\n request. The bytes in the key are not related to the caller or KMS key that is used to encrypt\n the private key. The public key is a DER-encoded X.509 SubjectPublicKeyInfo, as specified in\n RFC 5280.

\n\n

You can use the optional encryption context to add additional security to the encryption\n operation. If you specify an EncryptionContext, you must specify the same\n encryption context (a case-sensitive exact match) when decrypting the encrypted data key.\n Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context in the\n Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GenerateDataKeyPairWithoutPlaintext (key\n policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintextRequest": { + "type": "structure", + "members": { + "EncryptionContext": { + "target": "com.amazonaws.kms#EncryptionContextType", + "traits": { + "smithy.api#documentation": "

Specifies the encryption context that will be used when encrypting the private key in the\n data key pair.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Specifies the KMS key that encrypts the private key in the data key pair. You must specify\n a symmetric KMS key. You cannot use an asymmetric KMS key or a KMS key in a custom key store.\n To get the type and origin of your KMS key, use the DescribeKey operation.\n

\n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", + "smithy.api#required": {} + } + }, + "KeyPairSpec": { + "target": "com.amazonaws.kms#DataKeyPairSpec", + "traits": { + "smithy.api#documentation": "

Determines the type of data key pair that is generated.

\n

The KMS rule that restricts the use of asymmetric RSA KMS keys to encrypt and decrypt or to sign and verify (but not both), and the rule that permits you to use ECC KMS keys only to sign and verify, are not effective on data key pairs, which are used outside of KMS.

", + "smithy.api#required": {} + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + } + } + }, + "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintextResponse": { + "type": "structure", + "members": { + "PrivateKeyCiphertextBlob": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

The encrypted copy of the private key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" + } + }, + "PublicKey": { + "target": "com.amazonaws.kms#PublicKeyType", + "traits": { + "smithy.api#documentation": "

The public key (in plaintext).

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that encrypted the private key.

" + } + }, + "KeyPairSpec": { + "target": "com.amazonaws.kms#DataKeyPairSpec", + "traits": { + "smithy.api#documentation": "

The type of data key pair that was generated.

" + } + } + } + }, + "com.amazonaws.kms#GenerateDataKeyRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the symmetric KMS key that encrypts the data key.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", + "smithy.api#required": {} + } + }, + "EncryptionContext": { + "target": "com.amazonaws.kms#EncryptionContextType", + "traits": { + "smithy.api#documentation": "

Specifies the encryption context that will be used when encrypting the data key.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" + } + }, + "NumberOfBytes": { + "target": "com.amazonaws.kms#NumberOfBytesType", + "traits": { + "smithy.api#documentation": "

Specifies the length of the data key in bytes. For example, use the value 64 to generate a\n 512-bit data key (64 bytes is 512 bits). For 128-bit (16-byte) and 256-bit (32-byte) data\n keys, use the KeySpec parameter.

\n

You must specify either the KeySpec or the NumberOfBytes\n parameter (but not both) in every GenerateDataKey request.

" + } + }, + "KeySpec": { + "target": "com.amazonaws.kms#DataKeySpec", + "traits": { + "smithy.api#documentation": "

Specifies the length of the data key. Use AES_128 to generate a 128-bit\n symmetric key, or AES_256 to generate a 256-bit symmetric key.

\n

You must specify either the KeySpec or the NumberOfBytes\n parameter (but not both) in every GenerateDataKey request.

" + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + } + } + }, + "com.amazonaws.kms#GenerateDataKeyResponse": { + "type": "structure", + "members": { + "CiphertextBlob": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

The encrypted copy of the data key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" + } + }, + "Plaintext": { + "target": "com.amazonaws.kms#PlaintextType", + "traits": { + "smithy.api#documentation": "

The plaintext data key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded. Use this data key to encrypt your data outside of\n KMS. Then, remove it from memory as soon as possible.

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that encrypted the data key.

" + } + } + } + }, + "com.amazonaws.kms#GenerateDataKeyWithoutPlaintext": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#GenerateDataKeyWithoutPlaintextRequest" + }, + "output": { + "target": "com.amazonaws.kms#GenerateDataKeyWithoutPlaintextResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#InvalidKeyUsageException" + }, + { + "target": "com.amazonaws.kms#KeyUnavailableException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Generates a unique symmetric data key. This operation returns a data key that is encrypted\n under a KMS key that you specify. To request an asymmetric data key pair, use the GenerateDataKeyPair or GenerateDataKeyPairWithoutPlaintext\n operations.

\n

\n GenerateDataKeyWithoutPlaintext is identical to the GenerateDataKey operation except that returns only the encrypted copy of the\n data key. This operation is useful for systems that need to encrypt data at some point, but\n not immediately. When you need to encrypt the data, you call the Decrypt\n operation on the encrypted copy of the key.

\n

It's also useful in distributed systems with different levels of trust. For example, you\n might store encrypted data in containers. One component of your system creates new containers\n and stores an encrypted data key with each container. Then, a different component puts the\n data into the containers. That component first decrypts the data key, uses the plaintext data\n key to encrypt data, puts the encrypted data into the container, and then destroys the\n plaintext data key. In this system, the component that creates the containers never sees the\n plaintext data key.

\n

\n GenerateDataKeyWithoutPlaintext returns a unique data key for each request.\n The bytes in the keys are not related to the caller or KMS key that is used to encrypt the\n private key.

\n\n

To generate a data key, you must specify the symmetric KMS key that is used to encrypt the\n data key. You cannot use an asymmetric KMS key to generate a data key. To get the type of your\n KMS key, use the DescribeKey operation.

\n\n

If the operation succeeds, you will find the encrypted copy of the data key in the\n CiphertextBlob field.

\n\n

You can use the optional encryption context to add additional security to the encryption\n operation. If you specify an EncryptionContext, you must specify the same\n encryption context (a case-sensitive exact match) when decrypting the encrypted data key.\n Otherwise, the request to decrypt fails with an InvalidCiphertextException. For more information, see Encryption Context in the\n Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GenerateDataKeyWithoutPlaintext (key\n policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#GenerateDataKeyWithoutPlaintextRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The identifier of the symmetric KMS key that encrypts the data key.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", + "smithy.api#required": {} + } + }, + "EncryptionContext": { + "target": "com.amazonaws.kms#EncryptionContextType", + "traits": { + "smithy.api#documentation": "

Specifies the encryption context that will be used when encrypting the data key.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" + } + }, + "KeySpec": { + "target": "com.amazonaws.kms#DataKeySpec", + "traits": { + "smithy.api#documentation": "

The length of the data key. Use AES_128 to generate a 128-bit symmetric key,\n or AES_256 to generate a 256-bit symmetric key.

" + } + }, + "NumberOfBytes": { + "target": "com.amazonaws.kms#NumberOfBytesType", + "traits": { + "smithy.api#documentation": "

The length of the data key in bytes. For example, use the value 64 to generate a 512-bit\n data key (64 bytes is 512 bits). For common key lengths (128-bit and 256-bit symmetric keys),\n we recommend that you use the KeySpec field instead of this one.

" + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + } + } + }, + "com.amazonaws.kms#GenerateDataKeyWithoutPlaintextResponse": { + "type": "structure", + "members": { + "CiphertextBlob": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

The encrypted data key. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that encrypted the data key.

" + } + } + } + }, + "com.amazonaws.kms#GenerateRandom": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#GenerateRandomRequest" + }, + "output": { + "target": "com.amazonaws.kms#GenerateRandomResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" + }, + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + } + ], + "traits": { + "smithy.api#documentation": "

Returns a random byte string that is cryptographically secure.

\n

By default, the random byte string is generated in KMS. To generate the byte string in\n the CloudHSM cluster that is associated with a custom key store, specify the custom key store\n ID.

\n

Applications in Amazon Web Services Nitro Enclaves can call this operation by using the Amazon Web Services Nitro Enclaves Development Kit. For information about the supporting parameters, see How Amazon Web Services Nitro Enclaves use KMS in the Key Management Service Developer Guide.

\n

For more information about entropy and random number generation, see\n Key Management Service Cryptographic Details.

\n\n

\n Required permissions: kms:GenerateRandom (IAM policy)

" + } + }, + "com.amazonaws.kms#GenerateRandomRequest": { + "type": "structure", + "members": { + "NumberOfBytes": { + "target": "com.amazonaws.kms#NumberOfBytesType", + "traits": { + "smithy.api#documentation": "

The length of the byte string.

" + } + }, + "CustomKeyStoreId": { + "target": "com.amazonaws.kms#CustomKeyStoreIdType", + "traits": { + "smithy.api#documentation": "

Generates the random byte string in the CloudHSM cluster that is associated with the\n specified custom key store. To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

" + } + } + } + }, + "com.amazonaws.kms#GenerateRandomResponse": { + "type": "structure", + "members": { + "Plaintext": { + "target": "com.amazonaws.kms#PlaintextType", + "traits": { + "smithy.api#documentation": "

The random byte string. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" + } + } + } + }, + "com.amazonaws.kms#GetKeyPolicy": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#GetKeyPolicyRequest" + }, + "output": { + "target": "com.amazonaws.kms#GetKeyPolicyResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Gets a key policy attached to the specified KMS key.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:GetKeyPolicy (key policy)

\n

\n Related operations: PutKeyPolicy\n

" + } + }, + "com.amazonaws.kms#GetKeyPolicyRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Gets the key policy for the specified KMS key.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "PolicyName": { + "target": "com.amazonaws.kms#PolicyNameType", + "traits": { + "smithy.api#documentation": "

Specifies the name of the key policy. The only valid name is default. To get\n the names of key policies, use ListKeyPolicies.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#GetKeyPolicyResponse": { + "type": "structure", + "members": { + "Policy": { + "target": "com.amazonaws.kms#PolicyType", + "traits": { + "smithy.api#documentation": "

A key policy document in JSON format.

" + } + } + } + }, + "com.amazonaws.kms#GetKeyRotationStatus": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#GetKeyRotationStatusRequest" + }, + "output": { + "target": "com.amazonaws.kms#GetKeyRotationStatusResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Gets a Boolean value that indicates whether automatic rotation of the key material is\n enabled for the specified KMS key.

\n

You cannot enable automatic rotation of asymmetric KMS keys, KMS keys with imported key material, or KMS keys in a custom key store. To enable or disable automatic rotation of a set of related multi-Region keys, set the property on the primary key. The key rotation status for these KMS keys is always\n false.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n
    \n
  • \n

    Disabled: The key rotation status does not change when you disable a KMS key. However,\n while the KMS key is disabled, KMS does not rotate the key material.

    \n
  • \n
  • \n

    Pending deletion: While a KMS key is pending deletion, its key rotation status is\n false and KMS does not rotate the key material. If you cancel the\n deletion, the original key rotation status is restored.

    \n
  • \n
\n

\n Cross-account use: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key\n ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GetKeyRotationStatus (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#GetKeyRotationStatusRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Gets the rotation status for the specified KMS key.

\n \n

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a\ndifferent Amazon Web Services account, you must use the key ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#GetKeyRotationStatusResponse": { + "type": "structure", + "members": { + "KeyRotationEnabled": { + "target": "com.amazonaws.kms#BooleanType", + "traits": { + "smithy.api#documentation": "

A Boolean value that specifies whether key rotation is enabled.

" + } + } + } + }, + "com.amazonaws.kms#GetParametersForImport": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#GetParametersForImportRequest" + }, + "output": { + "target": "com.amazonaws.kms#GetParametersForImportResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Returns the items you need to import key material into a symmetric, customer managed KMS\n key. For more information about importing key material into KMS, see Importing Key Material\n in the Key Management Service Developer Guide.

\n

This operation returns a public key and an import token. Use the public key to encrypt the\n symmetric key material. Store the import token to send with a subsequent ImportKeyMaterial request.

\n

You must specify the key ID of the symmetric KMS key into which you will import key\n material. This KMS key's Origin must be EXTERNAL. You must also\n specify the wrapping algorithm and type of wrapping key (public key) that you will use to\n encrypt the key material. You cannot perform this operation on an asymmetric KMS key or on any KMS key in a different Amazon Web Services account.

\n

To import key material, you must use the public key and import token from the same\n response. These items are valid for 24 hours. The expiration date and time appear in the\n GetParametersForImport response. You cannot use an expired token in an ImportKeyMaterial request. If your key and token expire, send another\n GetParametersForImport request.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:GetParametersForImport (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#GetParametersForImportRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The identifier of the symmetric KMS key into which you will import key material. The\n Origin of the KMS key must be EXTERNAL.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "WrappingAlgorithm": { + "target": "com.amazonaws.kms#AlgorithmSpec", + "traits": { + "smithy.api#documentation": "

The algorithm you will use to encrypt the key material before importing it with ImportKeyMaterial. For more information, see Encrypt the Key Material\n in the Key Management Service Developer Guide.

", + "smithy.api#required": {} + } + }, + "WrappingKeySpec": { + "target": "com.amazonaws.kms#WrappingKeySpec", + "traits": { + "smithy.api#documentation": "

The type of wrapping key (public key) to return in the response. Only 2048-bit RSA public\n keys are supported.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#GetParametersForImportResponse": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key to use in a subsequent ImportKeyMaterial request. This is the same KMS key specified in the GetParametersForImport\n request.

" + } + }, + "ImportToken": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

The import token to send in a subsequent ImportKeyMaterial\n request.

" + } + }, + "PublicKey": { + "target": "com.amazonaws.kms#PlaintextType", + "traits": { + "smithy.api#documentation": "

The public key to use to encrypt the key material before importing it with ImportKeyMaterial.

" + } + }, + "ParametersValidTo": { + "target": "com.amazonaws.kms#DateType", + "traits": { + "smithy.api#documentation": "

The time at which the import token and public key are no longer valid. After this time,\n you cannot use them to make an ImportKeyMaterial request and you must send\n another GetParametersForImport request to get new ones.

" + } + } + } + }, + "com.amazonaws.kms#GetPublicKey": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#GetPublicKeyRequest" + }, + "output": { + "target": "com.amazonaws.kms#GetPublicKeyResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#InvalidKeyUsageException" + }, + { + "target": "com.amazonaws.kms#KeyUnavailableException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Returns the public key of an asymmetric KMS key. Unlike the private key of a asymmetric\n KMS key, which never leaves KMS unencrypted, callers with kms:GetPublicKey\n permission can download the public key of an asymmetric KMS key. You can share the public key\n to allow others to encrypt messages and verify signatures outside of KMS.\n For information about symmetric and asymmetric KMS keys, see Using Symmetric and Asymmetric KMS keys in the Key Management Service Developer Guide.

\n

You do not need to download the public key. Instead, you can use the public key within\n KMS by calling the Encrypt, ReEncrypt, or Verify operations with the identifier of an asymmetric KMS key. When you use the\n public key within KMS, you benefit from the authentication, authorization, and logging that\n are part of every KMS operation. You also reduce of risk of encrypting data that cannot be\n decrypted. These features are not effective outside of KMS. For details, see Special\n Considerations for Downloading Public Keys.

\n

To help you use the public key safely outside of KMS, GetPublicKey returns\n important information about the public key in the response, including:

\n
    \n
  • \n

    \n KeySpec: The type of key material in the public key, such as\n RSA_4096 or ECC_NIST_P521.

    \n
  • \n
  • \n

    \n KeyUsage: Whether the key is used for encryption or signing.

    \n
  • \n
  • \n

    \n EncryptionAlgorithms or SigningAlgorithms: A list of the encryption algorithms or the signing\n algorithms for the key.

    \n
  • \n
\n

Although KMS cannot enforce these restrictions on external operations, it is crucial\n that you use this information to prevent the public key from being used improperly. For\n example, you can prevent a public signing key from being used encrypt data, or prevent a\n public key from being used with an encryption algorithm that is not supported by KMS. You\n can also avoid errors, such as using the wrong signing algorithm in a verification\n operation.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use:\n Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:GetPublicKey (key policy)

\n

\n Related operations: CreateKey\n

" + } + }, + "com.amazonaws.kms#GetPublicKeyRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the asymmetric KMS key that includes the public key.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", + "smithy.api#required": {} + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + } + } + }, + "com.amazonaws.kms#GetPublicKeyResponse": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the asymmetric KMS key from which the public key was\n downloaded.

" + } + }, + "PublicKey": { + "target": "com.amazonaws.kms#PublicKeyType", + "traits": { + "smithy.api#documentation": "

The exported public key.

\n

The value is a DER-encoded X.509 public key, also known as\n SubjectPublicKeyInfo (SPKI), as defined in RFC 5280. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

\n

" + } + }, + "CustomerMasterKeySpec": { + "target": "com.amazonaws.kms#CustomerMasterKeySpec", + "traits": { + "smithy.api#deprecated": { + "message": "This field has been deprecated. Instead, use the KeySpec field." + }, + "smithy.api#documentation": "

Instead, use the KeySpec field in the GetPublicKey\n response.

\n

The KeySpec and CustomerMasterKeySpec fields have the same\n value. We recommend that you use the KeySpec field in your code. However, to\n avoid breaking changes, KMS will support both fields.

" + } + }, + "KeySpec": { + "target": "com.amazonaws.kms#KeySpec", + "traits": { + "smithy.api#documentation": "

The type of the of the public key that was downloaded.

" + } + }, + "KeyUsage": { + "target": "com.amazonaws.kms#KeyUsageType", + "traits": { + "smithy.api#documentation": "

The permitted use of the public key. Valid values are ENCRYPT_DECRYPT or\n SIGN_VERIFY.

\n

This information is critical. If a public key with SIGN_VERIFY key usage\n encrypts data outside of KMS, the ciphertext cannot be decrypted.

" + } + }, + "EncryptionAlgorithms": { + "target": "com.amazonaws.kms#EncryptionAlgorithmSpecList", + "traits": { + "smithy.api#documentation": "

The encryption algorithms that KMS supports for this key.

\n

This information is critical. If a public key encrypts data outside of KMS by using an\n unsupported encryption algorithm, the ciphertext cannot be decrypted.

\n

This field appears in the response only when the KeyUsage of the public key\n is ENCRYPT_DECRYPT.

" + } + }, + "SigningAlgorithms": { + "target": "com.amazonaws.kms#SigningAlgorithmSpecList", + "traits": { + "smithy.api#documentation": "

The signing algorithms that KMS supports for this key.

\n

This field appears in the response only when the KeyUsage of the public key\n is SIGN_VERIFY.

" + } + } + } + }, + "com.amazonaws.kms#GrantConstraints": { + "type": "structure", + "members": { + "EncryptionContextSubset": { + "target": "com.amazonaws.kms#EncryptionContextType", + "traits": { + "smithy.api#documentation": "

A list of key-value pairs that must be included in the encryption context of the\n cryptographic operation request. The grant allows the cryptographic operation only when the encryption\n context in the request includes the key-value pairs specified in this constraint, although it\n can include additional key-value pairs.

" + } + }, + "EncryptionContextEquals": { + "target": "com.amazonaws.kms#EncryptionContextType", + "traits": { + "smithy.api#documentation": "

A list of key-value pairs that must match the encryption context in the cryptographic operation\n request. The grant allows the operation only when the encryption context in the request is the\n same as the encryption context specified in this constraint.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Use this structure to allow cryptographic operations in the grant only when the operation request\n includes the specified encryption context.

\n

KMS applies the grant constraints only to cryptographic operations that support an\n encryption context, that is, all cryptographic operations with a symmetric KMS key. Grant\n constraints are not applied to operations that do not support an encryption context, such as\n cryptographic operations with asymmetric KMS keys and management operations, such as DescribeKey or RetireGrant.

\n \n

In a cryptographic operation, the encryption context in the decryption operation must be\n an exact, case-sensitive match for the keys and values in the encryption context of the\n encryption operation. Only the order of the pairs can vary.

\n

However, in a grant constraint, the key in each key-value pair is not case sensitive,\n but the value is case sensitive.

\n

To avoid confusion, do not use multiple encryption context pairs that differ only by\n case. To require a fully case-sensitive encryption context, use the\n kms:EncryptionContext: and kms:EncryptionContextKeys conditions\n in an IAM or key policy. For details, see kms:EncryptionContext: in the \n Key Management Service Developer Guide\n .

\n
" + } + }, + "com.amazonaws.kms#GrantIdType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 128 + } + } + }, + "com.amazonaws.kms#GrantList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#GrantListEntry" + } + }, + "com.amazonaws.kms#GrantListEntry": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The unique identifier for the KMS key to which the grant applies.

" + } + }, + "GrantId": { + "target": "com.amazonaws.kms#GrantIdType", + "traits": { + "smithy.api#documentation": "

The unique identifier for the grant.

" + } + }, + "Name": { + "target": "com.amazonaws.kms#GrantNameType", + "traits": { + "smithy.api#documentation": "

The friendly name that identifies the grant. If a name was provided in the CreateGrant request, that name is returned. Otherwise this value is null.

" + } + }, + "CreationDate": { + "target": "com.amazonaws.kms#DateType", + "traits": { + "smithy.api#documentation": "

The date and time when the grant was created.

" + } + }, + "GranteePrincipal": { + "target": "com.amazonaws.kms#PrincipalIdType", + "traits": { + "smithy.api#documentation": "

The identity that gets the permissions in the grant.

\n

The GranteePrincipal field in the ListGrants response usually contains the\n user or role designated as the grantee principal in the grant. However, when the grantee\n principal in the grant is an Amazon Web Services service, the GranteePrincipal field contains\n the service\n principal, which might represent several different grantee principals.

" + } + }, + "RetiringPrincipal": { + "target": "com.amazonaws.kms#PrincipalIdType", + "traits": { + "smithy.api#documentation": "

The principal that can retire the grant.

" + } + }, + "IssuingAccount": { + "target": "com.amazonaws.kms#PrincipalIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Web Services account under which the grant was issued.

" + } + }, + "Operations": { + "target": "com.amazonaws.kms#GrantOperationList", + "traits": { + "smithy.api#documentation": "

The list of operations permitted by the grant.

" + } + }, + "Constraints": { + "target": "com.amazonaws.kms#GrantConstraints", + "traits": { + "smithy.api#documentation": "

A list of key-value pairs that must be present in the encryption context of certain\n subsequent operations that the grant allows.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains information about a grant.

" + } + }, + "com.amazonaws.kms#GrantNameType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 256 + }, + "smithy.api#pattern": "^[a-zA-Z0-9:/_-]+$" + } + }, + "com.amazonaws.kms#GrantOperation": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "Decrypt", + "name": "Decrypt" + }, + { + "value": "Encrypt", + "name": "Encrypt" + }, + { + "value": "GenerateDataKey", + "name": "GenerateDataKey" + }, + { + "value": "GenerateDataKeyWithoutPlaintext", + "name": "GenerateDataKeyWithoutPlaintext" + }, + { + "value": "ReEncryptFrom", + "name": "ReEncryptFrom" + }, + { + "value": "ReEncryptTo", + "name": "ReEncryptTo" + }, + { + "value": "Sign", + "name": "Sign" + }, + { + "value": "Verify", + "name": "Verify" + }, + { + "value": "GetPublicKey", + "name": "GetPublicKey" + }, + { + "value": "CreateGrant", + "name": "CreateGrant" + }, + { + "value": "RetireGrant", + "name": "RetireGrant" + }, + { + "value": "DescribeKey", + "name": "DescribeKey" + }, + { + "value": "GenerateDataKeyPair", + "name": "GenerateDataKeyPair" + }, + { + "value": "GenerateDataKeyPairWithoutPlaintext", + "name": "GenerateDataKeyPairWithoutPlaintext" + } + ] + } + }, + "com.amazonaws.kms#GrantOperationList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#GrantOperation" + } + }, + "com.amazonaws.kms#GrantTokenList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#GrantTokenType" + }, + "traits": { + "smithy.api#length": { + "min": 0, + "max": 10 + } + } + }, + "com.amazonaws.kms#GrantTokenType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 8192 + } + } + }, + "com.amazonaws.kms#ImportKeyMaterial": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#ImportKeyMaterialRequest" + }, + "output": { + "target": "com.amazonaws.kms#ImportKeyMaterialResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#ExpiredImportTokenException" + }, + { + "target": "com.amazonaws.kms#IncorrectKeyMaterialException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#InvalidCiphertextException" + }, + { + "target": "com.amazonaws.kms#InvalidImportTokenException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Imports key material into an existing symmetric KMS KMS key that was created without key\n material. After you successfully import key material into a KMS key, you can reimport\n the same key material into that KMS key, but you cannot import different key\n material.

\n

You cannot perform this operation on an asymmetric KMS key or on any KMS key in a different Amazon Web Services account. For more information about creating KMS keys with no key material\n and then importing key material, see Importing Key Material in the\n Key Management Service Developer Guide.

\n

Before using this operation, call GetParametersForImport. Its response\n includes a public key and an import token. Use the public key to encrypt the key material.\n Then, submit the import token from the same GetParametersForImport\n response.

\n

When calling this operation, you must specify the following values:

\n
    \n
  • \n

    The key ID or key ARN of a KMS key with no key material. Its Origin must\n be EXTERNAL.

    \n

    To create a KMS key with no key material, call CreateKey and set the\n value of its Origin parameter to EXTERNAL. To get the\n Origin of a KMS key, call DescribeKey.)

    \n
  • \n
  • \n

    The encrypted key material. To get the public key to encrypt the key material, call\n GetParametersForImport.

    \n
  • \n
  • \n

    The import token that GetParametersForImport returned. You must use\n a public key and token from the same GetParametersForImport response.

    \n
  • \n
  • \n

    Whether the key material expires and if so, when. If you set an expiration date, KMS\n deletes the key material from the KMS key on the specified date, and the KMS key becomes\n unusable. To use the KMS key again, you must reimport the same key material. The only way\n to change an expiration date is by reimporting the same key material and specifying a new\n expiration date.

    \n
  • \n
\n

When this operation is successful, the key state of the KMS key changes from\n PendingImport to Enabled, and you can use the KMS key.

\n

If this operation fails, use the exception to help determine the problem. If the error is\n related to the key material, the import token, or wrapping key, use GetParametersForImport to get a new public key and import token for the KMS key\n and repeat the import procedure. For help, see How To Import Key\n Material in the Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:ImportKeyMaterial (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#ImportKeyMaterialRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The identifier of the symmetric KMS key that receives the imported key material. The KMS\n key's Origin must be EXTERNAL. This must be the same KMS key\n specified in the KeyID parameter of the corresponding GetParametersForImport request.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "ImportToken": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

The import token that you received in the response to a previous GetParametersForImport request. It must be from the same response that contained\n the public key that you used to encrypt the key material.

", + "smithy.api#required": {} + } + }, + "EncryptedKeyMaterial": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

The encrypted key material to import. The key material must be encrypted with the public\n wrapping key that GetParametersForImport returned, using the wrapping\n algorithm that you specified in the same GetParametersForImport request.

", + "smithy.api#required": {} + } + }, + "ValidTo": { + "target": "com.amazonaws.kms#DateType", + "traits": { + "smithy.api#documentation": "

The time at which the imported key material expires. When the key material expires, KMS\n deletes the key material and the KMS key becomes unusable. You must omit this parameter when\n the ExpirationModel parameter is set to\n KEY_MATERIAL_DOES_NOT_EXPIRE. Otherwise it is required.

" + } + }, + "ExpirationModel": { + "target": "com.amazonaws.kms#ExpirationModelType", + "traits": { + "smithy.api#documentation": "

Specifies whether the key material expires. The default is\n KEY_MATERIAL_EXPIRES, in which case you must include the ValidTo\n parameter. When this parameter is set to KEY_MATERIAL_DOES_NOT_EXPIRE, you must\n omit the ValidTo parameter.

" + } + } + } + }, + "com.amazonaws.kms#ImportKeyMaterialResponse": { + "type": "structure", + "members": {} + }, + "com.amazonaws.kms#IncorrectKeyException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "IncorrectKeyException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the specified KMS key cannot decrypt the data. The\n KeyId in a Decrypt request and the SourceKeyId\n in a ReEncrypt request must identify the same KMS key that was used to\n encrypt the ciphertext.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#IncorrectKeyMaterialException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "IncorrectKeyMaterialException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the key material in the request is, expired, invalid, or\n is not the same key material that was previously imported into this KMS key.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#IncorrectTrustAnchorException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "IncorrectTrustAnchorException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the trust anchor certificate in the request is not the\n trust anchor certificate for the specified CloudHSM cluster.

\n

When you initialize the cluster, you create the trust anchor certificate and save it in the\n customerCA.crt file.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#InvalidAliasNameException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "InvalidAliasName", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the specified alias name is not valid.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#InvalidArnException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "InvalidArn", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because a specified ARN, or an ARN in a key policy, is not\n valid.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#InvalidCiphertextException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "InvalidCiphertext", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

From the Decrypt or ReEncrypt operation, the request\n was rejected because the specified ciphertext, or additional authenticated data incorporated\n into the ciphertext, such as the encryption context, is corrupted, missing, or otherwise\n invalid.

\n

From the ImportKeyMaterial operation, the request was rejected because\n KMS could not decrypt the encrypted (wrapped) key material.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#InvalidGrantIdException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "InvalidGrantId", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the specified GrantId is not valid.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#InvalidGrantTokenException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "InvalidGrantToken", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the specified grant token is not valid.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#InvalidImportTokenException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "InvalidImportTokenException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the provided import token is invalid or is associated\n with a different KMS key.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#InvalidKeyUsageException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "InvalidKeyUsage", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected for one of the following reasons:

\n
    \n
  • \n

    The KeyUsage value of the KMS key is incompatible with the API\n operation.

    \n
  • \n
  • \n

    The encryption algorithm or signing algorithm specified for the operation is\n incompatible with the type of key material in the KMS key (KeySpec).

    \n
  • \n
\n

For encrypting, decrypting, re-encrypting, and generating data keys, the\n KeyUsage must be ENCRYPT_DECRYPT. For signing and verifying, the\n KeyUsage must be SIGN_VERIFY. To find the KeyUsage of\n a KMS key, use the DescribeKey operation.

\n

To find the encryption or signing algorithms supported for a particular KMS key, use the\n DescribeKey operation.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#InvalidMarkerException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "InvalidMarker", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the marker that specifies where pagination should next\n begin is not valid.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#KMSInternalException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "KMSInternal", + "httpResponseCode": 500 + }, + "smithy.api#documentation": "

The request was rejected because an internal exception occurred. The request can be\n retried.

", + "smithy.api#error": "server", + "smithy.api#httpError": 500 + } + }, + "com.amazonaws.kms#KMSInvalidSignatureException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "KMSInvalidSignature", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the signature verification failed. Signature verification\n fails when it cannot confirm that signature was produced by signing the specified message with\n the specified KMS key and signing algorithm.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#KMSInvalidStateException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "KMSInvalidStateException", + "httpResponseCode": 409 + }, + "smithy.api#documentation": "

The request was rejected because the state of the specified resource is not valid for this\n request.

\n

For more information about how key state affects the use of a KMS key, see Key state: Effect on your KMS\n key in the \n Key Management Service Developer Guide\n .

", + "smithy.api#error": "client", + "smithy.api#httpError": 409 + } + }, + "com.amazonaws.kms#KeyIdType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 2048 + } + } + }, + "com.amazonaws.kms#KeyList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#KeyListEntry" + } + }, + "com.amazonaws.kms#KeyListEntry": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Unique identifier of the key.

" + } + }, + "KeyArn": { + "target": "com.amazonaws.kms#ArnType", + "traits": { + "smithy.api#documentation": "

ARN of the key.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains information about each entry in the key list.

" + } + }, + "com.amazonaws.kms#KeyManagerType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "AWS", + "name": "AWS" + }, + { + "value": "CUSTOMER", + "name": "CUSTOMER" + } + ] + } + }, + "com.amazonaws.kms#KeyMetadata": { + "type": "structure", + "members": { + "AWSAccountId": { + "target": "com.amazonaws.kms#AWSAccountIdType", + "traits": { + "smithy.api#documentation": "

The twelve-digit account ID of the Amazon Web Services account that owns the KMS key.

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The globally unique identifier for the KMS key.

", + "smithy.api#required": {} + } + }, + "Arn": { + "target": "com.amazonaws.kms#ArnType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (ARN) of the KMS key. For examples, see Key Management Service (KMS) in the Example ARNs section of the Amazon Web Services General\n Reference.

" + } + }, + "CreationDate": { + "target": "com.amazonaws.kms#DateType", + "traits": { + "smithy.api#documentation": "

The date and time when the KMS key was created.

" + } + }, + "Enabled": { + "target": "com.amazonaws.kms#BooleanType", + "traits": { + "smithy.api#documentation": "

Specifies whether the KMS key is enabled. When KeyState is\n Enabled this value is true, otherwise it is false.

" + } + }, + "Description": { + "target": "com.amazonaws.kms#DescriptionType", + "traits": { + "smithy.api#documentation": "

The description of the KMS key.

" + } + }, + "KeyUsage": { + "target": "com.amazonaws.kms#KeyUsageType", + "traits": { + "smithy.api#documentation": "

The cryptographic operations for which you can use the KMS key.

" + } + }, + "KeyState": { + "target": "com.amazonaws.kms#KeyState", + "traits": { + "smithy.api#documentation": "

The current status of the KMS key.

\n

For more information about how key state affects the use of a KMS key, see Key state: Effect on your KMS\n key in the Key Management Service Developer Guide.

" + } + }, + "DeletionDate": { + "target": "com.amazonaws.kms#DateType", + "traits": { + "smithy.api#documentation": "

The date and time after which KMS deletes this KMS key. This value is present only when\n the KMS key is scheduled for deletion, that is, when its KeyState is\n PendingDeletion.

\n

When the primary key in a multi-Region key is scheduled for deletion but still has replica\n keys, its key state is PendingReplicaDeletion and the length of its waiting\n period is displayed in the PendingDeletionWindowInDays field.

" + } + }, + "ValidTo": { + "target": "com.amazonaws.kms#DateType", + "traits": { + "smithy.api#documentation": "

The time at which the imported key material expires. When the key material expires, KMS\n deletes the key material and the KMS key becomes unusable. This value is present only for KMS\n keys whose Origin is EXTERNAL and whose ExpirationModel\n is KEY_MATERIAL_EXPIRES, otherwise this value is omitted.

" + } + }, + "Origin": { + "target": "com.amazonaws.kms#OriginType", + "traits": { + "smithy.api#documentation": "

The source of the key material for the KMS key. When this value is AWS_KMS,\n KMS created the key material. When this value is EXTERNAL, the key material was\n imported or the KMS key doesn't have any key material. When this value is\n AWS_CLOUDHSM, the key material was created in the CloudHSM cluster associated with\n a custom key store.

" + } + }, + "CustomKeyStoreId": { + "target": "com.amazonaws.kms#CustomKeyStoreIdType", + "traits": { + "smithy.api#documentation": "

A unique identifier for the custom key store that contains the KMS key. This value is\n present only when the KMS key is created in a custom key store.

" + } + }, + "CloudHsmClusterId": { + "target": "com.amazonaws.kms#CloudHsmClusterIdType", + "traits": { + "smithy.api#documentation": "

The cluster ID of the CloudHSM cluster that contains the key material for the KMS key. When\n you create a KMS key in a custom key store, KMS creates the key material for the KMS key in\n the associated CloudHSM cluster. This value is present only when the KMS key is created in a\n custom key store.

" + } + }, + "ExpirationModel": { + "target": "com.amazonaws.kms#ExpirationModelType", + "traits": { + "smithy.api#documentation": "

Specifies whether the KMS key's key material expires. This value is present only when\n Origin is EXTERNAL, otherwise this value is omitted.

" + } + }, + "KeyManager": { + "target": "com.amazonaws.kms#KeyManagerType", + "traits": { + "smithy.api#documentation": "

The manager of the KMS key. KMS keys in your Amazon Web Services account are either customer managed or\n Amazon Web Services managed. For more information about the difference, see KMS keys in the Key Management Service Developer Guide.

" + } + }, + "CustomerMasterKeySpec": { + "target": "com.amazonaws.kms#CustomerMasterKeySpec", + "traits": { + "smithy.api#deprecated": { + "message": "This field has been deprecated. Instead, use the KeySpec field." + }, + "smithy.api#documentation": "

Instead, use the KeySpec field.

\n

The KeySpec and CustomerMasterKeySpec fields have the same\n value. We recommend that you use the KeySpec field in your code. However, to\n avoid breaking changes, KMS will support both fields.

" + } + }, + "KeySpec": { + "target": "com.amazonaws.kms#KeySpec", + "traits": { + "smithy.api#documentation": "

Describes the type of key material in the KMS key.

" + } + }, + "EncryptionAlgorithms": { + "target": "com.amazonaws.kms#EncryptionAlgorithmSpecList", + "traits": { + "smithy.api#documentation": "

The encryption algorithms that the KMS key supports. You cannot use the KMS key with other\n encryption algorithms within KMS.

\n

This value is present only when the KeyUsage of the KMS key is\n ENCRYPT_DECRYPT.

" + } + }, + "SigningAlgorithms": { + "target": "com.amazonaws.kms#SigningAlgorithmSpecList", + "traits": { + "smithy.api#documentation": "

The signing algorithms that the KMS key supports. You cannot use the KMS key with other\n signing algorithms within KMS.

\n

This field appears only when the KeyUsage of the KMS key is\n SIGN_VERIFY.

" + } + }, + "MultiRegion": { + "target": "com.amazonaws.kms#NullableBooleanType", + "traits": { + "smithy.api#documentation": "

Indicates whether the KMS key is a multi-Region (True) or regional\n (False) key. This value is True for multi-Region primary and\n replica keys and False for regional KMS keys.

\n

For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

" + } + }, + "MultiRegionConfiguration": { + "target": "com.amazonaws.kms#MultiRegionConfiguration", + "traits": { + "smithy.api#documentation": "

Lists the primary and replica keys in same multi-Region key. This field is present only\n when the value of the MultiRegion field is True.

\n

For more information about any listed KMS key, use the DescribeKey\n operation.

\n
    \n
  • \n

    \n MultiRegionKeyType indicates whether the KMS key is a\n PRIMARY or REPLICA key.

    \n
  • \n
  • \n

    \n PrimaryKey displays the key ARN and Region of the primary key. This field\n displays the current KMS key if it is the primary key.

    \n
  • \n
  • \n

    \n ReplicaKeys displays the key ARNs and Regions of all replica keys. This\n field includes the current KMS key if it is a replica key.

    \n
  • \n
" + } + }, + "PendingDeletionWindowInDays": { + "target": "com.amazonaws.kms#PendingWindowInDaysType", + "traits": { + "smithy.api#documentation": "

The waiting period before the primary key in a multi-Region key is deleted. This waiting\n period begins when the last of its replica keys is deleted. This value is present only when\n the KeyState of the KMS key is PendingReplicaDeletion. That\n indicates that the KMS key is the primary key in a multi-Region key, it is scheduled for\n deletion, and it still has existing replica keys.

\n

When a single-Region KMS key or a multi-Region replica key is scheduled for deletion, its\n deletion date is displayed in the DeletionDate field. However, when the primary\n key in a multi-Region key is scheduled for deletion, its waiting period doesn't begin until\n all of its replica keys are deleted. This value displays that waiting period. When the last\n replica key in the multi-Region key is deleted, the KeyState of the scheduled\n primary key changes from PendingReplicaDeletion to PendingDeletion\n and the deletion date appears in the DeletionDate field.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Contains metadata about a KMS key.

\n

This data type is used as a response element for the CreateKey and DescribeKey operations.

" + } + }, + "com.amazonaws.kms#KeySpec": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "RSA_2048", + "name": "RSA_2048" + }, + { + "value": "RSA_3072", + "name": "RSA_3072" + }, + { + "value": "RSA_4096", + "name": "RSA_4096" + }, + { + "value": "ECC_NIST_P256", + "name": "ECC_NIST_P256" + }, + { + "value": "ECC_NIST_P384", + "name": "ECC_NIST_P384" + }, + { + "value": "ECC_NIST_P521", + "name": "ECC_NIST_P521" + }, + { + "value": "ECC_SECG_P256K1", + "name": "ECC_SECG_P256K1" + }, + { + "value": "SYMMETRIC_DEFAULT", + "name": "SYMMETRIC_DEFAULT" + } + ] + } + }, + "com.amazonaws.kms#KeyState": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "Creating", + "name": "Creating" + }, + { + "value": "Enabled", + "name": "Enabled" + }, + { + "value": "Disabled", + "name": "Disabled" + }, + { + "value": "PendingDeletion", + "name": "PendingDeletion" + }, + { + "value": "PendingImport", + "name": "PendingImport" + }, + { + "value": "PendingReplicaDeletion", + "name": "PendingReplicaDeletion" + }, + { + "value": "Unavailable", + "name": "Unavailable" + }, + { + "value": "Updating", + "name": "Updating" + } + ] + } + }, + "com.amazonaws.kms#KeyStorePasswordType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 7, + "max": 32 + }, + "smithy.api#sensitive": {} + } + }, + "com.amazonaws.kms#KeyUnavailableException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "KeyUnavailable", + "httpResponseCode": 500 + }, + "smithy.api#documentation": "

The request was rejected because the specified KMS key was not available. You can retry\n the request.

", + "smithy.api#error": "server", + "smithy.api#httpError": 500 + } + }, + "com.amazonaws.kms#KeyUsageType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "SIGN_VERIFY", + "name": "SIGN_VERIFY" + }, + { + "value": "ENCRYPT_DECRYPT", + "name": "ENCRYPT_DECRYPT" + } + ] + } + }, + "com.amazonaws.kms#LimitExceededException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "LimitExceeded", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because a quota was exceeded. For more information, see Quotas in the\n Key Management Service Developer Guide.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#LimitType": { + "type": "integer", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 1, + "max": 1000 + } + } + }, + "com.amazonaws.kms#ListAliases": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#ListAliasesRequest" + }, + "output": { + "target": "com.amazonaws.kms#ListAliasesResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#InvalidMarkerException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Gets a list of aliases in the caller's Amazon Web Services account and region. For more information\n about aliases, see CreateAlias.

\n

By default, the ListAliases operation returns all aliases in the account and\n region. To get only the aliases associated with a particular KMS key, use the\n KeyId parameter.

\n

The ListAliases response can include aliases that you created and associated\n with your customer managed keys, and aliases that Amazon Web Services created and associated with Amazon Web Services\n managed keys in your account. You can recognize Amazon Web Services aliases because their names have the\n format aws/, such as aws/dynamodb.

\n

The response might also include aliases that have no TargetKeyId field. These\n are predefined aliases that Amazon Web Services has created but has not yet associated with a KMS key.\n Aliases that Amazon Web Services creates in your account, including predefined aliases, do not count against\n your KMS aliases\n quota.

\n

\n Cross-account use: No. ListAliases does not\n return aliases in other Amazon Web Services accounts.

\n \n\n

\n Required permissions: kms:ListAliases (IAM policy)

\n

For details, see Controlling access to aliases in the\n Key Management Service Developer Guide.

\n

\n Related operations:\n

\n ", + "smithy.api#paginated": { + "inputToken": "Marker", + "outputToken": "NextMarker", + "items": "Aliases", + "pageSize": "Limit" + } + } + }, + "com.amazonaws.kms#ListAliasesRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Lists only aliases that are associated with the specified KMS key. Enter a KMS key in your\n Amazon Web Services account.

\n

This parameter is optional. If you omit it, ListAliases returns all aliases\n in the account and Region.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

" + } + }, + "Limit": { + "target": "com.amazonaws.kms#LimitType", + "traits": { + "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between 1\n and 100, inclusive. If you do not include a value, it defaults to 50.

" + } + }, + "Marker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" + } + } + } + }, + "com.amazonaws.kms#ListAliasesResponse": { + "type": "structure", + "members": { + "Aliases": { + "target": "com.amazonaws.kms#AliasList", + "traits": { + "smithy.api#documentation": "

A list of aliases.

" + } + }, + "NextMarker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

When Truncated is true, this element is present and contains the\n value to use for the Marker parameter in a subsequent request.

" + } + }, + "Truncated": { + "target": "com.amazonaws.kms#BooleanType", + "traits": { + "smithy.api#documentation": "

A flag that indicates whether there are more items in the list. When this\n value is true, the list in this response is truncated. To get more items, pass the value of\n the NextMarker element in thisresponse to the Marker parameter in a\n subsequent request.

" + } + } + } + }, + "com.amazonaws.kms#ListGrants": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#ListGrantsRequest" + }, + "output": { + "target": "com.amazonaws.kms#ListGrantsResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantIdException" + }, + { + "target": "com.amazonaws.kms#InvalidMarkerException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Gets a list of all grants for the specified KMS key.

\n

You must specify the KMS key in all requests. You can filter the grant list by grant ID or\n grantee principal.

\n

For detailed information about grants, including grant terminology, see Using grants in the\n \n Key Management Service Developer Guide\n . For examples of working with grants in several\n programming languages, see Programming grants.

\n \n

The GranteePrincipal field in the ListGrants response usually contains the\n user or role designated as the grantee principal in the grant. However, when the grantee\n principal in the grant is an Amazon Web Services service, the GranteePrincipal field contains\n the service\n principal, which might represent several different grantee principals.

\n
\n

\n Cross-account use: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key\n ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:ListGrants (key policy)

\n

\n Related operations:\n

\n ", + "smithy.api#paginated": { + "inputToken": "Marker", + "outputToken": "NextMarker", + "items": "Grants", + "pageSize": "Limit" + } + } + }, + "com.amazonaws.kms#ListGrantsRequest": { + "type": "structure", + "members": { + "Limit": { + "target": "com.amazonaws.kms#LimitType", + "traits": { + "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between 1\n and 100, inclusive. If you do not include a value, it defaults to 50.

" + } + }, + "Marker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Returns only grants for the specified KMS key. This parameter is required.

\n \n

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a\ndifferent Amazon Web Services account, you must use the key ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "GrantId": { + "target": "com.amazonaws.kms#GrantIdType", + "traits": { + "smithy.api#documentation": "

Returns only the grant with the specified grant ID. The grant ID uniquely identifies the\n grant.

" + } + }, + "GranteePrincipal": { + "target": "com.amazonaws.kms#PrincipalIdType", + "traits": { + "smithy.api#documentation": "

Returns only grants where the specified principal is the grantee principal for the\n grant.

" + } + } + } + }, + "com.amazonaws.kms#ListGrantsResponse": { + "type": "structure", + "members": { + "Grants": { + "target": "com.amazonaws.kms#GrantList", + "traits": { + "smithy.api#documentation": "

A list of grants.

" + } + }, + "NextMarker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

When Truncated is true, this element is present and contains the\n value to use for the Marker parameter in a subsequent request.

" + } + }, + "Truncated": { + "target": "com.amazonaws.kms#BooleanType", + "traits": { + "smithy.api#documentation": "

A flag that indicates whether there are more items in the list. When this\n value is true, the list in this response is truncated. To get more items, pass the value of\n the NextMarker element in thisresponse to the Marker parameter in a\n subsequent request.

" + } + } + } + }, + "com.amazonaws.kms#ListKeyPolicies": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#ListKeyPoliciesRequest" + }, + "output": { + "target": "com.amazonaws.kms#ListKeyPoliciesResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Gets the names of the key policies that are attached to a KMS key. This operation is\n designed to get policy names that you can use in a GetKeyPolicy operation.\n However, the only valid policy name is default.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:ListKeyPolicies (key policy)

\n

\n Related operations:\n

\n ", + "smithy.api#paginated": { + "inputToken": "Marker", + "outputToken": "NextMarker", + "items": "PolicyNames", + "pageSize": "Limit" + } + } + }, + "com.amazonaws.kms#ListKeyPoliciesRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Gets the names of key policies for the specified KMS key.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "Limit": { + "target": "com.amazonaws.kms#LimitType", + "traits": { + "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between\n 1 and 1000, inclusive. If you do not include a value, it defaults to 100.

\n

Only one policy can be attached to a key.

" + } + }, + "Marker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" + } + } + } + }, + "com.amazonaws.kms#ListKeyPoliciesResponse": { + "type": "structure", + "members": { + "PolicyNames": { + "target": "com.amazonaws.kms#PolicyNameList", + "traits": { + "smithy.api#documentation": "

A list of key policy names. The only valid value is default.

" + } + }, + "NextMarker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

When Truncated is true, this element is present and contains the\n value to use for the Marker parameter in a subsequent request.

" + } + }, + "Truncated": { + "target": "com.amazonaws.kms#BooleanType", + "traits": { + "smithy.api#documentation": "

A flag that indicates whether there are more items in the list. When this\n value is true, the list in this response is truncated. To get more items, pass the value of\n the NextMarker element in thisresponse to the Marker parameter in a\n subsequent request.

" + } + } + } + }, + "com.amazonaws.kms#ListKeysRequest": { + "type": "structure", + "members": { + "Limit": { + "target": "com.amazonaws.kms#LimitType", + "traits": { + "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between\n 1 and 1000, inclusive. If you do not include a value, it defaults to 100.

" + } + }, + "Marker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" + } + } + } + }, + "com.amazonaws.kms#ListResourceTags": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#ListResourceTagsRequest" + }, + "output": { + "target": "com.amazonaws.kms#ListResourceTagsResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#InvalidMarkerException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Returns all tags on the specified KMS key.

\n

For general information about tags, including the format and syntax, see Tagging Amazon Web Services resources in\n the Amazon Web Services General Reference. For information about using\n tags in KMS, see Tagging\n keys.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:ListResourceTags (key policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#ListResourceTagsRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Gets tags on the specified KMS key.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "Limit": { + "target": "com.amazonaws.kms#LimitType", + "traits": { + "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between 1 and 50, inclusive. If\n you do not include a value, it defaults to 50.

" + } + }, + "Marker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

\n

Do not attempt to construct this value. Use only the value of NextMarker from\n the truncated response you just received.

" + } + } + } + }, + "com.amazonaws.kms#ListResourceTagsResponse": { + "type": "structure", + "members": { + "Tags": { + "target": "com.amazonaws.kms#TagList", + "traits": { + "smithy.api#documentation": "

A list of tags. Each tag consists of a tag key and a tag value.

\n \n

Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
" + } + }, + "NextMarker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

When Truncated is true, this element is present and contains the\n value to use for the Marker parameter in a subsequent request.

\n

Do not assume or infer any information from this value.

" + } + }, + "Truncated": { + "target": "com.amazonaws.kms#BooleanType", + "traits": { + "smithy.api#documentation": "

A flag that indicates whether there are more items in the list. When this\n value is true, the list in this response is truncated. To get more items, pass the value of\n the NextMarker element in thisresponse to the Marker parameter in a\n subsequent request.

" + } + } + } + }, + "com.amazonaws.kms#ListRetirableGrantsRequest": { + "type": "structure", + "members": { + "Limit": { + "target": "com.amazonaws.kms#LimitType", + "traits": { + "smithy.api#documentation": "

Use this parameter to specify the maximum number of items to return. When this\n value is present, KMS does not return more than the specified number of items, but it might\n return fewer.

\n

This value is optional. If you include a value, it must be between 1\n and 100, inclusive. If you do not include a value, it defaults to 50.

" + } + }, + "Marker": { + "target": "com.amazonaws.kms#MarkerType", + "traits": { + "smithy.api#documentation": "

Use this parameter in a subsequent request after you receive a response with\n truncated results. Set it to the value of NextMarker from the truncated response\n you just received.

" + } + }, + "RetiringPrincipal": { + "target": "com.amazonaws.kms#PrincipalIdType", + "traits": { + "smithy.api#documentation": "

The retiring principal for which to list grants. Enter a principal in your\n Amazon Web Services account.

\n

To specify the retiring principal, use the Amazon Resource Name (ARN) of an\n Amazon Web Services principal. Valid Amazon Web Services principals include Amazon Web Services accounts (root), IAM users, federated\n users, and assumed role users. For examples of the ARN syntax for specifying a principal, see\n Amazon Web Services Identity and Access Management (IAM) in the Example ARNs section of the\n Amazon Web Services General Reference.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#MalformedPolicyDocumentException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "MalformedPolicyDocument", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because the specified policy is not syntactically or semantically\n correct.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#MarkerType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 1024 + }, + "smithy.api#pattern": "^[\\u0020-\\u00FF]*$" + } + }, + "com.amazonaws.kms#MessageType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "RAW", + "name": "RAW" + }, + { + "value": "DIGEST", + "name": "DIGEST" + } + ] + } + }, + "com.amazonaws.kms#MultiRegionConfiguration": { + "type": "structure", + "members": { + "MultiRegionKeyType": { + "target": "com.amazonaws.kms#MultiRegionKeyType", + "traits": { + "smithy.api#documentation": "

Indicates whether the KMS key is a PRIMARY or REPLICA\n key.

" + } + }, + "PrimaryKey": { + "target": "com.amazonaws.kms#MultiRegionKey", + "traits": { + "smithy.api#documentation": "

Displays the key ARN and Region of the primary key. This field includes the current KMS\n key if it is the primary key.

" + } + }, + "ReplicaKeys": { + "target": "com.amazonaws.kms#MultiRegionKeyList", + "traits": { + "smithy.api#documentation": "

displays the key ARNs and Regions of all replica keys. This field includes the current KMS\n key if it is a replica key.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Describes the configuration of this multi-Region key. This field appears only when the KMS\n key is a primary or replica of a multi-Region key.

\n

For more information about any listed KMS key, use the DescribeKey\n operation.

" + } + }, + "com.amazonaws.kms#MultiRegionKey": { + "type": "structure", + "members": { + "Arn": { + "target": "com.amazonaws.kms#ArnType", + "traits": { + "smithy.api#documentation": "

Displays the key ARN of a primary or replica key of a multi-Region key.

" + } + }, + "Region": { + "target": "com.amazonaws.kms#RegionType", + "traits": { + "smithy.api#documentation": "

Displays the Amazon Web Services Region of a primary or replica key in a multi-Region key.

" + } + } + }, + "traits": { + "smithy.api#documentation": "

Describes the primary or replica key in a multi-Region key.

" + } + }, + "com.amazonaws.kms#MultiRegionKeyList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#MultiRegionKey" + } + }, + "com.amazonaws.kms#MultiRegionKeyType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "PRIMARY", + "name": "PRIMARY" + }, + { + "value": "REPLICA", + "name": "REPLICA" + } + ] + } + }, + "com.amazonaws.kms#NotFoundException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "NotFound", + "httpResponseCode": 404 + }, + "smithy.api#documentation": "

The request was rejected because the specified entity or resource could not be\n found.

", + "smithy.api#error": "client", + "smithy.api#httpError": 404 + } + }, + "com.amazonaws.kms#NullableBooleanType": { + "type": "boolean", + "traits": { + "smithy.api#box": {} + } + }, + "com.amazonaws.kms#NumberOfBytesType": { + "type": "integer", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 1, + "max": 1024 + } + } + }, + "com.amazonaws.kms#OriginType": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "AWS_KMS", + "name": "AWS_KMS" + }, + { + "value": "EXTERNAL", + "name": "EXTERNAL" + }, + { + "value": "AWS_CLOUDHSM", + "name": "AWS_CLOUDHSM" + } + ] + } + }, + "com.amazonaws.kms#PendingWindowInDaysType": { + "type": "integer", + "traits": { + "smithy.api#box": {}, + "smithy.api#range": { + "min": 1, + "max": 365 + } + } + }, + "com.amazonaws.kms#PlaintextType": { + "type": "blob", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 4096 + }, + "smithy.api#sensitive": {} + } + }, + "com.amazonaws.kms#PolicyNameList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#PolicyNameType" + } + }, + "com.amazonaws.kms#PolicyNameType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 128 + }, + "smithy.api#pattern": "^[\\w]+$" + } + }, + "com.amazonaws.kms#PolicyType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 131072 + }, + "smithy.api#pattern": "^[\\u0009\\u000A\\u000D\\u0020-\\u00FF]+$" + } + }, + "com.amazonaws.kms#PrincipalIdType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 256 + }, + "smithy.api#pattern": "^[\\w+=,.@:/-]+$" + } + }, + "com.amazonaws.kms#PublicKeyType": { + "type": "blob", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 8192 + } + } + }, + "com.amazonaws.kms#PutKeyPolicy": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#PutKeyPolicyRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#LimitExceededException" + }, + { + "target": "com.amazonaws.kms#MalformedPolicyDocumentException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Attaches a key policy to the specified KMS key.

\n

For more information about key policies, see Key Policies in the Key Management Service Developer Guide.\n For help writing and formatting a JSON policy document, see the IAM JSON Policy Reference in the \n Identity and Access Management User Guide\n . For examples of adding a key policy in multiple programming languages,\n see Setting a key policy in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:PutKeyPolicy (key policy)

\n

\n Related operations: GetKeyPolicy\n

" + } + }, + "com.amazonaws.kms#PutKeyPolicyRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Sets the key policy on the specified KMS key.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "PolicyName": { + "target": "com.amazonaws.kms#PolicyNameType", + "traits": { + "smithy.api#documentation": "

The name of the key policy. The only valid value is default.

", + "smithy.api#required": {} + } + }, + "Policy": { + "target": "com.amazonaws.kms#PolicyType", + "traits": { + "smithy.api#documentation": "

The key policy to attach to the KMS key.

\n

The key policy must meet the following criteria:

\n
    \n
  • \n

    If you don't set BypassPolicyLockoutSafetyCheck to true, the key policy\n must allow the principal that is making the PutKeyPolicy request to make a\n subsequent PutKeyPolicy request on the KMS key. This reduces the risk that\n the KMS key becomes unmanageable. For more information, refer to the scenario in the\n Default Key Policy section of the Key Management Service Developer Guide.

    \n
  • \n
  • \n

    Each statement in the key policy must contain one or more principals. The principals\n in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services\n principal (for example, an IAM user or role), you might need to enforce a delay before\n including the new principal in a key policy because the new principal might not be\n immediately visible to KMS. For more information, see Changes that I make are not always immediately visible in the Amazon Web Services\n Identity and Access Management User Guide.

    \n
  • \n
\n

The key policy cannot exceed 32 kilobytes (32768 bytes). For more information, see Resource Quotas in the\n Key Management Service Developer Guide.

", + "smithy.api#required": {} + } + }, + "BypassPolicyLockoutSafetyCheck": { + "target": "com.amazonaws.kms#BooleanType", + "traits": { + "smithy.api#documentation": "

A flag to indicate whether to bypass the key policy lockout safety check.

\n \n

Setting this value to true increases the risk that the KMS key becomes unmanageable. Do\n not set this value to true indiscriminately.

\n

For more information, refer to the scenario in the Default Key Policy section in the Key Management Service Developer Guide.

\n
\n

Use this parameter only when you intend to prevent the principal that is making the\n request from making a subsequent PutKeyPolicy request on the KMS key.

\n

The default value is false.

" + } + } + } + }, + "com.amazonaws.kms#ReEncrypt": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#ReEncryptRequest" + }, + "output": { + "target": "com.amazonaws.kms#ReEncryptResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#IncorrectKeyException" + }, + { + "target": "com.amazonaws.kms#InvalidCiphertextException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#InvalidKeyUsageException" + }, + { + "target": "com.amazonaws.kms#KeyUnavailableException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Decrypts ciphertext and then reencrypts it entirely within KMS. You can use this\n operation to change the KMS key under which data is encrypted, such as when you manually\n rotate a KMS key or change the KMS key that protects a ciphertext. You can also use\n it to reencrypt ciphertext under the same KMS key, such as to change the encryption\n context of a ciphertext.

\n

The ReEncrypt operation can decrypt ciphertext that was encrypted by using an\n KMS KMS key in an KMS operation, such as Encrypt or GenerateDataKey. It can also decrypt ciphertext that was encrypted by using the\n public key of an asymmetric KMS key\n outside of KMS. However, it cannot decrypt ciphertext produced by other libraries, such as\n the Amazon Web Services Encryption SDK or\n Amazon S3\n client-side encryption. These libraries return a ciphertext format that is\n incompatible with KMS.

\n

When you use the ReEncrypt operation, you need to provide information for the\n decrypt operation and the subsequent encrypt operation.

\n
    \n
  • \n

    If your ciphertext was encrypted under an asymmetric KMS key, you must use the\n SourceKeyId parameter to identify the KMS key that encrypted the\n ciphertext. You must also supply the encryption algorithm that was used. This information\n is required to decrypt the data.

    \n
  • \n
  • \n

    If your ciphertext was encrypted under a symmetric KMS key, the\n SourceKeyId parameter is optional. KMS can get this information from\n metadata that it adds to the symmetric ciphertext blob. This feature adds durability to\n your implementation by ensuring that authorized users can decrypt ciphertext decades after\n it was encrypted, even if they've lost track of the key ID. However, specifying the source\n KMS key is always recommended as a best practice. When you use the\n SourceKeyId parameter to specify a KMS key, KMS uses only the KMS key you\n specify. If the ciphertext was encrypted under a different KMS key, the\n ReEncrypt operation fails. This practice ensures that you use the KMS key\n that you intend.

    \n
  • \n
  • \n

    To reencrypt the data, you must use the DestinationKeyId parameter\n specify the KMS key that re-encrypts the data after it is decrypted. You can select a\n symmetric or asymmetric KMS key. If the destination KMS key is an asymmetric KMS key, you\n must also provide the encryption algorithm. The algorithm that you choose must be\n compatible with the KMS key.

    \n\n \n

    When you use an asymmetric KMS key to encrypt or reencrypt data, be sure to record the KMS key and encryption algorithm that you choose. You will be required to provide the same KMS key and encryption algorithm when you decrypt the data. If the KMS key and algorithm do not match the values used to encrypt the data, the decrypt operation fails.

    \n

    You are not required to supply the key ID and encryption algorithm when you decrypt with symmetric KMS keys because KMS stores this information in the ciphertext blob. KMS cannot store metadata in ciphertext generated with asymmetric keys. The standard format for asymmetric key ciphertext does not include configurable fields.

    \n
    \n
  • \n
\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: Yes.\n The source KMS key and destination KMS key can be in different Amazon Web Services accounts. Either or both\n KMS keys can be in a different account than the caller. To specify a KMS key in a different\n account, you must use its key ARN or alias ARN.

\n\n

\n Required permissions:

\n
    \n
  • \n

    \n kms:ReEncryptFrom\n permission on the source KMS key (key policy)

    \n
  • \n
  • \n

    \n kms:ReEncryptTo\n permission on the destination KMS key (key policy)

    \n
  • \n
\n

To permit reencryption from or to a KMS key, include the \"kms:ReEncrypt*\"\n permission in your key policy. This permission is\n automatically included in the key policy when you use the console to create a KMS key. But you\n must include it manually when you create a KMS key programmatically or when you use the PutKeyPolicy operation to set a key policy.

\n\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#ReEncryptRequest": { + "type": "structure", + "members": { + "CiphertextBlob": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

Ciphertext of the data to reencrypt.

", + "smithy.api#required": {} + } + }, + "SourceEncryptionContext": { + "target": "com.amazonaws.kms#EncryptionContextType", + "traits": { + "smithy.api#documentation": "

Specifies the encryption context to use to decrypt the ciphertext. Enter the same\n encryption context that was used to encrypt the ciphertext.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" + } + }, + "SourceKeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Specifies the KMS key that KMS will use to decrypt the ciphertext before it is\n re-encrypted. Enter a key ID of the KMS key that was used to encrypt the ciphertext.

\n

This parameter is required only when the ciphertext was encrypted under an asymmetric KMS\n key. If you used a symmetric KMS key, KMS can get the KMS key from metadata that it adds to\n the symmetric ciphertext blob. However, it is always recommended as a best practice. This\n practice ensures that you use the KMS key that you intend.

\n \n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

" + } + }, + "DestinationKeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

A unique identifier for the KMS key that is used to reencrypt the data. Specify a\n symmetric or asymmetric KMS key with a KeyUsage value of\n ENCRYPT_DECRYPT. To find the KeyUsage value of a KMS key, use the\n DescribeKey operation.

\n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", + "smithy.api#required": {} + } + }, + "DestinationEncryptionContext": { + "target": "com.amazonaws.kms#EncryptionContextType", + "traits": { + "smithy.api#documentation": "

Specifies that encryption context to use when the reencrypting the data.

\n

A destination encryption context is valid only when the destination KMS key is a symmetric\n KMS key. The standard ciphertext format for asymmetric KMS keys does not include fields for\n metadata.

\n

An encryption context is a collection of non-secret key-value pairs that represents additional authenticated data. When you use an encryption context to encrypt data, you must specify the same (an exact case-sensitive match) encryption context to decrypt the data. An encryption context is optional when encrypting with a symmetric KMS key, but it is highly recommended.

\n

For more information, see\n Encryption\n Context in the Key Management Service Developer Guide.

" + } + }, + "SourceEncryptionAlgorithm": { + "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

Specifies the encryption algorithm that KMS will use to decrypt the ciphertext before it\n is reencrypted. The default value, SYMMETRIC_DEFAULT, represents the algorithm\n used for symmetric KMS keys.

\n

Specify the same algorithm that was used to encrypt the ciphertext. If you specify a\n different algorithm, the decrypt attempt fails.

\n

This parameter is required only when the ciphertext was encrypted under an asymmetric KMS\n key.

" + } + }, + "DestinationEncryptionAlgorithm": { + "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

Specifies the encryption algorithm that KMS will use to reecrypt the data after it has\n decrypted it. The default value, SYMMETRIC_DEFAULT, represents the encryption\n algorithm used for symmetric KMS keys.

\n

This parameter is required only when the destination KMS key is an asymmetric KMS\n key.

" + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + } + } + }, + "com.amazonaws.kms#ReEncryptResponse": { + "type": "structure", + "members": { + "CiphertextBlob": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

The reencrypted data. When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" + } + }, + "SourceKeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Unique identifier of the KMS key used to originally encrypt the data.

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key that was used to reencrypt the data.

" + } + }, + "SourceEncryptionAlgorithm": { + "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

The encryption algorithm that was used to decrypt the ciphertext before it was\n reencrypted.

" + } + }, + "DestinationEncryptionAlgorithm": { + "target": "com.amazonaws.kms#EncryptionAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

The encryption algorithm that was used to reencrypt the data.

" + } + } + } + }, + "com.amazonaws.kms#RegionType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 32 + }, + "smithy.api#pattern": "^([a-z]+-){2,3}\\d+$" + } + }, + "com.amazonaws.kms#ReplicateKey": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#ReplicateKeyRequest" + }, + "output": { + "target": "com.amazonaws.kms#ReplicateKeyResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#AlreadyExistsException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#LimitExceededException" + }, + { + "target": "com.amazonaws.kms#MalformedPolicyDocumentException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#TagException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Replicates a multi-Region key into the specified Region. This operation creates a\n multi-Region replica key based on a multi-Region primary key in a different Region of the same\n Amazon Web Services partition. You can create multiple replicas of a primary key, but each must be in a\n different Region. To create a multi-Region primary key, use the CreateKey\n operation.

\n

This operation supports multi-Region keys, an KMS feature that lets you create multiple\n interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key\n material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt\n it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

\n

A replica key is a fully-functional KMS key that can be used\n independently of its primary and peer replica keys. A primary key and its replica keys share\n properties that make them interoperable. They have the same key ID and key material. They also\n have the same key\n spec, key\n usage, key\n material origin, and automatic key rotation status. KMS automatically synchronizes these shared\n properties among related multi-Region keys. All other properties of a replica key can differ,\n including its key\n policy, tags, aliases, and key\n state. KMS pricing and quotas for KMS keys apply to each primary key and replica\n key.

\n

When this operation completes, the new replica key has a transient key state of\n Creating. This key state changes to Enabled (or\n PendingImport) after a few seconds when the process of creating the new replica\n key is complete. While the key state is Creating, you can manage key, but you\n cannot yet use it in cryptographic operations. If you are creating and using the replica key\n programmatically, retry on KMSInvalidStateException or call\n DescribeKey to check its KeyState value before using it. For\n details about the Creating key state, see Key state: Effect on your KMS key in the\n Key Management Service Developer Guide.

\n

The CloudTrail log of a ReplicateKey operation records a\n ReplicateKey operation in the primary key's Region and a CreateKey operation in the replica key's Region.

\n

If you replicate a multi-Region primary key with imported key material, the replica key is\n created with no key material. You must import the same key material that you imported into the\n primary key. For details, see Importing key material into multi-Region keys in the Key Management Service Developer Guide.

\n

To convert a replica key to a primary key, use the UpdatePrimaryRegion\n operation.

\n \n

\n ReplicateKey uses different default values for the KeyPolicy\n and Tags parameters than those used in the KMS console. For details, see the\n parameter descriptions.

\n
\n

\n Cross-account use: No. You cannot use this operation to\n create a replica key in a different Amazon Web Services account.

\n

\n Required permissions:

\n
    \n
  • \n

    \n kms:ReplicateKey on the primary key (in the primary key's Region).\n Include this permission in the primary key's key policy.

    \n
  • \n
  • \n

    \n kms:CreateKey in an IAM policy in the replica Region.

    \n
  • \n
  • \n

    To use the Tags parameter, kms:TagResource in an IAM policy\n in the replica Region.

    \n
  • \n
\n

\n Related operations\n

\n " + } + }, + "com.amazonaws.kms#ReplicateKeyRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the multi-Region primary key that is being replicated. To determine whether a\n KMS key is a multi-Region primary key, use the DescribeKey operation to\n check the value of the MultiRegionKeyType property.

\n \n

Specify the key ID or key ARN of a multi-Region primary key.

\n

For example:

\n
    \n
  • \n

    Key ID: mrk-1234abcd12ab34cd56ef1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "ReplicaRegion": { + "target": "com.amazonaws.kms#RegionType", + "traits": { + "smithy.api#documentation": "

The Region ID of the Amazon Web Services Region for this replica key.

\n

Enter the Region ID, such as us-east-1 or ap-southeast-2. For a\n list of Amazon Web Services Regions in which KMS is supported, see KMS service endpoints in the\n Amazon Web Services General Reference.

\n

The replica must be in a different Amazon Web Services Region than its primary key and other replicas of\n that primary key, but in the same Amazon Web Services partition. KMS must be available in the replica\n Region. If the Region is not enabled by default, the Amazon Web Services account must be enabled in the\n Region.

\n

For information about Amazon Web Services partitions, see Amazon Resource Names (ARNs) in the\n Amazon Web Services General Reference. For information about enabling and disabling Regions, see Enabling a\n Region and Disabling a Region in the\n Amazon Web Services General Reference.

", + "smithy.api#required": {} + } + }, + "Policy": { + "target": "com.amazonaws.kms#PolicyType", + "traits": { + "smithy.api#documentation": "

The key policy to attach to the KMS key. This parameter is optional. If you do not provide\n a key policy, KMS attaches the default key policy to the\n KMS key.

\n

The key policy is not a shared property of multi-Region keys. You can specify the same key\n policy or a different key policy for each key in a set of related multi-Region keys. KMS\n does not synchronize this property.

\n

If you provide a key policy, it must meet the following criteria:

\n
    \n
  • \n

    If you don't set BypassPolicyLockoutSafetyCheck to true, the key policy\n must give the caller kms:PutKeyPolicy permission on the replica key. This\n reduces the risk that the KMS key becomes unmanageable. For more information, refer to the\n scenario in the Default Key Policy section of the \n Key Management Service Developer Guide\n .

    \n
  • \n
  • \n

    Each statement in the key policy must contain one or more principals. The principals\n in the key policy must exist and be visible to KMS. When you create a new Amazon Web Services\n principal (for example, an IAM user or role), you might need to enforce a delay before\n including the new principal in a key policy because the new principal might not be\n immediately visible to KMS. For more information, see Changes that I make are not always immediately visible in the\n \n Identity and Access Management User Guide\n .

    \n
  • \n
  • \n

    The key policy size quota is 32 kilobytes (32768 bytes).

    \n
  • \n
" + } + }, + "BypassPolicyLockoutSafetyCheck": { + "target": "com.amazonaws.kms#BooleanType", + "traits": { + "smithy.api#documentation": "

A flag to indicate whether to bypass the key policy lockout safety check.

\n \n

Setting this value to true increases the risk that the KMS key becomes unmanageable. Do\n not set this value to true indiscriminately.

\n

For more information, refer to the scenario in the Default Key Policy section in the Key Management Service Developer Guide.

\n
\n

Use this parameter only when you intend to prevent the principal that is making the\n request from making a subsequent PutKeyPolicy request on the KMS key.

\n

The default value is false.

" + } + }, + "Description": { + "target": "com.amazonaws.kms#DescriptionType", + "traits": { + "smithy.api#documentation": "

A description of the KMS key. The default value is an empty string (no\n description).

\n

The description is not a shared property of multi-Region keys. You can specify the same\n description or a different description for each key in a set of related multi-Region keys.\n KMS does not synchronize this property.

" + } + }, + "Tags": { + "target": "com.amazonaws.kms#TagList", + "traits": { + "smithy.api#documentation": "

Assigns one or more tags to the replica key. Use this parameter to tag the KMS key when it\n is created. To tag an existing KMS key, use the TagResource\n operation.

\n \n

Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

To use this parameter, you must have kms:TagResource permission in an IAM policy.

\n

Tags are not a shared property of multi-Region keys. You can specify the same tags or\n different tags for each key in a set of related multi-Region keys. KMS does not synchronize\n this property.

\n

Each tag consists of a tag key and a tag value. Both the tag key and the tag value are\n required, but the tag value can be an empty (null) string. You cannot have more than one tag\n on a KMS key with the same tag key. If you specify an existing tag key with a different tag\n value, KMS replaces the current tag value with the specified one.

\n

When you add tags to an Amazon Web Services resource, Amazon Web Services generates a cost allocation\n report with usage and costs aggregated by tags. Tags can also be used to control access to a KMS key. For details,\n see Tagging Keys.

" + } + } + } + }, + "com.amazonaws.kms#ReplicateKeyResponse": { + "type": "structure", + "members": { + "ReplicaKeyMetadata": { + "target": "com.amazonaws.kms#KeyMetadata", + "traits": { + "smithy.api#documentation": "

Displays details about the new replica key, including its Amazon Resource Name (key ARN) and\n key state. It also\n includes the ARN and Amazon Web Services Region of its primary key and other replica keys.

" + } + }, + "ReplicaPolicy": { + "target": "com.amazonaws.kms#PolicyType", + "traits": { + "smithy.api#documentation": "

The key policy of the new replica key. The value is a key policy document in JSON\n format.

" + } + }, + "ReplicaTags": { + "target": "com.amazonaws.kms#TagList", + "traits": { + "smithy.api#documentation": "

The tags on the new replica key. The value is a list of tag key and tag value\n pairs.

" + } + } + } + }, + "com.amazonaws.kms#RetireGrant": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#RetireGrantRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantIdException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Deletes a grant. Typically, you retire a grant when you no longer need its permissions. To\n identify the grant to retire, use a grant token, or both the grant ID and a\n key identifier (key ID or key ARN) of the KMS key. The CreateGrant operation\n returns both values.

\n

This operation can be called by the retiring principal for a grant,\n by the grantee principal if the grant allows the RetireGrant\n operation, and by the Amazon Web Services account (root user) in which the grant is created. It can also be\n called by principals to whom permission for retiring a grant is delegated. For details, see\n Retiring and\n revoking grants in the Key Management Service Developer Guide.

\n

For detailed information about grants, including grant terminology, see Using grants in the\n \n Key Management Service Developer Guide\n . For examples of working with grants in several\n programming languages, see Programming grants.

\n

\n Cross-account use: Yes. You can retire a grant on a KMS\n key in a different Amazon Web Services account.

\n

\n Required permissions::Permission to retire a grant is\n determined primarily by the grant. For details, see Retiring and revoking grants in\n the Key Management Service Developer Guide.

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#RetireGrantRequest": { + "type": "structure", + "members": { + "GrantToken": { + "target": "com.amazonaws.kms#GrantTokenType", + "traits": { + "smithy.api#documentation": "

Identifies the grant to be retired. You can use a grant token to identify a new grant even\n before it has achieved eventual consistency.

\n

Only the CreateGrant operation returns a grant token. For details, see\n Grant token\n and Eventual consistency in the Key Management Service Developer Guide.

" + } + }, + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The key ARN KMS key associated with the grant. To find the key ARN, use the ListKeys operation.

\n

For example: arn:aws:kms:us-east-2:444455556666:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

" + } + }, + "GrantId": { + "target": "com.amazonaws.kms#GrantIdType", + "traits": { + "smithy.api#documentation": "

Identifies the grant to retire. To get the grant ID, use CreateGrant,\n ListGrants, or ListRetirableGrants.

\n
    \n
  • \n

    Grant ID Example -\n 0123456789012345678901234567890123456789012345678901234567890123

    \n
  • \n
" + } + } + } + }, + "com.amazonaws.kms#RevokeGrant": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#RevokeGrantRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantIdException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Deletes the specified grant. You revoke a grant to terminate the permissions that the\n grant allows. For more information, see Retiring and revoking grants in\n the \n Key Management Service Developer Guide\n .

\n

When you create, retire, or revoke a grant, there might be a brief delay, usually less than five minutes, until the grant is available throughout KMS. This state is known as eventual consistency. For details, see Eventual consistency in\n the \n Key Management Service Developer Guide\n .

\n

For detailed information about grants, including grant terminology, see Using grants in the\n \n Key Management Service Developer Guide\n . For examples of working with grants in several\n programming languages, see Programming grants.

\n

\n Cross-account use: Yes. To perform this operation on a KMS key in a different Amazon Web Services account, specify the key\n ARN in the value of the KeyId parameter.

\n

\n Required permissions: kms:RevokeGrant (key policy).

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#RevokeGrantRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

A unique identifier for the KMS key associated with the grant. To get the key ID and key\n ARN for a KMS key, use ListKeys or DescribeKey.

\n \n

Specify the key ID or key ARN of the KMS key. To specify a KMS key in a\ndifferent Amazon Web Services account, you must use the key ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "GrantId": { + "target": "com.amazonaws.kms#GrantIdType", + "traits": { + "smithy.api#documentation": "

Identifies the grant to revoke. To get the grant ID, use CreateGrant,\n ListGrants, or ListRetirableGrants.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#ScheduleKeyDeletion": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#ScheduleKeyDeletionRequest" + }, + "output": { + "target": "com.amazonaws.kms#ScheduleKeyDeletionResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Schedules the deletion of a KMS key. By default, KMS applies a waiting period of 30\n days, but you can specify a waiting period of 7-30 days. When this operation is successful,\n the key state of the KMS key changes to PendingDeletion and the key can't be used\n in any cryptographic operations. It remains in this state for the duration of the waiting\n period. Before the waiting period ends, you can use CancelKeyDeletion to\n cancel the deletion of the KMS key. After the waiting period ends, KMS deletes the KMS key,\n its key material, and all KMS data associated with it, including all aliases that refer to\n it.

\n \n

Deleting a KMS key is a destructive and potentially dangerous operation. When a KMS key\n is deleted, all data that was encrypted under the KMS key is unrecoverable. (The only\n exception is a multi-Region replica key.) To prevent the use of a KMS key without deleting\n it, use DisableKey.

\n
\n

If you schedule deletion of a KMS key from a custom key store, when the waiting period\n expires, ScheduleKeyDeletion deletes the KMS key from KMS. Then KMS makes a\n best effort to delete the key material from the associated CloudHSM cluster. However, you might\n need to manually delete the orphaned key\n material from the cluster and its backups.

\n

You can schedule the deletion of a multi-Region primary key and its replica keys at any\n time. However, KMS will not delete a multi-Region primary key with existing replica keys. If\n you schedule the deletion of a primary key with replicas, its key state changes to\n PendingReplicaDeletion and it cannot be replicated or used in cryptographic\n operations. This status can continue indefinitely. When the last of its replicas keys is\n deleted (not just scheduled), the key state of the primary key changes to\n PendingDeletion and its waiting period (PendingWindowInDays)\n begins. For details, see Deleting multi-Region keys in the\n Key Management Service Developer Guide.

\n

For more information about scheduling a KMS key for deletion, see Deleting KMS keys in the\n Key Management Service Developer Guide.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n\n

\n Required permissions: kms:ScheduleKeyDeletion (key\n policy)

\n

\n Related operations\n

\n " + } + }, + "com.amazonaws.kms#ScheduleKeyDeletionRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The unique identifier of the KMS key to delete.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "PendingWindowInDays": { + "target": "com.amazonaws.kms#PendingWindowInDaysType", + "traits": { + "smithy.api#documentation": "

The waiting period, specified in number of days. After the waiting period ends, KMS\n deletes the KMS key.

\n

If the KMS key is a multi-Region primary key with replicas, the waiting period begins when\n the last of its replica keys is deleted. Otherwise, the waiting period begins\n immediately.

\n

This value is optional. If you include a value, it must be between 7 and 30, inclusive. If\n you do not include a value, it defaults to 30.

" + } + } + } + }, + "com.amazonaws.kms#ScheduleKeyDeletionResponse": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the KMS key whose deletion is scheduled.

" + } + }, + "DeletionDate": { + "target": "com.amazonaws.kms#DateType", + "traits": { + "smithy.api#documentation": "

The date and time after which KMS deletes the KMS key.

\n

If the KMS key is a multi-Region primary key with replica keys, this field does not\n appear. The deletion date for the primary key isn't known until its last replica key is\n deleted.

" + } + }, + "KeyState": { + "target": "com.amazonaws.kms#KeyState", + "traits": { + "smithy.api#documentation": "

The current status of the KMS key.

\n

For more information about how key state affects the use of a KMS key, see Key state: Effect on your KMS\n key in the Key Management Service Developer Guide.

" + } + }, + "PendingWindowInDays": { + "target": "com.amazonaws.kms#PendingWindowInDaysType", + "traits": { + "smithy.api#documentation": "

The waiting period before the KMS key is deleted.

\n

If the KMS key is a multi-Region primary key with replicas, the waiting period begins when\n the last of its replica keys is deleted. Otherwise, the waiting period begins\n immediately.

" + } + } + } + }, + "com.amazonaws.kms#Sign": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#SignRequest" + }, + "output": { + "target": "com.amazonaws.kms#SignResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#InvalidKeyUsageException" + }, + { + "target": "com.amazonaws.kms#KeyUnavailableException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Creates a digital\n signature for a message or message digest by using the private key in an asymmetric\n KMS key. To verify the signature, use the Verify operation, or use the\n public key in the same asymmetric KMS key outside of KMS. For information about symmetric and asymmetric KMS keys, see Using Symmetric and Asymmetric KMS keys in the Key Management Service Developer Guide.

\n

Digital signatures are generated and verified by using asymmetric key pair, such as an RSA\n or ECC pair that is represented by an asymmetric KMS key. The key owner (or an authorized\n user) uses their private key to sign a message. Anyone with the public key can verify that the\n message was signed with that particular private key and that the message hasn't changed since\n it was signed.

\n

To use the Sign operation, provide the following information:

\n
    \n
  • \n

    Use the KeyId parameter to identify an asymmetric KMS key with a\n KeyUsage value of SIGN_VERIFY. To get the\n KeyUsage value of a KMS key, use the DescribeKey\n operation. The caller must have kms:Sign permission on the KMS key.

    \n
  • \n
  • \n

    Use the Message parameter to specify the message or message digest to\n sign. You can submit messages of up to 4096 bytes. To sign a larger message, generate a\n hash digest of the message, and then provide the hash digest in the Message\n parameter. To indicate whether the message is a full message or a digest, use the\n MessageType parameter.

    \n
  • \n
  • \n

    Choose a signing algorithm that is compatible with the KMS key.

    \n
  • \n
\n \n

When signing a message, be sure to record the KMS key and the signing algorithm. This\n information is required to verify the signature.

\n
\n

To verify the signature that this operation generates, use the Verify\n operation. Or use the GetPublicKey operation to download the public key and\n then use the public key to verify the signature outside of KMS.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:Sign (key policy)

\n

\n Related operations: Verify\n

" + } + }, + "com.amazonaws.kms#SignRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies an asymmetric KMS key. KMS uses the private key in the asymmetric KMS key to\n sign the message. The KeyUsage type of the KMS key must be\n SIGN_VERIFY. To find the KeyUsage of a KMS key, use the DescribeKey operation.

\n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", + "smithy.api#required": {} + } + }, + "Message": { + "target": "com.amazonaws.kms#PlaintextType", + "traits": { + "smithy.api#documentation": "

Specifies the message or message digest to sign. Messages can be 0-4096 bytes. To sign a\n larger message, provide the message digest.

\n

If you provide a message, KMS generates a hash digest of the message and then signs\n it.

", + "smithy.api#required": {} + } + }, + "MessageType": { + "target": "com.amazonaws.kms#MessageType", + "traits": { + "smithy.api#documentation": "

Tells KMS whether the value of the Message parameter is a message or\n message digest. The default value, RAW, indicates a message. To indicate a message digest,\n enter DIGEST.

" + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + }, + "SigningAlgorithm": { + "target": "com.amazonaws.kms#SigningAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

Specifies the signing algorithm to use when signing the message.

\n

Choose an algorithm that is compatible with the type and size of the specified asymmetric\n KMS key.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#SignResponse": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the asymmetric KMS key that was used to sign the message.

" + } + }, + "Signature": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

The cryptographic signature that was generated for the message.

\n
    \n
  • \n

    When used with the supported RSA signing algorithms, the encoding of this value is\n defined by PKCS #1 in RFC\n 8017.

    \n
  • \n
  • \n

    When used with the ECDSA_SHA_256, ECDSA_SHA_384, or\n ECDSA_SHA_512 signing algorithms, this value is a DER-encoded object as\n defined by ANS X9.62–2005 and RFC 3279 Section 2.2.3.\n This is the most commonly used signature format and is appropriate for most uses.\n

    \n
  • \n
\n

When you use the HTTP API or the Amazon Web Services CLI, the value is Base64-encoded. Otherwise, it is not Base64-encoded.

" + } + }, + "SigningAlgorithm": { + "target": "com.amazonaws.kms#SigningAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

The signing algorithm that was used to sign the message.

" + } + } + } + }, + "com.amazonaws.kms#SigningAlgorithmSpec": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "RSASSA_PSS_SHA_256", + "name": "RSASSA_PSS_SHA_256" + }, + { + "value": "RSASSA_PSS_SHA_384", + "name": "RSASSA_PSS_SHA_384" + }, + { + "value": "RSASSA_PSS_SHA_512", + "name": "RSASSA_PSS_SHA_512" + }, + { + "value": "RSASSA_PKCS1_V1_5_SHA_256", + "name": "RSASSA_PKCS1_V1_5_SHA_256" + }, + { + "value": "RSASSA_PKCS1_V1_5_SHA_384", + "name": "RSASSA_PKCS1_V1_5_SHA_384" + }, + { + "value": "RSASSA_PKCS1_V1_5_SHA_512", + "name": "RSASSA_PKCS1_V1_5_SHA_512" + }, + { + "value": "ECDSA_SHA_256", + "name": "ECDSA_SHA_256" + }, + { + "value": "ECDSA_SHA_384", + "name": "ECDSA_SHA_384" + }, + { + "value": "ECDSA_SHA_512", + "name": "ECDSA_SHA_512" + } + ] + } + }, + "com.amazonaws.kms#SigningAlgorithmSpecList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#SigningAlgorithmSpec" + } + }, + "com.amazonaws.kms#Tag": { + "type": "structure", + "members": { + "TagKey": { + "target": "com.amazonaws.kms#TagKeyType", + "traits": { + "smithy.api#documentation": "

The key of the tag.

", + "smithy.api#required": {} + } + }, + "TagValue": { + "target": "com.amazonaws.kms#TagValueType", + "traits": { + "smithy.api#documentation": "

The value of the tag.

", + "smithy.api#required": {} + } + } + }, + "traits": { + "smithy.api#documentation": "

A key-value pair. A tag consists of a tag key and a tag value. Tag keys and tag values are\n both required, but tag values can be empty (null) strings.

\n

For information about the rules that apply to tag keys and tag values, see User-Defined Tag Restrictions in the Amazon Web Services Billing and Cost Management\n User Guide.

" + } + }, + "com.amazonaws.kms#TagException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "TagException", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because one or more tags are not valid.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#TagKeyList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#TagKeyType" + } + }, + "com.amazonaws.kms#TagKeyType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 128 + } + } + }, + "com.amazonaws.kms#TagList": { + "type": "list", + "member": { + "target": "com.amazonaws.kms#Tag" + } + }, + "com.amazonaws.kms#TagResource": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#TagResourceRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#LimitExceededException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#TagException" + } + ], + "traits": { + "smithy.api#documentation": "

Adds or edits tags on a customer managed key.

\n \n

Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

Each tag consists of a tag key and a tag value, both of which are case-sensitive strings.\n The tag value can be an empty (null) string. To add a tag, specify a new tag key and a tag\n value. To edit a tag, specify an existing tag key and a new tag value.

\n

You can use this operation to tag a customer managed key, but you cannot\n tag an Amazon Web Services\n managed key, an Amazon Web Services owned key, a custom key\n store, or an alias.

\n

You can also add tags to a KMS key while creating it (CreateKey) or\n replicating it (ReplicateKey).

\n

For information about using tags in KMS, see Tagging keys. For general information about\n tags, including the format and syntax, see Tagging Amazon Web Services resources in the Amazon\n Web Services General Reference.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:TagResource (key policy)

\n

\n Related operations\n

\n " + } + }, + "com.amazonaws.kms#TagResourceRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies a customer managed key in the account and Region.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "Tags": { + "target": "com.amazonaws.kms#TagList", + "traits": { + "smithy.api#documentation": "

One or more tags.

\n

Each tag consists of a tag key and a tag value. The tag value can be an empty (null)\n string.

\n

You cannot have more than one tag on a KMS key with the same tag key. If you specify an\n existing tag key with a different tag value, KMS replaces the current tag value with the\n specified one.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#TagValueType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 0, + "max": 256 + } + } + }, + "com.amazonaws.kms#TrentService": { + "type": "service", + "version": "2014-11-01", + "operations": [ + { + "target": "com.amazonaws.kms#CancelKeyDeletion" + }, + { + "target": "com.amazonaws.kms#ConnectCustomKeyStore" + }, + { + "target": "com.amazonaws.kms#CreateAlias" + }, + { + "target": "com.amazonaws.kms#CreateCustomKeyStore" + }, + { + "target": "com.amazonaws.kms#CreateGrant" + }, + { + "target": "com.amazonaws.kms#CreateKey" + }, + { + "target": "com.amazonaws.kms#Decrypt" + }, + { + "target": "com.amazonaws.kms#DeleteAlias" + }, + { + "target": "com.amazonaws.kms#DeleteCustomKeyStore" + }, + { + "target": "com.amazonaws.kms#DeleteImportedKeyMaterial" + }, + { + "target": "com.amazonaws.kms#DescribeCustomKeyStores" + }, + { + "target": "com.amazonaws.kms#DescribeKey" + }, + { + "target": "com.amazonaws.kms#DisableKey" + }, + { + "target": "com.amazonaws.kms#DisableKeyRotation" + }, + { + "target": "com.amazonaws.kms#DisconnectCustomKeyStore" + }, + { + "target": "com.amazonaws.kms#EnableKey" + }, + { + "target": "com.amazonaws.kms#EnableKeyRotation" + }, + { + "target": "com.amazonaws.kms#Encrypt" + }, + { + "target": "com.amazonaws.kms#GenerateDataKey" + }, + { + "target": "com.amazonaws.kms#GenerateDataKeyPair" + }, + { + "target": "com.amazonaws.kms#GenerateDataKeyPairWithoutPlaintext" + }, + { + "target": "com.amazonaws.kms#GenerateDataKeyWithoutPlaintext" + }, + { + "target": "com.amazonaws.kms#GenerateRandom" + }, + { + "target": "com.amazonaws.kms#GetKeyPolicy" + }, + { + "target": "com.amazonaws.kms#GetKeyRotationStatus" + }, + { + "target": "com.amazonaws.kms#GetParametersForImport" + }, + { + "target": "com.amazonaws.kms#GetPublicKey" + }, + { + "target": "com.amazonaws.kms#ImportKeyMaterial" + }, + { + "target": "com.amazonaws.kms#ListAliases" + }, + { + "target": "com.amazonaws.kms#ListGrants" + }, + { + "target": "com.amazonaws.kms#ListKeyPolicies" + }, + { + "target": "com.amazonaws.kms#ListResourceTags" + }, + { + "target": "com.amazonaws.kms#PutKeyPolicy" + }, + { + "target": "com.amazonaws.kms#ReEncrypt" + }, + { + "target": "com.amazonaws.kms#ReplicateKey" + }, + { + "target": "com.amazonaws.kms#RetireGrant" + }, + { + "target": "com.amazonaws.kms#RevokeGrant" + }, + { + "target": "com.amazonaws.kms#ScheduleKeyDeletion" + }, + { + "target": "com.amazonaws.kms#Sign" + }, + { + "target": "com.amazonaws.kms#TagResource" + }, + { + "target": "com.amazonaws.kms#UntagResource" + }, + { + "target": "com.amazonaws.kms#UpdateAlias" + }, + { + "target": "com.amazonaws.kms#UpdateCustomKeyStore" + }, + { + "target": "com.amazonaws.kms#UpdateKeyDescription" + }, + { + "target": "com.amazonaws.kms#UpdatePrimaryRegion" + }, + { + "target": "com.amazonaws.kms#Verify" + } + ], + "traits": { + "aws.api#service": { + "sdkId": "KMS", + "arnNamespace": "kms", + "cloudFormationName": "KMS", + "cloudTrailEventSource": "kms.amazonaws.com", + "endpointPrefix": "kms" + }, + "aws.auth#sigv4": { + "name": "kms" + }, + "aws.protocols#awsJson1_1": {}, + "smithy.api#documentation": "Key Management Service\n

Key Management Service (KMS) is an encryption and key management web service. This guide describes\n the KMS operations that you can call programmatically. For general information about KMS,\n see the \n Key Management Service Developer Guide\n .

\n \n

KMS is replacing the term customer master key (CMK) with KMS key and KMS key. The concept has not changed. To prevent breaking changes, KMS is keeping some variations of this term.

\n

Amazon Web Services provides SDKs that consist of libraries and sample code for various programming\n languages and platforms (Java, Ruby, .Net, macOS, Android, etc.). The SDKs provide a\n convenient way to create programmatic access to KMS and other Amazon Web Services services. For example,\n the SDKs take care of tasks such as signing requests (see below), managing errors, and\n retrying requests automatically. For more information about the Amazon Web Services SDKs, including how to\n download and install them, see Tools for Amazon Web\n Services.

\n
\n

We recommend that you use the Amazon Web Services SDKs to make programmatic API calls to KMS.

\n

Clients must support TLS (Transport Layer Security) 1.0. We recommend TLS 1.2. Clients\n must also support cipher suites with Perfect Forward Secrecy (PFS) such as Ephemeral\n Diffie-Hellman (DHE) or Elliptic Curve Ephemeral Diffie-Hellman (ECDHE). Most modern systems\n such as Java 7 and later support these modes.

\n

\n Signing Requests\n

\n

Requests must be signed by using an access key ID and a secret access key. We strongly\n recommend that you do not use your Amazon Web Services account (root) access key ID and\n secret key for everyday work with KMS. Instead, use the access key ID and secret access key\n for an IAM user. You can also use the Amazon Web Services Security Token Service to generate temporary\n security credentials that you can use to sign requests.

\n

All KMS operations require Signature Version 4.

\n

\n Logging API Requests\n

\n

KMS supports CloudTrail, a service that logs Amazon Web Services API calls and related events for your\n Amazon Web Services account and delivers them to an Amazon S3 bucket that you specify. By using the\n information collected by CloudTrail, you can determine what requests were made to KMS, who made\n the request, when it was made, and so on. To learn more about CloudTrail, including how to turn it\n on and find your log files, see the CloudTrail User Guide.

\n

\n Additional Resources\n

\n

For more information about credentials and request signing, see the following:

\n \n

\n Commonly Used API Operations\n

\n

Of the API operations discussed in this guide, the following will prove the most useful\n for most applications. You will likely perform operations other than these, such as creating\n keys and assigning policies, by using the console.

\n ", + "smithy.api#title": "AWS Key Management Service", + "smithy.api#xmlNamespace": { + "uri": "https://trent.amazonaws.com/doc/2014-11-01/" + } + } + }, + "com.amazonaws.kms#TrustAnchorCertificateType": { + "type": "string", + "traits": { + "smithy.api#length": { + "min": 1, + "max": 5000 + } + } + }, + "com.amazonaws.kms#UnsupportedOperationException": { + "type": "structure", + "members": { + "message": { + "target": "com.amazonaws.kms#ErrorMessageType" + } + }, + "traits": { + "aws.protocols#awsQueryError": { + "code": "UnsupportedOperation", + "httpResponseCode": 400 + }, + "smithy.api#documentation": "

The request was rejected because a specified parameter is not supported or a specified\n resource is not valid for this operation.

", + "smithy.api#error": "client", + "smithy.api#httpError": 400 + } + }, + "com.amazonaws.kms#UntagResource": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#UntagResourceRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#TagException" + } + ], + "traits": { + "smithy.api#documentation": "

Deletes tags from a customer managed key. To delete a tag,\n specify the tag key and the KMS key.

\n \n

Tagging or untagging a KMS key can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

When it succeeds, the UntagResource operation doesn't return any output.\n Also, if the specified tag key isn't found on the KMS key, it doesn't throw an exception or\n return a response. To confirm that the operation worked, use the ListResourceTags operation.

\n\n

For information about using tags in KMS, see Tagging keys. For general information about\n tags, including the format and syntax, see Tagging Amazon Web Services resources in the Amazon\n Web Services General Reference.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:UntagResource (key policy)

\n

\n Related operations\n

\n " + } + }, + "com.amazonaws.kms#UntagResourceRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the KMS key from which you are removing tags.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "TagKeys": { + "target": "com.amazonaws.kms#TagKeyList", + "traits": { + "smithy.api#documentation": "

One or more tag keys. Specify only the tag keys, not the tag values.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#UpdateAlias": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#UpdateAliasRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#LimitExceededException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Associates an existing KMS alias with a different KMS key. Each alias is associated with\n only one KMS key at a time, although a KMS key can have multiple aliases. The alias and the\n KMS key must be in the same Amazon Web Services account and Region.

\n \n

Adding, deleting, or updating an alias can allow or deny permission to the KMS key. For details, see Using ABAC in KMS in the Key Management Service Developer Guide.

\n
\n

The current and new KMS key must be the same type (both symmetric or both asymmetric), and\n they must have the same key usage (ENCRYPT_DECRYPT or SIGN_VERIFY).\n This restriction prevents errors in code that uses aliases. If you must assign an alias to a\n different type of KMS key, use DeleteAlias to delete the old alias and CreateAlias to create a new alias.

\n

You cannot use UpdateAlias to change an alias name. To change an alias name,\n use DeleteAlias to delete the old alias and CreateAlias to\n create a new alias.

\n

Because an alias is not a property of a KMS key, you can create, update, and delete the\n aliases of a KMS key without affecting the KMS key. Also, aliases do not appear in the\n response from the DescribeKey operation. To get the aliases of all KMS keys\n in the account, use the ListAliases operation.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n

\n Required permissions\n

\n \n

For details, see Controlling access to aliases in the\n Key Management Service Developer Guide.

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#UpdateAliasRequest": { + "type": "structure", + "members": { + "AliasName": { + "target": "com.amazonaws.kms#AliasNameType", + "traits": { + "smithy.api#documentation": "

Identifies the alias that is changing its KMS key. This value must begin with\n alias/ followed by the alias name, such as alias/ExampleAlias. You\n cannot use UpdateAlias to change the alias name.

", + "smithy.api#required": {} + } + }, + "TargetKeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the customer managed key to associate with the alias. You don't have permission to\n associate an alias with an Amazon Web Services managed key.

\n

The KMS key must be in the same Amazon Web Services account and Region as the alias. Also, the new\n target KMS key must be the same type as the current target KMS key (both symmetric or both\n asymmetric) and they must have the same key usage.

\n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

\n

To\n verify that the alias is mapped to the correct KMS key, use ListAliases.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#UpdateCustomKeyStore": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#UpdateCustomKeyStoreRequest" + }, + "output": { + "target": "com.amazonaws.kms#UpdateCustomKeyStoreResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#CloudHsmClusterInvalidConfigurationException" + }, + { + "target": "com.amazonaws.kms#CloudHsmClusterNotActiveException" + }, + { + "target": "com.amazonaws.kms#CloudHsmClusterNotFoundException" + }, + { + "target": "com.amazonaws.kms#CloudHsmClusterNotRelatedException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreInvalidStateException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreNameInUseException" + }, + { + "target": "com.amazonaws.kms#CustomKeyStoreNotFoundException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + } + ], + "traits": { + "smithy.api#documentation": "

Changes the properties of a custom key store. Use the CustomKeyStoreId\n parameter to identify the custom key store you want to edit. Use the remaining parameters to\n change the properties of the custom key store.

\n

You can only update a custom key store that is disconnected. To disconnect the custom key\n store, use DisconnectCustomKeyStore. To reconnect the custom key store after\n the update completes, use ConnectCustomKeyStore. To find the connection\n state of a custom key store, use the DescribeCustomKeyStores\n operation.

\n

The CustomKeyStoreId parameter is required in all commands. Use the other\n parameters of UpdateCustomKeyStore to edit your key store settings.

\n
    \n
  • \n

    Use the NewCustomKeyStoreName parameter to change the friendly name of\n the custom key store to the value that you specify.

    \n

    \n
  • \n
  • \n

    Use the KeyStorePassword parameter tell KMS the current password of the\n \n kmsuser crypto user (CU) in the associated CloudHSM cluster. You\n can use this parameter to fix connection\n failures that occur when KMS cannot log into the associated cluster because\n the kmsuser password has changed. This value does not change the password in\n the CloudHSM cluster.

    \n

    \n
  • \n
  • \n

    Use the CloudHsmClusterId parameter to associate the custom key store\n with a different, but related, CloudHSM cluster. You can use this parameter to repair a\n custom key store if its CloudHSM cluster becomes corrupted or is deleted, or when you need to\n create or restore a cluster from a backup.

    \n
  • \n
\n

If the operation succeeds, it returns a JSON object with no\nproperties.

\n

This operation is part of the Custom Key Store feature feature in KMS, which\ncombines the convenience and extensive integration of KMS with the isolation and control of a\nsingle-tenant key store.

\n

\n Cross-account\n use: No. You cannot perform this operation on a custom key store in a different Amazon Web Services account.

\n

\n Required permissions: kms:UpdateCustomKeyStore (IAM policy)

\n

\n Related operations:\n

\n " + } + }, + "com.amazonaws.kms#UpdateCustomKeyStoreRequest": { + "type": "structure", + "members": { + "CustomKeyStoreId": { + "target": "com.amazonaws.kms#CustomKeyStoreIdType", + "traits": { + "smithy.api#documentation": "

Identifies the custom key store that you want to update. Enter the ID of the custom key\n store. To find the ID of a custom key store, use the DescribeCustomKeyStores operation.

", + "smithy.api#required": {} + } + }, + "NewCustomKeyStoreName": { + "target": "com.amazonaws.kms#CustomKeyStoreNameType", + "traits": { + "smithy.api#documentation": "

Changes the friendly name of the custom key store to the value that you specify. The\n custom key store name must be unique in the Amazon Web Services account.

" + } + }, + "KeyStorePassword": { + "target": "com.amazonaws.kms#KeyStorePasswordType", + "traits": { + "smithy.api#documentation": "

Enter the current password of the kmsuser crypto user (CU) in the CloudHSM\n cluster that is associated with the custom key store.

\n

This parameter tells KMS the current password of the kmsuser crypto user\n (CU). It does not set or change the password of any users in the CloudHSM cluster.

" + } + }, + "CloudHsmClusterId": { + "target": "com.amazonaws.kms#CloudHsmClusterIdType", + "traits": { + "smithy.api#documentation": "

Associates the custom key store with a related CloudHSM cluster.

\n

Enter the cluster ID of the cluster that you used to create the custom key store or a\n cluster that shares a backup history and has the same cluster certificate as the original\n cluster. You cannot use this parameter to associate a custom key store with an unrelated\n cluster. In addition, the replacement cluster must fulfill the requirements for\n a cluster associated with a custom key store. To view the cluster certificate of a cluster,\n use the DescribeClusters operation.

" + } + } + } + }, + "com.amazonaws.kms#UpdateCustomKeyStoreResponse": { + "type": "structure", + "members": {} + }, + "com.amazonaws.kms#UpdateKeyDescription": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#UpdateKeyDescriptionRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Updates the description of a KMS key. To see the description of a KMS key, use DescribeKey.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account\n use: No. You cannot perform this operation on a KMS key in a different Amazon Web Services account.

\n\n

\n Required permissions: kms:UpdateKeyDescription (key policy)

\n

\n Related operations\n

\n " + } + }, + "com.amazonaws.kms#UpdateKeyDescriptionRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Updates the description of the specified KMS key.

\n \n

Specify the key ID or key ARN of the KMS key.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "Description": { + "target": "com.amazonaws.kms#DescriptionType", + "traits": { + "smithy.api#documentation": "

New description for the KMS key.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#UpdatePrimaryRegion": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#UpdatePrimaryRegionRequest" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidArnException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + }, + { + "target": "com.amazonaws.kms#UnsupportedOperationException" + } + ], + "traits": { + "smithy.api#documentation": "

Changes the primary key of a multi-Region key.

\n

This operation changes the replica key in the specified Region to a primary key and\n changes the former primary key to a replica key. For example, suppose you have a primary key\n in us-east-1 and a replica key in eu-west-2. If you run\n UpdatePrimaryRegion with a PrimaryRegion value of\n eu-west-2, the primary key is now the key in eu-west-2, and the\n key in us-east-1 becomes a replica key. For details, see Updating the primary Region in the Key Management Service Developer Guide.

\n

This operation supports multi-Region keys, an KMS feature that lets you create multiple\n interoperable KMS keys in different Amazon Web Services Regions. Because these KMS keys have the same key ID, key\n material, and other metadata, you can use them interchangeably to encrypt data in one Amazon Web Services Region and decrypt\n it in a different Amazon Web Services Region without re-encrypting the data or making a cross-Region call. For more information about multi-Region keys, see Using multi-Region keys in the Key Management Service Developer Guide.

\n

The primary key of a multi-Region key is the source for properties\n that are always shared by primary and replica keys, including the key material, key ID, key spec, key usage, key material\n origin, and automatic\n key rotation. It's the only key that can be replicated. You cannot delete the primary\n key until all replica keys are deleted.

\n

The key ID and primary Region that you specify uniquely identify the replica key that will\n become the primary key. The primary Region must already have a replica key. This operation\n does not create a KMS key in the specified Region. To find the replica keys, use the DescribeKey operation on the primary key or any replica key. To create a replica\n key, use the ReplicateKey operation.

\n

You can run this operation while using the affected multi-Region keys in cryptographic\n operations. This operation should not delay, interrupt, or cause failures in cryptographic\n operations.

\n

Even after this operation completes, the process of updating the primary Region might\n still be in progress for a few more seconds. Operations such as DescribeKey might\n display both the old and new primary keys as replicas. The old and new primary keys have a\n transient key state of Updating. The original key state is restored when the\n update is complete. While the key state is Updating, you can use the keys in\n cryptographic operations, but you cannot replicate the new primary key or perform certain\n management operations, such as enabling or disabling these keys. For details about the\n Updating key state, see Key state:\n Effect on your KMS key in the Key Management Service Developer Guide.

\n

This operation does not return any output. To verify that primary key is changed, use the\n DescribeKey operation.

\n

\n Cross-account use: No. You cannot use this operation in a\n different Amazon Web Services account.

\n

\n Required permissions:

\n
    \n
  • \n

    \n kms:UpdatePrimaryRegion on the current primary key (in the primary key's\n Region). Include this permission primary key's key policy.

    \n
  • \n
  • \n

    \n kms:UpdatePrimaryRegion on the current replica key (in the replica key's\n Region). Include this permission in the replica key's key policy.

    \n
  • \n
\n

\n Related operations\n

\n " + } + }, + "com.amazonaws.kms#UpdatePrimaryRegionRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the current primary key. When the operation completes, this KMS key will be a\n replica key.

\n

Specify the key ID or key ARN of a multi-Region primary key.

\n

For example:

\n
    \n
  • \n

    Key ID: mrk-1234abcd12ab34cd56ef1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/mrk-1234abcd12ab34cd56ef1234567890ab\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey.

", + "smithy.api#required": {} + } + }, + "PrimaryRegion": { + "target": "com.amazonaws.kms#RegionType", + "traits": { + "smithy.api#documentation": "

The Amazon Web Services Region of the new primary key. Enter the Region ID, such as\n us-east-1 or ap-southeast-2. There must be an existing replica key\n in this Region.

\n

When the operation completes, the multi-Region key in this Region will be the primary\n key.

", + "smithy.api#required": {} + } + } + } + }, + "com.amazonaws.kms#Verify": { + "type": "operation", + "input": { + "target": "com.amazonaws.kms#VerifyRequest" + }, + "output": { + "target": "com.amazonaws.kms#VerifyResponse" + }, + "errors": [ + { + "target": "com.amazonaws.kms#DependencyTimeoutException" + }, + { + "target": "com.amazonaws.kms#DisabledException" + }, + { + "target": "com.amazonaws.kms#InvalidGrantTokenException" + }, + { + "target": "com.amazonaws.kms#InvalidKeyUsageException" + }, + { + "target": "com.amazonaws.kms#KeyUnavailableException" + }, + { + "target": "com.amazonaws.kms#KMSInternalException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidSignatureException" + }, + { + "target": "com.amazonaws.kms#KMSInvalidStateException" + }, + { + "target": "com.amazonaws.kms#NotFoundException" + } + ], + "traits": { + "smithy.api#documentation": "

Verifies a digital signature that was generated by the Sign operation.

\n

\n

Verification confirms that an authorized user signed the message with the specified KMS\n key and signing algorithm, and the message hasn't changed since it was signed. If the\n signature is verified, the value of the SignatureValid field in the response is\n True. If the signature verification fails, the Verify operation\n fails with an KMSInvalidSignatureException exception.

\n

A digital signature is generated by using the private key in an asymmetric KMS key. The\n signature is verified by using the public key in the same asymmetric KMS key.\n For information about symmetric and asymmetric KMS keys, see Using Symmetric and Asymmetric KMS keys in the Key Management Service Developer Guide.

\n

To verify a digital signature, you can use the Verify operation. Specify the\n same asymmetric KMS key, message, and signing algorithm that were used to produce the\n signature.

\n

You can also verify the digital signature by using the public key of the KMS key outside\n of KMS. Use the GetPublicKey operation to download the public key in the\n asymmetric KMS key and then use the public key to verify the signature outside of KMS. The\n advantage of using the Verify operation is that it is performed within KMS. As\n a result, it's easy to call, the operation is performed within the FIPS boundary, it is logged\n in CloudTrail, and you can use key policy and IAM policy to determine who is authorized to use\n the KMS key to verify signatures.

\n

The KMS key that you use for this operation must be in a compatible key state. For\ndetails, see Key state: Effect on your KMS key in the Key Management Service Developer Guide.

\n

\n Cross-account use: Yes. To perform this operation with a KMS key in a different Amazon Web Services account, specify\n the key ARN or alias ARN in the value of the KeyId parameter.

\n\n

\n Required permissions: kms:Verify (key policy)

\n

\n Related operations: Sign\n

" + } + }, + "com.amazonaws.kms#VerifyRequest": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

Identifies the asymmetric KMS key that will be used to verify the signature. This must be\n the same KMS key that was used to generate the signature. If you specify a different KMS key,\n the signature verification fails.

\n

To specify a KMS key, use its key ID, key ARN, alias name, or alias ARN. When using an alias name, prefix it with \"alias/\". To specify a KMS key in a different Amazon Web Services account, you must use the key ARN or alias ARN.

\n

For example:

\n
    \n
  • \n

    Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Key ARN: arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab\n

    \n
  • \n
  • \n

    Alias name: alias/ExampleAlias\n

    \n
  • \n
  • \n

    Alias ARN: arn:aws:kms:us-east-2:111122223333:alias/ExampleAlias\n

    \n
  • \n
\n

To get the key ID and key ARN for a KMS key, use ListKeys or DescribeKey. To get the alias name and alias ARN, use ListAliases.

", + "smithy.api#required": {} + } + }, + "Message": { + "target": "com.amazonaws.kms#PlaintextType", + "traits": { + "smithy.api#documentation": "

Specifies the message that was signed. You can submit a raw message of up to 4096 bytes,\n or a hash digest of the message. If you submit a digest, use the MessageType\n parameter with a value of DIGEST.

\n

If the message specified here is different from the message that was signed, the signature\n verification fails. A message and its hash digest are considered to be the same\n message.

", + "smithy.api#required": {} + } + }, + "MessageType": { + "target": "com.amazonaws.kms#MessageType", + "traits": { + "smithy.api#documentation": "

Tells KMS whether the value of the Message parameter is a message or\n message digest. The default value, RAW, indicates a message. To indicate a message digest,\n enter DIGEST.

\n \n

Use the DIGEST value only when the value of the Message\n parameter is a message digest. If you use the DIGEST value with a raw message,\n the security of the verification operation can be compromised.

\n
" + } + }, + "Signature": { + "target": "com.amazonaws.kms#CiphertextType", + "traits": { + "smithy.api#documentation": "

The signature that the Sign operation generated.

", + "smithy.api#required": {} + } + }, + "SigningAlgorithm": { + "target": "com.amazonaws.kms#SigningAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

The signing algorithm that was used to sign the message. If you submit a different\n algorithm, the signature verification fails.

", + "smithy.api#required": {} + } + }, + "GrantTokens": { + "target": "com.amazonaws.kms#GrantTokenList", + "traits": { + "smithy.api#documentation": "

A list of grant tokens.

\n

Use a grant token when your permission to call this operation comes from a new grant that has not yet achieved eventual consistency. For more information, see Grant token and Using a grant token in the\n Key Management Service Developer Guide.

" + } + } + } + }, + "com.amazonaws.kms#VerifyResponse": { + "type": "structure", + "members": { + "KeyId": { + "target": "com.amazonaws.kms#KeyIdType", + "traits": { + "smithy.api#documentation": "

The Amazon Resource Name (key ARN) of the asymmetric KMS key that was used to verify the signature.

" + } + }, + "SignatureValid": { + "target": "com.amazonaws.kms#BooleanType", + "traits": { + "smithy.api#documentation": "

A Boolean value that indicates whether the signature was verified. A value of\n True indicates that the Signature was produced by signing the\n Message with the specified KeyID and\n SigningAlgorithm. If the signature is not verified, the Verify\n operation fails with a KMSInvalidSignatureException exception.

" + } + }, + "SigningAlgorithm": { + "target": "com.amazonaws.kms#SigningAlgorithmSpec", + "traits": { + "smithy.api#documentation": "

The signing algorithm that was used to verify the signature.

" + } + } + } + }, + "com.amazonaws.kms#WrappingKeySpec": { + "type": "string", + "traits": { + "smithy.api#enum": [ + { + "value": "RSA_2048", + "name": "RSA_2048" + } + ] + } } + } } diff --git a/TestModels/aws-sdks/kms/README.md b/TestModels/aws-sdks/kms/README.md index daf5c1ab26..f4c8292aff 100644 --- a/TestModels/aws-sdks/kms/README.md +++ b/TestModels/aws-sdks/kms/README.md @@ -5,27 +5,33 @@ This project tests the [AWS KMS](https://aws.amazon.com/kms/) Operations `Encryp NOTE: The `model.json` in this project comes from [private-aws-encryption-sdk-dafny-staging/ComAmazonawsKms/Model/](https://github.com/aws/private-aws-encryption-sdk-dafny-staging/tree/v4-seperate-modules/ComAmazonawsKms/Model), and is different from the standard model at https://github.com/aws/aws-models/kms/ ## Build + ### .NET + 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dafny polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` ## Development + 1. To add another target runtime support, edit the `Makefile` and add the appropriate recipe to generate the `polymorph` wrappers, and dafny transpilation. 2. Provide any glue code between dafny and target runtime if required. 3. Build, execute, and test in the target runtime. -*Example* +_Example_ -`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. \ No newline at end of file +`--output-dotnet ` in the `gradlew run` is used to generate the polymorph wrappers. Similarly `--compileTarget:` flags is used in dafny recipe to transpile to C#. diff --git a/TestModels/aws-sdks/kms/runtimes/java/src/main/java/software/amazon/cryptography/services/kms/internal/__default.java b/TestModels/aws-sdks/kms/runtimes/java/src/main/java/software/amazon/cryptography/services/kms/internal/__default.java index 27ee6dbcc2..6d5fc7f4e4 100644 --- a/TestModels/aws-sdks/kms/runtimes/java/src/main/java/software/amazon/cryptography/services/kms/internal/__default.java +++ b/TestModels/aws-sdks/kms/runtimes/java/src/main/java/software/amazon/cryptography/services/kms/internal/__default.java @@ -3,71 +3,76 @@ // Extern code for AWS SDK for Java V2 package software.amazon.cryptography.services.kms.internaldafny; +import static software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence; +import static software.amazon.smithy.dafny.conversion.ToNative.Simple.String; + +import StandardLibraryInterop_Compile.WrappersInterop; +import Wrappers_Compile.Option; +import Wrappers_Compile.Result; import dafny.DafnySequence; import software.amazon.awssdk.regions.Region; import software.amazon.awssdk.regions.providers.AwsRegionProviderChain; import software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain; import software.amazon.awssdk.services.kms.KmsClient; import software.amazon.awssdk.services.kms.KmsClientBuilder; - import software.amazon.cryptography.services.kms.internaldafny.types.Error; import software.amazon.cryptography.services.kms.internaldafny.types.IKMSClient; -import StandardLibraryInterop_Compile.WrappersInterop; -import Wrappers_Compile.Option; -import Wrappers_Compile.Result; -import static software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence; -import static software.amazon.smithy.dafny.conversion.ToNative.Simple.String; +public class __default + extends software.amazon.cryptography.services.kms.internaldafny._ExternBase___default { -public class __default extends software.amazon.cryptography.services.kms.internaldafny._ExternBase___default{ - public static Result KMSClient() { - try { - KmsClientBuilder builder = KmsClient.builder(); - AwsRegionProviderChain regionProvider = DefaultAwsRegionProviderChain.builder().build(); - String region = regionProvider.getRegion().toString(); - KmsClient client = builder.build(); - IKMSClient shim = new Shim(client, region); - return CreateSuccessOfClient(shim); - } catch (Exception e) { - Error dafny_error = Error.create_KMSInternalException( - WrappersInterop.CreateStringSome(CharacterSequence(e.getMessage()))); - return CreateFailureOfError(dafny_error); - } + public static Result KMSClient() { + try { + KmsClientBuilder builder = KmsClient.builder(); + AwsRegionProviderChain regionProvider = DefaultAwsRegionProviderChain + .builder() + .build(); + String region = regionProvider.getRegion().toString(); + KmsClient client = builder.build(); + IKMSClient shim = new Shim(client, region); + return CreateSuccessOfClient(shim); + } catch (Exception e) { + Error dafny_error = Error.create_KMSInternalException( + WrappersInterop.CreateStringSome(CharacterSequence(e.getMessage())) + ); + return CreateFailureOfError(dafny_error); } + } - public static Result KMSClient(final String region) { - try { - KmsClientBuilder builder = KmsClient.builder(); - KmsClient client = builder.region(Region.of(region)).build(); - IKMSClient shim = new Shim(client, region); - return CreateSuccessOfClient(shim); - } catch (Exception e) { - Error dafny_error = Error.create_KMSInternalException( - WrappersInterop.CreateStringSome(CharacterSequence(e.getMessage()))); - return CreateFailureOfError(dafny_error); - } + public static Result KMSClient(final String region) { + try { + KmsClientBuilder builder = KmsClient.builder(); + KmsClient client = builder.region(Region.of(region)).build(); + IKMSClient shim = new Shim(client, region); + return CreateSuccessOfClient(shim); + } catch (Exception e) { + Error dafny_error = Error.create_KMSInternalException( + WrappersInterop.CreateStringSome(CharacterSequence(e.getMessage())) + ); + return CreateFailureOfError(dafny_error); } + } - public static Wrappers_Compile.Option RegionMatch( - final IKMSClient client, - final DafnySequence region - ) { - // We should never be passing anything other than Shim as the 'client'. - // If this cast fails, that indicates that there is something wrong with - // our code generation. - Shim shim = (Shim) client; - - // If the client was created externally we - // have no way to determine what region it is - // configured with. - if (shim.region() == null) { - return WrappersInterop.CreateBooleanNone(); - } + public static Wrappers_Compile.Option RegionMatch( + final IKMSClient client, + final DafnySequence region + ) { + // We should never be passing anything other than Shim as the 'client'. + // If this cast fails, that indicates that there is something wrong with + // our code generation. + Shim shim = (Shim) client; - // Otherwise we kept record of the region - // when we created the client. - String shimRegion = shim.region(); - String regionStr = String(region); - return WrappersInterop.CreateBooleanSome(regionStr.equals(shimRegion)); + // If the client was created externally we + // have no way to determine what region it is + // configured with. + if (shim.region() == null) { + return WrappersInterop.CreateBooleanNone(); } + + // Otherwise we kept record of the region + // when we created the client. + String shimRegion = shim.region(); + String regionStr = String(region); + return WrappersInterop.CreateBooleanSome(regionStr.equals(shimRegion)); + } } diff --git a/TestModels/aws-sdks/kms/runtimes/java/src/main/java/software/amazon/cryptography/services/kms/internal/types/__default.java b/TestModels/aws-sdks/kms/runtimes/java/src/main/java/software/amazon/cryptography/services/kms/internal/types/__default.java index 1085954f4a..d9e198bee3 100644 --- a/TestModels/aws-sdks/kms/runtimes/java/src/main/java/software/amazon/cryptography/services/kms/internal/types/__default.java +++ b/TestModels/aws-sdks/kms/runtimes/java/src/main/java/software/amazon/cryptography/services/kms/internal/types/__default.java @@ -2,4 +2,5 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.cryptography.services.kms.internaldafny.types; -public class __default extends software.amazon.cryptography.services.kms.internaldafny.types._ExternBase___default {} +public class __default + extends software.amazon.cryptography.services.kms.internaldafny.types._ExternBase___default {} diff --git a/TestModels/aws-sdks/sqs-via-cli/Model/sqs.json b/TestModels/aws-sdks/sqs-via-cli/Model/sqs.json index 2f4ee5190c..02940651e7 100644 --- a/TestModels/aws-sdks/sqs-via-cli/Model/sqs.json +++ b/TestModels/aws-sdks/sqs-via-cli/Model/sqs.json @@ -4295,4 +4295,4 @@ } } } -} \ No newline at end of file +} diff --git a/TestModels/aws-sdks/sqs-via-cli/README.md b/TestModels/aws-sdks/sqs-via-cli/README.md index e8f67fe233..d929aee2ff 100644 --- a/TestModels/aws-sdks/sqs-via-cli/README.md +++ b/TestModels/aws-sdks/sqs-via-cli/README.md @@ -11,16 +11,19 @@ For more details, please see `TestModels/aws-sdks/sqs/README.md`. ### .NET 1. Generate the Wrappers using `polymorph` + ``` make polymorph_dafny polymorph_dotnet ``` 2. Transpile the tests (and implementation) to the target runtime. + ``` make transpile_net ``` 3. Generate the executable in the .NET and execute the tests + ``` make test_net ``` diff --git a/TestModels/aws-sdks/sqs/model/sqs.json b/TestModels/aws-sdks/sqs/model/sqs.json index 2f4ee5190c..02940651e7 100644 --- a/TestModels/aws-sdks/sqs/model/sqs.json +++ b/TestModels/aws-sdks/sqs/model/sqs.json @@ -4295,4 +4295,4 @@ } } } -} \ No newline at end of file +} diff --git a/TestModels/dafny-dependencies/README.md b/TestModels/dafny-dependencies/README.md index 499007a584..14375183fa 100644 --- a/TestModels/dafny-dependencies/README.md +++ b/TestModels/dafny-dependencies/README.md @@ -10,6 +10,7 @@ These dependencies are sourced from other repositories. Each dependency should have an update script. To update a dependency, execute: + ``` ./update.sh ``` @@ -26,6 +27,7 @@ Example: To update the `StandardLibrary`, which is developed in the ESDK-Dafny repo, in the `v4-seperate-modules` branch: + ``` ./update.sh /Users/tonyknap/workplace/ryan-new-world/private-aws-encryption-sdk-dafny-staging v4-seperate-modules ``` diff --git a/TestModels/dafny-dependencies/StandardLibrary/runtimes/java/src/main/java/UTF8/__default.java b/TestModels/dafny-dependencies/StandardLibrary/runtimes/java/src/main/java/UTF8/__default.java index c3171cdd88..010dbed431 100644 --- a/TestModels/dafny-dependencies/StandardLibrary/runtimes/java/src/main/java/UTF8/__default.java +++ b/TestModels/dafny-dependencies/StandardLibrary/runtimes/java/src/main/java/UTF8/__default.java @@ -2,6 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 package UTF8; +import static software.amazon.smithy.dafny.conversion.ToDafny.Simple.ByteSequence; +import static software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence; +import static software.amazon.smithy.dafny.conversion.ToNative.Simple.ByteBuffer; +import static software.amazon.smithy.dafny.conversion.ToNative.Simple.String; + +import Wrappers_Compile.Result; +import dafny.DafnySequence; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.charset.CharacterCodingException; @@ -10,14 +17,6 @@ import java.nio.charset.CharsetEncoder; import java.nio.charset.StandardCharsets; -import Wrappers_Compile.Result; -import dafny.DafnySequence; - -import static software.amazon.smithy.dafny.conversion.ToDafny.Simple.ByteSequence; -import static software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence; -import static software.amazon.smithy.dafny.conversion.ToNative.Simple.ByteBuffer; -import static software.amazon.smithy.dafny.conversion.ToNative.Simple.String; - // The only way to keep this thread/concurrent safe/ is // to create a new Coder everytime. // If we wanted to increase performance, @@ -25,50 +24,63 @@ // and reset the coder everytime. public class __default extends UTF8._ExternBase___default { - // This is largely copied from Polymorph's dafny-java-conversion: - // software.amazon.smithy.dafny.conversion.ToDafny.Simple.DafnyUtf8Bytes - public static Result< - DafnySequence, - DafnySequence> Encode( - final DafnySequence s) { - Charset utf8 = StandardCharsets.UTF_8; - // See thread/concurrent safe comment above class - CharsetEncoder coder = utf8.newEncoder(); - CharBuffer inBuffer = CharBuffer.wrap(String(s)); - inBuffer.position(0); - try { - ByteBuffer outBuffer = coder.encode(inBuffer); - // outBuffer's capacity can be much higher than the limit. - // By taking just the limit, we ensure we do not include - // any allocated but un-filled space. - return CreateEncodeSuccess( - (DafnySequence) ByteSequence(outBuffer, 0, outBuffer.limit())); - } catch (CharacterCodingException ex) { - return CreateEncodeFailure( - (DafnySequence) CharacterSequence("Could not encode input to Dafny Bytes.")); - } + // This is largely copied from Polymorph's dafny-java-conversion: + // software.amazon.smithy.dafny.conversion.ToDafny.Simple.DafnyUtf8Bytes + public static Result< + DafnySequence, + DafnySequence + > Encode(final DafnySequence s) { + Charset utf8 = StandardCharsets.UTF_8; + // See thread/concurrent safe comment above class + CharsetEncoder coder = utf8.newEncoder(); + CharBuffer inBuffer = CharBuffer.wrap(String(s)); + inBuffer.position(0); + try { + ByteBuffer outBuffer = coder.encode(inBuffer); + // outBuffer's capacity can be much higher than the limit. + // By taking just the limit, we ensure we do not include + // any allocated but un-filled space. + return CreateEncodeSuccess( + (DafnySequence) ByteSequence( + outBuffer, + 0, + outBuffer.limit() + ) + ); + } catch (CharacterCodingException ex) { + return CreateEncodeFailure( + (DafnySequence) CharacterSequence( + "Could not encode input to Dafny Bytes." + ) + ); } + } - // This is largely copied from Polymorph's dafny-java-conversion: - // software.amazon.smithy.dafny.conversion.ToNative.Simple.DafnyUtf8Bytes - public static Result< - DafnySequence, - DafnySequence> Decode( - final DafnySequence s) { - Charset utf8 = StandardCharsets.UTF_8; - // See thread/concurrent safe comment above class - CharsetDecoder coder = utf8.newDecoder(); - ByteBuffer inBuffer = ByteBuffer(s); - inBuffer.position(0); - try { - CharBuffer outBuffer = coder.decode(inBuffer); - outBuffer.position(0); - return CreateDecodeSuccess( - (DafnySequence) CharacterSequence(outBuffer.toString())); - } catch (CharacterCodingException ex) { - return CreateDecodeFailure( - (DafnySequence) CharacterSequence("Could not encode input to Dafny Bytes.")); - } + // This is largely copied from Polymorph's dafny-java-conversion: + // software.amazon.smithy.dafny.conversion.ToNative.Simple.DafnyUtf8Bytes + public static Result< + DafnySequence, + DafnySequence + > Decode(final DafnySequence s) { + Charset utf8 = StandardCharsets.UTF_8; + // See thread/concurrent safe comment above class + CharsetDecoder coder = utf8.newDecoder(); + ByteBuffer inBuffer = ByteBuffer(s); + inBuffer.position(0); + try { + CharBuffer outBuffer = coder.decode(inBuffer); + outBuffer.position(0); + return CreateDecodeSuccess( + (DafnySequence) CharacterSequence( + outBuffer.toString() + ) + ); + } catch (CharacterCodingException ex) { + return CreateDecodeFailure( + (DafnySequence) CharacterSequence( + "Could not encode input to Dafny Bytes." + ) + ); } - + } } diff --git a/TestModels/dafny-dependencies/dafny_runtime_rust/README.md b/TestModels/dafny-dependencies/dafny_runtime_rust/README.md index d7280c698c..1398c66af4 100644 --- a/TestModels/dafny-dependencies/dafny_runtime_rust/README.md +++ b/TestModels/dafny-dependencies/dafny_runtime_rust/README.md @@ -1,2 +1,2 @@ Local copy of the Dafny Rust runtime, -maintained here until the actual runtime is published as a crate. \ No newline at end of file +maintained here until the actual runtime is published as a crate. diff --git a/cfn/CA.yaml b/cfn/CA.yaml index d24c9ed665..51df5f77ad 100644 --- a/cfn/CA.yaml +++ b/cfn/CA.yaml @@ -1,7 +1,6 @@ AWSTemplateFormatVersion: "2010-09-09" Description: "CodeArtifact Domain, Repositories, and related IAM Policies/Roles for packages in the Polymorph Repo" Parameters: - DomainName: Type: String Description: The name of the CodeArtifact Domain @@ -18,19 +17,19 @@ Outputs: Description: "Arn for IAM Policy github-polymorph-CA-ReadWriteDelete" Value: !Ref CAReadWriteDeletePolicy Export: - Name: !Sub '${AWS::StackName}-GitHubCAReadWriteDeletePolicyArn' + Name: !Sub "${AWS::StackName}-GitHubCAReadWriteDeletePolicyArn" # This policy SHOULD be given to the ESDK-Dafny & Gazelle Repos GitHubCAReadPolicyArn: Description: "Arn for IAM Policy github-polymorph-CA-Read" Value: !Ref CAReadPolicy Export: - Name: !Sub '${AWS::StackName}-GitHubCAReadPolicyArn' + Name: !Sub "${AWS::StackName}-GitHubCAReadPolicyArn" # This policy COULD be imported by stack that creates the ToolsDevelopment role ToolDevelopmentAssumePolicyArn: Description: "Arn for IAM Policy that can Assume Roles created for Polymorph CA" Value: !Ref ToolDevelopmentAssumePolicy Export: - Name: !Sub '${AWS::StackName}-ToolDevelopmentAssumePolicyArn' + Name: !Sub "${AWS::StackName}-ToolDevelopmentAssumePolicyArn" Resources: Domain: @@ -59,7 +58,7 @@ Resources: Description: "Allow Read, Write, and Delete of CodeArtifact Domain github-polymorph" ManagedPolicyName: !Sub "${DomainName}-CA-ReadWriteDelete-${AWS::Region}" PolicyDocument: - Version: '2012-10-17' + Version: "2012-10-17" Statement: - Effect: Allow Action: @@ -95,7 +94,7 @@ Resources: Resource: "*" Condition: StringEquals: - 'sts:AWSServiceName': "codeartifact.amazonaws.com" + "sts:AWSServiceName": "codeartifact.amazonaws.com" # This policy SHOULD be given to the ESDK-Dafny & Gazelle Repos CAReadPolicy: @@ -104,7 +103,7 @@ Resources: Description: "Allow Read of CodeArtifact Domain github-polymorph" ManagedPolicyName: !Sub "${DomainName}-CA-Read-${AWS::Region}" PolicyDocument: - Version: '2012-10-17' + Version: "2012-10-17" Statement: - Effect: Allow Action: @@ -134,10 +133,10 @@ Resources: Resource: "*" Condition: StringEquals: - 'sts:AWSServiceName': "codeartifact.amazonaws.com" + "sts:AWSServiceName": "codeartifact.amazonaws.com" CASourceRole: - Type: 'AWS::IAM::Role' + Type: "AWS::IAM::Role" Properties: RoleName: !Sub "${ProjectName}-CA-SourceRole-${AWS::Region}" Description: "For the Source Repo, allows Publish, Pull, and Delete" @@ -150,14 +149,14 @@ Resources: - Effect: Allow Principal: AWS: !Sub "arn:aws:iam::${AWS::AccountId}:root" - Action: 'sts:AssumeRole' + Action: "sts:AssumeRole" - Effect: Allow Principal: AWS: !Sub "arn:aws:iam::${AWS::AccountId}:role/ToolsDevelopment" - Action: 'sts:AssumeRole' + Action: "sts:AssumeRole" CAPullRole: - Type: 'AWS::IAM::Role' + Type: "AWS::IAM::Role" Properties: RoleName: !Sub "${ProjectName}-CA-PullRole-${AWS::Region}" Description: "For consuming Repos, only allows Pull" @@ -170,11 +169,11 @@ Resources: - Effect: Allow Principal: AWS: !Sub "arn:aws:iam::${AWS::AccountId}:root" - Action: 'sts:AssumeRole' + Action: "sts:AssumeRole" - Effect: Allow Principal: AWS: !Sub "arn:aws:iam::${AWS::AccountId}:role/ToolsDevelopment" - Action: 'sts:AssumeRole' + Action: "sts:AssumeRole" ToolDevelopmentAssumePolicy: Type: "AWS::IAM::ManagedPolicy" @@ -182,13 +181,13 @@ Resources: Description: "Allows Tools Development to assume roles defined for Polymorph CA" ManagedPolicyName: !Sub "Assume-${ProjectName}-CA-Roles-${AWS::Region}" PolicyDocument: - Version: '2012-10-17' + Version: "2012-10-17" Statement: - Effect: Allow Action: - - 'sts:AssumeRole' - - 'sts:AssumeRoleWithSAML' - - 'sts:AssumeRoleWithWebIdentity' + - "sts:AssumeRole" + - "sts:AssumeRoleWithSAML" + - "sts:AssumeRoleWithWebIdentity" Resource: - !GetAtt CASourceRole.Arn - !GetAtt CAPullRole.Arn diff --git a/cfn/README.md b/cfn/README.md index 03b7224103..ab40dc2662 100644 --- a/cfn/README.md +++ b/cfn/README.md @@ -1,16 +1,19 @@ ## Fetching CA Credentials + The CFN stacks here SHOULD allow the IAM role Tools Development to access the Code Artifact Resources created. But not directly. -Instead, the stacks allow the Dev role to ASSUME +Instead, the stacks allow the Dev role to ASSUME the created IAM Roles. Here is a little bash that can do that. -In addition to the `isengardcli`, it relies on `jq` and the `aws-cli`, +In addition to the `isengardcli`, it relies on `jq` and the `aws-cli`, both of which are on Homebrew and should be available for Windows or Linux. Don't forget to set the opening variables. + #### Script + ```shell export AWS_REGION="us-west-2" export ACCOUNT_ID=370957321024 # 370957321024 is the Ops CI Account @@ -47,7 +50,8 @@ export CODEARTIFACT_URL_SMITHY=`aws codeartifact get-repository-endpoint \ ``` #### Details -More instructions can be read + +More instructions can be read [in the CA User Guide](https://docs.aws.amazon.com/codeartifact/latest/ug/maven-gradle.html). If you want to check how the results of the above, @@ -55,7 +59,9 @@ try `env | grep CODE`, or `env | grep AWS`. Those should print the intermediate and final env variables. ### Reset + Shell command to reset the environment: + ```shell unset STS_RESPONSE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY \ AWS_SESSION_TOKEN CODEARTIFACT_AUTH_TOKEN \ @@ -63,10 +69,12 @@ unset STS_RESPONSE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY \ ``` ### Publish `DafnyJavaConversion` or `SmithyPolymorph` to CA + From the same directory as the project, Run the [script above](#script), and then `gradle publish`. ### Test Pulling + To test the Pull permissions or fetch a Jar from CA for local use, you need to determine the Asset Name for the Jar, @@ -75,6 +83,7 @@ and then fetch that Jar via the Asset Name. 1. Fetch `CODEARTIFACT_AUTH_TOKEN` and CA Endpoint URL with [script above](#script) 2. Run the following to retrieve a list of asset names, and manually copy the name + ```shell CA_REPOSITORY="DafnyJavaConversion" CA_PACKAGE="conversion" @@ -89,8 +98,10 @@ aws codeartifact list-package-version-assets \ --namespace "$CA_NAMESPACE" \ --package-version "$CA_VERSION" | jq -r .assets ``` + 3. Run the following to retrieve the Jar, replacing `CA_ASSET_NAME` with the value from (2.) + ```shell CA_ASSET_NAME="conversion-1.0-20221214.000034-1.jar" aws codeartifact get-package-version-asset \ @@ -104,7 +115,9 @@ aws codeartifact get-package-version-asset \ --asset "$CA_ASSET_NAME" \ $CA_ASSET_NAME ``` + 4. (Optional) Install the Jar to Maven local via: + ```shell mvn -B -ntp install:install-file \ -Dfile="$CA_ASSET_NAME" \ @@ -116,11 +129,14 @@ mvn -B -ntp install:install-file \ ``` ### Push an arbitrary Java package to CA + Here, I pushed the DafnyRuntime Jar to the Dafny->Java conversion repository, but you could customize the following to push any Jar. + 1. Follow AWS Docs [instructions to configure `~/.m2/settings.xml`](https://docs.aws.amazon.com/codeartifact/latest/ug/maven-mvn.html#publishing-third-party-artifacts). 2. Fetch `CODEARTIFACT_AUTH_TOKEN` and CA Endpoint URL with [script above](#script) 3. Customize and run + ```shell mvn deploy:deploy-file \ -DgroupId=dafny.lang \ diff --git a/cfn/ci.yaml b/cfn/ci.yaml index 556783b8ce..2df53d0064 100644 --- a/cfn/ci.yaml +++ b/cfn/ci.yaml @@ -49,7 +49,7 @@ Resources: Description: "Allow Read, Write, and Delete of Items in Test Table" ManagedPolicyName: !Sub "${ProjectName}-DDB-ReadWriteDelete-${AWS::Region}" PolicyDocument: - Version: '2012-10-17' + Version: "2012-10-17" Statement: - Effect: Allow Action: @@ -71,7 +71,7 @@ Resources: Properties: ManagedPolicyName: !Sub "${ProjectName}-KMS-${AWS::Region}" PolicyDocument: - Version: '2012-10-17' + Version: "2012-10-17" Statement: - Effect: Allow Action: @@ -87,7 +87,7 @@ Resources: Properties: ManagedPolicyName: !Sub "${ProjectName}-SQS-${AWS::Region}" PolicyDocument: - Version: '2012-10-17' + Version: "2012-10-17" Statement: - Effect: Allow Action: @@ -96,7 +96,7 @@ Resources: - !Sub "arn:aws:sqs:${AWS::Region}:${AWS::AccountId}:*" GitHubCIRole: - Type: 'AWS::IAM::Role' + Type: "AWS::IAM::Role" Properties: RoleName: !Sub "GitHub-CI-${ProjectName}-Role-${AWS::Region}" Description: "Access DDB, KMS, & CA Resources for CI from GitHub" diff --git a/codegen/smithy-dafny-codegen-cli/README.md b/codegen/smithy-dafny-codegen-cli/README.md index a06d93002b..b1a9132561 100644 --- a/codegen/smithy-dafny-codegen-cli/README.md +++ b/codegen/smithy-dafny-codegen-cli/README.md @@ -69,6 +69,7 @@ $./gradlew run --args="\ You can also look at the [ServiceCodegenSmokeTest](./src/test/java/software/amazon/polymorph/smithydotnet/ServiceCodegenSmokeTest.java) as a reference for how to use the library. It reads and generates code for the [test model](./src/test/resources/model.smithy), then prints the generated code to stdout. ## Arguments + By default, nothing is generated. Language generation is enabled by the language's `output` argument. This argument also determines the directory code will be written. @@ -76,6 +77,7 @@ This argument also determines the directory code will be written. ## Useful Debugging expressions: To print a `List`: + ``` .stream().map(ParseToken::text).collect(Collectors.joining(" ")) ``` diff --git a/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java b/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java index 00791ed132..df7b4aff97 100644 --- a/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java +++ b/codegen/smithy-dafny-codegen-cli/src/main/java/software/amazon/polymorph/CodegenCli.java @@ -3,279 +3,369 @@ package software.amazon.polymorph; -import software.amazon.polymorph.CodegenEngine.TargetLanguage; -import software.amazon.polymorph.smithydafny.DafnyVersion; -import software.amazon.polymorph.smithyjava.generator.CodegenSubject.AwsSdkVersion; - +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.DefaultParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; - +import software.amazon.polymorph.CodegenEngine.TargetLanguage; +import software.amazon.polymorph.smithydafny.DafnyVersion; +import software.amazon.polymorph.smithyjava.generator.CodegenSubject.AwsSdkVersion; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.loader.ModelAssembler; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.Arrays; - public class CodegenCli { - private static final Logger LOGGER = LoggerFactory.getLogger(CodegenCli.class); - public static void main(String[] args) { - if (args.length == 0 || Arrays.asList(args).contains("-h")) { - printHelpMessage(); - System.exit(0); - } - Optional cliArgumentsOptional = Optional.empty(); - try { - cliArgumentsOptional = CliArguments.parse(args); - } catch (ParseException e) { - LOGGER.error("Command-line arguments could not be parsed", e); - System.exit(1); - } - if (cliArgumentsOptional.isEmpty()) { - printHelpMessage(); - System.exit(0); - } - final CliArguments cliArguments = cliArgumentsOptional.get(); + private static final Logger LOGGER = LoggerFactory.getLogger( + CodegenCli.class + ); + + public static void main(String[] args) { + if (args.length == 0 || Arrays.asList(args).contains("-h")) { + printHelpMessage(); + System.exit(0); + } + Optional cliArgumentsOptional = Optional.empty(); + try { + cliArgumentsOptional = CliArguments.parse(args); + } catch (ParseException e) { + LOGGER.error("Command-line arguments could not be parsed", e); + System.exit(1); + } + if (cliArgumentsOptional.isEmpty()) { + printHelpMessage(); + System.exit(0); + } + final CliArguments cliArguments = cliArgumentsOptional.get(); - LOGGER.debug("Loading model from {}", cliArguments.modelPath); - final ModelAssembler assembler = new ModelAssembler(); - assembler.addImport(cliArguments.modelPath); - Arrays.stream(cliArguments.dependentModelPaths).forEach(assembler::addImport); - // Discover models from the classpath (e.g. models of library-defined traits) - assembler.discoverModels(); - final Model serviceModel = assembler.assemble().unwrap(); + LOGGER.debug("Loading model from {}", cliArguments.modelPath); + final ModelAssembler assembler = new ModelAssembler(); + assembler.addImport(cliArguments.modelPath); + Arrays + .stream(cliArguments.dependentModelPaths) + .forEach(assembler::addImport); + // Discover models from the classpath (e.g. models of library-defined traits) + assembler.discoverModels(); + final Model serviceModel = assembler.assemble().unwrap(); - // If Smithy ever lets us configure this: - // https://github.com/smithy-lang/smithy/blob/f598b87c51af5943686e38706847a5091fe718da/smithy-model/src/main/java/software/amazon/smithy/model/loader/ModelLoader.java#L76 - // We can remove this log statement. - // (Alternatively, We could inline `addImport`, - // and ignore dfy & md files. Link to `addImport` below) - // https://github.com/smithy-lang/smithy/blob/f598b87c51af5943686e38706847a5091fe718da/smithy-model/src/main/java/software/amazon/smithy/model/loader/ModelAssembler.java#L256-L281 - LOGGER.info("End annoying Smithy \"No ModelLoader was able to load\" warnings.\n\n"); + // If Smithy ever lets us configure this: + // https://github.com/smithy-lang/smithy/blob/f598b87c51af5943686e38706847a5091fe718da/smithy-model/src/main/java/software/amazon/smithy/model/loader/ModelLoader.java#L76 + // We can remove this log statement. + // (Alternatively, We could inline `addImport`, + // and ignore dfy & md files. Link to `addImport` below) + // https://github.com/smithy-lang/smithy/blob/f598b87c51af5943686e38706847a5091fe718da/smithy-model/src/main/java/software/amazon/smithy/model/loader/ModelAssembler.java#L256-L281 + LOGGER.info( + "End annoying Smithy \"No ModelLoader was able to load\" warnings.\n\n" + ); - final Map outputDirs = new HashMap<>(); - cliArguments.outputDafnyDir.ifPresent(path -> outputDirs.put(TargetLanguage.DAFNY, path)); - cliArguments.outputJavaDir.ifPresent(path -> outputDirs.put(TargetLanguage.JAVA, path)); - cliArguments.outputDotnetDir.ifPresent(path -> outputDirs.put(TargetLanguage.DOTNET, path)); + final Map outputDirs = new HashMap<>(); + cliArguments.outputDafnyDir.ifPresent(path -> + outputDirs.put(TargetLanguage.DAFNY, path) + ); + cliArguments.outputJavaDir.ifPresent(path -> + outputDirs.put(TargetLanguage.JAVA, path) + ); + cliArguments.outputDotnetDir.ifPresent(path -> + outputDirs.put(TargetLanguage.DOTNET, path) + ); - final CodegenEngine.Builder engineBuilder = new CodegenEngine.Builder() - .withFromSmithyBuildPlugin(false) - .withLibraryRoot(cliArguments.libraryRoot) - .withServiceModel(serviceModel) - .withDependentModelPaths(cliArguments.dependentModelPaths) - .withNamespace(cliArguments.namespace) - .withTargetLangOutputDirs(outputDirs) - .withAwsSdkStyle(cliArguments.awsSdkStyle) - .withLocalServiceTest(cliArguments.localServiceTest) - .withDafnyVersion(cliArguments.dafnyVersion) - .withUpdatePatchFiles(cliArguments.updatePatchFiles); - cliArguments.propertiesFile.ifPresent(engineBuilder::withPropertiesFile); - cliArguments.javaAwsSdkVersion.ifPresent(engineBuilder::withJavaAwsSdkVersion); - cliArguments.includeDafnyFile.ifPresent(engineBuilder::withIncludeDafnyFile); - cliArguments.patchFilesDir.ifPresent(engineBuilder::withPatchFilesDir); - final CodegenEngine engine = engineBuilder.build(); - engine.run(); - } + final CodegenEngine.Builder engineBuilder = new CodegenEngine.Builder() + .withFromSmithyBuildPlugin(false) + .withLibraryRoot(cliArguments.libraryRoot) + .withServiceModel(serviceModel) + .withDependentModelPaths(cliArguments.dependentModelPaths) + .withNamespace(cliArguments.namespace) + .withTargetLangOutputDirs(outputDirs) + .withAwsSdkStyle(cliArguments.awsSdkStyle) + .withLocalServiceTest(cliArguments.localServiceTest) + .withDafnyVersion(cliArguments.dafnyVersion) + .withUpdatePatchFiles(cliArguments.updatePatchFiles); + cliArguments.propertiesFile.ifPresent(engineBuilder::withPropertiesFile); + cliArguments.javaAwsSdkVersion.ifPresent( + engineBuilder::withJavaAwsSdkVersion + ); + cliArguments.includeDafnyFile.ifPresent( + engineBuilder::withIncludeDafnyFile + ); + cliArguments.patchFilesDir.ifPresent(engineBuilder::withPatchFilesDir); + final CodegenEngine engine = engineBuilder.build(); + engine.run(); + } - private static Options getCliOptions() { - return new Options() - .addOption(Option.builder("h") - .longOpt("help") - .desc("print help message") - .build()) - .addOption(Option.builder("r") - .longOpt("library-root") - .desc("root directory of the library") - .hasArg() - .required() - .build()) - .addOption(Option.builder("m") - .longOpt("model") - .desc("directory for the model file[s] (.smithy or json format).") - .hasArg() - .required() - .build()) - .addOption(Option.builder("d") - .longOpt("dependent-model") - .desc("directory for dependent model file[s] (.smithy format)") - .hasArg() - .required() - .build()) - .addOption(Option.builder("n") - .longOpt("namespace") - .desc("smithy namespace to generate code for, such as 'com.foo'") - .hasArg() - .required() - .build()) - .addOption(Option.builder() - .longOpt("output-dotnet") - .desc(" output directory for generated .NET files") - .hasArg() - .build()) - .addOption(Option.builder() - .longOpt("output-java") - .desc(" output directory for generated Java files") - .hasArg() - .build()) - .addOption(Option.builder() - .longOpt("java-aws-sdk-version") - .desc(" AWS SDK for Java version to use: v1, or v2 (default)") - .hasArg() - .build()) - .addOption(Option.builder() - .longOpt("dafny-version") - .desc("Dafny version to generate code for") - .hasArg() - .build()) - .addOption(Option.builder() - .longOpt("properties-file") - .desc("Path to generate the project.properties file at") - .hasArg() - .build()) - .addOption(Option.builder() - .longOpt("aws-sdk") - .desc(" generate AWS SDK-style API and shims") - .build()) - .addOption(Option.builder() - .longOpt("local-service-test") - .desc(" generate Dafny that tests a local service") - .build()) - .addOption(Option.builder() - .longOpt("output-dafny") - .desc(" output directory for generated Dafny code") - .hasArg() - .optionalArg(true) - .build()) - .addOption(Option.builder() - .longOpt("include-dafny") - .desc(" files to be include in the generated Dafny") - .hasArg() - .build()) - .addOption(Option.builder() - .longOpt("patch-files-dir") - .desc(" location of patch files. Defaults to /codegen-patches") - .hasArg() - .build()) - .addOption(Option.builder() - .longOpt("update-patch-files") - .desc(" update patch files in instead of applying them") - .build()); - } + private static Options getCliOptions() { + return new Options() + .addOption( + Option.builder("h").longOpt("help").desc("print help message").build() + ) + .addOption( + Option + .builder("r") + .longOpt("library-root") + .desc("root directory of the library") + .hasArg() + .required() + .build() + ) + .addOption( + Option + .builder("m") + .longOpt("model") + .desc("directory for the model file[s] (.smithy or json format).") + .hasArg() + .required() + .build() + ) + .addOption( + Option + .builder("d") + .longOpt("dependent-model") + .desc("directory for dependent model file[s] (.smithy format)") + .hasArg() + .required() + .build() + ) + .addOption( + Option + .builder("n") + .longOpt("namespace") + .desc("smithy namespace to generate code for, such as 'com.foo'") + .hasArg() + .required() + .build() + ) + .addOption( + Option + .builder() + .longOpt("output-dotnet") + .desc(" output directory for generated .NET files") + .hasArg() + .build() + ) + .addOption( + Option + .builder() + .longOpt("output-java") + .desc(" output directory for generated Java files") + .hasArg() + .build() + ) + .addOption( + Option + .builder() + .longOpt("java-aws-sdk-version") + .desc( + " AWS SDK for Java version to use: v1, or v2 (default)" + ) + .hasArg() + .build() + ) + .addOption( + Option + .builder() + .longOpt("dafny-version") + .desc("Dafny version to generate code for") + .hasArg() + .build() + ) + .addOption( + Option + .builder() + .longOpt("properties-file") + .desc("Path to generate the project.properties file at") + .hasArg() + .build() + ) + .addOption( + Option + .builder() + .longOpt("aws-sdk") + .desc(" generate AWS SDK-style API and shims") + .build() + ) + .addOption( + Option + .builder() + .longOpt("local-service-test") + .desc(" generate Dafny that tests a local service") + .build() + ) + .addOption( + Option + .builder() + .longOpt("output-dafny") + .desc(" output directory for generated Dafny code") + .hasArg() + .optionalArg(true) + .build() + ) + .addOption( + Option + .builder() + .longOpt("include-dafny") + .desc(" files to be include in the generated Dafny") + .hasArg() + .build() + ) + .addOption( + Option + .builder() + .longOpt("patch-files-dir") + .desc( + " location of patch files. Defaults to /codegen-patches" + ) + .hasArg() + .build() + ) + .addOption( + Option + .builder() + .longOpt("update-patch-files") + .desc( + " update patch files in instead of applying them" + ) + .build() + ); + } - private static void printHelpMessage() { - new HelpFormatter().printHelp("smithy-dafny-codegen-cli", getCliOptions()); - } + private static void printHelpMessage() { + new HelpFormatter().printHelp("smithy-dafny-codegen-cli", getCliOptions()); + } - private record CliArguments( - Path libraryRoot, - Path modelPath, - Path[] dependentModelPaths, - String namespace, - Optional outputDotnetDir, - Optional outputJavaDir, - Optional outputDafnyDir, - Optional javaAwsSdkVersion, - DafnyVersion dafnyVersion, - Optional propertiesFile, - Optional includeDafnyFile, - boolean awsSdkStyle, - boolean localServiceTest, - Optional patchFilesDir, - boolean updatePatchFiles - ) { - /** - * @param args arguments to parse - * @return parsed arguments, or {@code Optional.empty()} if help should be printed - * @throws ParseException if command line arguments are invalid - */ - static Optional parse(String[] args) throws ParseException { - final DefaultParser parser = new DefaultParser(); - final CommandLine commandLine = parser.parse(getCliOptions(), args); - if (commandLine.hasOption("h")) { - printHelpMessage(); - return Optional.empty(); - } + private record CliArguments( + Path libraryRoot, + Path modelPath, + Path[] dependentModelPaths, + String namespace, + Optional outputDotnetDir, + Optional outputJavaDir, + Optional outputDafnyDir, + Optional javaAwsSdkVersion, + DafnyVersion dafnyVersion, + Optional propertiesFile, + Optional includeDafnyFile, + boolean awsSdkStyle, + boolean localServiceTest, + Optional patchFilesDir, + boolean updatePatchFiles + ) { + /** + * @param args arguments to parse + * @return parsed arguments, or {@code Optional.empty()} if help should be printed + * @throws ParseException if command line arguments are invalid + */ + static Optional parse(String[] args) throws ParseException { + final DefaultParser parser = new DefaultParser(); + final CommandLine commandLine = parser.parse(getCliOptions(), args); + if (commandLine.hasOption("h")) { + printHelpMessage(); + return Optional.empty(); + } - Path libraryRoot = Paths.get(commandLine.getOptionValue("library-root")); + Path libraryRoot = Paths.get(commandLine.getOptionValue("library-root")); - final Path modelPath = Path.of(commandLine.getOptionValue('m')); + final Path modelPath = Path.of(commandLine.getOptionValue('m')); - final Path[] dependentModelPaths = Arrays - .stream(commandLine.getOptionValues('d')) - .map(Path::of) - .toArray(Path[]::new); + final Path[] dependentModelPaths = Arrays + .stream(commandLine.getOptionValues('d')) + .map(Path::of) + .toArray(Path[]::new); - final String namespace = commandLine.getOptionValue('n'); + final String namespace = commandLine.getOptionValue('n'); - Optional outputDafnyDir = Optional.ofNullable(commandLine.getOptionValue("output-dafny")) - .map(Paths::get); - if (commandLine.hasOption("output-dafny") && outputDafnyDir.isEmpty()) { - LOGGER.warn("Using `output-dafny` without providing a Path argument is deprecated and will be removed."); - LOGGER.warn("Assuming Dafny should be written to Model path."); - outputDafnyDir = Optional.of(Paths.get(commandLine.getOptionValue("m"))); - } + Optional outputDafnyDir = Optional + .ofNullable(commandLine.getOptionValue("output-dafny")) + .map(Paths::get); + if (commandLine.hasOption("output-dafny") && outputDafnyDir.isEmpty()) { + LOGGER.warn( + "Using `output-dafny` without providing a Path argument is deprecated and will be removed." + ); + LOGGER.warn("Assuming Dafny should be written to Model path."); + outputDafnyDir = + Optional.of(Paths.get(commandLine.getOptionValue("m"))); + } - final Optional outputJavaDir = Optional.ofNullable(commandLine.getOptionValue("output-java")) - .map(Paths::get); - final Optional outputDotnetDir = Optional.ofNullable(commandLine.getOptionValue("output-dotnet")) - .map(Paths::get); + final Optional outputJavaDir = Optional + .ofNullable(commandLine.getOptionValue("output-java")) + .map(Paths::get); + final Optional outputDotnetDir = Optional + .ofNullable(commandLine.getOptionValue("output-dotnet")) + .map(Paths::get); - boolean localServiceTest = commandLine.hasOption("local-service-test"); - final boolean awsSdkStyle = commandLine.hasOption("aws-sdk"); + boolean localServiceTest = commandLine.hasOption("local-service-test"); + final boolean awsSdkStyle = commandLine.hasOption("aws-sdk"); - Optional javaAwsSdkVersion = Optional.empty(); - if (commandLine.hasOption("java-aws-sdk-version")) { - final String versionStr = commandLine.getOptionValue("java-aws-sdk-version").trim().toUpperCase(); - try { - javaAwsSdkVersion = Optional.of(AwsSdkVersion.valueOf(versionStr)); - } catch (IllegalArgumentException ex) { - LOGGER.error("Unknown Java AWS SDK version {}", versionStr); - throw ex; - } - } + Optional javaAwsSdkVersion = Optional.empty(); + if (commandLine.hasOption("java-aws-sdk-version")) { + final String versionStr = commandLine + .getOptionValue("java-aws-sdk-version") + .trim() + .toUpperCase(); + try { + javaAwsSdkVersion = Optional.of(AwsSdkVersion.valueOf(versionStr)); + } catch (IllegalArgumentException ex) { + LOGGER.error("Unknown Java AWS SDK version {}", versionStr); + throw ex; + } + } - DafnyVersion dafnyVersion; - String versionStr = commandLine.getOptionValue("dafny-version"); - if (versionStr == null) { - LOGGER.error("--dafny-version option is required"); - System.exit(-1); - } - try { - dafnyVersion = DafnyVersion.parse(versionStr.trim()); - } catch (IllegalArgumentException ex) { - LOGGER.error("Could not parse --dafny-version: {}", versionStr); - throw ex; - } + DafnyVersion dafnyVersion; + String versionStr = commandLine.getOptionValue("dafny-version"); + if (versionStr == null) { + LOGGER.error("--dafny-version option is required"); + System.exit(-1); + } + try { + dafnyVersion = DafnyVersion.parse(versionStr.trim()); + } catch (IllegalArgumentException ex) { + LOGGER.error("Could not parse --dafny-version: {}", versionStr); + throw ex; + } - Optional propertiesFile = Optional.ofNullable(commandLine.getOptionValue("properties-file")) - .map(Paths::get); + Optional propertiesFile = Optional + .ofNullable(commandLine.getOptionValue("properties-file")) + .map(Paths::get); - Optional includeDafnyFile = Optional.empty(); - if (outputDafnyDir.isPresent()) { - includeDafnyFile = Optional.of(Paths.get(commandLine.getOptionValue("include-dafny"))); - } + Optional includeDafnyFile = Optional.empty(); + if (outputDafnyDir.isPresent()) { + includeDafnyFile = + Optional.of(Paths.get(commandLine.getOptionValue("include-dafny"))); + } - Optional patchFilesDir = Optional.ofNullable(commandLine.getOptionValue("patch-files-dir")) - .map(Paths::get); - final boolean updatePatchFiles = commandLine.hasOption("update-patch-files"); + Optional patchFilesDir = Optional + .ofNullable(commandLine.getOptionValue("patch-files-dir")) + .map(Paths::get); + final boolean updatePatchFiles = commandLine.hasOption( + "update-patch-files" + ); - return Optional.of(new CliArguments( - libraryRoot, modelPath, dependentModelPaths, namespace, - outputDotnetDir, outputJavaDir, outputDafnyDir, - javaAwsSdkVersion, dafnyVersion, propertiesFile, includeDafnyFile, awsSdkStyle, - localServiceTest, patchFilesDir, updatePatchFiles - )); - } + return Optional.of( + new CliArguments( + libraryRoot, + modelPath, + dependentModelPaths, + namespace, + outputDotnetDir, + outputJavaDir, + outputDafnyDir, + javaAwsSdkVersion, + dafnyVersion, + propertiesFile, + includeDafnyFile, + awsSdkStyle, + localServiceTest, + patchFilesDir, + updatePatchFiles + ) + ); } + } } diff --git a/codegen/smithy-dafny-codegen-test/smithy-build.json b/codegen/smithy-dafny-codegen-test/smithy-build.json index ff4c27ed0b..ef48fecf97 100644 --- a/codegen/smithy-dafny-codegen-test/smithy-build.json +++ b/codegen/smithy-dafny-codegen-test/smithy-build.json @@ -1,6 +1,6 @@ { - "version": "1.0", - "plugins": { - "_comment": "TODO" - } + "version": "1.0", + "plugins": { + "_comment": "TODO" + } } diff --git a/codegen/smithy-dafny-codegen/README.md b/codegen/smithy-dafny-codegen/README.md index 642bef8e89..cd310baf19 100644 --- a/codegen/smithy-dafny-codegen/README.md +++ b/codegen/smithy-dafny-codegen/README.md @@ -5,8 +5,8 @@ for generating a Dafny client for a given Smithy model, as described in the [Smithy codegen docs](https://smithy.io/2.0/guides/using-code-generation/generating-a-client.html). -*WARNING: All internal and external interfaces are considered unstable and subject to change without notice. -This includes the interfaces in the code generated by this library.* +_WARNING: All internal and external interfaces are considered unstable and subject to change without notice. +This includes the interfaces in the code generated by this library._ ## Limitations @@ -67,12 +67,12 @@ are as follows: your service model depends on, such as AWS-specific traits. See https://smithy.io/2.0/guides/using-code-generation/index.html for more examples. - Note the exact version of the `software.amazon.smithy` dependencies MAY NOT need to be + Note the exact version of the `software.amazon.smithy` dependencies MAY NOT need to be `1.28.1` exactly, but MUST be consistent. 3. Make a copy of the `TestModels/dafny-dependencies/StandardLibrary` directory for the generated code to refer to. - + This is necessary because the runtime library code the generated code will depend on is not yet available as a shared Dafny library. @@ -82,18 +82,18 @@ are as follows: to support in the generated client: ```json - { - "version": "1.0", - "plugins": { - "dafny-client-codegen": { - "edition": "2023.10", - "service": "smithy.example#ExampleService", - "targetLanguages": ["dotnet"], - "dafnyVersion": "4.3.0", - "includeDafnyFile": "[relative]/[path]/[to]/StandardLibrary/src/Index.dfy" - } - } - } + { + "version": "1.0", + "plugins": { + "dafny-client-codegen": { + "edition": "2023.10", + "service": "smithy.example#ExampleService", + "targetLanguages": ["dotnet"], + "dafnyVersion": "4.3.0", + "includeDafnyFile": "[relative]/[path]/[to]/StandardLibrary/src/Index.dfy" + } + } + } ``` See [`DafnyClientCodegenPluginSettings.java`](https://github.com/awslabs/smithy-dafny/blob/main-1.x/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPluginSettings.java) for more details about plugin settings. @@ -131,26 +131,26 @@ to one of the shape types that this plugin does not yet support: ```json { - "version": "1.0", - "projections": { - "dafny-supported": { - "transforms": [ - { - "name": "excludeShapesBySelector", - "args": { - "selector": "operation :test(~> document)" - } - } - ], - "plugins": { - "dafny-client-codegen": { - "service": "smithy.example#ExampleService", - "targetLanguages": ["dotnet"], - "includeDafnyPath": "[relative]/[path]/[to]/smithy-dafny/TestModels/dafny-dependencies/StandardLibrary/src/Index.dfy" - } - } + "version": "1.0", + "projections": { + "dafny-supported": { + "transforms": [ + { + "name": "excludeShapesBySelector", + "args": { + "selector": "operation :test(~> document)" + } } - }, + ], + "plugins": { + "dafny-client-codegen": { + "service": "smithy.example#ExampleService", + "targetLanguages": ["dotnet"], + "includeDafnyPath": "[relative]/[path]/[to]/smithy-dafny/TestModels/dafny-dependencies/StandardLibrary/src/Index.dfy" + } + } + } + } } ``` diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java index 1ce908fb14..dc2722dfd6 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/CodegenEngine.java @@ -6,6 +6,17 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Streams; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Stream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.polymorph.smithydafny.DafnyApiCodegen; @@ -31,586 +42,686 @@ import software.amazon.smithy.utils.IoUtils; import software.amazon.smithy.utils.Pair; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Stream; - public class CodegenEngine { - private static final Logger LOGGER = LoggerFactory.getLogger(CodegenEngine.class); - - // Used to distinguish different conventions between the CLI - // and the Smithy build plugin, such as where .NET project files live. - private final boolean fromSmithyBuildPlugin; - private final Path libraryRoot; - private final Path[] dependentModelPaths; - private final String namespace; - private final Map targetLangOutputDirs; - private final DafnyVersion dafnyVersion; - private final Optional propertiesFile; - private final Optional patchFilesDir; - private final boolean updatePatchFiles; - // refactor this to only be required if generating Java - private final AwsSdkVersion javaAwsSdkVersion; - private final Optional includeDafnyFile; - private final boolean awsSdkStyle; - private final boolean localServiceTest; - private final boolean generateProjectFiles; - - // To be initialized in constructor - private final Model model; - private final ServiceShape serviceShape; - - /** - * This should only be called by {@link Builder#build()}, - * which is responsible for validating that the arguments are non-null, - * are mutually compatible, etc. - */ - private CodegenEngine( - final boolean fromSmithyBuildPlugin, - final Model serviceModel, - final Path[] dependentModelPaths, - final String namespace, - final Map targetLangOutputDirs, - final DafnyVersion dafnyVersion, - final Optional propertiesFile, - final AwsSdkVersion javaAwsSdkVersion, - final Optional includeDafnyFile, - final boolean awsSdkStyle, - final boolean localServiceTest, - final boolean generateProjectFiles, - final Path libraryRoot, - final Optional patchFilesDir, - final boolean updatePatchFiles - ) { - // To be provided to constructor - this.fromSmithyBuildPlugin = fromSmithyBuildPlugin; - this.dependentModelPaths = dependentModelPaths; - this.namespace = namespace; - this.targetLangOutputDirs = targetLangOutputDirs; - this.dafnyVersion = dafnyVersion; - this.propertiesFile = propertiesFile; - this.javaAwsSdkVersion = javaAwsSdkVersion; - this.includeDafnyFile = includeDafnyFile; - this.awsSdkStyle = awsSdkStyle; - this.localServiceTest = localServiceTest; - this.generateProjectFiles = generateProjectFiles; - this.libraryRoot = libraryRoot; - this.patchFilesDir = patchFilesDir; - this.updatePatchFiles = updatePatchFiles; - - this.model = this.awsSdkStyle - // TODO: move this into a DirectedCodegen.customizeBeforeShapeGeneration implementation - ? ModelUtils.addMissingErrorMessageMembers(serviceModel) - : serviceModel; - - this.serviceShape = ModelUtils.serviceFromNamespace(this.model, this.namespace); - } - - /** - * Executes code generation for the configured language(s). - * This method is designed to be internally stateless - * and idempotent with respect to the file system. - */ - public void run() { - try { - LOGGER.debug("Ensuring target-language output directories exist"); - for (final Path dir : this.targetLangOutputDirs.values()) { - Files.createDirectories(dir); - } - } catch (IOException e) { - e.printStackTrace(); - System.exit(1); - } - for (final TargetLanguage lang : targetLangOutputDirs.keySet()) { - final Path outputDir = targetLangOutputDirs.get(lang).toAbsolutePath().normalize(); - switch (lang) { - case DAFNY -> generateDafny(outputDir); - case JAVA -> generateJava(outputDir); - case DOTNET -> generateDotnet(outputDir); - default -> throw new UnsupportedOperationException("Cannot generate code for target language %s" - .formatted(lang.name())); - } - } - - propertiesFile.ifPresent(this::generateProjectPropertiesFile); + private static final Logger LOGGER = LoggerFactory.getLogger( + CodegenEngine.class + ); + + // Used to distinguish different conventions between the CLI + // and the Smithy build plugin, such as where .NET project files live. + private final boolean fromSmithyBuildPlugin; + private final Path libraryRoot; + private final Path[] dependentModelPaths; + private final String namespace; + private final Map targetLangOutputDirs; + private final DafnyVersion dafnyVersion; + private final Optional propertiesFile; + private final Optional patchFilesDir; + private final boolean updatePatchFiles; + // refactor this to only be required if generating Java + private final AwsSdkVersion javaAwsSdkVersion; + private final Optional includeDafnyFile; + private final boolean awsSdkStyle; + private final boolean localServiceTest; + private final boolean generateProjectFiles; + + // To be initialized in constructor + private final Model model; + private final ServiceShape serviceShape; + + /** + * This should only be called by {@link Builder#build()}, + * which is responsible for validating that the arguments are non-null, + * are mutually compatible, etc. + */ + private CodegenEngine( + final boolean fromSmithyBuildPlugin, + final Model serviceModel, + final Path[] dependentModelPaths, + final String namespace, + final Map targetLangOutputDirs, + final DafnyVersion dafnyVersion, + final Optional propertiesFile, + final AwsSdkVersion javaAwsSdkVersion, + final Optional includeDafnyFile, + final boolean awsSdkStyle, + final boolean localServiceTest, + final boolean generateProjectFiles, + final Path libraryRoot, + final Optional patchFilesDir, + final boolean updatePatchFiles + ) { + // To be provided to constructor + this.fromSmithyBuildPlugin = fromSmithyBuildPlugin; + this.dependentModelPaths = dependentModelPaths; + this.namespace = namespace; + this.targetLangOutputDirs = targetLangOutputDirs; + this.dafnyVersion = dafnyVersion; + this.propertiesFile = propertiesFile; + this.javaAwsSdkVersion = javaAwsSdkVersion; + this.includeDafnyFile = includeDafnyFile; + this.awsSdkStyle = awsSdkStyle; + this.localServiceTest = localServiceTest; + this.generateProjectFiles = generateProjectFiles; + this.libraryRoot = libraryRoot; + this.patchFilesDir = patchFilesDir; + this.updatePatchFiles = updatePatchFiles; + + this.model = + this.awsSdkStyle + // TODO: move this into a DirectedCodegen.customizeBeforeShapeGeneration implementation + ? ModelUtils.addMissingErrorMessageMembers(serviceModel) + : serviceModel; + + this.serviceShape = + ModelUtils.serviceFromNamespace(this.model, this.namespace); + } + + /** + * Executes code generation for the configured language(s). + * This method is designed to be internally stateless + * and idempotent with respect to the file system. + */ + public void run() { + try { + LOGGER.debug("Ensuring target-language output directories exist"); + for (final Path dir : this.targetLangOutputDirs.values()) { + Files.createDirectories(dir); + } + } catch (IOException e) { + e.printStackTrace(); + System.exit(1); } - private void generateProjectPropertiesFile(final Path outputPath) { - final String propertiesTemplate = IoUtils.readUtf8Resource( - this.getClass(), "/templates/project.properties.template"); - // Drop the pre-release suffix, if any. - // This means with the current Dafny pre-release naming convention, - // we'll grab the most recent full release of a Dafny runtime. - // This mapping may need to change in the future. - // Ideally this would be handled by the Dafny CLI itself. - String dafnyVersionString = new DafnyVersion( - dafnyVersion.getMajor(), dafnyVersion.getMinor(), dafnyVersion.getPatch() - ).unparse(); - final String propertiesText = propertiesTemplate - .replace("%DAFNY_VERSION%", dafnyVersionString); - IOUtils.writeToFile(propertiesText, outputPath.toFile()); + for (final TargetLanguage lang : targetLangOutputDirs.keySet()) { + final Path outputDir = targetLangOutputDirs + .get(lang) + .toAbsolutePath() + .normalize(); + switch (lang) { + case DAFNY -> generateDafny(outputDir); + case JAVA -> generateJava(outputDir); + case DOTNET -> generateDotnet(outputDir); + default -> throw new UnsupportedOperationException( + "Cannot generate code for target language %s".formatted(lang.name()) + ); + } } - private void generateDafny(final Path outputDir) { - // Validated by builder, but check again - assert this.includeDafnyFile.isPresent(); - final DafnyApiCodegen dafnyApiCodegen = new DafnyApiCodegen( - model, - serviceShape, - outputDir, - this.includeDafnyFile.get(), - this.dependentModelPaths, - this.awsSdkStyle); - - if (this.localServiceTest) { - IOUtils.writeTokenTreesIntoDir( - dafnyApiCodegen.generateWrappedAbstractServiceModule(outputDir), - outputDir); - LOGGER.info("Dafny that tests a local service generated in {}", outputDir); - } else { - IOUtils.writeTokenTreesIntoDir(dafnyApiCodegen.generate(), outputDir); - LOGGER.info("Dafny code generated in {}", outputDir); - } - - LOGGER.info("Formatting Dafny code in {}", outputDir); - runCommand(outputDir, - "dafny", "format", - "--function-syntax:3", - "--unicode-char:false", - "."); - - handlePatching(TargetLanguage.DAFNY, outputDir); + propertiesFile.ifPresent(this::generateProjectPropertiesFile); + } + + private void generateProjectPropertiesFile(final Path outputPath) { + final String propertiesTemplate = IoUtils.readUtf8Resource( + this.getClass(), + "/templates/project.properties.template" + ); + // Drop the pre-release suffix, if any. + // This means with the current Dafny pre-release naming convention, + // we'll grab the most recent full release of a Dafny runtime. + // This mapping may need to change in the future. + // Ideally this would be handled by the Dafny CLI itself. + String dafnyVersionString = new DafnyVersion( + dafnyVersion.getMajor(), + dafnyVersion.getMinor(), + dafnyVersion.getPatch() + ) + .unparse(); + final String propertiesText = propertiesTemplate.replace( + "%DAFNY_VERSION%", + dafnyVersionString + ); + IOUtils.writeToFile(propertiesText, outputPath.toFile()); + } + + private void generateDafny(final Path outputDir) { + // Validated by builder, but check again + assert this.includeDafnyFile.isPresent(); + final DafnyApiCodegen dafnyApiCodegen = new DafnyApiCodegen( + model, + serviceShape, + outputDir, + this.includeDafnyFile.get(), + this.dependentModelPaths, + this.awsSdkStyle + ); + + if (this.localServiceTest) { + IOUtils.writeTokenTreesIntoDir( + dafnyApiCodegen.generateWrappedAbstractServiceModule(outputDir), + outputDir + ); + LOGGER.info( + "Dafny that tests a local service generated in {}", + outputDir + ); + } else { + IOUtils.writeTokenTreesIntoDir(dafnyApiCodegen.generate(), outputDir); + LOGGER.info("Dafny code generated in {}", outputDir); } - private void generateJava(final Path outputDir) { - if (this.awsSdkStyle) { - switch (this.javaAwsSdkVersion) { - case V1 -> javaAwsSdkV1(outputDir); - case V2 -> javaAwsSdkV2(outputDir); - } - } else if (this.localServiceTest) { - javaWrappedLocalService(outputDir); - } else { - javaLocalService(outputDir); - } - - LOGGER.info("Formatting Java code in {}", outputDir); - runCommand(outputDir, - "npx", "prettier", "--plugin=prettier-plugin-java", outputDir.toString(), "--write"); - - handlePatching(TargetLanguage.JAVA, outputDir); + LOGGER.info("Formatting Dafny code in {}", outputDir); + runCommand( + outputDir, + "dafny", + "format", + "--function-syntax:3", + "--unicode-char:false", + "." + ); + + handlePatching(TargetLanguage.DAFNY, outputDir); + } + + private void generateJava(final Path outputDir) { + if (this.awsSdkStyle) { + switch (this.javaAwsSdkVersion) { + case V1 -> javaAwsSdkV1(outputDir); + case V2 -> javaAwsSdkV2(outputDir); + } + } else if (this.localServiceTest) { + javaWrappedLocalService(outputDir); + } else { + javaLocalService(outputDir); } - private void javaLocalService(final Path outputDir) { - final JavaLibrary javaLibrary = new JavaLibrary(this.model, this.serviceShape, this.javaAwsSdkVersion, this.dafnyVersion); - IOUtils.writeTokenTreesIntoDir(javaLibrary.generate(), outputDir); - LOGGER.info("Java code generated in {}", outputDir); + LOGGER.info("Formatting Java code in {}", outputDir); + runCommand( + outputDir, + "npx", + "prettier", + "--plugin=prettier-plugin-java", + outputDir.toString(), + "--write" + ); + + handlePatching(TargetLanguage.JAVA, outputDir); + } + + private void javaLocalService(final Path outputDir) { + final JavaLibrary javaLibrary = new JavaLibrary( + this.model, + this.serviceShape, + this.javaAwsSdkVersion, + this.dafnyVersion + ); + IOUtils.writeTokenTreesIntoDir(javaLibrary.generate(), outputDir); + LOGGER.info("Java code generated in {}", outputDir); + } + + private void javaWrappedLocalService(final Path outputDir) { + final TestJavaLibrary testJavaLibrary = new TestJavaLibrary( + model, + serviceShape, + this.javaAwsSdkVersion, + this.dafnyVersion + ); + IOUtils.writeTokenTreesIntoDir(testJavaLibrary.generate(), outputDir); + LOGGER.info("Java that tests a local service generated in {}", outputDir); + } + + private void javaAwsSdkV1(Path outputDir) { + final JavaAwsSdkV1 javaShimCodegen = JavaAwsSdkV1.createJavaAwsSdkV1( + this.serviceShape, + this.model + ); + IOUtils.writeTokenTreesIntoDir(javaShimCodegen.generate(), outputDir); + LOGGER.info("Java V1 code generated in {}", outputDir); + } + + private void javaAwsSdkV2(final Path outputDir) { + final JavaAwsSdkV2 javaV2ShimCodegen = JavaAwsSdkV2.createJavaAwsSdkV2( + serviceShape, + model, + dafnyVersion + ); + IOUtils.writeTokenTreesIntoDir(javaV2ShimCodegen.generate(), outputDir); + LOGGER.info("Java V2 code generated in {}", outputDir); + } + + private void generateDotnet(final Path outputDir) { + if (this.awsSdkStyle) { + netAwsSdk(outputDir); + if (this.generateProjectFiles) { + netAwsSdkProjectFiles(outputDir); + } + } else if (this.localServiceTest) { + netWrappedLocalService(outputDir); + } else { + netLocalService(outputDir); } - private void javaWrappedLocalService(final Path outputDir) { - final TestJavaLibrary testJavaLibrary = new TestJavaLibrary(model, serviceShape, this.javaAwsSdkVersion, this.dafnyVersion); - IOUtils.writeTokenTreesIntoDir(testJavaLibrary.generate(), outputDir); - LOGGER.info("Java that tests a local service generated in {}", outputDir); + Path dotnetRoot = fromSmithyBuildPlugin + ? libraryRoot.resolve("runtimes").resolve("dotnet").resolve("Generated") + : libraryRoot.resolve("runtimes").resolve("net"); + LOGGER.info("Formatting .NET code in {}", dotnetRoot); + // Locate all *.csproj files in the directory + try { + Stream args = Streams.concat( + Stream.of("dotnet", "format"), + Files + .list(dotnetRoot) + .filter(path -> path.toFile().getName().endsWith(".csproj")) + .map(Path::toString) + ); + runCommand(dotnetRoot, args.toArray(String[]::new)); + } catch (IOException e) { + throw new RuntimeException(e); } - private void javaAwsSdkV1(Path outputDir) { - final JavaAwsSdkV1 javaShimCodegen = JavaAwsSdkV1.createJavaAwsSdkV1(this.serviceShape, this.model); - IOUtils.writeTokenTreesIntoDir(javaShimCodegen.generate(), outputDir); - LOGGER.info("Java V1 code generated in {}", outputDir); + handlePatching(TargetLanguage.DOTNET, outputDir); + } + + private void netLocalService(final Path outputDir) { + final ServiceCodegen service = new ServiceCodegen(model, serviceShape); + IOUtils.writeTokenTreesIntoDir(service.generate(), outputDir); + + final ShimCodegen shim = new ShimCodegen(model, serviceShape); + IOUtils.writeTokenTreesIntoDir(shim.generate(), outputDir); + + final TypeConversionCodegen conversion = new TypeConversionCodegen( + model, + serviceShape + ); + IOUtils.writeTokenTreesIntoDir(conversion.generate(), outputDir); + LOGGER.info(".NET code generated in {}", outputDir); + } + + private void netWrappedLocalService(final Path outputDir) { + final LocalServiceWrappedCodegen service = new LocalServiceWrappedCodegen( + model, + serviceShape + ); + IOUtils.writeTokenTreesIntoDir(service.generate(), outputDir); + + final LocalServiceWrappedShimCodegen wrappedShim = + new LocalServiceWrappedShimCodegen(model, serviceShape); + IOUtils.writeTokenTreesIntoDir(wrappedShim.generate(), outputDir); + + final TypeConversionCodegen conversion = + new LocalServiceWrappedConversionCodegen(model, serviceShape); + IOUtils.writeTokenTreesIntoDir(conversion.generate(), outputDir); + LOGGER.info(".NET that tests a local service generated in {}", outputDir); + } + + private void netAwsSdk(final Path outputDir) { + final AwsSdkShimCodegen dotnetShimCodegen = new AwsSdkShimCodegen( + model, + serviceShape + ); + IOUtils.writeTokenTreesIntoDir(dotnetShimCodegen.generate(), outputDir); + + final TypeConversionCodegen conversion = new AwsSdkTypeConversionCodegen( + model, + serviceShape + ); + IOUtils.writeTokenTreesIntoDir(conversion.generate(), outputDir); + LOGGER.info(".NET code generated in {}", outputDir); + } + + private void netAwsSdkProjectFiles(final Path outputDir) { + final String sdkId = + this.serviceShape.expectTrait(ServiceTrait.class).getSdkId(); + + final Path includeDafnyFile = + this.includeDafnyFile.orElseThrow(() -> + new IllegalStateException( + "includeDafnyFile required when generating .NET project files" + ) + ); + // Assumes that includeDafnyFile is at StandardLibrary/src/Index.dfy + // TODO be smarter about finding the StandardLibrary path + final Path stdLibPath = outputDir.relativize( + includeDafnyFile.resolve("../..") + ); + + final String csprojTemplate = IoUtils.readUtf8Resource( + this.getClass(), + "/templates/AwsSdkProject.csproj.template" + ); + final String csprojText = csprojTemplate + .replace("%SDK_ID%", sdkId) + .replace("%STDLIB_PATH%", stdLibPath.toString()); + IOUtils.writeToFile( + csprojText, + outputDir.resolve(sdkId + ".csproj").toFile() + ); + + // TODO generate Makefile + + LOGGER.info(".NET project files generated in {}", outputDir); + } + + private static final Pattern PATCH_FILE_PATTERN = Pattern.compile( + "dafny-(.*).patch" + ); + + private DafnyVersion getDafnyVersionForPatchFile(Path file) { + String fileName = file.getFileName().toString(); + Matcher matcher = PATCH_FILE_PATTERN.matcher(fileName); + if (matcher.matches()) { + String versionString = matcher.group(1); + return DafnyVersion.parse(versionString); + } else { + throw new IllegalArgumentException( + "Patch files must be of the form dafny-.patch: " + file + ); } + } - private void javaAwsSdkV2(final Path outputDir) { - final JavaAwsSdkV2 javaV2ShimCodegen = JavaAwsSdkV2.createJavaAwsSdkV2(serviceShape, model, dafnyVersion); - IOUtils.writeTokenTreesIntoDir(javaV2ShimCodegen.generate(), outputDir); - LOGGER.info("Java V2 code generated in {}", outputDir); + private void handlePatching(TargetLanguage targetLanguage, Path outputDir) { + if (patchFilesDir.isEmpty()) { + return; } - private void generateDotnet(final Path outputDir) { - if (this.awsSdkStyle) { - netAwsSdk(outputDir); - if (this.generateProjectFiles) { - netAwsSdkProjectFiles(outputDir); - } - } else if (this.localServiceTest) { - netWrappedLocalService(outputDir); - } else { - netLocalService(outputDir); + Path patchFilesForLanguage = patchFilesDir + .get() + .resolve(targetLanguage.name().toLowerCase()); + try { + if (updatePatchFiles) { + Files.createDirectories(patchFilesForLanguage); + Path patchFile = patchFilesForLanguage.resolve( + "dafny-%s.patch".formatted(dafnyVersion.unparse()) + ); + Path outputDirRelative = libraryRoot.relativize(outputDir); + // Need to ignore the exit code because diff will return 1 if there is a diff + String patchContent = runCommandIgnoringExitCode( + libraryRoot, + "git", + "diff", + "-R", + outputDirRelative.toString() + ); + if (!patchContent.isBlank()) { + IOUtils.writeToFile(patchContent, patchFile.toFile()); } - - - Path dotnetRoot = fromSmithyBuildPlugin - ? libraryRoot.resolve("runtimes").resolve("dotnet").resolve("Generated") - : libraryRoot.resolve("runtimes").resolve("net"); - LOGGER.info("Formatting .NET code in {}", dotnetRoot); - // Locate all *.csproj files in the directory - try { - Stream args = Streams.concat( - Stream.of("dotnet", "format"), - Files.list(dotnetRoot) - .filter(path -> path.toFile().getName().endsWith(".csproj")) - .map(Path::toString)); - runCommand(dotnetRoot, args.toArray(String[]::new)); - } catch (IOException e) { - throw new RuntimeException(e); + } + + if (Files.exists(patchFilesForLanguage)) { + List> sortedPatchFiles = Files + .list(patchFilesForLanguage) + .map(file -> Pair.of(getDafnyVersionForPatchFile(file), file)) + .sorted(Collections.reverseOrder(Map.Entry.comparingByKey())) + .toList(); + for (Pair patchFilePair : sortedPatchFiles) { + if (dafnyVersion.compareTo(patchFilePair.getKey()) >= 0) { + Path patchFile = patchFilePair.getValue(); + LOGGER.info("Applying patch file {}", patchFile); + runCommand(libraryRoot, "git", "apply", patchFile.toString()); + return; + } } - - handlePatching(TargetLanguage.DOTNET, outputDir); + } + } catch (IOException e) { + throw new RuntimeException(e); } - - private void netLocalService(final Path outputDir) { - final ServiceCodegen service = new ServiceCodegen(model, serviceShape); - IOUtils.writeTokenTreesIntoDir(service.generate(), outputDir); - - final ShimCodegen shim = new ShimCodegen(model, serviceShape); - IOUtils.writeTokenTreesIntoDir(shim.generate(), outputDir); - - final TypeConversionCodegen conversion = new TypeConversionCodegen(model, serviceShape); - IOUtils.writeTokenTreesIntoDir(conversion.generate(), outputDir); - LOGGER.info(".NET code generated in {}", outputDir); + } + + private String runCommand(Path workingDir, String... args) { + List argsList = List.of(args); + StringBuilder output = new StringBuilder(); + int exitCode = IoUtils.runCommand( + argsList, + workingDir, + output, + Collections.emptyMap() + ); + if (exitCode != 0) { + throw new RuntimeException("Command failed: " + argsList + "\n" + output); } + return output.toString(); + } + + private String runCommandIgnoringExitCode(Path workingDir, String... args) { + List argsList = List.of(args); + StringBuilder output = new StringBuilder(); + IoUtils.runCommand(argsList, workingDir, output, Collections.emptyMap()); + return output.toString(); + } + + public static class Builder { + + private boolean fromSmithyBuildPlugin = false; + private Model serviceModel; + private Path[] dependentModelPaths; + private String namespace; + private Map targetLangOutputDirs; + private DafnyVersion dafnyVersion = new DafnyVersion(4, 1, 0); + private Path propertiesFile; + private AwsSdkVersion javaAwsSdkVersion = AwsSdkVersion.V2; + private Path includeDafnyFile; + private boolean awsSdkStyle = false; + private boolean localServiceTest = false; + private boolean generateProjectFiles = false; + private Path libraryRoot; + private Path patchFilesDir; + private boolean updatePatchFiles = false; + + public Builder() {} - private void netWrappedLocalService(final Path outputDir) { - final LocalServiceWrappedCodegen service = new LocalServiceWrappedCodegen(model, serviceShape); - IOUtils.writeTokenTreesIntoDir(service.generate(), outputDir); - - final LocalServiceWrappedShimCodegen wrappedShim = new LocalServiceWrappedShimCodegen(model, serviceShape); - IOUtils.writeTokenTreesIntoDir(wrappedShim.generate(), outputDir); - - final TypeConversionCodegen conversion = new LocalServiceWrappedConversionCodegen(model, serviceShape); - IOUtils.writeTokenTreesIntoDir(conversion.generate(), outputDir); - LOGGER.info(".NET that tests a local service generated in {}", outputDir); + /** + * Sets the directory in which to search for model files(s) containing the desired service. + */ + public Builder withServiceModel(final Model serviceModel) { + this.serviceModel = serviceModel; + return this; } - private void netAwsSdk(final Path outputDir) { - final AwsSdkShimCodegen dotnetShimCodegen = new AwsSdkShimCodegen(model, serviceShape); - IOUtils.writeTokenTreesIntoDir(dotnetShimCodegen.generate(), outputDir); - - final TypeConversionCodegen conversion = new AwsSdkTypeConversionCodegen(model, serviceShape); - IOUtils.writeTokenTreesIntoDir(conversion.generate(), outputDir); - LOGGER.info(".NET code generated in {}", outputDir); + /** + * Sets the directories in which to search for dependent model file(s). + */ + public Builder withDependentModelPaths(final Path[] dependentModelPaths) { + this.dependentModelPaths = dependentModelPaths; + return this; } - private void netAwsSdkProjectFiles(final Path outputDir) { - final String sdkId = this.serviceShape.expectTrait(ServiceTrait.class).getSdkId(); - - final Path includeDafnyFile = this.includeDafnyFile.orElseThrow( - () -> new IllegalStateException("includeDafnyFile required when generating .NET project files")); - // Assumes that includeDafnyFile is at StandardLibrary/src/Index.dfy - // TODO be smarter about finding the StandardLibrary path - final Path stdLibPath = outputDir.relativize(includeDafnyFile.resolve("../..")); - - final String csprojTemplate = IoUtils.readUtf8Resource( - this.getClass(), "/templates/AwsSdkProject.csproj.template"); - final String csprojText = csprojTemplate - .replace("%SDK_ID%", sdkId) - .replace("%STDLIB_PATH%", stdLibPath.toString()); - IOUtils.writeToFile(csprojText, outputDir.resolve(sdkId + ".csproj").toFile()); - - // TODO generate Makefile - - LOGGER.info(".NET project files generated in {}", outputDir); + /** + * Sets the Smithy namespace for which to generate code (e.g. "com.foo"). + */ + public Builder withNamespace(final String namespace) { + this.namespace = namespace; + return this; } - private static final Pattern PATCH_FILE_PATTERN = Pattern.compile("dafny-(.*).patch"); - - private DafnyVersion getDafnyVersionForPatchFile(Path file) { - String fileName = file.getFileName().toString(); - Matcher matcher = PATCH_FILE_PATTERN.matcher(fileName); - if (matcher.matches()) { - String versionString = matcher.group(1); - return DafnyVersion.parse(versionString); - } else { - throw new IllegalArgumentException("Patch files must be of the form dafny-.patch: " + file); - } + /** + * Sets the target language(s) for which to generate code, + * along with the directory(-ies) into which to output each language's generated code. + */ + public Builder withTargetLangOutputDirs( + final Map targetLangOutputDirs + ) { + this.targetLangOutputDirs = targetLangOutputDirs; + return this; } - private void handlePatching(TargetLanguage targetLanguage, Path outputDir) { - if (patchFilesDir.isEmpty()) { - return; - } - - Path patchFilesForLanguage = patchFilesDir.get().resolve(targetLanguage.name().toLowerCase()); - try { - if (updatePatchFiles) { - Files.createDirectories(patchFilesForLanguage); - Path patchFile = patchFilesForLanguage.resolve("dafny-%s.patch".formatted(dafnyVersion.unparse())); - Path outputDirRelative = libraryRoot.relativize(outputDir); - // Need to ignore the exit code because diff will return 1 if there is a diff - String patchContent = runCommandIgnoringExitCode(libraryRoot, "git", "diff", "-R", outputDirRelative.toString()); - if (!patchContent.isBlank()) { - IOUtils.writeToFile(patchContent, patchFile.toFile()); - } - } - - if (Files.exists(patchFilesForLanguage)) { - List> sortedPatchFiles = Files.list(patchFilesForLanguage) - .map(file -> Pair.of(getDafnyVersionForPatchFile(file), file)) - .sorted(Collections.reverseOrder(Map.Entry.comparingByKey())) - .toList(); - for (Pair patchFilePair : sortedPatchFiles) { - if (dafnyVersion.compareTo(patchFilePair.getKey()) >= 0) { - Path patchFile = patchFilePair.getValue(); - LOGGER.info("Applying patch file {}", patchFile); - runCommand(libraryRoot, "git", "apply", patchFile.toString()); - return; - } - } - } - } catch (IOException e) { - throw new RuntimeException(e); - } + /** + * Sets the Dafny version for which generated code should be compatible. + * This is used to ensure both Dafny source compatibility + * and compatibility with the Dafny compiler and runtime internals, + * which shim code generation currently depends on. + */ + public Builder withDafnyVersion(final DafnyVersion dafnyVersion) { + this.dafnyVersion = dafnyVersion; + return this; } - private String runCommand(Path workingDir, String ... args) { - List argsList = List.of(args); - StringBuilder output = new StringBuilder(); - int exitCode = IoUtils.runCommand( - argsList, - workingDir, - output, - Collections.emptyMap()); - if (exitCode != 0) { - throw new RuntimeException("Command failed: " + argsList + "\n" + output); - } - return output.toString(); + /** + * Sets the path to generate a project.properties file at. + * This will contain a dafnyVersion property that can be used to + * select the correct version of the Dafny runtime in target language + * project configurations, amonst other potential uses. + * The properties file may contain other metadata in the future. + */ + public Builder withPropertiesFile(final Path propertiesFile) { + this.propertiesFile = propertiesFile; + return this; } - private String runCommandIgnoringExitCode(Path workingDir, String ... args) { - List argsList = List.of(args); - StringBuilder output = new StringBuilder(); - IoUtils.runCommand( - argsList, - workingDir, - output, - Collections.emptyMap()); - return output.toString(); + /** + * Sets the version of the AWS SDK for Java for which generated code should be compatible. + * This has no effect unless the engine is configured to generate Java code. + */ + public Builder withJavaAwsSdkVersion( + final AwsSdkVersion javaAwsSdkVersion + ) { + this.javaAwsSdkVersion = javaAwsSdkVersion; + return this; } - public static class Builder { - private boolean fromSmithyBuildPlugin = false; - private Model serviceModel; - private Path[] dependentModelPaths; - private String namespace; - private Map targetLangOutputDirs; - private DafnyVersion dafnyVersion = new DafnyVersion(4, 1, 0); - private Path propertiesFile; - private AwsSdkVersion javaAwsSdkVersion = AwsSdkVersion.V2; - private Path includeDafnyFile; - private boolean awsSdkStyle = false; - private boolean localServiceTest = false; - private boolean generateProjectFiles = false; - private Path libraryRoot; - private Path patchFilesDir; - private boolean updatePatchFiles = false; - - public Builder() {} - - /** - * Sets the directory in which to search for model files(s) containing the desired service. - */ - public Builder withServiceModel(final Model serviceModel) { - this.serviceModel = serviceModel; - return this; - } - - /** - * Sets the directories in which to search for dependent model file(s). - */ - public Builder withDependentModelPaths(final Path[] dependentModelPaths) { - this.dependentModelPaths = dependentModelPaths; - return this; - } - - /** - * Sets the Smithy namespace for which to generate code (e.g. "com.foo"). - */ - public Builder withNamespace(final String namespace) { - this.namespace = namespace; - return this; - } - - /** - * Sets the target language(s) for which to generate code, - * along with the directory(-ies) into which to output each language's generated code. - */ - public Builder withTargetLangOutputDirs(final Map targetLangOutputDirs) { - this.targetLangOutputDirs = targetLangOutputDirs; - return this; - } - - /** - * Sets the Dafny version for which generated code should be compatible. - * This is used to ensure both Dafny source compatibility - * and compatibility with the Dafny compiler and runtime internals, - * which shim code generation currently depends on. - */ - public Builder withDafnyVersion(final DafnyVersion dafnyVersion) { - this.dafnyVersion = dafnyVersion; - return this; - } - - /** - * Sets the path to generate a project.properties file at. - * This will contain a dafnyVersion property that can be used to - * select the correct version of the Dafny runtime in target language - * project configurations, amonst other potential uses. - * The properties file may contain other metadata in the future. - */ - public Builder withPropertiesFile(final Path propertiesFile) { - this.propertiesFile = propertiesFile; - return this; - } - - /** - * Sets the version of the AWS SDK for Java for which generated code should be compatible. - * This has no effect unless the engine is configured to generate Java code. - */ - public Builder withJavaAwsSdkVersion(final AwsSdkVersion javaAwsSdkVersion) { - this.javaAwsSdkVersion = javaAwsSdkVersion; - return this; - } - - /** - * Sets a file to be included in the generated Dafny code. - */ - public Builder withIncludeDafnyFile(final Path includeDafnyFile) { - this.includeDafnyFile = includeDafnyFile; - return this; - } - - /** - * Sets whether codegen will generate AWS SDK-compatible API and shims. - */ - public Builder withAwsSdkStyle(final boolean awsSdkStyle) { - this.awsSdkStyle = awsSdkStyle; - return this; - } + /** + * Sets a file to be included in the generated Dafny code. + */ + public Builder withIncludeDafnyFile(final Path includeDafnyFile) { + this.includeDafnyFile = includeDafnyFile; + return this; + } - /** - * Sets whether codegen will generate Dafny code to test a local service. - */ - public Builder withLocalServiceTest(final boolean localServiceTest) { - this.localServiceTest = localServiceTest; - return this; - } + /** + * Sets whether codegen will generate AWS SDK-compatible API and shims. + */ + public Builder withAwsSdkStyle(final boolean awsSdkStyle) { + this.awsSdkStyle = awsSdkStyle; + return this; + } - /** - * Sets whether codegen will generate project files, - * including a Makefile and target-language specific build configuration. - */ - public Builder withGenerateProjectFiles(final boolean generateProjectFiles) { - this.generateProjectFiles = generateProjectFiles; - return this; - } + /** + * Sets whether codegen will generate Dafny code to test a local service. + */ + public Builder withLocalServiceTest(final boolean localServiceTest) { + this.localServiceTest = localServiceTest; + return this; + } - /** - * Sets the root directory of the library being built. - * Used to locate any patch files (under ./codegen-patches) - * and things like target language project roots. - */ - public Builder withLibraryRoot(final Path libraryRoot) { - this.libraryRoot = libraryRoot; - return this; - } + /** + * Sets whether codegen will generate project files, + * including a Makefile and target-language specific build configuration. + */ + public Builder withGenerateProjectFiles( + final boolean generateProjectFiles + ) { + this.generateProjectFiles = generateProjectFiles; + return this; + } - /** - * Indicates whether the engine is being used from the polymorph CLI - * or the Smithy build plugin. - * Needed because the two use cases have different library layout conventions. - */ - public Builder withFromSmithyBuildPlugin(final boolean fromSmithyBuildPlugin) { - this.fromSmithyBuildPlugin = fromSmithyBuildPlugin; - return this; - } + /** + * Sets the root directory of the library being built. + * Used to locate any patch files (under ./codegen-patches) + * and things like target language project roots. + */ + public Builder withLibraryRoot(final Path libraryRoot) { + this.libraryRoot = libraryRoot; + return this; + } - /** - * The location of patch files. - */ - public Builder withPatchFilesDir(final Path patchFilesDir) { - this.patchFilesDir = patchFilesDir; - return this; - } + /** + * Indicates whether the engine is being used from the polymorph CLI + * or the Smithy build plugin. + * Needed because the two use cases have different library layout conventions. + */ + public Builder withFromSmithyBuildPlugin( + final boolean fromSmithyBuildPlugin + ) { + this.fromSmithyBuildPlugin = fromSmithyBuildPlugin; + return this; + } - /** - * If true, updates the relevant patch files in (library-root)/codegen-patches - * to change the generated code into the state of the code before generation. - */ - public Builder withUpdatePatchFiles(final boolean updatePatchFiles) { - this.updatePatchFiles = updatePatchFiles; - return this; - } + /** + * The location of patch files. + */ + public Builder withPatchFilesDir(final Path patchFilesDir) { + this.patchFilesDir = patchFilesDir; + return this; + } - public CodegenEngine build() { - final Model serviceModel = Objects.requireNonNull(this.serviceModel); - final Path[] dependentModelPaths = this.dependentModelPaths == null - ? new Path[] {} - : this.dependentModelPaths.clone(); - if (Strings.isNullOrEmpty(this.namespace)) { - throw new IllegalStateException("No namespace provided"); - } - - final Map targetLangOutputDirsRaw = Objects.requireNonNull(this.targetLangOutputDirs); - targetLangOutputDirsRaw.replaceAll((_lang, path) -> path.toAbsolutePath().normalize()); - final Map targetLangOutputDirs = ImmutableMap.copyOf(targetLangOutputDirsRaw); - - final DafnyVersion dafnyVersion = Objects.requireNonNull(this.dafnyVersion); - final Optional propertiesFile = Optional.ofNullable(this.propertiesFile) - .map(path -> path.toAbsolutePath().normalize()); - final AwsSdkVersion javaAwsSdkVersion = Objects.requireNonNull(this.javaAwsSdkVersion); - - if (targetLangOutputDirs.containsKey(TargetLanguage.DAFNY) - && this.includeDafnyFile == null) { - throw new IllegalStateException("includeDafnyFile is required when generating Dafny code"); - } - final Optional includeDafnyFile = Optional.ofNullable(this.includeDafnyFile) - .map(path -> path.toAbsolutePath().normalize()); - - if (this.awsSdkStyle && this.localServiceTest) { - throw new IllegalStateException( - "Cannot generate AWS SDK style code, and test a local service, at the same time"); - } - - final Path libraryRoot = this.libraryRoot.toAbsolutePath().normalize(); - - final Optional patchFilesDir = Optional.ofNullable(this.patchFilesDir) - .map(path -> path.toAbsolutePath().normalize()); - if (updatePatchFiles && patchFilesDir.isEmpty()) { - throw new IllegalStateException( - "Cannot update patch files without specifying a patch files directory"); - } - - return new CodegenEngine( - fromSmithyBuildPlugin, - serviceModel, - dependentModelPaths, - this.namespace, - targetLangOutputDirs, - dafnyVersion, - propertiesFile, - javaAwsSdkVersion, - includeDafnyFile, - this.awsSdkStyle, - this.localServiceTest, - this.generateProjectFiles, - libraryRoot, - patchFilesDir, - updatePatchFiles - ); - } + /** + * If true, updates the relevant patch files in (library-root)/codegen-patches + * to change the generated code into the state of the code before generation. + */ + public Builder withUpdatePatchFiles(final boolean updatePatchFiles) { + this.updatePatchFiles = updatePatchFiles; + return this; } - public enum TargetLanguage { - DAFNY, - JAVA, - DOTNET, + public CodegenEngine build() { + final Model serviceModel = Objects.requireNonNull(this.serviceModel); + final Path[] dependentModelPaths = this.dependentModelPaths == null + ? new Path[] {} + : this.dependentModelPaths.clone(); + if (Strings.isNullOrEmpty(this.namespace)) { + throw new IllegalStateException("No namespace provided"); + } + + final Map targetLangOutputDirsRaw = + Objects.requireNonNull(this.targetLangOutputDirs); + targetLangOutputDirsRaw.replaceAll((_lang, path) -> + path.toAbsolutePath().normalize() + ); + final Map targetLangOutputDirs = + ImmutableMap.copyOf(targetLangOutputDirsRaw); + + final DafnyVersion dafnyVersion = Objects.requireNonNull( + this.dafnyVersion + ); + final Optional propertiesFile = Optional + .ofNullable(this.propertiesFile) + .map(path -> path.toAbsolutePath().normalize()); + final AwsSdkVersion javaAwsSdkVersion = Objects.requireNonNull( + this.javaAwsSdkVersion + ); + + if ( + targetLangOutputDirs.containsKey(TargetLanguage.DAFNY) && + this.includeDafnyFile == null + ) { + throw new IllegalStateException( + "includeDafnyFile is required when generating Dafny code" + ); + } + final Optional includeDafnyFile = Optional + .ofNullable(this.includeDafnyFile) + .map(path -> path.toAbsolutePath().normalize()); + + if (this.awsSdkStyle && this.localServiceTest) { + throw new IllegalStateException( + "Cannot generate AWS SDK style code, and test a local service, at the same time" + ); + } + + final Path libraryRoot = this.libraryRoot.toAbsolutePath().normalize(); + + final Optional patchFilesDir = Optional + .ofNullable(this.patchFilesDir) + .map(path -> path.toAbsolutePath().normalize()); + if (updatePatchFiles && patchFilesDir.isEmpty()) { + throw new IllegalStateException( + "Cannot update patch files without specifying a patch files directory" + ); + } + + return new CodegenEngine( + fromSmithyBuildPlugin, + serviceModel, + dependentModelPaths, + this.namespace, + targetLangOutputDirs, + dafnyVersion, + propertiesFile, + javaAwsSdkVersion, + includeDafnyFile, + this.awsSdkStyle, + this.localServiceTest, + this.generateProjectFiles, + libraryRoot, + patchFilesDir, + updatePatchFiles + ); } + } + + public enum TargetLanguage { + DAFNY, + JAVA, + DOTNET, + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyApiCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyApiCodegen.java index 7b4cb20b62..f0d8394ee9 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyApiCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyApiCodegen.java @@ -4,7 +4,13 @@ package software.amazon.polymorph.smithydafny; import com.google.common.annotations.VisibleForTesting; - +import java.nio.file.Path; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; import software.amazon.polymorph.traits.LocalServiceTrait; import software.amazon.polymorph.traits.MutableLocalStateTrait; @@ -14,692 +20,844 @@ import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.utils.Token; import software.amazon.polymorph.utils.TokenTree; - +import software.amazon.smithy.aws.traits.*; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.*; import software.amazon.smithy.model.traits.*; -import software.amazon.smithy.aws.traits.*; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.nio.file.Path; -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; -import java.util.stream.Stream; public class DafnyApiCodegen { - private final Model model; - private final ServiceShape serviceShape; - private final DafnyNameResolver nameResolver; - private final Path outputDir; - private final Path includeDafnyFile; - private static final Logger LOGGER = LoggerFactory.getLogger(DafnyApiCodegen.class); - static final Optional DOUBLE_LENGTH_CONSTRAINT = Optional.of( - generateLengthConstraint(LengthTrait.builder() - .min((long) 8).max((long) 8).build())); - // Codegen for nested lists and maps uses temporary variables with unique names for set comprehension. - // These look like `tmp`, `t`, or `tmps` with a number appended: e.g. `tmp0`, `t0`, `tmps0`. - // This identifier is appended to variable names to ensure all of these variables have unique names, and - // do not accidentally re-use a variable. - // This provides unique identifiers across all Dafny-generated code. - private int intermediateTempVariableCounter = 0; - private final boolean generateCollectionOfErrors; - - public DafnyApiCodegen( - final Model model, - final ServiceShape serviceShape, - final Path outputDir, - final Path includeDafnyFile, - final Path[] dependentModelPaths, - final boolean awsSdkRequest - ) { - this.model = model; - this.serviceShape = serviceShape; - this.outputDir = outputDir; - this.includeDafnyFile = includeDafnyFile; - this.nameResolver = new DafnyNameResolver( - model, - this.serviceShape.toShapeId().getNamespace(), - // Collect into TreeSet so that we generate code in a deterministic order (lexicographic, in particular) - new TreeSet(), - dependentModelPaths.clone() - ); - this.generateCollectionOfErrors = !awsSdkRequest; - } - public Map generate() { + private final Model model; + private final ServiceShape serviceShape; + private final DafnyNameResolver nameResolver; + private final Path outputDir; + private final Path includeDafnyFile; + private static final Logger LOGGER = LoggerFactory.getLogger( + DafnyApiCodegen.class + ); + static final Optional DOUBLE_LENGTH_CONSTRAINT = Optional.of( + generateLengthConstraint( + LengthTrait.builder().min((long) 8).max((long) 8).build() + ) + ); + // Codegen for nested lists and maps uses temporary variables with unique names for set comprehension. + // These look like `tmp`, `t`, or `tmps` with a number appended: e.g. `tmp0`, `t0`, `tmps0`. + // This identifier is appended to variable names to ensure all of these variables have unique names, and + // do not accidentally re-use a variable. + // This provides unique identifiers across all Dafny-generated code. + private int intermediateTempVariableCounter = 0; + private final boolean generateCollectionOfErrors; + + public DafnyApiCodegen( + final Model model, + final ServiceShape serviceShape, + final Path outputDir, + final Path includeDafnyFile, + final Path[] dependentModelPaths, + final boolean awsSdkRequest + ) { + this.model = model; + this.serviceShape = serviceShape; + this.outputDir = outputDir; + this.includeDafnyFile = includeDafnyFile; + this.nameResolver = + new DafnyNameResolver( + model, + this.serviceShape.toShapeId().getNamespace(), + // Collect into TreeSet so that we generate code in a deterministic order (lexicographic, in particular) + new TreeSet(), + dependentModelPaths.clone() + ); + this.generateCollectionOfErrors = !awsSdkRequest; + } - // I generate the types *first* - // This is because the generated types - // MAY depend on other models. - // In this case I need these modules - // so that I can include them. - final TokenTree generatedTypes = TokenTree - .of( - model - .shapes() - .filter(shape -> ModelUtils.isInServiceNamespace(shape.getId(), serviceShape)) - // Sort by shape ID for deterministic generated code - .collect(Collectors.toCollection(TreeSet::new)) - .stream() - .map(this::generateCodeForShape) - .flatMap(Optional::stream) - ) - .lineSeparated(); + public Map generate() { + // I generate the types *first* + // This is because the generated types + // MAY depend on other models. + // In this case I need these modules + // so that I can include them. + final TokenTree generatedTypes = TokenTree + .of( + model + .shapes() + .filter(shape -> + ModelUtils.isInServiceNamespace(shape.getId(), serviceShape) + ) + // Sort by shape ID for deterministic generated code + .collect(Collectors.toCollection(TreeSet::new)) + .stream() + .map(this::generateCodeForShape) + .flatMap(Optional::stream) + ) + .lineSeparated(); - // A smithy model may reference a model in a different package. - // In which case we need to include it. - final TokenTree includeDirectives = TokenTree - .of(Stream - .concat( - Stream - .of( - outputDir.relativize(includeDafnyFile) - ), - nameResolver - .dependentModels() - // nameResolve.dependentModels() filters dependentModelPaths - // to only the relevant dependent models. - // Some models are only informational, - // and do not point to any generated Dafny. - .stream() - .map(d -> outputDir - .relativize(d.modelPath().resolve("../src/Index.dfy")) - ) - .map(Path::toString) - ) - .map(p -> "include \"" + p + "\"") - .map(Token::of) + // A smithy model may reference a model in a different package. + // In which case we need to include it. + final TokenTree includeDirectives = TokenTree + .of( + Stream + .concat( + Stream.of(outputDir.relativize(includeDafnyFile)), + nameResolver + .dependentModels() + // nameResolve.dependentModels() filters dependentModelPaths + // to only the relevant dependent models. + // Some models are only informational, + // and do not point to any generated Dafny. + .stream() + .map(d -> + outputDir.relativize(d.modelPath().resolve("../src/Index.dfy")) + ) + .map(Path::toString) ) - .lineSeparated(); + .map(p -> "include \"" + p + "\"") + .map(Token::of) + ) + .lineSeparated(); - final String namespace = serviceShape.getId().getNamespace(); - final String typesModuleName = DafnyNameResolver.dafnyTypesModuleName(namespace); - final TokenTree typesModuleHeader = Token.of("module {:extern \"%s\" } %s" - .formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(serviceShape.getId()), - typesModuleName - )); - final TokenTree abstractServiceModule = generateAbstractServiceModule(serviceShape); - final TokenTree abstractOperationsModule = generateAbstractOperationsModule(serviceShape); - final TokenTree modeledErrorDataType = generateModeledErrorDataType(); - // A smithy model may reference a model in a different package. - // In which case we need to import it. - // Everything MUST BE GENERATED BEFORE `typesModulePrelude` is calculated. - // Otherwise, a foreign shape maybe referenced WITHOUT an import. - final TokenTree typesModulePrelude = TokenTree - .of(Stream - .concat( - DafnyNameResolver.modulePreludeStandardImports(), - nameResolver - .dependentModels() - .stream() - .map(d -> - "import " + DafnyNameResolver.dafnyTypesModuleName(d.namespace()))) - .map(Token::of) + final String namespace = serviceShape.getId().getNamespace(); + final String typesModuleName = DafnyNameResolver.dafnyTypesModuleName( + namespace + ); + final TokenTree typesModuleHeader = Token.of( + "module {:extern \"%s\" } %s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId( + serviceShape.getId() + ), + typesModuleName + ) + ); + final TokenTree abstractServiceModule = generateAbstractServiceModule( + serviceShape + ); + final TokenTree abstractOperationsModule = generateAbstractOperationsModule( + serviceShape + ); + final TokenTree modeledErrorDataType = generateModeledErrorDataType(); + // A smithy model may reference a model in a different package. + // In which case we need to import it. + // Everything MUST BE GENERATED BEFORE `typesModulePrelude` is calculated. + // Otherwise, a foreign shape maybe referenced WITHOUT an import. + final TokenTree typesModulePrelude = TokenTree + .of( + Stream + .concat( + DafnyNameResolver.modulePreludeStandardImports(), + nameResolver + .dependentModels() + .stream() + .map(d -> + "import " + + DafnyNameResolver.dafnyTypesModuleName(d.namespace()) + ) ) - .lineSeparated(); + .map(Token::of) + ) + .lineSeparated(); - final TokenTree typesModuleBody = TokenTree - .of( - typesModulePrelude, - // These are just put here to facilitate nice formatting... - TokenTree.of("// Generic helpers for verification of mock/unit tests."), - TokenTree.of("datatype %s = %s(input: I, output: O)" - .formatted( - nameResolver.callEventTypeName(), - nameResolver.callEventTypeName() - )), - TokenTree.empty(), - TokenTree.of("// Begin Generated Types"), - TokenTree.empty(), - generatedTypes, - // Error types are generated *after* - // all other types to account - // for any dependent modules - modeledErrorDataType + final TokenTree typesModuleBody = TokenTree + .of( + typesModulePrelude, + // These are just put here to facilitate nice formatting... + TokenTree.of("// Generic helpers for verification of mock/unit tests."), + TokenTree.of( + "datatype %s = %s(input: I, output: O)".formatted( + nameResolver.callEventTypeName(), + nameResolver.callEventTypeName() ) - .lineSeparated() - .braced(); + ), + TokenTree.empty(), + TokenTree.of("// Begin Generated Types"), + TokenTree.empty(), + generatedTypes, + // Error types are generated *after* + // all other types to account + // for any dependent modules + modeledErrorDataType + ) + .lineSeparated() + .braced(); - final Path path = Path.of("%s.dfy".formatted(typesModuleName)); - final TokenTree fullCode = TokenTree - .of( - includeDirectives, - typesModuleHeader, - typesModuleBody, - abstractServiceModule, - abstractOperationsModule - ) - .lineSeparated(); - return Map.of(path, fullCode); + final Path path = Path.of("%s.dfy".formatted(typesModuleName)); + final TokenTree fullCode = TokenTree + .of( + includeDirectives, + typesModuleHeader, + typesModuleBody, + abstractServiceModule, + abstractOperationsModule + ) + .lineSeparated(); + return Map.of(path, fullCode); + } + + public Map generateWrappedAbstractServiceModule( + final Path outputDafny + ) { + if (serviceShape.hasTrait(ServiceTrait.class)) { + // TODO move the AWS SDK branch over here. + // It should be the case that the default --aws-sdk + // is for building a Dafny AWS SDK, + // not wrapping an existing one. + throw new IllegalStateException( + "Wrapped AWS service only supported in --aws-sdk" + ); + } else if (!serviceShape.hasTrait(LocalServiceTrait.class)) { + throw new IllegalStateException("Service does not have supported trait"); } - public Map generateWrappedAbstractServiceModule(final Path outputDafny) { - if (serviceShape.hasTrait(ServiceTrait.class)) { - // TODO move the AWS SDK branch over here. - // It should be the case that the default --aws-sdk - // is for building a Dafny AWS SDK, - // not wrapping an existing one. - throw new IllegalStateException("Wrapped AWS service only supported in --aws-sdk"); - } else if (!serviceShape.hasTrait(LocalServiceTrait.class)) { - throw new IllegalStateException("Service does not have supported trait"); - } - - final String namespace = serviceShape.getId().getNamespace(); - final String typesModuleName = DafnyNameResolver.dafnyTypesModuleName(namespace); - final Path path = Path.of("%sWrapped.dfy".formatted(typesModuleName)); - - // A smithy model may reference a model in a different package. - // In which case we need to include it. - final TokenTree includeDirectives = TokenTree - .of(Stream - .concat( - Stream - .of( - outputDir.relativize(includeDafnyFile), - outputDafny.relativize(outputDir.resolve("../src/Index.dfy")) - ), - nameResolver - .dependentModels() - .stream() - .map(d -> outputDir - .relativize(d.modelPath().resolve("../src/Index.dfy")) - ) - .map(Path::toString) - ) - .map(p -> "include \"" + p + "\"") - .map(Token::of) - ) - .lineSeparated(); + final String namespace = serviceShape.getId().getNamespace(); + final String typesModuleName = DafnyNameResolver.dafnyTypesModuleName( + namespace + ); + final Path path = Path.of("%sWrapped.dfy".formatted(typesModuleName)); - final TokenTree fullCode = TokenTree.of( - includeDirectives, generateAbstractWrappedLocalService(serviceShape) - ).lineSeparated(); - return Map.of(path, fullCode); - } + // A smithy model may reference a model in a different package. + // In which case we need to include it. + final TokenTree includeDirectives = TokenTree + .of( + Stream + .concat( + Stream.of( + outputDir.relativize(includeDafnyFile), + outputDafny.relativize(outputDir.resolve("../src/Index.dfy")) + ), + nameResolver + .dependentModels() + .stream() + .map(d -> + outputDir.relativize(d.modelPath().resolve("../src/Index.dfy")) + ) + .map(Path::toString) + ) + .map(p -> "include \"" + p + "\"") + .map(Token::of) + ) + .lineSeparated(); - private Optional generateCodeForShape(final Shape shape) { - final ShapeId shapeId = shape.getId(); - return Optional.ofNullable(switch (shape.getType()) { - case SERVICE -> TokenTree - .of(generateServiceTraitDefinition(serviceShape)) - .lineSeparated(); - case BLOB -> generateBlobTypeDefinition(shapeId); - case BOOLEAN -> generateBoolTypeDefinition(shapeId); - case STRING -> { - if (shape.hasTrait(EnumTrait.class)) { - yield generateEnumTypeDefinition(shapeId); - } else if (shape.hasTrait(DafnyUtf8BytesTrait.ID)) { - yield generateValidUTF8BytesType(shapeId); - } else { - yield generateStringTypeDefinition(shapeId); - } - } - case INTEGER, LONG -> generateNumericTypeDefinition(shapeId); - case DOUBLE -> generateDoubleTypeDefinition(shapeId); - case LIST -> generateListTypeDefinition(shapeId); - case MAP -> generateMapTypeDefinition(shapeId); - case STRUCTURE -> { - if (shape.hasTrait(TraitDefinition.class)) { - yield null; - } else if (shape.hasTrait(PositionalTrait.class)) { - yield null; - } else if (shape.hasTrait(ReferenceTrait.class)) { - yield generateReferenceTraitDefinition(shapeId); - } else if (shape.hasTrait(ErrorTrait.class)) { - // All error shapes are a single integrated data type - yield null; - } else { - yield generateStructureTypeDefinition(shapeId); - } - } - case UNION -> generateUnionTypeDefinition(shapeId); - default -> null; - }); - } + final TokenTree fullCode = TokenTree + .of(includeDirectives, generateAbstractWrappedLocalService(serviceShape)) + .lineSeparated(); + return Map.of(path, fullCode); + } - public TokenTree generateValidUTF8BytesType(final ShapeId shapeId) { - final StringShape stringShape = model.expectShape(shapeId, StringShape.class); - final Optional lengthConstraint = stringShape - .getTrait(LengthTrait.class) - .map(DafnyApiCodegen::generateLengthConstraint); - return generateSubsetType(shapeId, "ValidUTF8Bytes", lengthConstraint); - } + private Optional generateCodeForShape(final Shape shape) { + final ShapeId shapeId = shape.getId(); + return Optional.ofNullable( + switch (shape.getType()) { + case SERVICE -> TokenTree + .of(generateServiceTraitDefinition(serviceShape)) + .lineSeparated(); + case BLOB -> generateBlobTypeDefinition(shapeId); + case BOOLEAN -> generateBoolTypeDefinition(shapeId); + case STRING -> { + if (shape.hasTrait(EnumTrait.class)) { + yield generateEnumTypeDefinition(shapeId); + } else if (shape.hasTrait(DafnyUtf8BytesTrait.ID)) { + yield generateValidUTF8BytesType(shapeId); + } else { + yield generateStringTypeDefinition(shapeId); + } + } + case INTEGER, LONG -> generateNumericTypeDefinition(shapeId); + case DOUBLE -> generateDoubleTypeDefinition(shapeId); + case LIST -> generateListTypeDefinition(shapeId); + case MAP -> generateMapTypeDefinition(shapeId); + case STRUCTURE -> { + if (shape.hasTrait(TraitDefinition.class)) { + yield null; + } else if (shape.hasTrait(PositionalTrait.class)) { + yield null; + } else if (shape.hasTrait(ReferenceTrait.class)) { + yield generateReferenceTraitDefinition(shapeId); + } else if (shape.hasTrait(ErrorTrait.class)) { + // All error shapes are a single integrated data type + yield null; + } else { + yield generateStructureTypeDefinition(shapeId); + } + } + case UNION -> generateUnionTypeDefinition(shapeId); + default -> null; + } + ); + } - public TokenTree generateBlobTypeDefinition(final ShapeId blobShapeId) { - final BlobShape blobShape = model.expectShape(blobShapeId, BlobShape.class); - final Optional lengthConstraint = blobShape.getTrait(LengthTrait.class) - .map(DafnyApiCodegen::generateLengthConstraint); - return generateSubsetType(blobShapeId, "seq", lengthConstraint); - } + public TokenTree generateValidUTF8BytesType(final ShapeId shapeId) { + final StringShape stringShape = model.expectShape( + shapeId, + StringShape.class + ); + final Optional lengthConstraint = stringShape + .getTrait(LengthTrait.class) + .map(DafnyApiCodegen::generateLengthConstraint); + return generateSubsetType(shapeId, "ValidUTF8Bytes", lengthConstraint); + } - public TokenTree generateBoolTypeDefinition(final ShapeId boolShapeId) { - return generateTypeSynonym(boolShapeId, "bool"); - } + public TokenTree generateBlobTypeDefinition(final ShapeId blobShapeId) { + final BlobShape blobShape = model.expectShape(blobShapeId, BlobShape.class); + final Optional lengthConstraint = blobShape + .getTrait(LengthTrait.class) + .map(DafnyApiCodegen::generateLengthConstraint); + return generateSubsetType(blobShapeId, "seq", lengthConstraint); + } - public TokenTree generateStringTypeDefinition(final ShapeId stringShapeId) { - final StringShape stringShape = model.expectShape(stringShapeId, StringShape.class); - final Optional lengthConstraint = stringShape.getTrait(LengthTrait.class) - .map(DafnyApiCodegen::generateLengthConstraint); - return generateSubsetType(stringShapeId, "string", lengthConstraint); - } + public TokenTree generateBoolTypeDefinition(final ShapeId boolShapeId) { + return generateTypeSynonym(boolShapeId, "bool"); + } - public TokenTree generateEnumTypeDefinition(final ShapeId stringShapeId) { - final StringShape stringShape = model.expectShape(stringShapeId, StringShape.class); - final EnumTrait enumTrait = stringShape.getTrait(EnumTrait.class).orElseThrow(); + public TokenTree generateStringTypeDefinition(final ShapeId stringShapeId) { + final StringShape stringShape = model.expectShape( + stringShapeId, + StringShape.class + ); + final Optional lengthConstraint = stringShape + .getTrait(LengthTrait.class) + .map(DafnyApiCodegen::generateLengthConstraint); + return generateSubsetType(stringShapeId, "string", lengthConstraint); + } - if (!enumTrait.hasNames()) { - throw new UnsupportedOperationException("Unnamed enums not supported"); - } - //noinspection OptionalGetWithoutIsPresent - final TokenTree constructors = TokenTree.of(enumTrait.getValues().stream() - .map(enumDefinition -> enumDefinition.getName().get()) - .peek(name -> { - if (!ModelUtils.isValidEnumDefinitionName(name)) { - throw new UnsupportedOperationException("Invalid enum definition name: %s".formatted(name)); - } - }) - .map(name -> TokenTree.of("\n\t|", name))); - - return Token.of("datatype %s =".formatted(nameResolver.baseTypeForShape(stringShapeId))).append(constructors); - } + public TokenTree generateEnumTypeDefinition(final ShapeId stringShapeId) { + final StringShape stringShape = model.expectShape( + stringShapeId, + StringShape.class + ); + final EnumTrait enumTrait = stringShape + .getTrait(EnumTrait.class) + .orElseThrow(); + + if (!enumTrait.hasNames()) { + throw new UnsupportedOperationException("Unnamed enums not supported"); + } + //noinspection OptionalGetWithoutIsPresent + final TokenTree constructors = TokenTree.of( + enumTrait + .getValues() + .stream() + .map(enumDefinition -> enumDefinition.getName().get()) + .peek(name -> { + if (!ModelUtils.isValidEnumDefinitionName(name)) { + throw new UnsupportedOperationException( + "Invalid enum definition name: %s".formatted(name) + ); + } + }) + .map(name -> TokenTree.of("\n\t|", name)) + ); - public TokenTree generateNumericTypeDefinition(final ShapeId numberShapeId) { - final NumberShape numberShape = model.expectShape(numberShapeId, NumberShape.class); - final Optional rangeConstraint = numberShape.getTrait(RangeTrait.class) - .map(DafnyApiCodegen::generateRangeConstraint); - final String baseType = Objects.requireNonNull( - DafnyNameResolver.DAFNY_TYPES_BY_SIMPLE_SHAPE_TYPE.get(numberShape.getType())); - return generateSubsetType(numberShapeId, baseType, rangeConstraint); - } + return Token + .of( + "datatype %s =".formatted(nameResolver.baseTypeForShape(stringShapeId)) + ) + .append(constructors); + } - public TokenTree generateDoubleTypeDefinition(final ShapeId doubleShapeId) { - final DoubleShape doubleShape = model.expectShape(doubleShapeId, DoubleShape.class); - if (doubleShape.hasTrait(RangeTrait.class)) { - LOGGER.error("Smithy-Dafny cannot handle Range Trait on a Double and Ignores the Trait. ShapeId: %s".formatted(doubleShapeId)); - } - final String baseType = Objects.requireNonNull( - DafnyNameResolver.DAFNY_TYPES_BY_SIMPLE_SHAPE_TYPE.get(doubleShape.getType())); - return generateSubsetType(doubleShapeId, baseType, DOUBLE_LENGTH_CONSTRAINT); - } + public TokenTree generateNumericTypeDefinition(final ShapeId numberShapeId) { + final NumberShape numberShape = model.expectShape( + numberShapeId, + NumberShape.class + ); + final Optional rangeConstraint = numberShape + .getTrait(RangeTrait.class) + .map(DafnyApiCodegen::generateRangeConstraint); + final String baseType = Objects.requireNonNull( + DafnyNameResolver.DAFNY_TYPES_BY_SIMPLE_SHAPE_TYPE.get( + numberShape.getType() + ) + ); + return generateSubsetType(numberShapeId, baseType, rangeConstraint); + } - public TokenTree generateListTypeDefinition(final ShapeId listShapeId) { - final ListShape listShape = model.expectShape(listShapeId, ListShape.class); - final Optional lengthConstraint = listShape.getTrait(LengthTrait.class) - .map(DafnyApiCodegen::generateLengthConstraint); - final String baseType = "seq<%s>".formatted(nameResolver.baseTypeForShape(listShape.getMember().getId())); - return generateSubsetType(listShapeId, baseType, lengthConstraint); + public TokenTree generateDoubleTypeDefinition(final ShapeId doubleShapeId) { + final DoubleShape doubleShape = model.expectShape( + doubleShapeId, + DoubleShape.class + ); + if (doubleShape.hasTrait(RangeTrait.class)) { + LOGGER.error( + "Smithy-Dafny cannot handle Range Trait on a Double and Ignores the Trait. ShapeId: %s".formatted( + doubleShapeId + ) + ); } + final String baseType = Objects.requireNonNull( + DafnyNameResolver.DAFNY_TYPES_BY_SIMPLE_SHAPE_TYPE.get( + doubleShape.getType() + ) + ); + return generateSubsetType( + doubleShapeId, + baseType, + DOUBLE_LENGTH_CONSTRAINT + ); + } - public TokenTree generateMapTypeDefinition(final ShapeId mapShapeId) { - final MapShape mapShape = model.expectShape(mapShapeId, MapShape.class); - final Optional lengthConstraint = mapShape.getTrait(LengthTrait.class) - .map(DafnyApiCodegen::generateLengthConstraint); - final String keyType = nameResolver.baseTypeForShape(mapShape.getKey().getId()); - final String valueType = nameResolver.baseTypeForShape(mapShape.getValue().getId()); - final String baseType = "map<%s, %s>".formatted(keyType, valueType); - return generateSubsetType(mapShapeId, baseType, lengthConstraint); - } + public TokenTree generateListTypeDefinition(final ShapeId listShapeId) { + final ListShape listShape = model.expectShape(listShapeId, ListShape.class); + final Optional lengthConstraint = listShape + .getTrait(LengthTrait.class) + .map(DafnyApiCodegen::generateLengthConstraint); + final String baseType = + "seq<%s>".formatted( + nameResolver.baseTypeForShape(listShape.getMember().getId()) + ); + return generateSubsetType(listShapeId, baseType, lengthConstraint); + } - public TokenTree generateStructureTypeDefinition(final ShapeId structureShapeId) { - final StructureShape structureShape = model.expectShape(structureShapeId, StructureShape.class); + public TokenTree generateMapTypeDefinition(final ShapeId mapShapeId) { + final MapShape mapShape = model.expectShape(mapShapeId, MapShape.class); + final Optional lengthConstraint = mapShape + .getTrait(LengthTrait.class) + .map(DafnyApiCodegen::generateLengthConstraint); + final String keyType = nameResolver.baseTypeForShape( + mapShape.getKey().getId() + ); + final String valueType = nameResolver.baseTypeForShape( + mapShape.getValue().getId() + ); + final String baseType = "map<%s, %s>".formatted(keyType, valueType); + return generateSubsetType(mapShapeId, baseType, lengthConstraint); + } - final String typeName = structureShapeId.getName(); - return TokenTree.of( - Token.of("datatype %1$s =".formatted(typeName)), - generateDataTypeConstructorFromStructure(structureShapeId) - ); - } + public TokenTree generateStructureTypeDefinition( + final ShapeId structureShapeId + ) { + final StructureShape structureShape = model.expectShape( + structureShapeId, + StructureShape.class + ); + + final String typeName = structureShapeId.getName(); + return TokenTree.of( + Token.of("datatype %1$s =".formatted(typeName)), + generateDataTypeConstructorFromStructure(structureShapeId) + ); + } - public TokenTree generateUnionTypeDefinition(final ShapeId unionShapeId) { - final UnionShape unionShape = model.expectShape(unionShapeId, UnionShape.class); + public TokenTree generateUnionTypeDefinition(final ShapeId unionShapeId) { + final UnionShape unionShape = model.expectShape( + unionShapeId, + UnionShape.class + ); - return TokenTree.of( - Token.of("datatype %s =".formatted(nameResolver.baseTypeForShape(unionShapeId))), - TokenTree.of( + return TokenTree + .of( + Token.of( + "datatype %s =".formatted(nameResolver.baseTypeForShape(unionShapeId)) + ), + TokenTree + .of( unionShape .members() .stream() - .map(this::generateWrappedDataTypeConstructorFromUnionMember)).lineSeparated() - ).lineSeparated(); - } + .map(this::generateWrappedDataTypeConstructorFromUnionMember) + ) + .lineSeparated() + ) + .lineSeparated(); + } - public TokenTree generateWrappedDataTypeConstructorFromUnionMember(final MemberShape memberShape) { - final String name = memberShape.getMemberName(); - final String wrappedType = nameResolver.baseTypeForShape(memberShape.getTarget()); + public TokenTree generateWrappedDataTypeConstructorFromUnionMember( + final MemberShape memberShape + ) { + final String name = memberShape.getMemberName(); + final String wrappedType = nameResolver.baseTypeForShape( + memberShape.getTarget() + ); - return TokenTree.of("| %s(%s: %s)".formatted(name, name, wrappedType)); - } + return TokenTree.of("| %s(%s: %s)".formatted(name, name, wrappedType)); + } - private TokenTree generateStructureTypeParameter(final MemberShape memberShape) { - String dflt = ""; - if (ModelUtils.memberShapeIsOptional(model, memberShape)) { - dflt = " := Option.None"; - } - return Token.of("nameonly %s: %s%s".formatted( - memberShape.getMemberName(), nameResolver.baseTypeForShape(memberShape.getId()), dflt)); - } + private TokenTree generateStructureTypeParameter( + final MemberShape memberShape + ) { + String dflt = ""; + if (ModelUtils.memberShapeIsOptional(model, memberShape)) { + dflt = " := Option.None"; + } + return Token.of( + "nameonly %s: %s%s".formatted( + memberShape.getMemberName(), + nameResolver.baseTypeForShape(memberShape.getId()), + dflt + ) + ); + } - public TokenTree generateServiceTraitDefinition(ServiceShape serviceShape) { + public TokenTree generateServiceTraitDefinition(ServiceShape serviceShape) { + final TokenTree trait = TokenTree.of( + "trait {:termination false}", + nameResolver.traitForServiceClient(serviceShape) + ); + final TokenTree methods = TokenTree + .of( + serviceShape + .getAllOperations() + .stream() + .flatMap(operation -> + Stream.of( + generateEnsuresPubliclyPredicate(serviceShape, operation), + generateBodilessOperationMethodThatEnsuresCallEvents( + serviceShape, + operation, + ImplementationType.CODEGEN + ), + TokenTree.empty() + ) + ) + ) + .lineSeparated(); - final TokenTree trait = TokenTree - .of( - "trait {:termination false}", - nameResolver.traitForServiceClient(serviceShape) - ); - final TokenTree methods = TokenTree - .of( - serviceShape - .getAllOperations() - .stream() - .flatMap(operation -> Stream.of( - generateEnsuresPubliclyPredicate(serviceShape, operation), - generateBodilessOperationMethodThatEnsuresCallEvents(serviceShape, operation, ImplementationType.CODEGEN), - TokenTree.empty() + return TokenTree + .of( + generateHistoricalCallEventsForService(serviceShape), + trait, + methods + .prepend( + generateMutableInvariantInterface(serviceShape.getId()) + .append( + Token.of( + "ghost const %s: %s".formatted( + nameResolver.callHistoryFieldName(), + nameResolver.historicalCallHistoryClassForService( + serviceShape + ) + ) ) ) ) - .lineSeparated(); + .lineSeparated() + .braced() + ) + .lineSeparated(); + } - return TokenTree - .of( - generateHistoricalCallEventsForService(serviceShape), - trait, - methods - .prepend(generateMutableInvariantInterface(serviceShape.getId()) - .append(Token.of("ghost const %s: %s" - .formatted( - nameResolver.callHistoryFieldName(), - nameResolver.historicalCallHistoryClassForService(serviceShape))))) - .lineSeparated() - .braced() - ) - .lineSeparated(); + public TokenTree generateReferenceTraitDefinition( + final ShapeId shapeWithReference + ) { + final ReferenceTrait referenceTrait = model + .getShape(shapeWithReference) + .orElseThrow() + .expectTrait(ReferenceTrait.class); + + // This is a reference structure for returning a service + // As such, there is no need to build any code here. + // The actual implementation of the service + // would be in that services Smithy module. + if (referenceTrait.isService()) { + // TODO: This is a hack to make the side effect happen + // While there is no code to generate, + // the module needs to be included + // because we are obviously using it! + final String sideEffect = nameResolver.dafnyModulePrefixForShape( + model.expectShape(referenceTrait.getReferentId()) + ); + return null; } - - public TokenTree generateReferenceTraitDefinition(final ShapeId shapeWithReference) { - final ReferenceTrait referenceTrait = model - .getShape(shapeWithReference) - .orElseThrow() - .expectTrait(ReferenceTrait.class); - - // This is a reference structure for returning a service - // As such, there is no need to build any code here. - // The actual implementation of the service - // would be in that services Smithy module. - if (referenceTrait.isService()) { - // TODO: This is a hack to make the side effect happen - // While there is no code to generate, - // the module needs to be included - // because we are obviously using it! - final String sideEffect = nameResolver - .dafnyModulePrefixForShape(model.expectShape(referenceTrait.getReferentId())); - return null; - } - final ResourceShape resource = model - .getShape(referenceTrait.getReferentId()) - .orElseThrow() - .asResourceShape() - .orElseThrow(); - - final TokenTree trait = TokenTree - .of( - "trait {:termination false}", - nameResolver.baseTypeForShape(shapeWithReference) - ); + final ResourceShape resource = model + .getShape(referenceTrait.getReferentId()) + .orElseThrow() + .asResourceShape() + .orElseThrow(); - final TokenTree methods = TokenTree - .of( - resource - .getAllOperations() - .stream() - .flatMap(operation -> Stream.of( - generateResourceOperationMethod(serviceShape, operation), - TokenTree.empty() - )) - ) - .lineSeparated(); + final TokenTree trait = TokenTree.of( + "trait {:termination false}", + nameResolver.baseTypeForShape(shapeWithReference) + ); - return TokenTree - .of( - generateHistoricalCallEventsForResource(resource), - trait, - methods - .prepend(generateMutableInvariantInterface(referenceTrait.getReferentId()) - .append(Token.of("ghost const %s: %s" - .formatted( - nameResolver.callHistoryFieldName(), - nameResolver.historicalCallHistoryClassForResource(resource))))) - .lineSeparated() - .braced() + final TokenTree methods = TokenTree + .of( + resource + .getAllOperations() + .stream() + .flatMap(operation -> + Stream.of( + generateResourceOperationMethod(serviceShape, operation), + TokenTree.empty() + ) ) - .lineSeparated(); - } - - - public TokenTree generateHistoricalCallEventsForService(final ServiceShape service) { + ) + .lineSeparated(); - final TokenTree className = TokenTree - .of("class %s" - .formatted(nameResolver.historicalCallHistoryClassForService(service)) - ); - final TokenTree constructor = TokenTree - .of( - service - .getAllOperations() - .stream() - .map(operation -> model.expectShape(operation, OperationShape.class)) - .map(operation -> TokenTree.of( - "%s := [];".formatted(nameResolver.historicalCallEventsForOperation(operation)) - )) + return TokenTree + .of( + generateHistoricalCallEventsForResource(resource), + trait, + methods + .prepend( + generateMutableInvariantInterface(referenceTrait.getReferentId()) + .append( + Token.of( + "ghost const %s: %s".formatted( + nameResolver.callHistoryFieldName(), + nameResolver.historicalCallHistoryClassForResource( + resource + ) + ) + ) + ) ) .lineSeparated() .braced() - .prepend(Token.of("ghost constructor()")); - final TokenTree fields = TokenTree - .of( - service - .getAllOperations() - .stream() - .map(operation -> generateHistoricalCallEvents(operation)) - ) - .lineSeparated(); + ) + .lineSeparated(); + } - return className - .append(TokenTree - .of(constructor, fields) - .lineSeparated() - .braced()); - } + public TokenTree generateHistoricalCallEventsForService( + final ServiceShape service + ) { + final TokenTree className = TokenTree.of( + "class %s".formatted( + nameResolver.historicalCallHistoryClassForService(service) + ) + ); + final TokenTree constructor = TokenTree + .of( + service + .getAllOperations() + .stream() + .map(operation -> model.expectShape(operation, OperationShape.class)) + .map(operation -> + TokenTree.of( + "%s := [];".formatted( + nameResolver.historicalCallEventsForOperation(operation) + ) + ) + ) + ) + .lineSeparated() + .braced() + .prepend(Token.of("ghost constructor()")); + final TokenTree fields = TokenTree + .of( + service + .getAllOperations() + .stream() + .map(operation -> generateHistoricalCallEvents(operation)) + ) + .lineSeparated(); - // This is basically a duplicate of generateHistoricalCallEventsForService - // however Java does not do well with Union types - // so I do not know of an elegant way to dedupe the code - // since they have to take different arguments. - public TokenTree generateHistoricalCallEventsForResource(final ResourceShape resource) { + return className.append( + TokenTree.of(constructor, fields).lineSeparated().braced() + ); + } - final TokenTree className = TokenTree - .of("class %s" - .formatted(nameResolver.historicalCallHistoryClassForResource(resource)) - ); - final TokenTree constructor = TokenTree - .of( - resource - .getAllOperations() - .stream() - .map(operation -> model.expectShape(operation, OperationShape.class)) - .map(operation -> TokenTree.of( - "%s := [];".formatted(nameResolver.historicalCallEventsForOperation(operation)) - )) - ) - .lineSeparated() - .braced() - .prepend(Token.of("ghost constructor()")); - final TokenTree fields = TokenTree - .of( - resource - .getAllOperations() - .stream() - .map(operation -> generateHistoricalCallEvents(operation)) + // This is basically a duplicate of generateHistoricalCallEventsForService + // however Java does not do well with Union types + // so I do not know of an elegant way to dedupe the code + // since they have to take different arguments. + public TokenTree generateHistoricalCallEventsForResource( + final ResourceShape resource + ) { + final TokenTree className = TokenTree.of( + "class %s".formatted( + nameResolver.historicalCallHistoryClassForResource(resource) + ) + ); + final TokenTree constructor = TokenTree + .of( + resource + .getAllOperations() + .stream() + .map(operation -> model.expectShape(operation, OperationShape.class)) + .map(operation -> + TokenTree.of( + "%s := [];".formatted( + nameResolver.historicalCallEventsForOperation(operation) + ) + ) ) - .lineSeparated(); + ) + .lineSeparated() + .braced() + .prepend(Token.of("ghost constructor()")); + final TokenTree fields = TokenTree + .of( + resource + .getAllOperations() + .stream() + .map(operation -> generateHistoricalCallEvents(operation)) + ) + .lineSeparated(); - return className - .append(TokenTree - .of(constructor, fields) - .lineSeparated() - .braced()); - } + return className.append( + TokenTree.of(constructor, fields).lineSeparated().braced() + ); + } - public TokenTree generateOperationParams(final OperationShape operationShape) { - return operationShape - .getInput() - .map(nameResolver::baseTypeForShape) - .map(inputType -> TokenTree.of("input:", inputType)) - .orElse(TokenTree.empty()); - } + public TokenTree generateOperationParams( + final OperationShape operationShape + ) { + return operationShape + .getInput() + .map(nameResolver::baseTypeForShape) + .map(inputType -> TokenTree.of("input:", inputType)) + .orElse(TokenTree.empty()); + } - private TokenTree generateOperationOutputParams(final OperationShape operationShape) { - return TokenTree - .of("output: %s".formatted(nameResolver.returnTypeForOperation(operationShape))); - } + private TokenTree generateOperationOutputParams( + final OperationShape operationShape + ) { + return TokenTree.of( + "output: %s".formatted( + nameResolver.returnTypeForOperation(operationShape) + ) + ); + } - private TokenTree generateOperationReturnsClause( - final ServiceShape serviceShape, - final OperationShape operationShape - ) { - return TokenTree - .of("%s (%s)" - .formatted( - nameResolver.isFunction(serviceShape, operationShape) - ? ":" - : "returns", - generateOperationOutputParams(operationShape) - )); - } + private TokenTree generateOperationReturnsClause( + final ServiceShape serviceShape, + final OperationShape operationShape + ) { + return TokenTree.of( + "%s (%s)".formatted( + nameResolver.isFunction(serviceShape, operationShape) + ? ":" + : "returns", + generateOperationOutputParams(operationShape) + ) + ); + } - private TokenTree generateMutableInvariantInterface(ShapeId shapeId) { - // Dealing with mutable state is HARD. - // At this time we only support this - // for resources and not for services. - final boolean mutableState = model - .getShape(shapeId) - .orElseThrow() - .hasTrait(MutableLocalStateTrait.class); - final String readsClause = "reads this`%s, %s - {%s}".formatted( + private TokenTree generateMutableInvariantInterface(ShapeId shapeId) { + // Dealing with mutable state is HARD. + // At this time we only support this + // for resources and not for services. + final boolean mutableState = model + .getShape(shapeId) + .orElseThrow() + .hasTrait(MutableLocalStateTrait.class); + final String readsClause = + "reads this`%s, %s - {%s}".formatted( nameResolver.mutableStateFunctionName(), nameResolver.mutableStateFunctionName(), nameResolver.callHistoryFieldName() - ); - return TokenTree - .of( - "// Helper to define any additional modifies/reads clauses.", - "// If your operations need to mutate state,", - "// add it in your constructor function:", - "// %s := {your, fields, here, %s};".formatted( - nameResolver.mutableStateFunctionName(), - nameResolver.callHistoryFieldName()), - mutableState - ? """ -// Given that you are mutating state, -// your %s function is going to get complicated. -""" - .formatted( - nameResolver.validStateInvariantName() - ) - : """ -// If you do not need to mutate anything: -// %s := {%s}; -""" - .formatted( + ); + return TokenTree + .of( + "// Helper to define any additional modifies/reads clauses.", + "// If your operations need to mutate state,", + "// add it in your constructor function:", + "// %s := {your, fields, here, %s};".formatted( nameResolver.mutableStateFunctionName(), nameResolver.callHistoryFieldName() - ), - "ghost %s %s: set".formatted( - mutableState ? "var" : "const", - nameResolver.mutableStateFunctionName() ), - "// For an unassigned field defined in a trait,", - "// Dafny can only assign a value in the constructor.", - "// This means that for Dafny to reason about this value,", - "// it needs some way to know (an invariant),", - "// about the state of the object.", - "// This builds on the Valid/Repr paradigm", - "// To make this kind requires safe to add", - "// to methods called from unverified code,", - "// the predicate MUST NOT take any arguments.", - "// This means that the correctness of this requires", - "// MUST only be evaluated by the class itself.", - "// If you require any additional mutation,", - "// then you MUST ensure everything you need in %s.".formatted(nameResolver.validStateInvariantName()), - "// You MUST also ensure %s in your constructor.".formatted(nameResolver.validStateInvariantName()), - mutableState - ? """ -// Not only will you need to ensure -// that all your mutable elements are contained in %s, -// you MUST also ensure -// that your invariant does not rely on %s. -// This means your invariant will begin to look like: -// && %1$s in %2$s -// && this in %2$s // so we can read property -// && property in %2$s // so we can read properties of property -// && property != %1$s as object // property really is not %1$s! -// && (forall m <- property.Modifies // everything in property.Modifies -// :: m in %2$s - %1$s) // is in %2$s and really is not %1$s! -""" - .formatted( - nameResolver.callHistoryFieldName(), - nameResolver.mutableStateFunctionName() - ) - : "", - "predicate %s()".formatted(nameResolver.validStateInvariantName()), - mutableState ? readsClause : "", - "ensures %s() ==> %s in %s" - .formatted( - nameResolver.validStateInvariantName(), + mutableState + ? """ + // Given that you are mutating state, + // your %s function is going to get complicated. + """.formatted(nameResolver.validStateInvariantName()) + : """ + // If you do not need to mutate anything: + // %s := {%s}; + """.formatted( + nameResolver.mutableStateFunctionName(), + nameResolver.callHistoryFieldName() + ), + "ghost %s %s: set".formatted( + mutableState ? "var" : "const", + nameResolver.mutableStateFunctionName() + ), + "// For an unassigned field defined in a trait,", + "// Dafny can only assign a value in the constructor.", + "// This means that for Dafny to reason about this value,", + "// it needs some way to know (an invariant),", + "// about the state of the object.", + "// This builds on the Valid/Repr paradigm", + "// To make this kind requires safe to add", + "// to methods called from unverified code,", + "// the predicate MUST NOT take any arguments.", + "// This means that the correctness of this requires", + "// MUST only be evaluated by the class itself.", + "// If you require any additional mutation,", + "// then you MUST ensure everything you need in %s.".formatted( + nameResolver.validStateInvariantName() + ), + "// You MUST also ensure %s in your constructor.".formatted( + nameResolver.validStateInvariantName() + ), + mutableState + ? """ + // Not only will you need to ensure + // that all your mutable elements are contained in %s, + // you MUST also ensure + // that your invariant does not rely on %s. + // This means your invariant will begin to look like: + // && %1$s in %2$s + // && this in %2$s // so we can read property + // && property in %2$s // so we can read properties of property + // && property != %1$s as object // property really is not %1$s! + // && (forall m <- property.Modifies // everything in property.Modifies + // :: m in %2$s - %1$s) // is in %2$s and really is not %1$s! + """.formatted( nameResolver.callHistoryFieldName(), nameResolver.mutableStateFunctionName() ) - ) - .dropEmpty() - .lineSeparated() - .append(TokenTree.empty()) - .lineSeparated(); - } - - private TokenTree generateBodilessOperationMethodThatEnsuresCallEvents( - final ServiceShape serviceShape, - final ShapeId operationShapeId, - final ImplementationType implementationType - ) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - final Boolean isFunction = nameResolver.isFunction(serviceShape, operationShape); + : "", + "predicate %s()".formatted(nameResolver.validStateInvariantName()), + mutableState ? readsClause : "", + "ensures %s() ==> %s in %s".formatted( + nameResolver.validStateInvariantName(), + nameResolver.callHistoryFieldName(), + nameResolver.mutableStateFunctionName() + ) + ) + .dropEmpty() + .lineSeparated() + .append(TokenTree.empty()) + .lineSeparated(); + } - final TokenTree config = implementationType.equals(ImplementationType.ABSTRACT) - ? TokenTree.of("config: %s".formatted( - DafnyNameResolver.internalConfigType())) - : TokenTree.empty(); + private TokenTree generateBodilessOperationMethodThatEnsuresCallEvents( + final ServiceShape serviceShape, + final ShapeId operationShapeId, + final ImplementationType implementationType + ) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + final Boolean isFunction = nameResolver.isFunction( + serviceShape, + operationShape + ); + + final TokenTree config = implementationType.equals( + ImplementationType.ABSTRACT + ) + ? TokenTree.of( + "config: %s".formatted(DafnyNameResolver.internalConfigType()) + ) + : TokenTree.empty(); - final TokenTree operationMethod = TokenTree - .of( - TokenTree - .of(nameResolver.executableType(serviceShape, operationShape)) - .append(Token.of(nameResolver.publicMethodNameForOperation(operationShape))) - .append(generateOperationParams(operationShape) + final TokenTree operationMethod = TokenTree + .of( + TokenTree + .of(nameResolver.executableType(serviceShape, operationShape)) + .append( + Token.of(nameResolver.publicMethodNameForOperation(operationShape)) + ) + .append( + generateOperationParams(operationShape) .prepend(config) .dropEmpty() .separated(TokenTree.of(",")) - .parenthesized()), - generateOperationReturnsClause(serviceShape, operationShape), - isFunction - ? TokenTree.of("// Functions that are transparent do not need ensures") - : TokenTree + .parenthesized() + ), + generateOperationReturnsClause(serviceShape, operationShape), + isFunction + ? TokenTree.of( + "// Functions that are transparent do not need ensures" + ) + : TokenTree .of( - generateMutableInvariantForMethod(serviceShape, operationShapeId, implementationType), + generateMutableInvariantForMethod( + serviceShape, + operationShapeId, + implementationType + ), generateEnsuresForEnsuresPubliclyPredicate(operationShapeId), !implementationType.equals(ImplementationType.ABSTRACT) ? generateEnsuresHistoricalCallEvents(operationShapeId) @@ -707,196 +865,261 @@ private TokenTree generateBodilessOperationMethodThatEnsuresCallEvents( ) .dropEmpty() .lineSeparated() - ) - .lineSeparated(); - return TokenTree - .of( - // This function returns the bodiless method - // at the end of the TokenTree - // so that other callers can compose - // and add bodies. - TokenTree.of(!implementationType.equals(ImplementationType.ABSTRACT) + ) + .lineSeparated(); + return TokenTree + .of( + // This function returns the bodiless method + // at the end of the TokenTree + // so that other callers can compose + // and add bodies. + TokenTree.of( + !implementationType.equals(ImplementationType.ABSTRACT) ? "// The public method to be called by library consumers" - : "// The private method to be refined by the library developer"), - operationMethod - ) - .lineSeparated(); - } - private TokenTree generateResourceOperationMethod( - final ServiceShape serviceShape, - final ShapeId operationShapeId - ) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); + : "// The private method to be refined by the library developer" + ), + operationMethod + ) + .lineSeparated(); + } - return TokenTree + private TokenTree generateResourceOperationMethod( + final ServiceShape serviceShape, + final ShapeId operationShapeId + ) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + + return TokenTree + .of( + generateEnsuresPubliclyPredicate(serviceShape, operationShapeId), + generateBodilessOperationMethodThatEnsuresCallEvents( + serviceShape, + operationShapeId, + ImplementationType.CODEGEN + ), + // Implement this for library developer + // This implementation will record the call outcome + // and return the result + TokenTree .of( - generateEnsuresPubliclyPredicate(serviceShape, operationShapeId), - generateBodilessOperationMethodThatEnsuresCallEvents(serviceShape, operationShapeId, ImplementationType.CODEGEN), - // Implement this for library developer - // This implementation will record the call outcome - // and return the result TokenTree - .of( - TokenTree - .of("output :=") - .append(Token.of(nameResolver.methodNameToImplementForResourceOperation(operationShape))) - .append(TokenTree.of("(input);")), - generateAccumulateHistoricalCallEvents(operationShapeId) + .of("output :=") + .append( + Token.of( + nameResolver.methodNameToImplementForResourceOperation( + operationShape + ) + ) ) - .lineSeparated() - .braced(), - // This is method for the library developer to implement + .append(TokenTree.of("(input);")), + generateAccumulateHistoricalCallEvents(operationShapeId) + ) + .lineSeparated() + .braced(), + // This is method for the library developer to implement + TokenTree + .of( + TokenTree.of("// The method to implement in the concrete class. "), TokenTree - .of( - TokenTree.of("// The method to implement in the concrete class. "), - TokenTree - .of(nameResolver.executableType(serviceShape, operationShape)) - .append(Token.of(nameResolver.methodNameToImplementForResourceOperation(operationShape))) - .append(generateOperationParams(operationShape).dropEmpty().parenthesized()), - generateOperationReturnsClause(serviceShape, operationShape), - generateMutableInvariantForMethod(serviceShape, operationShapeId, ImplementationType.DEVELOPER), - generateEnsuresForEnsuresPubliclyPredicate(operationShapeId), - generateEnsuresUnchangedCallHistory(operationShapeId) + .of(nameResolver.executableType(serviceShape, operationShape)) + .append( + Token.of( + nameResolver.methodNameToImplementForResourceOperation( + operationShape + ) + ) ) - .lineSeparated() + .append( + generateOperationParams(operationShape) + .dropEmpty() + .parenthesized() + ), + generateOperationReturnsClause(serviceShape, operationShape), + generateMutableInvariantForMethod( + serviceShape, + operationShapeId, + ImplementationType.DEVELOPER + ), + generateEnsuresForEnsuresPubliclyPredicate(operationShapeId), + generateEnsuresUnchangedCallHistory(operationShapeId) ) - .lineSeparated(); - } - - private TokenTree generateHistoricalCallEvents( - final ShapeId operationShapeId - ) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - // The Dafny datatype OR unit () - final String inputType = operationShape - .getInput() - .map(nameResolver::baseTypeForShape) - .orElse("()"); - final String outputType = nameResolver.returnTypeForOperation(operationShape); + .lineSeparated() + ) + .lineSeparated(); + } - return TokenTree - .of( - "ghost var %s: seq<%s<%s, %s>>" - .formatted( - nameResolver.historicalCallEventsForOperation(operationShape), - nameResolver.callEventTypeName(), - inputType, - outputType - ) - ); - } + private TokenTree generateHistoricalCallEvents( + final ShapeId operationShapeId + ) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + // The Dafny datatype OR unit () + final String inputType = operationShape + .getInput() + .map(nameResolver::baseTypeForShape) + .orElse("()"); + final String outputType = nameResolver.returnTypeForOperation( + operationShape + ); + + return TokenTree.of( + "ghost var %s: seq<%s<%s, %s>>".formatted( + nameResolver.historicalCallEventsForOperation(operationShape), + nameResolver.callEventTypeName(), + inputType, + outputType + ) + ); + } - /* + /* The purpose of this ENUM is to distinguish who is writing the body of the method: DEVELOPER ==> This is for the method on a Resource that a Developer should implement. CODEGEN ==> This is for the method that is completely generated. This may be the "public" method in the trait or the public method in the service. ABSTRACT ==> This is for the method on the Service that should be implemented by the developer. */ - public enum ImplementationType { - // TODO, this is too complicated, please simplify - DEVELOPER, CODEGEN, ABSTRACT - } - - private TokenTree generateMutableInvariantForMethod( - final ServiceShape serviceShape, - final ShapeId operationShapeId, - final ImplementationType implementationType - ) { - - final String historySeq = implementationType == ImplementationType.CODEGEN - ? "%s`%s".formatted(nameResolver.callHistoryFieldName(), operationShapeId.getName()) - : ""; - - final TokenTree requires = OperationMemberRequires(operationShapeId, implementationType); - final TokenTree ensures = OperationMemberEnsures(operationShapeId, implementationType); - final TokenTree modifiesSet = OperationModifiesInputs(operationShapeId, implementationType); + public enum ImplementationType { + // TODO, this is too complicated, please simplify + DEVELOPER, + CODEGEN, + ABSTRACT, + } - final TokenTree modifies = TokenTree - .of( - modifiesSet, - Token.of(historySeq) + private TokenTree generateMutableInvariantForMethod( + final ServiceShape serviceShape, + final ShapeId operationShapeId, + final ImplementationType implementationType + ) { + final String historySeq = implementationType == ImplementationType.CODEGEN + ? "%s`%s".formatted( + nameResolver.callHistoryFieldName(), + operationShapeId.getName() ) - .flatten() - .dropEmpty() - .separated(Token.of(",\n")) - .prependToNonEmpty(Token.of("modifies")); - final TokenTree decreases = modifiesSet - .flatten() - .dropEmpty() - .separated(Token.of(",\n")) - .prependToNonEmpty(TokenTree + : ""; + + final TokenTree requires = OperationMemberRequires( + operationShapeId, + implementationType + ); + final TokenTree ensures = OperationMemberEnsures( + operationShapeId, + implementationType + ); + final TokenTree modifiesSet = OperationModifiesInputs( + operationShapeId, + implementationType + ); + + final TokenTree modifies = TokenTree + .of(modifiesSet, Token.of(historySeq)) + .flatten() + .dropEmpty() + .separated(Token.of(",\n")) + .prependToNonEmpty(Token.of("modifies")); + final TokenTree decreases = modifiesSet + .flatten() + .dropEmpty() + .separated(Token.of(",\n")) + .prependToNonEmpty( + TokenTree .of( "// Dafny will skip type parameters when generating a default decreases clause.", "decreases" ) .lineSeparated() - ); - - return TokenTree - .of( - requires, - modifies, - decreases, - ensures - ) - .dropEmpty() - .lineSeparated(); - } + ); - private TokenTree OperationMemberRequires( - final ShapeId operationShapeId, - final ImplementationType implementationType - ) { - final String validStateInvariantName = nameResolver.validStateInvariantName(); - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); + return TokenTree + .of(requires, modifies, decreases, ensures) + .dropEmpty() + .lineSeparated(); + } - final TokenTree inputReferencesThatNeedValidState = operationShape - .getInput() - .map(shapeId -> TokenTree - .of(ModelUtils - .streamStructureMembers(model.expectShape(shapeId, StructureShape.class)) + private TokenTree OperationMemberRequires( + final ShapeId operationShapeId, + final ImplementationType implementationType + ) { + final String validStateInvariantName = + nameResolver.validStateInvariantName(); + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + + final TokenTree inputReferencesThatNeedValidState = operationShape + .getInput() + .map(shapeId -> + TokenTree.of( + ModelUtils + .streamStructureMembers( + model.expectShape(shapeId, StructureShape.class) + ) // Input members with a ReferenceTrait will have a `ValidState` predicate // This invariant needs to be maintained across all method calls .filter(this::OnlyReferenceStructures) - .map(member -> OperationMemberValidState(member, operationShape, InputOutput.INPUT, implementationType)) + .map(member -> + OperationMemberValidState( + member, + operationShape, + InputOutput.INPUT, + implementationType + ) + ) .map(TokenTree::of) - ) ) - .orElse(TokenTree.empty()); - return Token.of(!implementationType.equals(ImplementationType.ABSTRACT) + ) + .orElse(TokenTree.empty()); + return Token + .of( + !implementationType.equals(ImplementationType.ABSTRACT) ? "\n && %s()".formatted(validStateInvariantName) - : "\n && %s(config)".formatted(nameResolver.validConfigPredicate())) - .append(inputReferencesThatNeedValidState) - .dropEmpty() - .prependToNonEmpty(Token.of("requires")); - } + : "\n && %s(config)".formatted(nameResolver.validConfigPredicate()) + ) + .append(inputReferencesThatNeedValidState) + .dropEmpty() + .prependToNonEmpty(Token.of("requires")); + } private TokenTree OperationMemberEnsures( final ShapeId operationShapeId, final ImplementationType implementationType ) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - final String validStateInvariantName = nameResolver.validStateInvariantName(); + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + final String validStateInvariantName = + nameResolver.validStateInvariantName(); final TokenTree outputReferencesThatNeedValidState = operationShape .getOutput() .map(shapeId -> model.expectShape(shapeId, StructureShape.class)) - .map(structureShape -> ModelUtils - .streamStructureMembers(structureShape) - // Input members with a ReferenceTrait will have a `ValidState` predicate - // This invariant needs to be maintained across all method calls - .filter(this::OnlyReferenceStructures) - .map(member -> OperationMemberValidState(member, operationShape, InputOutput.OUTPUT, implementationType)) + .map(structureShape -> + ModelUtils + .streamStructureMembers(structureShape) + // Input members with a ReferenceTrait will have a `ValidState` predicate + // This invariant needs to be maintained across all method calls + .filter(this::OnlyReferenceStructures) + .map(member -> + OperationMemberValidState( + member, + operationShape, + InputOutput.OUTPUT, + implementationType + ) + ) ) .map(TokenTree::of) .map(memberTokens -> { if (memberTokens.isEmpty()) return memberTokens; return TokenTree - .of( - Token.of("output.Success? ==> "), - memberTokens - ) + .of(Token.of("output.Success? ==> "), memberTokens) .parenthesized() .prepend(Token.of("&&")); }) @@ -904,9 +1127,11 @@ private TokenTree OperationMemberEnsures( return TokenTree .of( - Token.of(!implementationType.equals(ImplementationType.ABSTRACT) - ? "&& %s()".formatted(validStateInvariantName) - : "&& %s(config)".formatted(nameResolver.validConfigPredicate())), + Token.of( + !implementationType.equals(ImplementationType.ABSTRACT) + ? "&& %s()".formatted(validStateInvariantName) + : "&& %s(config)".formatted(nameResolver.validConfigPredicate()) + ), outputReferencesThatNeedValidState ) .dropEmpty() @@ -915,1270 +1140,1618 @@ private TokenTree OperationMemberEnsures( .lineSeparated(); } - private Boolean OnlyReferenceStructures(MemberShape member) { - final Shape target = model.expectShape(member.getTarget()); - - return - // If the member is a reference type - ( - target.getType() == ShapeType.STRUCTURE) - && target.hasTrait(ReferenceTrait.class) - // If the member is a LIST of a reference type - || ( - target.getType() == ShapeType.LIST - && model - .expectShape( - target - .asListShape() - .get() - .getMember() - .getTarget()) - .hasTrait(ReferenceTrait.class) - ); - } + private Boolean OnlyReferenceStructures(MemberShape member) { + final Shape target = model.expectShape(member.getTarget()); + + return ( // If the member is a reference type + ((target.getType() == ShapeType.STRUCTURE) && + target.hasTrait(ReferenceTrait.class)) || + // If the member is a LIST of a reference type + (target.getType() == ShapeType.LIST && + model + .expectShape(target.asListShape().get().getMember().getTarget()) + .hasTrait(ReferenceTrait.class)) + ); + } - public enum InputOutput { - INPUT, OUTPUT - } - private TokenTree OperationMemberValidState( - final MemberShape member, - final OperationShape operationShape, - final InputOutput direction, - final ImplementationType implementationType - ) { - final String validStateInvariantName = nameResolver.validStateInvariantName(); - final boolean isOutput = direction == InputOutput.OUTPUT; - - final ShapeId directionShape = direction == InputOutput.INPUT - // The member MUST be a member of input or output - // so there MUST be such a shape. - ? operationShape.getInput().get() - : operationShape.getOutputShape(); - - if (member.getId() == directionShape.withMember(member.getMemberName())) { - throw new IllegalStateException("Member not on operation"); - } + public enum InputOutput { + INPUT, + OUTPUT, + } - final boolean isList = model.expectShape(member.getTarget()).getType() == ShapeType.LIST; - // This is tricky, given where we are, there MUST be an output shape. - // If this output is @positional, - // then we need to drop the member name - final String memberName = model.expectShape(directionShape).hasTrait(PositionalTrait.class) - ? "" - : ".%s".formatted(member.getMemberName()); - - final String varName = direction == InputOutput.INPUT - ? "input" + memberName - : "output.value" + memberName; // These all expect to be appended to "output.Success? ==> " - - // Inputs can not be fresh - // so if they are added to our output - // then we can not prove freshness of these items - final TokenTree removeInputs = direction == InputOutput.OUTPUT - ? OperationModifiesInputs(operationShape.getId(), implementationType) - .prependSeperated(Token.of("-")) - : TokenTree.empty(); - - // We need to do 3 things here - // first, we need the member to have ValidState - // second, its Modifies set MUST NOT be shared. - // This second claim is to ensure that state can be reasoned about - // third, everything MUST be fresh. This will make using things _much_ simpler - // you may hate me now, but you will come around - if (member.isRequired() && !isList) { - // Required single item - return TokenTree - .of( - Token.of("%s.%s()".formatted(varName, validStateInvariantName)), - Token.of( - // If we are putting the method in an abstract module - // then there is no object to share state with - !implementationType.equals(ImplementationType.ABSTRACT) - ? "%s.Modifies !! {%s}".formatted(varName, nameResolver.callHistoryFieldName()) - : ""), - Token.of(isOutput ? "fresh(%s)".formatted(varName) : ""), - isOutput - ? Token - .of("fresh") - .append(TokenTree - .of(Token.of("%s.Modifies".formatted(varName)), removeInputs) - .parenthesized()) - : TokenTree.empty() - ) - .dropEmpty() - .prependSeperated(Token.of("\n &&")); - } else if (!member.isRequired() && !isList) { - // Optional single item - return TokenTree - .of( - "&& ( %s.Some? ==>".formatted(varName), - "&& %s.value.%s()".formatted(varName, validStateInvariantName), + private TokenTree OperationMemberValidState( + final MemberShape member, + final OperationShape operationShape, + final InputOutput direction, + final ImplementationType implementationType + ) { + final String validStateInvariantName = + nameResolver.validStateInvariantName(); + final boolean isOutput = direction == InputOutput.OUTPUT; + + final ShapeId directionShape = direction == InputOutput.INPUT + // The member MUST be a member of input or output + // so there MUST be such a shape. + ? operationShape.getInput().get() + : operationShape.getOutputShape(); + + if (member.getId() == directionShape.withMember(member.getMemberName())) { + throw new IllegalStateException("Member not on operation"); + } + + final boolean isList = + model.expectShape(member.getTarget()).getType() == ShapeType.LIST; + // This is tricky, given where we are, there MUST be an output shape. + // If this output is @positional, + // then we need to drop the member name + final String memberName = model + .expectShape(directionShape) + .hasTrait(PositionalTrait.class) + ? "" + : ".%s".formatted(member.getMemberName()); + + final String varName = direction == InputOutput.INPUT + ? "input" + memberName + : "output.value" + memberName; // These all expect to be appended to "output.Success? ==> " + + // Inputs can not be fresh + // so if they are added to our output + // then we can not prove freshness of these items + final TokenTree removeInputs = direction == InputOutput.OUTPUT + ? OperationModifiesInputs(operationShape.getId(), implementationType) + .prependSeperated(Token.of("-")) + : TokenTree.empty(); + + // We need to do 3 things here + // first, we need the member to have ValidState + // second, its Modifies set MUST NOT be shared. + // This second claim is to ensure that state can be reasoned about + // third, everything MUST be fresh. This will make using things _much_ simpler + // you may hate me now, but you will come around + if (member.isRequired() && !isList) { + // Required single item + return TokenTree + .of( + Token.of("%s.%s()".formatted(varName, validStateInvariantName)), + Token.of( // If we are putting the method in an abstract module // then there is no object to share state with !implementationType.equals(ImplementationType.ABSTRACT) - ? "&& %s.value.Modifies !! {%s}".formatted(varName, nameResolver.callHistoryFieldName()) + ? "%s.Modifies !! {%s}".formatted( + varName, + nameResolver.callHistoryFieldName() + ) + : "" + ), + Token.of(isOutput ? "fresh(%s)".formatted(varName) : ""), + isOutput + ? Token + .of("fresh") + .append( + TokenTree + .of(Token.of("%s.Modifies".formatted(varName)), removeInputs) + .parenthesized() + ) + : TokenTree.empty() + ) + .dropEmpty() + .prependSeperated(Token.of("\n &&")); + } else if (!member.isRequired() && !isList) { + // Optional single item + return TokenTree + .of( + "&& ( %s.Some? ==>".formatted(varName), + "&& %s.value.%s()".formatted(varName, validStateInvariantName), + // If we are putting the method in an abstract module + // then there is no object to share state with + !implementationType.equals(ImplementationType.ABSTRACT) + ? "&& %s.value.Modifies !! {%s}".formatted( + varName, + nameResolver.callHistoryFieldName() + ) : "", - isOutput ? "&& fresh(%s.value)".formatted(varName) : "", - isOutput ? "&& fresh(%s.value.Modifies)".formatted(varName) : "", - ")" - ) - .dropEmpty() - .lineSeparated(); - } else if (isList && member.isRequired()) { - // Required list item - return TokenTree - .of( - "&& ( forall i <- %s ::".formatted(varName), - "&& i.%s()".formatted(validStateInvariantName), - // If we are putting the method in an abstract module - // then there is no object to share state with - !implementationType.equals(ImplementationType.ABSTRACT) - ? "&& i.Modifies !! {%s}".formatted(nameResolver.callHistoryFieldName()) + isOutput ? "&& fresh(%s.value)".formatted(varName) : "", + isOutput ? "&& fresh(%s.value.Modifies)".formatted(varName) : "", + ")" + ) + .dropEmpty() + .lineSeparated(); + } else if (isList && member.isRequired()) { + // Required list item + return TokenTree + .of( + "&& ( forall i <- %s ::".formatted(varName), + "&& i.%s()".formatted(validStateInvariantName), + // If we are putting the method in an abstract module + // then there is no object to share state with + !implementationType.equals(ImplementationType.ABSTRACT) + ? "&& i.Modifies !! {%s}".formatted( + nameResolver.callHistoryFieldName() + ) : "", - isOutput ? "&& fresh(i)" : "", - isOutput ? " && fresh(i.Modifies)" : "", - ")" - ) - .dropEmpty() - .lineSeparated(); - } else if (isList && !member.isRequired()) { - // Optional list item - return TokenTree - .of( - "&& ( %s.Some? ==>".formatted(varName), - "&& ( forall i <- %s.value ::".formatted(varName), - "&& i.%s()".formatted(validStateInvariantName), - // If we are putting the method in an abstract module - // then there is no object to share state with - !implementationType.equals(ImplementationType.ABSTRACT) - ? "&& i.Modifies !! {%s}".formatted(nameResolver.callHistoryFieldName()) + isOutput ? "&& fresh(i)" : "", + isOutput ? " && fresh(i.Modifies)" : "", + ")" + ) + .dropEmpty() + .lineSeparated(); + } else if (isList && !member.isRequired()) { + // Optional list item + return TokenTree + .of( + "&& ( %s.Some? ==>".formatted(varName), + "&& ( forall i <- %s.value ::".formatted(varName), + "&& i.%s()".formatted(validStateInvariantName), + // If we are putting the method in an abstract module + // then there is no object to share state with + !implementationType.equals(ImplementationType.ABSTRACT) + ? "&& i.Modifies !! {%s}".formatted( + nameResolver.callHistoryFieldName() + ) : "", - isOutput ? "&& fresh(i)" : "", - isOutput ? " && fresh(i.Modifies)" : "", - "))" - ) - .dropEmpty() - .lineSeparated(); - } else { - throw new IllegalStateException("Unsupported shape type"); - } + isOutput ? "&& fresh(i)" : "", + isOutput ? " && fresh(i.Modifies)" : "", + "))" + ) + .dropEmpty() + .lineSeparated(); + } else { + throw new IllegalStateException("Unsupported shape type"); } + } - private TokenTree OperationModifiesInputs( - final ShapeId operationShapeId, - final ImplementationType implementationType - ){ - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - return operationShape - .getInput() - .map(shapeId -> model.expectShape(shapeId, StructureShape.class)) - .map(structureShape -> ModelUtils + private TokenTree OperationModifiesInputs( + final ShapeId operationShapeId, + final ImplementationType implementationType + ) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + return operationShape + .getInput() + .map(shapeId -> model.expectShape(shapeId, StructureShape.class)) + .map(structureShape -> + ModelUtils .streamStructureMembers(structureShape) // Input members with a ReferenceTrait will have mutable state // This state needs to be maintained across all method calls .filter(this::OnlyReferenceStructures) .map(member -> OperationMemberModifies(member, operationShape)) + ) + .map(TokenTree::of) + .orElse(TokenTree.empty()) + .prepend( + // This lets us keep track of any additional modifications + implementationType == ImplementationType.ABSTRACT + // The abstract operations do not have a class with a `Modifies` property + ? Token.of( + "%s(config)".formatted(nameResolver.modifiesInternalConfig()) + ) + // The class has a `Modifies` property + // The `- {History} is important for consumers + // otherwise if they use multiple APIs + // Dafny will assume that each API can modify _any_ other History. + : Token.of( + "%s - {%s}".formatted( + nameResolver.mutableStateFunctionName(), + nameResolver.callHistoryFieldName() + ) + ) + ) + .flatten(); + } + + private TokenTree OperationMemberModifies( + final MemberShape member, + final OperationShape operationShape + ) { + final ShapeId directionShape = operationShape.getInput().get(); + + if (member.getId() == directionShape.withMember(member.getMemberName())) { + throw new IllegalStateException("Member not on operation"); + } + + final boolean isList = + model.expectShape(member.getTarget()).getType() == ShapeType.LIST; + // This is tricky, given where we are, there MUST be an output shape. + // If this output is @positional, + // then we need to drop the member name + final String memberName = model + .expectShape(directionShape) + .hasTrait(PositionalTrait.class) + ? "" + : ".%s".formatted(member.getMemberName()); + + final String varName = "input" + memberName; + + // If we have a reference input, + // then we MAY modify that input. + // This means we will need both + // a modifies and a decreases' clause. + // The decreases clause is because + // Dafny will skip type parameters + // when generating a default decreases clause. + if (member.isRequired() && !isList) { + // Required single item + return TokenTree.of("%s.Modifies".formatted(varName)); + } else if (!member.isRequired() && !isList) { + // Optional single item + return TokenTree + .of( + "(if %s.Some? then %s.value.Modifies else {})".formatted( + varName, + varName + ) + ) + .lineSeparated(); + } else if (isList && member.isRequired()) { + // Required list item + return TokenTree + .of( + "(set m: object, i | i in %s && m in i.Modifies :: m)".formatted( + varName + ) ) - .map(TokenTree::of) - .orElse(TokenTree.empty()) - .prepend( - // This lets us keep track of any additional modifications - implementationType == ImplementationType.ABSTRACT - // The abstract operations do not have a class with a `Modifies` property - ? Token.of("%s(config)".formatted(nameResolver.modifiesInternalConfig())) - // The class has a `Modifies` property - // The `- {History} is important for consumers - // otherwise if they use multiple APIs - // Dafny will assume that each API can modify _any_ other History. - : Token.of("%s - {%s}" - .formatted(nameResolver.mutableStateFunctionName(), nameResolver.callHistoryFieldName())) + .lineSeparated(); + } else if (isList && !member.isRequired()) { + // Optional list item + return TokenTree + .of( + "(if %s.Some? then (set m: object, i | i in %s.value && m in i.Modifies :: m) else {})".formatted( + varName, + varName + ) ) - .flatten(); + .lineSeparated(); + } else { + throw new IllegalStateException("Unsupported shape type"); } + } - private TokenTree OperationMemberModifies( - final MemberShape member, - final OperationShape operationShape - ) { - final ShapeId directionShape = operationShape.getInput().get(); + private TokenTree generateEnsuresHistoricalCallEvents( + final ShapeId operationShapeId + ) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + + final String historicalCallEventsForOperation = + "%s.%s".formatted( + nameResolver.callHistoryFieldName(), + nameResolver.historicalCallEventsForOperation(operationShape) + ); - if (member.getId() == directionShape.withMember(member.getMemberName())) { - throw new IllegalStateException("Member not on operation"); - } + final String historicalCallEventDafnyString = operationShape + .getInput() + .isPresent() + ? "%s == old(%s) + [%s(input, output)]" + : "%s == old(%s) + [%s((), output)]"; + + return TokenTree.of( + Token.of("ensures"), + Token.of( + historicalCallEventDafnyString.formatted( + historicalCallEventsForOperation, + historicalCallEventsForOperation, + nameResolver.callEventTypeName() + ) + ) + ); + } - final boolean isList = model.expectShape(member.getTarget()).getType() == ShapeType.LIST; - // This is tricky, given where we are, there MUST be an output shape. - // If this output is @positional, - // then we need to drop the member name - final String memberName = model.expectShape(directionShape).hasTrait(PositionalTrait.class) - ? "" - : ".%s".formatted(member.getMemberName()); - - final String varName = "input" + memberName; - - // If we have a reference input, - // then we MAY modify that input. - // This means we will need both - // a modifies and a decreases' clause. - // The decreases clause is because - // Dafny will skip type parameters - // when generating a default decreases clause. - if (member.isRequired() && !isList) { - // Required single item - return TokenTree - .of( - "%s.Modifies".formatted(varName) - ); - } else if (!member.isRequired() && !isList) { - // Optional single item - return TokenTree - .of( - "(if %s.Some? then %s.value.Modifies else {})" - .formatted(varName, varName) - ) - .lineSeparated(); - } else if (isList && member.isRequired()) { - // Required list item - return TokenTree - .of( - "(set m: object, i | i in %s && m in i.Modifies :: m)" - .formatted(varName) - ) - .lineSeparated(); - } else if (isList && !member.isRequired()) { - // Optional list item - return TokenTree - .of( - "(if %s.Some? then (set m: object, i | i in %s.value && m in i.Modifies :: m) else {})" - .formatted(varName, varName) - ) - .lineSeparated(); - } else { - throw new IllegalStateException("Unsupported shape type"); - } - } - - - private TokenTree generateEnsuresHistoricalCallEvents( - final ShapeId operationShapeId - ) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - - final String historicalCallEventsForOperation = "%s.%s" - .formatted( - nameResolver.callHistoryFieldName(), - nameResolver.historicalCallEventsForOperation(operationShape)); - - final String historicalCallEventDafnyString = operationShape.getInput().isPresent() ? "%s == old(%s) + [%s(input, output)]" : "%s == old(%s) + [%s((), output)]"; - - return TokenTree - .of( - Token.of("ensures"), - Token.of(historicalCallEventDafnyString - .formatted( - historicalCallEventsForOperation, - historicalCallEventsForOperation, - nameResolver.callEventTypeName()) - ) - ); - } - - private TokenTree generateAccumulateHistoricalCallEvents( - final ShapeId operationShapeId - ) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - final String historicalCallEventDafnyString = operationShape.getInput().isPresent() ? "%s := %s + [%s(input, output)];" : "%s := %s + [%s((), output)];"; - final String historicalCallEvents = "%s.%s" - .formatted( - nameResolver.callHistoryFieldName(), - nameResolver.historicalCallEventsForOperation(operationShape)); - return TokenTree - .of( - historicalCallEventDafnyString - .formatted( - historicalCallEvents, - historicalCallEvents, - nameResolver.callEventTypeName() - ) - ); - } + private TokenTree generateAccumulateHistoricalCallEvents( + final ShapeId operationShapeId + ) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + final String historicalCallEventDafnyString = operationShape + .getInput() + .isPresent() + ? "%s := %s + [%s(input, output)];" + : "%s := %s + [%s((), output)];"; + final String historicalCallEvents = + "%s.%s".formatted( + nameResolver.callHistoryFieldName(), + nameResolver.historicalCallEventsForOperation(operationShape) + ); + return TokenTree.of( + historicalCallEventDafnyString.formatted( + historicalCallEvents, + historicalCallEvents, + nameResolver.callEventTypeName() + ) + ); + } - private TokenTree generateEnsuresPubliclyPredicate( - final ServiceShape serviceShape, - final ShapeId operationShapeId - ) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - final Boolean isFunction = nameResolver.isFunction(serviceShape, operationShape); - - return isFunction - ? TokenTree - .of("// Functions are deterministic, no need for historical call events or ensures indirection") - : TokenTree + private TokenTree generateEnsuresPubliclyPredicate( + final ServiceShape serviceShape, + final ShapeId operationShapeId + ) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + final Boolean isFunction = nameResolver.isFunction( + serviceShape, + operationShape + ); + + return isFunction + ? TokenTree.of( + "// Functions are deterministic, no need for historical call events or ensures indirection" + ) + : TokenTree .of( - TokenTree - .of( - "predicate %s(%s)" - .formatted( - nameResolver.ensuresPubliclyPredicate(operationShape), - generateOperationParams(operationShape) - .append(generateOperationOutputParams(operationShape)) - .dropEmpty() - .separated(TokenTree.of(",")) - ) - ) + TokenTree.of( + "predicate %s(%s)".formatted( + nameResolver.ensuresPubliclyPredicate(operationShape), + generateOperationParams(operationShape) + .append(generateOperationOutputParams(operationShape)) + .dropEmpty() + .separated(TokenTree.of(",")) + ) + ) ) .lineSeparated(); + } - } - - private TokenTree generateEnsuresForEnsuresPubliclyPredicate( - final ShapeId operationShapeId - ) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - final String ensureClauseDafnyString = operationShape.getInput().isPresent() ? "ensures %s(input, output)" : "ensures %s(output)"; - return TokenTree - .of(ensureClauseDafnyString.formatted(nameResolver.ensuresPubliclyPredicate(operationShape)) - ); - } + private TokenTree generateEnsuresForEnsuresPubliclyPredicate( + final ShapeId operationShapeId + ) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + final String ensureClauseDafnyString = operationShape.getInput().isPresent() + ? "ensures %s(input, output)" + : "ensures %s(output)"; + return TokenTree.of( + ensureClauseDafnyString.formatted( + nameResolver.ensuresPubliclyPredicate(operationShape) + ) + ); + } - private TokenTree generateEnsuresUnchangedCallHistory( - final ShapeId operationShapeId - ) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); + private TokenTree generateEnsuresUnchangedCallHistory( + final ShapeId operationShapeId + ) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + + return TokenTree.of( + "ensures unchanged(%s)".formatted(nameResolver.callHistoryFieldName()) + ); + } - return TokenTree + /** + * Generates the service's error types that are not modeled directly. These include: + *
    + *
  • the error trait
  • + *
  • an "unknown error" class
  • + *
+ */ + public TokenTree generateModeledErrorDataType() { + return TokenTree + .of( + Token.of("datatype Error ="), + Token.of("// Local Error structures are listed here"), + TokenTree .of( - "ensures unchanged(%s)".formatted(nameResolver.callHistoryFieldName()) - ); - } - - /** - * Generates the service's error types that are not modeled directly. These include: - *
    - *
  • the error trait
  • - *
  • an "unknown error" class
  • - *
- */ - public TokenTree generateModeledErrorDataType() { - return TokenTree.of( - Token.of("datatype Error ="), - Token.of("// Local Error structures are listed here"), - TokenTree.of( ModelUtils .streamNamespaceErrors(model, serviceShape.getId().getNamespace()) .map(Shape::getId) .map(this::generateDataTypeConstructorFromStructure) - ).lineSeparated(), - Token.of("// Any dependent models are listed here"), - TokenTree.of( + ) + .lineSeparated(), + Token.of("// Any dependent models are listed here"), + TokenTree + .of( nameResolver .dependentModels() .stream() .map(this::generateDependantErrorDataTypeConstructor) - ).lineSeparated(), - collectionOfErrors(), - Token.of("// The Opaque error, used for native, extern, wrapped or unknown errors"), - Token.of("| Opaque(obj: object)"), - // Helper error for use with `extern` - Token.of("type OpaqueError = e: Error | e.Opaque? witness *") - ).lineSeparated(); - } - - private TokenTree collectionOfErrors() { - if (!this.generateCollectionOfErrors) { - return TokenTree.empty(); - } - return TokenTree.of( - Token.of("// The Collection error is used to collect several errors together"), - Token.of("// This is useful when composing OR logic."), - Token.of("// Consider the following method:"), - Token.of("// "), - Token.of("// method FN(n:I)"), - Token.of("// returns (res: Result)"), - Token.of("// ensures A(I).Success? ==> res.Success?"), - Token.of("// ensures B(I).Success? ==> res.Success?"), - Token.of("// ensures A(I).Failure? && B(I).Failure? ==> res.Failure?"), - Token.of("// "), - Token.of("// If either A || B is successful then FN is successful."), - Token.of("// And if A && B fail then FN will fail."), - Token.of("// But what information should FN transmit back to the caller?"), - Token.of("// While it may be correct to hide these details from the caller,"), - Token.of("// this can not be the globally correct option."), - Token.of("// Suppose that A and B can be blocked by different ACLs,"), - Token.of("// and that their representation of I is only eventually consistent."), - Token.of("// How can the caller distinguish, at a minimum for logging,"), - Token.of("// the difference between the four failure modes?"), - Token.of("// || (!access(A(I)) && !access(B(I)))"), - Token.of("// || (!exit(A(I)) && !exit(B(I)))"), - Token.of("// || (!access(A(I)) && !exit(B(I)))"), - Token.of("// || (!exit(A(I)) && !access(B(I)))"), - Token.of("| CollectionOfErrors(list: seq, nameonly message: string)") - ).lineSeparated(); - } - - public TokenTree generateDataTypeConstructorFromStructure(final ShapeId shapeId) { - final StructureShape structureShape = model.expectShape(shapeId, StructureShape.class); - final String typeName = shapeId.getName(); - - final TokenTree params = TokenTree - .of(ModelUtils - .streamStructureMembers(structureShape) - .map(this::generateStructureTypeParameter) ) - // This combines the trees - .separated(TokenTree.of(Token.of(","), Token.NEWLINE)) - .parenthesized() - // Because `separated` combined things, this works nicely - .lineSeparated(); + .lineSeparated(), + collectionOfErrors(), + Token.of( + "// The Opaque error, used for native, extern, wrapped or unknown errors" + ), + Token.of("| Opaque(obj: object)"), + // Helper error for use with `extern` + Token.of("type OpaqueError = e: Error | e.Opaque? witness *") + ) + .lineSeparated(); + } - return TokenTree.of( - Token.of("| %1$s".formatted(typeName)), - params); + private TokenTree collectionOfErrors() { + if (!this.generateCollectionOfErrors) { + return TokenTree.empty(); } + return TokenTree + .of( + Token.of( + "// The Collection error is used to collect several errors together" + ), + Token.of("// This is useful when composing OR logic."), + Token.of("// Consider the following method:"), + Token.of("// "), + Token.of("// method FN(n:I)"), + Token.of("// returns (res: Result)"), + Token.of("// ensures A(I).Success? ==> res.Success?"), + Token.of("// ensures B(I).Success? ==> res.Success?"), + Token.of( + "// ensures A(I).Failure? && B(I).Failure? ==> res.Failure?" + ), + Token.of("// "), + Token.of("// If either A || B is successful then FN is successful."), + Token.of("// And if A && B fail then FN will fail."), + Token.of( + "// But what information should FN transmit back to the caller?" + ), + Token.of( + "// While it may be correct to hide these details from the caller," + ), + Token.of("// this can not be the globally correct option."), + Token.of("// Suppose that A and B can be blocked by different ACLs,"), + Token.of( + "// and that their representation of I is only eventually consistent." + ), + Token.of( + "// How can the caller distinguish, at a minimum for logging," + ), + Token.of("// the difference between the four failure modes?"), + Token.of("// || (!access(A(I)) && !access(B(I)))"), + Token.of("// || (!exit(A(I)) && !exit(B(I)))"), + Token.of("// || (!access(A(I)) && !exit(B(I)))"), + Token.of("// || (!exit(A(I)) && !access(B(I)))"), + Token.of( + "| CollectionOfErrors(list: seq, nameonly message: string)" + ) + ) + .lineSeparated(); + } - public TokenTree generateDependantErrorDataTypeConstructor(final DependentSmithyModel dependentSmithyModel) { - final String errorType = nameResolver.dafnyTypesModuleName(dependentSmithyModel.namespace()) + ".Error"; - final String errorConstructorName = errorType - .replace("Types.Error", ""); + public TokenTree generateDataTypeConstructorFromStructure( + final ShapeId shapeId + ) { + final StructureShape structureShape = model.expectShape( + shapeId, + StructureShape.class + ); + final String typeName = shapeId.getName(); - return TokenTree.of( - Token.of("| %s(%s: %s)" - .formatted(errorConstructorName, errorConstructorName, errorType)) - ); - } + final TokenTree params = TokenTree + .of( + ModelUtils + .streamStructureMembers(structureShape) + .map(this::generateStructureTypeParameter) + ) + // This combines the trees + .separated(TokenTree.of(Token.of(","), Token.NEWLINE)) + .parenthesized() + // Because `separated` combined things, this works nicely + .lineSeparated(); - public TokenTree generateAbstractBody() { - final TokenTree abstractModulePrelude = TokenTree - .of(DafnyNameResolver.abstractModulePrelude(serviceShape)) - .lineSeparated(); + return TokenTree.of(Token.of("| %1$s".formatted(typeName)), params); + } - if (serviceShape.hasTrait(ServiceTrait.class)) { - return TokenTree - .of( - abstractModulePrelude, - generateAbstractAwsServiceClass(serviceShape) + public TokenTree generateDependantErrorDataTypeConstructor( + final DependentSmithyModel dependentSmithyModel + ) { + final String errorType = + nameResolver.dafnyTypesModuleName(dependentSmithyModel.namespace()) + + ".Error"; + final String errorConstructorName = errorType.replace("Types.Error", ""); + + return TokenTree.of( + Token.of( + "| %s(%s: %s)".formatted( + errorConstructorName, + errorConstructorName, + errorType ) - .lineSeparated(); - } else if (serviceShape.hasTrait(LocalServiceTrait.class)) { - return TokenTree - .of( - abstractModulePrelude, generateAbstractLocalService(serviceShape) - ) - .lineSeparated(); - } else { - throw new IllegalStateException("Service does not have supported trait"); - } - } + ) + ); + } - // This method needs to be called before typesModulePrelude is calculated - public TokenTree generateAbstractServiceModule(ServiceShape serviceShape) { - final TokenTree abstractModulePrelude = TokenTree - .of(DafnyNameResolver.abstractModulePrelude(serviceShape)) + public TokenTree generateAbstractBody() { + final TokenTree abstractModulePrelude = TokenTree + .of(DafnyNameResolver.abstractModulePrelude(serviceShape)) + .lineSeparated(); + + if (serviceShape.hasTrait(ServiceTrait.class)) { + return TokenTree + .of( + abstractModulePrelude, + generateAbstractAwsServiceClass(serviceShape) + ) + .lineSeparated(); + } else if (serviceShape.hasTrait(LocalServiceTrait.class)) { + return TokenTree + .of(abstractModulePrelude, generateAbstractLocalService(serviceShape)) .lineSeparated(); - final TokenTree moduleHeader = TokenTree.of("abstract module %s" - .formatted(nameResolver.abstractServiceModuleName(serviceShape))); + } else { + throw new IllegalStateException("Service does not have supported trait"); + } + } - if (serviceShape.hasTrait(ServiceTrait.class)) { - TokenTree body = generateAbstractAwsServiceClass(serviceShape); - return moduleHeader - .append(Token - .of( - abstractModulePrelude, - body + // This method needs to be called before typesModulePrelude is calculated + public TokenTree generateAbstractServiceModule(ServiceShape serviceShape) { + final TokenTree abstractModulePrelude = TokenTree + .of(DafnyNameResolver.abstractModulePrelude(serviceShape)) + .lineSeparated(); + final TokenTree moduleHeader = TokenTree.of( + "abstract module %s".formatted( + nameResolver.abstractServiceModuleName(serviceShape) + ) + ); + + if (serviceShape.hasTrait(ServiceTrait.class)) { + TokenTree body = generateAbstractAwsServiceClass(serviceShape); + return moduleHeader.append( + Token.of(abstractModulePrelude, body).lineSeparated().braced() + ); + } else if (serviceShape.hasTrait(LocalServiceTrait.class)) { + final TokenTree operationsPrelude = TokenTree + .of( + "import Operations : %s".formatted( + nameResolver.abstractOperationsModuleName(serviceShape) ) - .lineSeparated() - .braced() - ); - } else if (serviceShape.hasTrait(LocalServiceTrait.class)) { - final TokenTree operationsPrelude = TokenTree - .of( - "import Operations : %s" - .formatted(nameResolver.abstractOperationsModuleName(serviceShape)) - ) - .lineSeparated(); + ) + .lineSeparated(); - final Function isInputParamRequiredForOperation = (operation) -> { - return model.expectShape(operation, OperationShape.class).getInput().isPresent(); + final Function isInputParamRequiredForOperation = + operation -> { + return model + .expectShape(operation, OperationShape.class) + .getInput() + .isPresent(); }; - final TokenTree methods = TokenTree - .of( - serviceShape - .getAllOperations() - .stream() - .flatMap(operation -> Stream.of( - nameResolver.isFunction(serviceShape, model.expectShape(operation, OperationShape.class)) + final TokenTree methods = TokenTree + .of( + serviceShape + .getAllOperations() + .stream() + .flatMap(operation -> + Stream.of( + nameResolver.isFunction( + serviceShape, + model.expectShape(operation, OperationShape.class) + ) ? Token.empty() : TokenTree - .of( - generateEnsuresPubliclyPredicate(serviceShape, operation), - TokenTree - .of( - (isInputParamRequiredForOperation.apply(operation) ? "{Operations.%s(input, output)}" : "{Operations.%s(output)}") - .formatted( - nameResolver.ensuresPubliclyPredicate(model.expectShape(operation, OperationShape.class)) + .of( + generateEnsuresPubliclyPredicate(serviceShape, operation), + TokenTree.of( + (isInputParamRequiredForOperation.apply(operation) + ? "{Operations.%s(input, output)}" + : "{Operations.%s(output)}").formatted( + nameResolver.ensuresPubliclyPredicate( + model.expectShape(operation, OperationShape.class) + ) ) ) - ) - .lineSeparated(), - generateBodilessOperationMethodThatEnsuresCallEvents(serviceShape, operation, ImplementationType.CODEGEN), + ) + .lineSeparated(), + generateBodilessOperationMethodThatEnsuresCallEvents( + serviceShape, + operation, + ImplementationType.CODEGEN + ), TokenTree .of( - nameResolver.isFunction(serviceShape, model.expectShape(operation, OperationShape.class)) - ? TokenTree.of((isInputParamRequiredForOperation.apply(operation) ? "Operations.%s(config, input)" : "Operations.%s(config)").formatted( - operation.getName() - )) - : TokenTree.of( - Token.of((isInputParamRequiredForOperation.apply(operation) ? "output := Operations.%s(config, input);" : "output := Operations.%s(config);") - .formatted( - operation.getName() - )), - generateAccumulateHistoricalCallEvents(operation) - ) - .lineSeparated() + nameResolver.isFunction( + serviceShape, + model.expectShape(operation, OperationShape.class) + ) + ? TokenTree.of( + (isInputParamRequiredForOperation.apply(operation) + ? "Operations.%s(config, input)" + : "Operations.%s(config)").formatted( + operation.getName() + ) + ) + : TokenTree + .of( + Token.of( + (isInputParamRequiredForOperation.apply(operation) + ? "output := Operations.%s(config, input);" + : "output := Operations.%s(config);").formatted( + operation.getName() + ) + ), + generateAccumulateHistoricalCallEvents(operation) + ) + .lineSeparated() ) .lineSeparated() .braced(), - TokenTree.empty() - ) + TokenTree.empty() ) - ) - .lineSeparated(); + ) + ) + .lineSeparated(); - final String internalConfig = DafnyNameResolver.internalConfigType(); + final String internalConfig = DafnyNameResolver.internalConfigType(); - final TokenTree body = TokenTree - .of( - abstractModulePrelude, - operationsPrelude, - generateAbstractLocalService(serviceShape), - TokenTree.of("class %s extends %s" - .formatted(DafnyNameResolver.classNameForServiceClient(serviceShape), nameResolver.traitForServiceClient(serviceShape))), - TokenTree.of( - TokenTree.of("constructor(config: Operations.%s)".formatted(internalConfig)), - TokenTree.of("requires Operations.%s(config)" - .formatted(nameResolver.validConfigPredicate())), + final TokenTree body = TokenTree + .of( + abstractModulePrelude, + operationsPrelude, + generateAbstractLocalService(serviceShape), + TokenTree.of( + "class %s extends %s".formatted( + DafnyNameResolver.classNameForServiceClient(serviceShape), + nameResolver.traitForServiceClient(serviceShape) + ) + ), + TokenTree + .of( + TokenTree.of( + "constructor(config: Operations.%s)".formatted(internalConfig) + ), + TokenTree.of( + "requires Operations.%s(config)".formatted( + nameResolver.validConfigPredicate() + ) + ), TokenTree.of("ensures"), - TokenTree.of("&& %s()".formatted(nameResolver.validStateInvariantName())), - TokenTree.of("&& fresh(%s)".formatted(nameResolver.callHistoryFieldName())), + TokenTree.of( + "&& %s()".formatted(nameResolver.validStateInvariantName()) + ), + TokenTree.of( + "&& fresh(%s)".formatted(nameResolver.callHistoryFieldName()) + ), TokenTree.of("&& this.config == config"), - TokenTree.of("const config: Operations.%s".formatted(internalConfig)), - TokenTree.of("predicate %s()".formatted(nameResolver.validStateInvariantName())), - TokenTree.of("ensures %s() ==>".formatted(nameResolver.validStateInvariantName())), - TokenTree.of("&& Operations.%s(config)".formatted(nameResolver.validConfigPredicate())), - TokenTree.of("&& %s !in Operations.%s(config)" - .formatted(nameResolver.callHistoryFieldName(), nameResolver.modifiesInternalConfig())), - TokenTree.of("&& %s == Operations.%s(config) + {%s}" - .formatted( - nameResolver.mutableStateFunctionName(), - nameResolver.modifiesInternalConfig(), - nameResolver.callHistoryFieldName())), + TokenTree.of( + "const config: Operations.%s".formatted(internalConfig) + ), + TokenTree.of( + "predicate %s()".formatted( + nameResolver.validStateInvariantName() + ) + ), + TokenTree.of( + "ensures %s() ==>".formatted( + nameResolver.validStateInvariantName() + ) + ), + TokenTree.of( + "&& Operations.%s(config)".formatted( + nameResolver.validConfigPredicate() + ) + ), + TokenTree.of( + "&& %s !in Operations.%s(config)".formatted( + nameResolver.callHistoryFieldName(), + nameResolver.modifiesInternalConfig() + ) + ), + TokenTree.of( + "&& %s == Operations.%s(config) + {%s}".formatted( + nameResolver.mutableStateFunctionName(), + nameResolver.modifiesInternalConfig(), + nameResolver.callHistoryFieldName() + ) + ), methods - ).lineSeparated().braced() - ) - .lineSeparated() - .braced(); + ) + .lineSeparated() + .braced() + ) + .lineSeparated() + .braced(); - return TokenTree - .of( - Token.of("abstract module %s" - .formatted(nameResolver.abstractServiceModuleName(serviceShape))), - body - ) - .lineSeparated(); - } else { - throw new IllegalStateException("Service does not have supported trait"); - } + return TokenTree + .of( + Token.of( + "abstract module %s".formatted( + nameResolver.abstractServiceModuleName(serviceShape) + ) + ), + body + ) + .lineSeparated(); + } else { + throw new IllegalStateException("Service does not have supported trait"); } + } - /** - * Given a list of ShapeIds representing a path from a root shape to a reference shape, - * generates a TokenTree containing an {@code ensures} clause on the reference's ValidState - * @param managedReferenceMemberShapePath a list of shape IDs where: - * - The first element is the initial shape ID - * - The last element is the shape ID of a reference shape - * - Intermediate elements are a path of shape IDs from the first to the last shape ID - * @return TokenTree containing an {@code ensures} clause on the reference's ValidState - */ - public TokenTree ensuresValidStateClauseForPathToReference( - List managedReferenceMemberShapePath - ) { - return validStateClauseForPathToReference( - managedReferenceMemberShapePath, - "ensures" - ); - } + /** + * Given a list of ShapeIds representing a path from a root shape to a reference shape, + * generates a TokenTree containing an {@code ensures} clause on the reference's ValidState + * @param managedReferenceMemberShapePath a list of shape IDs where: + * - The first element is the initial shape ID + * - The last element is the shape ID of a reference shape + * - Intermediate elements are a path of shape IDs from the first to the last shape ID + * @return TokenTree containing an {@code ensures} clause on the reference's ValidState + */ + public TokenTree ensuresValidStateClauseForPathToReference( + List managedReferenceMemberShapePath + ) { + return validStateClauseForPathToReference( + managedReferenceMemberShapePath, + "ensures" + ); + } - /** - * Given a list of ShapeIds representing a path from a root shape to a reference shape, - * generates a TokenTree containing a {@code requires} clause on the reference's ValidState - * @param managedReferenceMemberShapePath a list of shape IDs where: - * - The first element is the initial shape ID - * - The last element is the shape ID of a reference shape - * - Intermediate elements are a path of shape IDs from the first to the last shape ID - * @return TokenTree containing an {@code requires} clause on the reference's ValidState - */ - public TokenTree requiresValidStateClauseForPathToReference( - List managedReferenceMemberShapePath - ) { - return validStateClauseForPathToReference( - managedReferenceMemberShapePath, - "requires" - ); - } + /** + * Given a list of ShapeIds representing a path from a root shape to a reference shape, + * generates a TokenTree containing a {@code requires} clause on the reference's ValidState + * @param managedReferenceMemberShapePath a list of shape IDs where: + * - The first element is the initial shape ID + * - The last element is the shape ID of a reference shape + * - Intermediate elements are a path of shape IDs from the first to the last shape ID + * @return TokenTree containing an {@code requires} clause on the reference's ValidState + */ + public TokenTree requiresValidStateClauseForPathToReference( + List managedReferenceMemberShapePath + ) { + return validStateClauseForPathToReference( + managedReferenceMemberShapePath, + "requires" + ); + } - /** - * Given a list of ShapeIds representing a path from a root shape to a reference shape, - * generates a TokenTree containing a clause starting with {@code prefix} on the reference's ValidState - * @param managedReferenceMemberShapePath a list of shape IDs where: - * - The first element is the initial shape ID - * - The last element is the shape ID of a reference shape - * - Intermediate elements are a path of shape IDs from the first to the last shape ID - * @return TokenTree containing a clause starting with {@code prefix} on the reference's ValidState - */ - public TokenTree validStateClauseForPathToReference( - List managedReferenceMemberShapePath, - String prefix - ) { - // accessPathToCurrentShape holds the accessor path prepending accessing the current shape in the path. - // e.g. if `barStructure` is the current variable inside `fooStructure`: - // accessPathToCurrentShape would be `config.fooStructure.value` - TokenTree accessPathToCurrentShape = TokenTree.of("config"); - // validStateClause is a builder for the valid state clause this method generates. - TokenTree validStateClause = TokenTree.of(prefix); - ShapeType currentShapeType = null; - TokenTree currentVarName; - boolean currentShapeRequired; - - for (ShapeId shapeIdInPath : managedReferenceMemberShapePath) { - Shape shapeInPath = model.expectShape(shapeIdInPath); - // Shapes in the path alternate between member shapes and their parents. - // Member shapes know the member variable name and whether the member is required. - // The parent shapes know the shape type. - // Both of these are relevant in transitioning to child members. - if (shapeInPath.isMemberShape()) { - currentVarName = TokenTree.of(".%s".formatted(shapeIdInPath.getMember().get())); - currentShapeRequired = shapeInPath.asMemberShape().get().isRequired(); - - if (currentShapeType == ShapeType.STRUCTURE) { - // Children of structures are accessed like fields; e.g. `fooStructure.barStructure` - accessPathToCurrentShape = TokenTree.of("%s%s".formatted(accessPathToCurrentShape, currentVarName)); - if (!currentShapeRequired) { - // If `fooStructure` is not required, its access must be preceded by checking for `.Some?` - validStateClause = validStateClause.append(TokenTree.of( - "%s.Some? ==>\n" - .formatted(accessPathToCurrentShape))); - - // Since `.Some?` is checked above, children are now accessed on the Option's value member - // i.e. `fooStructure.value.barStructure` - accessPathToCurrentShape = TokenTree.of("%s.value".formatted(accessPathToCurrentShape)); - } - } else if (currentShapeType == ShapeType.UNION) { - // Union members are accessed like fields - // e.g. `fooUnion.barUnionMember` - accessPathToCurrentShape = TokenTree.of( - "%s%s" .formatted(accessPathToCurrentShape, currentVarName)); - - // Union members must always be checked for presence; i.e. are always "optional" - // e.g. `fooUnion.barUnionMember? ==> ` - validStateClause = validStateClause.append(TokenTree.of( - "%s? ==>\n" - .formatted(accessPathToCurrentShape))); - - // Since presence is checked above, children are now accessed on the member - // e.g. `fooUnion.barUnionMember? ==> fooUnion.barUnionMember ...` - accessPathToCurrentShape = TokenTree.of("%s".formatted(accessPathToCurrentShape)); - } else if (currentShapeType == ShapeType.MAP || currentShapeType == ShapeType.LIST) { - // This branch is for collections of multiple values, i.e. maps or lists. - // These shapes use set comprehension to access valid state methods. - if (currentShapeType == ShapeType.MAP) { - // Children of map values are accessed by creating a set of the map values, - // then iterating through each value. - // (Smithy does not support references in map keys, so this does not need to be checked.) - validStateClause = validStateClause.append(TokenTree.of( - """ - var tmps%1$s := set t%1$s | t%1$s in %2$s.Values; - forall tmp%1$s :: tmp%1$s in tmps%1$s ==> - """ - .formatted( - intermediateTempVariableCounter, - accessPathToCurrentShape) - )); - } else if (currentShapeType == ShapeType.LIST) { - // - validStateClause = validStateClause.append(TokenTree.of( - """ - var tmps%1$s := set t%1$s | t%1$s in %2$s; - forall tmp%1$s :: tmp%1$s in tmps%1$s ==> - """ - .formatted( - intermediateTempVariableCounter, - accessPathToCurrentShape) - )); - } - - // Parsing the map using set comprehension means the access path to the next shape will - // be based on the current set comprehension variable used in the `forall` statement. - // This overwrites the accessPath up until this point. - accessPathToCurrentShape = TokenTree.of("tmp%1$s".formatted(intermediateTempVariableCounter)); - - // Increment tempVar counter so variable names don't get re-used - intermediateTempVariableCounter++; - } else { - // This is not a recognized shape type and is unsupported - throw new UnsupportedOperationException( - String.format("Shape type %s not supported. Shape name: %s", currentShapeType, currentVarName)); - } - } else { - // This is not a member shape, so this is a parent shape of a member. - // The parent shape knows the type of the member. - currentShapeType = shapeInPath.getType(); - } - } - // currentShape is the last shape in the path; by definition, it is the reference shape. - validStateClause = validStateClause.append(TokenTree.of("%s.ValidState()\n".formatted(accessPathToCurrentShape))); + /** + * Given a list of ShapeIds representing a path from a root shape to a reference shape, + * generates a TokenTree containing a clause starting with {@code prefix} on the reference's ValidState + * @param managedReferenceMemberShapePath a list of shape IDs where: + * - The first element is the initial shape ID + * - The last element is the shape ID of a reference shape + * - Intermediate elements are a path of shape IDs from the first to the last shape ID + * @return TokenTree containing a clause starting with {@code prefix} on the reference's ValidState + */ + public TokenTree validStateClauseForPathToReference( + List managedReferenceMemberShapePath, + String prefix + ) { + // accessPathToCurrentShape holds the accessor path prepending accessing the current shape in the path. + // e.g. if `barStructure` is the current variable inside `fooStructure`: + // accessPathToCurrentShape would be `config.fooStructure.value` + TokenTree accessPathToCurrentShape = TokenTree.of("config"); + // validStateClause is a builder for the valid state clause this method generates. + TokenTree validStateClause = TokenTree.of(prefix); + ShapeType currentShapeType = null; + TokenTree currentVarName; + boolean currentShapeRequired; + + for (ShapeId shapeIdInPath : managedReferenceMemberShapePath) { + Shape shapeInPath = model.expectShape(shapeIdInPath); + // Shapes in the path alternate between member shapes and their parents. + // Member shapes know the member variable name and whether the member is required. + // The parent shapes know the shape type. + // Both of these are relevant in transitioning to child members. + if (shapeInPath.isMemberShape()) { + currentVarName = + TokenTree.of(".%s".formatted(shapeIdInPath.getMember().get())); + currentShapeRequired = shapeInPath.asMemberShape().get().isRequired(); + + if (currentShapeType == ShapeType.STRUCTURE) { + // Children of structures are accessed like fields; e.g. `fooStructure.barStructure` + accessPathToCurrentShape = + TokenTree.of( + "%s%s".formatted(accessPathToCurrentShape, currentVarName) + ); + if (!currentShapeRequired) { + // If `fooStructure` is not required, its access must be preceded by checking for `.Some?` + validStateClause = + validStateClause.append( + TokenTree.of( + "%s.Some? ==>\n".formatted(accessPathToCurrentShape) + ) + ); + + // Since `.Some?` is checked above, children are now accessed on the Option's value member + // i.e. `fooStructure.value.barStructure` + accessPathToCurrentShape = + TokenTree.of("%s.value".formatted(accessPathToCurrentShape)); + } + } else if (currentShapeType == ShapeType.UNION) { + // Union members are accessed like fields + // e.g. `fooUnion.barUnionMember` + accessPathToCurrentShape = + TokenTree.of( + "%s%s".formatted(accessPathToCurrentShape, currentVarName) + ); - return TokenTree.of(validStateClause).lineSeparated(); - } + // Union members must always be checked for presence; i.e. are always "optional" + // e.g. `fooUnion.barUnionMember? ==> ` + validStateClause = + validStateClause.append( + TokenTree.of("%s? ==>\n".formatted(accessPathToCurrentShape)) + ); - /** - * Given a list of ShapeIds representing a path from a root shape to a reference shape, - * generates a TokenTree containing a {@code modifies} clause on the reference's Modifies member - * @param managedReferenceMemberShapePath a list of shape IDs where: - * - The first element is the initial shape ID - * - The last element is the shape ID of a reference shape - * - Intermediate elements are a path of shape IDs from the first to the last shape ID - * @return TokenTree containing a {@code modifies} clause on the reference's Modifies member - */ - public TokenTree modifiesClauseForPathToReference( - List managedReferenceMemberShapePath - ) { - return modifiesClauseForPathToReference( - managedReferenceMemberShapePath, - "modifies" - ); - } + // Since presence is checked above, children are now accessed on the member + // e.g. `fooUnion.barUnionMember? ==> fooUnion.barUnionMember ...` + accessPathToCurrentShape = + TokenTree.of("%s".formatted(accessPathToCurrentShape)); + } else if ( + currentShapeType == ShapeType.MAP || + currentShapeType == ShapeType.LIST + ) { + // This branch is for collections of multiple values, i.e. maps or lists. + // These shapes use set comprehension to access valid state methods. + if (currentShapeType == ShapeType.MAP) { + // Children of map values are accessed by creating a set of the map values, + // then iterating through each value. + // (Smithy does not support references in map keys, so this does not need to be checked.) + validStateClause = + validStateClause.append( + TokenTree.of( + """ + var tmps%1$s := set t%1$s | t%1$s in %2$s.Values; + forall tmp%1$s :: tmp%1$s in tmps%1$s ==> + """.formatted( + intermediateTempVariableCounter, + accessPathToCurrentShape + ) + ) + ); + } else if (currentShapeType == ShapeType.LIST) { + // + validStateClause = + validStateClause.append( + TokenTree.of( + """ + var tmps%1$s := set t%1$s | t%1$s in %2$s; + forall tmp%1$s :: tmp%1$s in tmps%1$s ==> + """.formatted( + intermediateTempVariableCounter, + accessPathToCurrentShape + ) + ) + ); + } - /** - * Given a list of ShapeIds representing a path from a root shape to a reference shape, - * generates a TokenTree containing a clause that would subtract the reference shape's Modifies member - * from another set. - * (This is expected to be wrapped around something like - * {@code ensures fresh(parentShape.Modifies (referenceMemberNotFreshClause here) )}, - * as the Modifies clauses access here will not be part of the fresh variable.) - * @param managedReferenceMemberShapePath a list of shape IDs where: - * - The first element is the initial shape ID - * - The last element is the shape ID of a reference shape - * - Intermediate elements are a path of shape IDs from the first to the last shape ID - * @return TokenTree containing a set subtraction clause for the reference shape's Modifies member. - */ - public TokenTree referenceMemberNotFreshClause( - List managedReferenceMemberShapePath - ) { - return TokenTree.of( - modifiesClauseForPathToReference( - managedReferenceMemberShapePath, - "- (" - ), - TokenTree.of(")") - ); + // Parsing the map using set comprehension means the access path to the next shape will + // be based on the current set comprehension variable used in the `forall` statement. + // This overwrites the accessPath up until this point. + accessPathToCurrentShape = + TokenTree.of("tmp%1$s".formatted(intermediateTempVariableCounter)); + + // Increment tempVar counter so variable names don't get re-used + intermediateTempVariableCounter++; + } else { + // This is not a recognized shape type and is unsupported + throw new UnsupportedOperationException( + String.format( + "Shape type %s not supported. Shape name: %s", + currentShapeType, + currentVarName + ) + ); + } + } else { + // This is not a member shape, so this is a parent shape of a member. + // The parent shape knows the type of the member. + currentShapeType = shapeInPath.getType(); + } } + // currentShape is the last shape in the path; by definition, it is the reference shape. + validStateClause = + validStateClause.append( + TokenTree.of("%s.ValidState()\n".formatted(accessPathToCurrentShape)) + ); - /** - * Given a list of ShapeIds representing a path from a root shape to a reference shape, - * generates a TokenTree containing a clause starting with {@code prefix} on the reference's Modifies member - * @param managedReferenceMemberShapePath a list of shape IDs where: - * - The first element is the initial shape ID - * - The last element is the shape ID of a reference shape - * - Intermediate elements are a path of shape IDs from the first to the last shape ID - * @return TokenTree containing a clause starting with {@code prefix} on the reference's Modifies member - */ - private TokenTree modifiesClauseForPathToReference( - List managedReferenceMemberShapePath, - String prefix - ) { - // The change in intermediateTempVariableCounter over this function is equal to the number of set - // comprehensions that were used to access the reference's Modifies member. - // This number is also used to generate the required number of set comprehensions to flatten out the - // set of Modifies clauses. - int startingIntermediateTempVariableCounter = intermediateTempVariableCounter; - // accessPathToCurrentShape holds the accessor path prepending accessing the current shape in the path. - // e.g. if `barStructure` is the current variable inside `fooStructure`: - // accessPathToCurrentShape would be `config.fooStructure.value` - String accessPathToCurrentShape = "config"; - // modifiesClause is a builder for the valid state clause this method generates. - TokenTree modifiesClause = TokenTree.of(prefix); - ShapeType currentShapeType = null; - String currentVarName; - boolean currentShapeRequired; - // The Modifies members of optional structure members that are not inside set comprehension expressions - // are accessed as `if path.to.var.Some? then path.to.var.value.path.to.reference.Modifies else {}`. - // The `else {}` is appended at the end of the entire modifies expression. - // If set comprehension is used later in the `modifies` clause, - // this will be appended after the set comprehension expression completes. - TokenTree appendAtEnd = TokenTree.empty(); - // When the `modifies` expression uses set comprehension to access Modifies members, - // the set comprehension is encapsulated in a single variable. - // This stores a reference to that variable's name. - TokenTree setComprehensionVar = null; - - for (ShapeId shapeIdInPath : managedReferenceMemberShapePath) { - Shape shapeInPath = model.expectShape(shapeIdInPath); - // Shapes in the path alternate between member shapes and their parents. - // Member shapes know the member variable name and whether the member is required. - // The parent shapes know the shape type. - // Both of these are relevant in transitioning to child members. - if (shapeInPath.isMemberShape()) { - currentVarName = "." + shapeIdInPath.getMember().get(); - currentShapeRequired = shapeInPath.asMemberShape().get().isRequired(); - - if (currentShapeType == ShapeType.STRUCTURE) { - // Children of structures are accessed like fields; e.g. `fooStructure.barStructure` - accessPathToCurrentShape += currentVarName; - - if (!currentShapeRequired) { - // If `fooStructure` is not required, its access must be preceded by checking for `.Some?` - if (setComprehensionVar != null) { - // If using set comprehension, the `.Some` check on an optional structure is added as - // a condition on the existing comprehension, starting with `&&` - // i.e. var setVar := set t | t in otherVar.Values && t.thisOptionalStructure.Some? - modifiesClause = modifiesClause.append(TokenTree.of( - "&& %1$s.Some? \n ".formatted(accessPathToCurrentShape) - )); - } else { - // If not using set comprehension, the `.Some` check on an optional structure is added as - // an if/else clause, where the else is appended at the very end of the modifies clause - modifiesClause = modifiesClause.append(TokenTree.of( - "if %1$s.Some? then \n".formatted(accessPathToCurrentShape) - )); - appendAtEnd = appendAtEnd.append(TokenTree.of("else {}\n")); - } - - // Since `.Some?` is checked above, children are now accessed on the Option's value member - // i.e. `fooStructure.value.barStructure` - accessPathToCurrentShape += ".value"; - } - - } else if (currentShapeType == ShapeType.UNION) { - // Union members are accessed like fields - // e.g. `fooUnion.barUnionMember` - accessPathToCurrentShape += currentVarName; - - // Union members must always be checked for presence; i.e. are always "optional" - if (setComprehensionVar != null) { - // If using set comprehension, the destructor on a union member is added as - // a condition on the existing comprehension, starting with `&&` - // e.g. `&& fooUnion.barUnionMember? ...` - modifiesClause = modifiesClause.append(TokenTree.of( - "&& %1$s? \n ".formatted(accessPathToCurrentShape) - )); - } else { - // If not using set comprehension, the destructor on a union member is added as - // an if/else clause, where the else is appended at the very end of the modifies clause - // e.g. `if fooUnion.barUnionMember? then ... else {}` - modifiesClause = modifiesClause.append(TokenTree.of( - "if %1$s? then \n".formatted(accessPathToCurrentShape) - )); - appendAtEnd = appendAtEnd.append(TokenTree.of("else {}\n")); - } - } else if (currentShapeType == ShapeType.MAP || currentShapeType == ShapeType.LIST) { - // This branch is for collections of multiple values, i.e. maps or lists. - // These shapes introduce a set comprehension variable to access valid state methods. - if (setComprehensionVar != null) { - - if (currentShapeType == ShapeType.LIST) { - modifiesClause = modifiesClause.append(TokenTree.of( - ", t%1$s <- %2$s" - .formatted(intermediateTempVariableCounter, - accessPathToCurrentShape) - )); - } else if (currentShapeType == ShapeType.MAP) { - // If using set comprehension, the map's values are accessed by extending the current - // comprehension expression - modifiesClause = modifiesClause.append(TokenTree.of( - ", t%1$s <- %2$s.Values" - .formatted(intermediateTempVariableCounter, - accessPathToCurrentShape) - )); - } - } else { - // If not using set comprehension, we now need to. - if (currentShapeType == ShapeType.LIST) { - modifiesClause = modifiesClause.append(TokenTree.of( - "set tmps%1$s <- set t%1$s <- %2$s | true\n ".formatted( - intermediateTempVariableCounter, - accessPathToCurrentShape) - )); - } else if (currentShapeType == ShapeType.MAP) { - modifiesClause = modifiesClause.append(TokenTree.of( - "set tmps%1$s <- set t%1$s <- %2$s.Values | true\n ".formatted( - intermediateTempVariableCounter, - accessPathToCurrentShape) - )); - } - - // Once this logic starts using set comprehension to access the variables, - // it will continue to expand on the same variable to access all Modifies clauses. - // Introduce a setComprehensionVar that will hold nested sets of Modifies members. - setComprehensionVar = TokenTree.of( - "tmps%1$s".formatted(intermediateTempVariableCounter)); - } - - // Parsing the map using set comprehension means the access path to the next shape will - // be based on the current set comprehension variable used in the expression. - // This overwrites the accessPath up until this point. - accessPathToCurrentShape = "t%1$s".formatted( - intermediateTempVariableCounter); - intermediateTempVariableCounter++; - } else { - // This is not a recognized shape type and is unsupported - throw new UnsupportedOperationException( - String.format("Shape type %s not supported. Shape name: %s", currentShapeType, currentVarName)); - } + return TokenTree.of(validStateClause).lineSeparated(); + } + + /** + * Given a list of ShapeIds representing a path from a root shape to a reference shape, + * generates a TokenTree containing a {@code modifies} clause on the reference's Modifies member + * @param managedReferenceMemberShapePath a list of shape IDs where: + * - The first element is the initial shape ID + * - The last element is the shape ID of a reference shape + * - Intermediate elements are a path of shape IDs from the first to the last shape ID + * @return TokenTree containing a {@code modifies} clause on the reference's Modifies member + */ + public TokenTree modifiesClauseForPathToReference( + List managedReferenceMemberShapePath + ) { + return modifiesClauseForPathToReference( + managedReferenceMemberShapePath, + "modifies" + ); + } + + /** + * Given a list of ShapeIds representing a path from a root shape to a reference shape, + * generates a TokenTree containing a clause that would subtract the reference shape's Modifies member + * from another set. + * (This is expected to be wrapped around something like + * {@code ensures fresh(parentShape.Modifies (referenceMemberNotFreshClause here) )}, + * as the Modifies clauses access here will not be part of the fresh variable.) + * @param managedReferenceMemberShapePath a list of shape IDs where: + * - The first element is the initial shape ID + * - The last element is the shape ID of a reference shape + * - Intermediate elements are a path of shape IDs from the first to the last shape ID + * @return TokenTree containing a set subtraction clause for the reference shape's Modifies member. + */ + public TokenTree referenceMemberNotFreshClause( + List managedReferenceMemberShapePath + ) { + return TokenTree.of( + modifiesClauseForPathToReference(managedReferenceMemberShapePath, "- ("), + TokenTree.of(")") + ); + } + + /** + * Given a list of ShapeIds representing a path from a root shape to a reference shape, + * generates a TokenTree containing a clause starting with {@code prefix} on the reference's Modifies member + * @param managedReferenceMemberShapePath a list of shape IDs where: + * - The first element is the initial shape ID + * - The last element is the shape ID of a reference shape + * - Intermediate elements are a path of shape IDs from the first to the last shape ID + * @return TokenTree containing a clause starting with {@code prefix} on the reference's Modifies member + */ + private TokenTree modifiesClauseForPathToReference( + List managedReferenceMemberShapePath, + String prefix + ) { + // The change in intermediateTempVariableCounter over this function is equal to the number of set + // comprehensions that were used to access the reference's Modifies member. + // This number is also used to generate the required number of set comprehensions to flatten out the + // set of Modifies clauses. + int startingIntermediateTempVariableCounter = + intermediateTempVariableCounter; + // accessPathToCurrentShape holds the accessor path prepending accessing the current shape in the path. + // e.g. if `barStructure` is the current variable inside `fooStructure`: + // accessPathToCurrentShape would be `config.fooStructure.value` + String accessPathToCurrentShape = "config"; + // modifiesClause is a builder for the valid state clause this method generates. + TokenTree modifiesClause = TokenTree.of(prefix); + ShapeType currentShapeType = null; + String currentVarName; + boolean currentShapeRequired; + // The Modifies members of optional structure members that are not inside set comprehension expressions + // are accessed as `if path.to.var.Some? then path.to.var.value.path.to.reference.Modifies else {}`. + // The `else {}` is appended at the end of the entire modifies expression. + // If set comprehension is used later in the `modifies` clause, + // this will be appended after the set comprehension expression completes. + TokenTree appendAtEnd = TokenTree.empty(); + // When the `modifies` expression uses set comprehension to access Modifies members, + // the set comprehension is encapsulated in a single variable. + // This stores a reference to that variable's name. + TokenTree setComprehensionVar = null; + + for (ShapeId shapeIdInPath : managedReferenceMemberShapePath) { + Shape shapeInPath = model.expectShape(shapeIdInPath); + // Shapes in the path alternate between member shapes and their parents. + // Member shapes know the member variable name and whether the member is required. + // The parent shapes know the shape type. + // Both of these are relevant in transitioning to child members. + if (shapeInPath.isMemberShape()) { + currentVarName = "." + shapeIdInPath.getMember().get(); + currentShapeRequired = shapeInPath.asMemberShape().get().isRequired(); + + if (currentShapeType == ShapeType.STRUCTURE) { + // Children of structures are accessed like fields; e.g. `fooStructure.barStructure` + accessPathToCurrentShape += currentVarName; + + if (!currentShapeRequired) { + // If `fooStructure` is not required, its access must be preceded by checking for `.Some?` + if (setComprehensionVar != null) { + // If using set comprehension, the `.Some` check on an optional structure is added as + // a condition on the existing comprehension, starting with `&&` + // i.e. var setVar := set t | t in otherVar.Values && t.thisOptionalStructure.Some? + modifiesClause = + modifiesClause.append( + TokenTree.of( + "&& %1$s.Some? \n ".formatted(accessPathToCurrentShape) + ) + ); } else { - currentShapeType = shapeInPath.getType(); + // If not using set comprehension, the `.Some` check on an optional structure is added as + // an if/else clause, where the else is appended at the very end of the modifies clause + modifiesClause = + modifiesClause.append( + TokenTree.of( + "if %1$s.Some? then \n".formatted(accessPathToCurrentShape) + ) + ); + appendAtEnd = appendAtEnd.append(TokenTree.of("else {}\n")); } - } - if (setComprehensionVar == null) { - // If not using set comprehension, the Modifies member comes at the end of the current access path. - modifiesClause = modifiesClause.append(TokenTree.of( - "%s".formatted(accessPathToCurrentShape) - )); - modifiesClause = TokenTree.of("%1$s.Modifies".formatted(modifiesClause)); + // Since `.Some?` is checked above, children are now accessed on the Option's value member + // i.e. `fooStructure.value.barStructure` + accessPathToCurrentShape += ".value"; + } + } else if (currentShapeType == ShapeType.UNION) { + // Union members are accessed like fields + // e.g. `fooUnion.barUnionMember` + accessPathToCurrentShape += currentVarName; + + // Union members must always be checked for presence; i.e. are always "optional" + if (setComprehensionVar != null) { + // If using set comprehension, the destructor on a union member is added as + // a condition on the existing comprehension, starting with `&&` + // e.g. `&& fooUnion.barUnionMember? ...` + modifiesClause = + modifiesClause.append( + TokenTree.of("&& %1$s? \n ".formatted(accessPathToCurrentShape)) + ); + } else { + // If not using set comprehension, the destructor on a union member is added as + // an if/else clause, where the else is appended at the very end of the modifies clause + // e.g. `if fooUnion.barUnionMember? then ... else {}` + modifiesClause = + modifiesClause.append( + TokenTree.of( + "if %1$s? then \n".formatted(accessPathToCurrentShape) + ) + ); + appendAtEnd = appendAtEnd.append(TokenTree.of("else {}\n")); + } + } else if ( + currentShapeType == ShapeType.MAP || + currentShapeType == ShapeType.LIST + ) { + // This branch is for collections of multiple values, i.e. maps or lists. + // These shapes introduce a set comprehension variable to access valid state methods. + if (setComprehensionVar != null) { + if (currentShapeType == ShapeType.LIST) { + modifiesClause = + modifiesClause.append( + TokenTree.of( + ", t%1$s <- %2$s".formatted( + intermediateTempVariableCounter, + accessPathToCurrentShape + ) + ) + ); + } else if (currentShapeType == ShapeType.MAP) { + // If using set comprehension, the map's values are accessed by extending the current + // comprehension expression + modifiesClause = + modifiesClause.append( + TokenTree.of( + ", t%1$s <- %2$s.Values".formatted( + intermediateTempVariableCounter, + accessPathToCurrentShape + ) + ) + ); + } + } else { + // If not using set comprehension, we now need to. + if (currentShapeType == ShapeType.LIST) { + modifiesClause = + modifiesClause.append( + TokenTree.of( + "set tmps%1$s <- set t%1$s <- %2$s | true\n ".formatted( + intermediateTempVariableCounter, + accessPathToCurrentShape + ) + ) + ); + } else if (currentShapeType == ShapeType.MAP) { + modifiesClause = + modifiesClause.append( + TokenTree.of( + "set tmps%1$s <- set t%1$s <- %2$s.Values | true\n ".formatted( + intermediateTempVariableCounter, + accessPathToCurrentShape + ) + ) + ); + } + + // Once this logic starts using set comprehension to access the variables, + // it will continue to expand on the same variable to access all Modifies clauses. + // Introduce a setComprehensionVar that will hold nested sets of Modifies members. + setComprehensionVar = + TokenTree.of( + "tmps%1$s".formatted(intermediateTempVariableCounter) + ); + } + + // Parsing the map using set comprehension means the access path to the next shape will + // be based on the current set comprehension variable used in the expression. + // This overwrites the accessPath up until this point. + accessPathToCurrentShape = + "t%1$s".formatted(intermediateTempVariableCounter); + intermediateTempVariableCounter++; } else { - // Extract Modifies member from expression - modifiesClause = modifiesClause.append(TokenTree.of(""" - :: %1$s, - obj <- %2$s.Modifies | obj in %2$s.Modifies :: obj""" - .formatted(accessPathToCurrentShape, setComprehensionVar) - )); + // This is not a recognized shape type and is unsupported + throw new UnsupportedOperationException( + String.format( + "Shape type %s not supported. Shape name: %s", + currentShapeType, + currentVarName + ) + ); } - - return TokenTree.of( - "%1$s\n%2$s" - .formatted(modifiesClause.toString(), appendAtEnd)).lineSeparated(); + } else { + currentShapeType = shapeInPath.getType(); + } } - public TokenTree generateAbstractLocalService(ServiceShape serviceShape) { - if (!serviceShape.hasTrait(LocalServiceTrait.class)) throw new IllegalStateException("MUST be an LocalService"); - final LocalServiceTrait localServiceTrait = serviceShape.expectTrait(LocalServiceTrait.class); - final String dafnyClientClass = "%sClient".formatted(localServiceTrait.getSdkId()); - final String dafnyClientTrait = nameResolver.traitForServiceClient(serviceShape); - - final String configTypeName = nameResolver.baseTypeForShape(localServiceTrait.getConfigId()); - final String defaultFunctionMethodName = "Default%s".formatted(localServiceTrait.getConfigId().getName()); - - final TokenTree defaultConfig = TokenTree - .of("function method %s(): %s".formatted(defaultFunctionMethodName, configTypeName)); - - // "Managed reference" shapes are shapes in the local service config whose target types have the Polymorph - // Reference trait. - // The local service must specially handle these shapes' Modifies members in its `modifies`, `ensures`, - // `requires`, and `fresh` clauses. - final ShapeId configShapeId = localServiceTrait.getConfigId(); - Set configShapeIdAsSet = new HashSet<>(); - configShapeIdAsSet.add(configShapeId); - - TokenTree serviceMethod = TokenTree.of( - "method %s(config: %s := %s())" - .formatted( - localServiceTrait.getSdkId(), - configTypeName, - defaultFunctionMethodName - ), - // Yes, Error is hard coded - // this can work because we need to be able Errors from other modules... - "returns (res: Result<%s, Error>)\n" - .formatted(dafnyClientClass) - ).lineSeparated(); + if (setComprehensionVar == null) { + // If not using set comprehension, the Modifies member comes at the end of the current access path. + modifiesClause = + modifiesClause.append( + TokenTree.of("%s".formatted(accessPathToCurrentShape)) + ); + modifiesClause = TokenTree.of("%1$s.Modifies".formatted(modifiesClause)); + } else { + // Extract Modifies member from expression + modifiesClause = + modifiesClause.append( + TokenTree.of( + """ + :: %1$s, + obj <- %2$s.Modifies | obj in %2$s.Modifies :: obj""".formatted( + accessPathToCurrentShape, + setComprehensionVar + ) + ) + ); + } - // Add `requires` clauses + return TokenTree + .of("%1$s\n%2$s".formatted(modifiesClause.toString(), appendAtEnd)) + .lineSeparated(); + } - Set> managedReferenceMemberShapePaths = ModelUtils.findAllDependentMemberReferenceShapesWithPaths(configShapeIdAsSet, model); + public TokenTree generateAbstractLocalService(ServiceShape serviceShape) { + if ( + !serviceShape.hasTrait(LocalServiceTrait.class) + ) throw new IllegalStateException("MUST be an LocalService"); + final LocalServiceTrait localServiceTrait = serviceShape.expectTrait( + LocalServiceTrait.class + ); + final String dafnyClientClass = + "%sClient".formatted(localServiceTrait.getSdkId()); + final String dafnyClientTrait = nameResolver.traitForServiceClient( + serviceShape + ); + + final String configTypeName = nameResolver.baseTypeForShape( + localServiceTrait.getConfigId() + ); + final String defaultFunctionMethodName = + "Default%s".formatted(localServiceTrait.getConfigId().getName()); + + final TokenTree defaultConfig = TokenTree.of( + "function method %s(): %s".formatted( + defaultFunctionMethodName, + configTypeName + ) + ); - if (!managedReferenceMemberShapePaths.isEmpty()) { - for (List managedReferenceMemberShapePath : managedReferenceMemberShapePaths) { - serviceMethod = serviceMethod.append( - requiresValidStateClauseForPathToReference(managedReferenceMemberShapePath)); - } - } + // "Managed reference" shapes are shapes in the local service config whose target types have the Polymorph + // Reference trait. + // The local service must specially handle these shapes' Modifies members in its `modifies`, `ensures`, + // `requires`, and `fresh` clauses. + final ShapeId configShapeId = localServiceTrait.getConfigId(); + Set configShapeIdAsSet = new HashSet<>(); + configShapeIdAsSet.add(configShapeId); - // Add `modifies` clauses + TokenTree serviceMethod = TokenTree + .of( + "method %s(config: %s := %s())".formatted( + localServiceTrait.getSdkId(), + configTypeName, + defaultFunctionMethodName + ), + // Yes, Error is hard coded + // this can work because we need to be able Errors from other modules... + "returns (res: Result<%s, Error>)\n".formatted(dafnyClientClass) + ) + .lineSeparated(); - if (!managedReferenceMemberShapePaths.isEmpty()) { - int intermediateTempVariableCounter = 0; + // Add `requires` clauses - for (List managedReferenceMemberShapePath : managedReferenceMemberShapePaths) { - serviceMethod = serviceMethod.append( - modifiesClauseForPathToReference(managedReferenceMemberShapePath)); - } - } + Set> managedReferenceMemberShapePaths = + ModelUtils.findAllDependentMemberReferenceShapesWithPaths( + configShapeIdAsSet, + model + ); - // Start `ensures` clause for assertions based on `res.Success?` + if (!managedReferenceMemberShapePaths.isEmpty()) { + for (List< + ShapeId + > managedReferenceMemberShapePath : managedReferenceMemberShapePaths) { + serviceMethod = + serviceMethod.append( + requiresValidStateClauseForPathToReference( + managedReferenceMemberShapePath + ) + ); + } + } - serviceMethod = serviceMethod.append(TokenTree.of( - "ensures res.Success? ==> ", - "&& fresh(res.value)\n" - ).lineSeparated()); + // Add `modifies` clauses - if (!managedReferenceMemberShapePaths.isEmpty()) { - serviceMethod = serviceMethod.append(TokenTree.of( - "&& fresh(res.value.%1$s\n" - .formatted(nameResolver.mutableStateFunctionName()) - )); + if (!managedReferenceMemberShapePaths.isEmpty()) { + int intermediateTempVariableCounter = 0; - for (List managedReferenceMemberShapePath : managedReferenceMemberShapePaths) { - serviceMethod = serviceMethod.append( - referenceMemberNotFreshClause(managedReferenceMemberShapePath)); - } - serviceMethod = serviceMethod.append(TokenTree.of(")\n")); + for (List< + ShapeId + > managedReferenceMemberShapePath : managedReferenceMemberShapePaths) { + serviceMethod = + serviceMethod.append( + modifiesClauseForPathToReference(managedReferenceMemberShapePath) + ); + } + } - } else { - // If there are no managed reference shapes, the entire local service Modifies member is ensured fresh - serviceMethod = serviceMethod.append(TokenTree.of( - "&& fresh(res.value.%s)\n".formatted(nameResolver.mutableStateFunctionName()) - ).lineSeparated()); - } + // Start `ensures` clause for assertions based on `res.Success?` - // Add more `ensures` clauses based on `res.Success?` - serviceMethod = serviceMethod.append(TokenTree.of( - "&& fresh(res.value.%s)".formatted(nameResolver.callHistoryFieldName()), - "&& res.value.%s()\n".formatted(nameResolver.validStateInvariantName()) - ).lineSeparated()); + serviceMethod = + serviceMethod.append( + TokenTree + .of("ensures res.Success? ==> ", "&& fresh(res.value)\n") + .lineSeparated() + ); - // Add any `ensures` clauses that have unique conditions + if (!managedReferenceMemberShapePaths.isEmpty()) { + serviceMethod = + serviceMethod.append( + TokenTree.of( + "&& fresh(res.value.%1$s\n".formatted( + nameResolver.mutableStateFunctionName() + ) + ) + ); - if (!managedReferenceMemberShapePaths.isEmpty()) { - for (List managedReferenceMemberShapePath : managedReferenceMemberShapePaths) { - serviceMethod = serviceMethod.append( - ensuresValidStateClauseForPathToReference(managedReferenceMemberShapePath)); - } - } + for (List< + ShapeId + > managedReferenceMemberShapePath : managedReferenceMemberShapePaths) { + serviceMethod = + serviceMethod.append( + referenceMemberNotFreshClause(managedReferenceMemberShapePath) + ); + } + serviceMethod = serviceMethod.append(TokenTree.of(")\n")); + } else { + // If there are no managed reference shapes, the entire local service Modifies member is ensured fresh + serviceMethod = + serviceMethod.append( + TokenTree + .of( + "&& fresh(res.value.%s)\n".formatted( + nameResolver.mutableStateFunctionName() + ) + ) + .lineSeparated() + ); + } - return TokenTree + // Add more `ensures` clauses based on `res.Success?` + serviceMethod = + serviceMethod.append( + TokenTree .of( - defaultConfig, - serviceMethod, - generateResultOfClientHelperFunctions(dafnyClientTrait) + "&& fresh(res.value.%s)".formatted( + nameResolver.callHistoryFieldName() + ), + "&& res.value.%s()\n".formatted( + nameResolver.validStateInvariantName() + ) ) - .lineSeparated(); - } + .lineSeparated() + ); - public TokenTree generateAbstractWrappedLocalService(ServiceShape serviceShape) { - if (!serviceShape.hasTrait(LocalServiceTrait.class)) throw new IllegalStateException("MUST be an LocalService"); - final LocalServiceTrait localServiceTrait = serviceShape.expectTrait(LocalServiceTrait.class); - - final String baseModuleName = DafnyNameResolver - .dafnyBaseModuleName(serviceShape.getId().getNamespace()); - - final TokenTree moduleHeader = TokenTree.of("abstract module WrappedAbstract%sService".formatted(baseModuleName)); - final TokenTree abstractModulePrelude = TokenTree - .of(DafnyNameResolver.wrappedAbstractModulePrelude(serviceShape)) - .lineSeparated(); - - final String configTypeName = nameResolver.baseTypeForShape(localServiceTrait.getConfigId()); - final String defaultFunctionMethodName = "Default%s".formatted(localServiceTrait.getConfigId().getName()); - - final TokenTree defaultConfig = TokenTree - .of("function method Wrapped%s(): %s".formatted(defaultFunctionMethodName, configTypeName)); - // TODO defer to Service.defaultFunctionMethodName, there is no reason for this to be left to implement - - final TokenTree serviceMethod = TokenTree - .of( - "method {:extern} Wrapped%s(config: %s := Wrapped%s())" - .formatted( - localServiceTrait.getSdkId(), - configTypeName, - defaultFunctionMethodName - ), - // Error MUST be hard coded. - // We need to be able to reference Errors across modules. - "returns (res: Result<%s, Error>)" - .formatted(DafnyNameResolver.traitNameForServiceClient(serviceShape)), - "ensures res.Success? ==> ", - "&& fresh(res.value)", - "&& fresh(res.value.%s)".formatted(nameResolver.mutableStateFunctionName()), - "&& fresh(res.value.%s)".formatted(nameResolver.callHistoryFieldName()), - "&& res.value.%s()".formatted(nameResolver.validStateInvariantName()) - ) - .lineSeparated(); - - return moduleHeader - .append(Token - .of( - abstractModulePrelude, - defaultConfig, - serviceMethod - ) - .lineSeparated() - .braced() - ); + // Add any `ensures` clauses that have unique conditions + + if (!managedReferenceMemberShapePaths.isEmpty()) { + for (List< + ShapeId + > managedReferenceMemberShapePath : managedReferenceMemberShapePaths) { + serviceMethod = + serviceMethod.append( + ensuresValidStateClauseForPathToReference( + managedReferenceMemberShapePath + ) + ); + } } - public TokenTree generateAbstractAwsServiceClass(ServiceShape serviceShape) { - if (!serviceShape.hasTrait(ServiceTrait.class)) throw new IllegalStateException("MUST be an AWS Service API"); - final ServiceTrait serviceTrait = serviceShape.expectTrait(ServiceTrait.class); - final String sdkId = serviceTrait.getSdkId(); - final String dafnyClientTrait = nameResolver.traitForServiceClient(serviceShape); + return TokenTree + .of( + defaultConfig, + serviceMethod, + generateResultOfClientHelperFunctions(dafnyClientTrait) + ) + .lineSeparated(); + } - final String configTypeName = "%sClientConfigType".formatted(sdkId); - final TokenTree configType = TokenTree - .of("datatype %s = %s".formatted(configTypeName, configTypeName) - ); - final String defaultFunctionMethodName = "Default%s".formatted(configTypeName); + public TokenTree generateAbstractWrappedLocalService( + ServiceShape serviceShape + ) { + if ( + !serviceShape.hasTrait(LocalServiceTrait.class) + ) throw new IllegalStateException("MUST be an LocalService"); + final LocalServiceTrait localServiceTrait = serviceShape.expectTrait( + LocalServiceTrait.class + ); + + final String baseModuleName = DafnyNameResolver.dafnyBaseModuleName( + serviceShape.getId().getNamespace() + ); + + final TokenTree moduleHeader = TokenTree.of( + "abstract module WrappedAbstract%sService".formatted(baseModuleName) + ); + final TokenTree abstractModulePrelude = TokenTree + .of(DafnyNameResolver.wrappedAbstractModulePrelude(serviceShape)) + .lineSeparated(); - final TokenTree defaultConfig = TokenTree - .of("function method %s(): %s".formatted(defaultFunctionMethodName, configTypeName)); + final String configTypeName = nameResolver.baseTypeForShape( + localServiceTrait.getConfigId() + ); + final String defaultFunctionMethodName = + "Default%s".formatted(localServiceTrait.getConfigId().getName()); - final TokenTree factory = TokenTree - .of( - "method {:extern} %sClient()".formatted(serviceTrait.getSdkId()), - "returns (res: Result<%s, Error>)".formatted(dafnyClientTrait), - "ensures res.Success? ==> ", - "&& fresh(res.value)", - "&& fresh(res.value.%s)".formatted(nameResolver.mutableStateFunctionName()), - "&& fresh(res.value.%s)".formatted(nameResolver.callHistoryFieldName()), - "&& res.value.%s()".formatted(nameResolver.validStateInvariantName()) - ).lineSeparated(); + final TokenTree defaultConfig = TokenTree.of( + "function method Wrapped%s(): %s".formatted( + defaultFunctionMethodName, + configTypeName + ) + ); + // TODO defer to Service.defaultFunctionMethodName, there is no reason for this to be left to implement - return TokenTree - .of( - configType, - defaultConfig, - factory, - generateResultOfClientHelperFunctions(dafnyClientTrait) - ) - .lineSeparated(); - } + final TokenTree serviceMethod = TokenTree + .of( + "method {:extern} Wrapped%s(config: %s := Wrapped%s())".formatted( + localServiceTrait.getSdkId(), + configTypeName, + defaultFunctionMethodName + ), + // Error MUST be hard coded. + // We need to be able to reference Errors across modules. + "returns (res: Result<%s, Error>)".formatted( + DafnyNameResolver.traitNameForServiceClient(serviceShape) + ), + "ensures res.Success? ==> ", + "&& fresh(res.value)", + "&& fresh(res.value.%s)".formatted( + nameResolver.mutableStateFunctionName() + ), + "&& fresh(res.value.%s)".formatted(nameResolver.callHistoryFieldName()), + "&& res.value.%s()".formatted(nameResolver.validStateInvariantName()) + ) + .lineSeparated(); - /** - * Generates Dafny methods that don't need to accept TypeDescriptors in some versions of Dafny, - * so that test models can have a single copy of Java code across multiple versions of Dafny. - * - * See also TestModels/dafny-dependencies/StandardLibrary/src/WrappersInterop.dfy. - */ - private static TokenTree generateResultOfClientHelperFunctions(String dafnyClientTrait) { - return TokenTree - .of( - "// Helper functions for the benefit of native code to create a Success(client) without referring to Dafny internals", - "function method CreateSuccessOfClient(client: %s): Result<%s, Error> {".formatted(dafnyClientTrait, dafnyClientTrait), - " Success(client)", - "}", - "function method CreateFailureOfError(error: Error): Result<%s, Error> {".formatted(dafnyClientTrait), - " Failure(error)", - "}" - ).lineSeparated(); - } + return moduleHeader.append( + Token + .of(abstractModulePrelude, defaultConfig, serviceMethod) + .lineSeparated() + .braced() + ); + } - private static TokenTree generateLengthConstraint(final LengthTrait lengthTrait) { - final String min = lengthTrait.getMin().map("%s <="::formatted).orElse(""); - final String max = lengthTrait.getMax().map("<= %s"::formatted).orElse(""); - return TokenTree.of(min, "|x|", max); - } + public TokenTree generateAbstractAwsServiceClass(ServiceShape serviceShape) { + if ( + !serviceShape.hasTrait(ServiceTrait.class) + ) throw new IllegalStateException("MUST be an AWS Service API"); + final ServiceTrait serviceTrait = serviceShape.expectTrait( + ServiceTrait.class + ); + final String sdkId = serviceTrait.getSdkId(); + final String dafnyClientTrait = nameResolver.traitForServiceClient( + serviceShape + ); + + final String configTypeName = "%sClientConfigType".formatted(sdkId); + final TokenTree configType = TokenTree.of( + "datatype %s = %s".formatted(configTypeName, configTypeName) + ); + final String defaultFunctionMethodName = + "Default%s".formatted(configTypeName); + + final TokenTree defaultConfig = TokenTree.of( + "function method %s(): %s".formatted( + defaultFunctionMethodName, + configTypeName + ) + ); - private static TokenTree generateRangeConstraint(final RangeTrait rangeTrait) { - final String min = rangeTrait.getMin().map("%s <="::formatted).orElse(""); - final String max = rangeTrait.getMax().map("<= %s"::formatted).orElse(""); - return TokenTree.of(min, "x", max); - } + final TokenTree factory = TokenTree + .of( + "method {:extern} %sClient()".formatted(serviceTrait.getSdkId()), + "returns (res: Result<%s, Error>)".formatted(dafnyClientTrait), + "ensures res.Success? ==> ", + "&& fresh(res.value)", + "&& fresh(res.value.%s)".formatted( + nameResolver.mutableStateFunctionName() + ), + "&& fresh(res.value.%s)".formatted(nameResolver.callHistoryFieldName()), + "&& res.value.%s()".formatted(nameResolver.validStateInvariantName()) + ) + .lineSeparated(); - /** - * Given a name {@code TypeName}, base type {@code BaseType}, and constraint predicate expressions - * {@code c1, c2, ..., cN} over a free variable {@code x}, generates a subset type like - *
-     * type TypeName = x: BaseType | (c1) && (c2) && ... && (cN) witness *
-     * 
- * - * If no constraint expressions are provided, then instead generates a type synonym like - *
-     * type TypeName = BaseType
-     * 
- */ - private TokenTree generateSubsetType( - final ShapeId shapeId, final String baseType, final Collection constraints) { - final String typeName = nameResolver.generatedTypeForShape(shapeId); - if (constraints.size() == 0) { - return TokenTree.of("type", typeName, "=", baseType); - } + return TokenTree + .of( + configType, + defaultConfig, + factory, + generateResultOfClientHelperFunctions(dafnyClientTrait) + ) + .lineSeparated(); + } - final TokenTree constraintsConjunct = TokenTree.of(constraints.stream().map(TokenTree::parenthesized)) - .separated(Token.of("&&")); - final String validityPredicateName = nameResolver.validityPredicateForShape(shapeId); - final TokenTree validityPredicate = Token.of( - "predicate method %s(x: %s)".formatted(validityPredicateName, baseType)) - .append(constraintsConjunct.braced()); - final TokenTree subsetType = - Token.of("type %s = x: %s | %s(x) witness *".formatted(typeName, baseType, validityPredicateName)); + /** + * Generates Dafny methods that don't need to accept TypeDescriptors in some versions of Dafny, + * so that test models can have a single copy of Java code across multiple versions of Dafny. + * + * See also TestModels/dafny-dependencies/StandardLibrary/src/WrappersInterop.dfy. + */ + private static TokenTree generateResultOfClientHelperFunctions( + String dafnyClientTrait + ) { + return TokenTree + .of( + "// Helper functions for the benefit of native code to create a Success(client) without referring to Dafny internals", + "function method CreateSuccessOfClient(client: %s): Result<%s, Error> {".formatted( + dafnyClientTrait, + dafnyClientTrait + ), + " Success(client)", + "}", + "function method CreateFailureOfError(error: Error): Result<%s, Error> {".formatted( + dafnyClientTrait + ), + " Failure(error)", + "}" + ) + .lineSeparated(); + } - return TokenTree.of(subsetType, validityPredicate).lineSeparated(); - } + private static TokenTree generateLengthConstraint( + final LengthTrait lengthTrait + ) { + final String min = lengthTrait.getMin().map("%s <="::formatted).orElse(""); + final String max = lengthTrait.getMax().map("<= %s"::formatted).orElse(""); + return TokenTree.of(min, "|x|", max); + } - /** - * Like {@link DafnyApiCodegen#generateSubsetType(ShapeId, String, Collection)}, but accepts - * {@link Optional}-wrapped constraints and discards the empty ones. - */ - @SuppressWarnings("JavaDoc") - @SafeVarargs - private TokenTree generateSubsetType( - final ShapeId shapeId, final String baseType, final Optional... constraintOptionals) { - final List constraints = Arrays.stream(constraintOptionals).flatMap(Optional::stream).toList(); - return generateSubsetType(shapeId, baseType, constraints); - } + private static TokenTree generateRangeConstraint( + final RangeTrait rangeTrait + ) { + final String min = rangeTrait.getMin().map("%s <="::formatted).orElse(""); + final String max = rangeTrait.getMax().map("<= %s"::formatted).orElse(""); + return TokenTree.of(min, "x", max); + } - @SuppressWarnings("SameParameterValue") - private TokenTree generateTypeSynonym( - final ShapeId shapeId, final String baseType) { - return generateSubsetType(shapeId, baseType, Optional.empty()); - } + /** + * Given a name {@code TypeName}, base type {@code BaseType}, and constraint predicate expressions + * {@code c1, c2, ..., cN} over a free variable {@code x}, generates a subset type like + *
+   * type TypeName = x: BaseType | (c1) && (c2) && ... && (cN) witness *
+   * 
+ * + * If no constraint expressions are provided, then instead generates a type synonym like + *
+   * type TypeName = BaseType
+   * 
+ */ + private TokenTree generateSubsetType( + final ShapeId shapeId, + final String baseType, + final Collection constraints + ) { + final String typeName = nameResolver.generatedTypeForShape(shapeId); + if (constraints.size() == 0) { + return TokenTree.of("type", typeName, "=", baseType); + } + + final TokenTree constraintsConjunct = TokenTree + .of(constraints.stream().map(TokenTree::parenthesized)) + .separated(Token.of("&&")); + final String validityPredicateName = nameResolver.validityPredicateForShape( + shapeId + ); + final TokenTree validityPredicate = Token + .of( + "predicate method %s(x: %s)".formatted(validityPredicateName, baseType) + ) + .append(constraintsConjunct.braced()); + final TokenTree subsetType = Token.of( + "type %s = x: %s | %s(x) witness *".formatted( + typeName, + baseType, + validityPredicateName + ) + ); - @VisibleForTesting - public Model getModel() { - return model; - } - private TokenTree generateAbstractOperationsModule(final ServiceShape serviceShape) - { + return TokenTree.of(subsetType, validityPredicate).lineSeparated(); + } - final String baseModuleName = DafnyNameResolver - .dafnyBaseModuleName(serviceShape.getId().getNamespace()); - final TokenTree header = TokenTree.of("abstract module Abstract%sOperations" - .formatted(baseModuleName) - ); + /** + * Like {@link DafnyApiCodegen#generateSubsetType(ShapeId, String, Collection)}, but accepts + * {@link Optional}-wrapped constraints and discards the empty ones. + */ + @SuppressWarnings("JavaDoc") + @SafeVarargs + private TokenTree generateSubsetType( + final ShapeId shapeId, + final String baseType, + final Optional... constraintOptionals + ) { + final List constraints = Arrays + .stream(constraintOptionals) + .flatMap(Optional::stream) + .toList(); + return generateSubsetType(shapeId, baseType, constraints); + } + @SuppressWarnings("SameParameterValue") + private TokenTree generateTypeSynonym( + final ShapeId shapeId, + final String baseType + ) { + return generateSubsetType(shapeId, baseType, Optional.empty()); + } - final String internalConfigType = DafnyNameResolver.internalConfigType(); + @VisibleForTesting + public Model getModel() { + return model; + } - final TokenTree body = TokenTree - .of( - TokenTree.of(DafnyNameResolver.abstractModulePrelude(serviceShape)), - TokenTree.of("type %s".formatted(internalConfigType)), - TokenTree.of("predicate %s(config: %s)" - .formatted(DafnyNameResolver.validConfigPredicate(), internalConfigType)), - TokenTree.of("function %s(config: %s): set" - .formatted(DafnyNameResolver.modifiesInternalConfig(), internalConfigType)), - TokenTree.of( - serviceShape - .getAllOperations() - .stream() - .map(operation -> TokenTree - .of( - generateEnsuresPubliclyPredicate(serviceShape, operation), - generateBodilessOperationMethodThatEnsuresCallEvents( - serviceShape, - operation, - ImplementationType.ABSTRACT - ) - ) - .flatten() - .lineSeparated() - ) + private TokenTree generateAbstractOperationsModule( + final ServiceShape serviceShape + ) { + final String baseModuleName = DafnyNameResolver.dafnyBaseModuleName( + serviceShape.getId().getNamespace() + ); + final TokenTree header = TokenTree.of( + "abstract module Abstract%sOperations".formatted(baseModuleName) + ); + + final String internalConfigType = DafnyNameResolver.internalConfigType(); + + final TokenTree body = TokenTree + .of( + TokenTree.of(DafnyNameResolver.abstractModulePrelude(serviceShape)), + TokenTree.of("type %s".formatted(internalConfigType)), + TokenTree.of( + "predicate %s(config: %s)".formatted( + DafnyNameResolver.validConfigPredicate(), + internalConfigType ) - .lineSeparated() - ) - .flatten() - .lineSeparated() - .braced(); + ), + TokenTree.of( + "function %s(config: %s): set".formatted( + DafnyNameResolver.modifiesInternalConfig(), + internalConfigType + ) + ), + TokenTree + .of( + serviceShape + .getAllOperations() + .stream() + .map(operation -> + TokenTree + .of( + generateEnsuresPubliclyPredicate(serviceShape, operation), + generateBodilessOperationMethodThatEnsuresCallEvents( + serviceShape, + operation, + ImplementationType.ABSTRACT + ) + ) + .flatten() + .lineSeparated() + ) + ) + .lineSeparated() + ) + .flatten() + .lineSeparated() + .braced(); - return TokenTree.of(header, body); - } + return TokenTree.of(header, body); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyNameResolver.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyNameResolver.java index 5f9ffcd25b..3af11140c0 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyNameResolver.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyNameResolver.java @@ -4,14 +4,11 @@ package software.amazon.polymorph.smithydafny; import com.google.common.base.Joiner; - import java.nio.file.Path; import java.util.*; import java.util.stream.Stream; - import javax.annotation.Nonnull; import javax.annotation.Nullable; - import software.amazon.polymorph.smithyjava.NamespaceHelper; import software.amazon.polymorph.traits.LocalServiceTrait; import software.amazon.polymorph.traits.PositionalTrait; @@ -33,345 +30,391 @@ public record DafnyNameResolver( TreeSet dependentModels, Path[] dependentModelPaths ) { - - public static final Map DAFNY_TYPES_BY_SIMPLE_SHAPE_TYPE = Map.ofEntries( - Map.entry(ShapeType.BLOB, "seq"), - Map.entry(ShapeType.BOOLEAN, "bool"), - Map.entry(ShapeType.STRING, "string"), - // currently unused in model and unsupported in StandardLibrary.UInt -// Map.entry(ShapeType.BYTE, "int8"), -// Map.entry(ShapeType.SHORT, "int16"), - Map.entry(ShapeType.INTEGER, "int32"), - Map.entry(ShapeType.LONG, "int64"), - Map.entry(ShapeType.DOUBLE, "seq") + public static final Map DAFNY_TYPES_BY_SIMPLE_SHAPE_TYPE = + Map.ofEntries( + Map.entry(ShapeType.BLOB, "seq"), + Map.entry(ShapeType.BOOLEAN, "bool"), + Map.entry(ShapeType.STRING, "string"), + // currently unused in model and unsupported in StandardLibrary.UInt + // Map.entry(ShapeType.BYTE, "int8"), + // Map.entry(ShapeType.SHORT, "int16"), + Map.entry(ShapeType.INTEGER, "int32"), + Map.entry(ShapeType.LONG, "int64"), + Map.entry(ShapeType.DOUBLE, "seq") ); - public static String nameForService(final ServiceShape serviceShape) { - // If the service is an AWS SDK service, use the sdkId. - // Otherwise, just use the shape name. - return serviceShape.getTrait(ServiceTrait.class) - .map(t -> AwsSdkNameResolverHelpers.mungeSdkId(t.getSdkId())) - // TODO: LocalServiceTrait has an SDKID as well... is this wrong? - .orElse(StringUtils.capitalize(serviceShape.getId().getName())); - } - - @SuppressWarnings("OptionalGetWithoutIsPresent") - public String baseTypeForShape(final ShapeId shapeId) { - final Shape shape = model.expectShape(shapeId); - final String shapeName = shapeId.getName(); - - if (ModelUtils.isSmithyApiShape(shapeId)) { - @Nullable final String simpleShapeType = DAFNY_TYPES_BY_SIMPLE_SHAPE_TYPE.get(shape.getType()); - return Objects.requireNonNull(simpleShapeType, - () -> String.format("No Dafny type for prelude shape %s", shapeId)); - } - - return switch (shape.getType()) { - case BLOB, BOOLEAN, STRING, - // currently unused in model and unsupported in StandardLibrary.UInt - // BYTE, SHORT - INTEGER, LONG, DOUBLE, - LIST, MAP -> dafnyModulePrefixForShape(shape) + shapeName; - case STRUCTURE -> { - if (shape.hasTrait(ReferenceTrait.class)) { - yield baseTypeForShape(shape.expectTrait(ReferenceTrait.class).getReferentId()); - } else if (shape.hasTrait(PositionalTrait.class)) { - final StructureShape structure = shape.asStructureShape().get(); - if (structure.getMemberNames().size() != 1) { - throw new IllegalStateException("Positional trait only supports a single member."); - } - final MemberShape member = structure - .getMember(structure.getMemberNames().get(0)) - .get(); - yield baseTypeForShape(member.getTarget()); - } else { - yield dafnyTypeNameShape(shape); - } - } - case SERVICE -> traitForServiceClient(shape.asServiceShape().get()); - case RESOURCE -> traitForResource(shape.asResourceShape().get()); - // Member calls baseTypeForShape on their type - case MEMBER -> baseTypeForMember(shape.asMemberShape().get()); - case UNION -> dafnyTypeNameShape(shape); - // TODO create/use better timestamp type in Dafny libraries - case TIMESTAMP -> "string"; - default -> throw new UnsupportedOperationException( - "Shape %s has unsupported type %s".formatted(shapeId, shape.getType())); - }; - } - - private String baseTypeForMember(final MemberShape memberShape) { - final String targetType = baseTypeForShape(memberShape.getTarget()); - - if (!ModelUtils.memberShapeIsOptional(model, memberShape)) { - return targetType; - } - - return ("Option<%s>").formatted(targetType); - } - - private String dafnyTypeNameShape(final Shape shape) { - return dafnyModulePrefixForShape(shape) + shape.getId().getName(); - } - - public String generatedTypeForShape(final ShapeId shapeId) { - return StringUtils.capitalize(shapeId.getName()); - } - - public static String traitNameForServiceClient(final ServiceShape serviceShape) { - return "I%sClient".formatted(nameForService(serviceShape)); - } - - public String traitForServiceClient(final ServiceShape serviceShape) { - return dafnyModulePrefixForShape(serviceShape) + traitNameForServiceClient(serviceShape); - } - - public static String classNameForServiceClient(ServiceShape shape) { - String serviceName = nameForService(shape); - if (shape.hasTrait(LocalServiceTrait.class)) { - LocalServiceTrait trait = shape.expectTrait(LocalServiceTrait.class); - serviceName = trait.getSdkId(); - } - return "%sClient".formatted(serviceName); - } - - public String traitForResource(final ResourceShape resourceShape) { - return dafnyModulePrefixForShape(resourceShape) + traitNameForResource(resourceShape); - } - - public static String traitNameForResource(final ResourceShape shape) { - final String resourceName = StringUtils.capitalize(shape.getId().getName()); - return "I%s".formatted(resourceName); - } - - public String publicMethodNameForOperation(final OperationShape operationShape) { - return StringUtils.capitalize(operationShape.getId().getName()); - } - - public String methodNameToImplementForResourceOperation(final OperationShape operationShape) { - return "%s'".formatted(publicMethodNameForOperation(operationShape)); - } - - public String historicalCallEventsForOperation(final OperationShape operationShape) { - // This works because the history is stored in its own object - return publicMethodNameForOperation(operationShape); - } - - public String historicalCallHistoryClassForResource(final ResourceShape resource) { - return "%s%s" - .formatted( - baseTypeForShape(resource.getId()), - historicalCallHistoryPostfix() + public static String nameForService(final ServiceShape serviceShape) { + // If the service is an AWS SDK service, use the sdkId. + // Otherwise, just use the shape name. + return serviceShape + .getTrait(ServiceTrait.class) + .map(t -> AwsSdkNameResolverHelpers.mungeSdkId(t.getSdkId())) + // TODO: LocalServiceTrait has an SDKID as well... is this wrong? + .orElse(StringUtils.capitalize(serviceShape.getId().getName())); + } + + @SuppressWarnings("OptionalGetWithoutIsPresent") + public String baseTypeForShape(final ShapeId shapeId) { + final Shape shape = model.expectShape(shapeId); + final String shapeName = shapeId.getName(); + + if (ModelUtils.isSmithyApiShape(shapeId)) { + @Nullable + final String simpleShapeType = DAFNY_TYPES_BY_SIMPLE_SHAPE_TYPE.get( + shape.getType() + ); + return Objects.requireNonNull( + simpleShapeType, + () -> String.format("No Dafny type for prelude shape %s", shapeId) + ); + } + + return switch (shape.getType()) { + case BLOB, + BOOLEAN, + STRING, + // currently unused in model and unsupported in StandardLibrary.UInt + // BYTE, SHORT + INTEGER, + LONG, + DOUBLE, + LIST, + MAP -> dafnyModulePrefixForShape(shape) + shapeName; + case STRUCTURE -> { + if (shape.hasTrait(ReferenceTrait.class)) { + yield baseTypeForShape( + shape.expectTrait(ReferenceTrait.class).getReferentId() ); - } - - public String historicalCallHistoryClassForService(final ServiceShape service) { - return "%s%s" - .formatted( - baseTypeForShape(service.getId()), - historicalCallHistoryPostfix() - ); - } - - public Boolean isFunction( - final ServiceShape serviceShape, - final OperationShape operationShape - ) { - // Operations that are declared as `@readOnly` - // on services that are `@localService` - // are treated as Dafny functions. - // This is useful for proof. - // Most languages do not have such a strict - // no side effects mathematical construct. - return serviceShape.hasTrait(LocalServiceTrait.class) - && operationShape.hasTrait(ReadonlyTrait.class); - } - - public String executableType( - final ServiceShape serviceShape, - final OperationShape operationShape - ) { - return isFunction(serviceShape, operationShape) - ? "function method" - : "method"; - } - - public String ensuresPubliclyPredicate(final OperationShape operationShape) { - return "%sEnsuresPublicly".formatted(publicMethodNameForOperation(operationShape)); - } - - /** - * Returns the return type for an operation of this service. - * This is {@code Result}, - * where {@code T} is either... - *
    - *
  • ... the corresponding Dafny output type, if the operation has output.
  • - *
  • ... {@code ()} ("unit"), if the operation does not have output.
  • - *
- */ - public String returnTypeForOperation(final OperationShape operationShape) { - final String outputType = operationShape - .getOutput() - .map(this::baseTypeForShape) - .orElse("()"); - return "Result<%s, %s>" - .formatted(outputType, "Error"); - } - - public Optional returnTypeForResult(final OperationShape operationShape) { - if (operationShape.getOutput().isPresent()) { - return Optional.of(this.baseTypeForShape(operationShape.getOutput().get())); - } - return Optional.empty(); - } - - public String validityPredicateForShape(final ShapeId shapeId) { - final String unqualifiedTypeName = baseTypeForShape(shapeId); - return "IsValid_%s".formatted(unqualifiedTypeName); - } - - //TODO: Figure which of these public static string methods should go to DafnyNameResolverHelpers - - // i.e. "AwsCryptographyMaterialProvidersTypes" - // This is the Dafny module name for the smithy->Dafny types file. - public static String dafnyTypesModuleName(final String namespace) { - return dafnyBaseModuleName(namespace) + "Types"; - } - - // i.e. "AwsCryptographyMaterialProviders" - // This is used as a base to build various names for generated Dafny types and traits. - public static String dafnyBaseModuleName(final String namespace) { - final Stream namespaceParts = Arrays - .stream(namespace.split("\\.")) - .map(StringUtils::capitalize); - return Joiner.on("").join(namespaceParts.iterator()); - } - - public String dafnyModulePrefixForShape(final Shape shape) { - final String shapeNamespace = shape.getId().getNamespace(); - if (!namespace.equals(shapeNamespace)) { - - // Unfortunate side effect - // Need to add these so that they can be included - // because we are obviously using them! - dependentModels - .add(DependentSmithyModel.of(shape, dependentModelPaths)); - - // Append `.` so that it is easy to use. - // If you only want the name use localDafnyModuleName - return dafnyTypesModuleName(shapeNamespace) + "."; + } else if (shape.hasTrait(PositionalTrait.class)) { + final StructureShape structure = shape.asStructureShape().get(); + if (structure.getMemberNames().size() != 1) { + throw new IllegalStateException( + "Positional trait only supports a single member." + ); + } + final MemberShape member = structure + .getMember(structure.getMemberNames().get(0)) + .get(); + yield baseTypeForShape(member.getTarget()); } else { - // This is "local" and so does not need any Module name... - return ""; + yield dafnyTypeNameShape(shape); } - } - - /** - * Outside of {@code smithydafny}, this should not be called directly. - * Instead, call - * {@link software.amazon.polymorph.utils.DafnyNameResolverHelpers#packageNameForNamespace}. - */ - // i.e. "software.amazon.cryptography.materialproviders.internaldafny" - // The base namespace at which all smithy->Dafny->X generated code is built to, - // used in {:extern}. - // TODO: Currently converts the smithy namespace into a Java idiomatic one. - public static String dafnyExternNamespace(final String namespace) { - return NamespaceHelper.standardize(namespace) + ".internaldafny"; - } - - /** - * Outside of {@code smithydafny}, this should not be called directly. - * Instead, call - * {@link software.amazon.polymorph.utils.DafnyNameResolverHelpers#dafnyExternNamespaceForNamespace}. - */ - // i.e. "software.amazon.cryptography.materialproviders.internaldafny.types" - // The namespace for all the smithy->Dafny->X generated types, - // i.e. the {:extern} for the Dafny Types module - public static String dafnyTypesModuleExternNamespace(final String namespace) { - return dafnyExternNamespace(namespace) + ".types"; - } - - public String callEventTypeName() { - return "DafnyCallEvent"; - } - - public String mutableStateFunctionName() { - return "Modifies"; - } - - public String validStateInvariantName() { - return "ValidState"; - } - - public String callHistoryFieldName() { - return "History"; - } - - public String historicalCallHistoryPostfix() { - return "CallHistory"; - } - - public static Stream modulePreludeStandardImports() { - return Stream - .of( - "import opened Wrappers", - "import opened StandardLibrary.UInt", - "import opened UTF8" - ); - } - - public static Stream abstractModulePrelude(ServiceShape serviceShape) - { - final String typesModuleName = dafnyTypesModuleName(serviceShape.getId().getNamespace()); - - return Stream - .concat( - modulePreludeStandardImports(), - Stream.of("import opened Types = %s".formatted(typesModuleName)) - ) - .map(i -> Token.of(i)); - } + } + case SERVICE -> traitForServiceClient(shape.asServiceShape().get()); + case RESOURCE -> traitForResource(shape.asResourceShape().get()); + // Member calls baseTypeForShape on their type + case MEMBER -> baseTypeForMember(shape.asMemberShape().get()); + case UNION -> dafnyTypeNameShape(shape); + // TODO create/use better timestamp type in Dafny libraries + case TIMESTAMP -> "string"; + default -> throw new UnsupportedOperationException( + "Shape %s has unsupported type %s".formatted(shapeId, shape.getType()) + ); + }; + } + + private String baseTypeForMember(final MemberShape memberShape) { + final String targetType = baseTypeForShape(memberShape.getTarget()); + + if (!ModelUtils.memberShapeIsOptional(model, memberShape)) { + return targetType; + } + + return ("Option<%s>").formatted(targetType); + } + + private String dafnyTypeNameShape(final Shape shape) { + return dafnyModulePrefixForShape(shape) + shape.getId().getName(); + } + + public String generatedTypeForShape(final ShapeId shapeId) { + return StringUtils.capitalize(shapeId.getName()); + } + + public static String traitNameForServiceClient( + final ServiceShape serviceShape + ) { + return "I%sClient".formatted(nameForService(serviceShape)); + } + + public String traitForServiceClient(final ServiceShape serviceShape) { + return ( + dafnyModulePrefixForShape(serviceShape) + + traitNameForServiceClient(serviceShape) + ); + } - public static String abstractServiceModuleName(ServiceShape serviceShape) - { - final String moduleNamespace = moduleNamespace(serviceShape.getId().getNamespace()); - return "Abstract%sService".formatted(moduleNamespace); + public static String classNameForServiceClient(ServiceShape shape) { + String serviceName = nameForService(shape); + if (shape.hasTrait(LocalServiceTrait.class)) { + LocalServiceTrait trait = shape.expectTrait(LocalServiceTrait.class); + serviceName = trait.getSdkId(); } + return "%sClient".formatted(serviceName); + } - // TODO: I am so confused by what all these dafny*Namespace methods are doing. - // There has to be duplication. I do not know where. But it must exist. - // Let's give them documentation and then reduce. - /** "com.amazonaws.kms" -> "ComAmazonAwsKms" */ - @Nonnull - public static String moduleNamespace(String namespace) { - return DafnyNameResolver.dafnyBaseModuleName(namespace); - } + public String traitForResource(final ResourceShape resourceShape) { + return ( + dafnyModulePrefixForShape(resourceShape) + + traitNameForResource(resourceShape) + ); + } + + public static String traitNameForResource(final ResourceShape shape) { + final String resourceName = StringUtils.capitalize(shape.getId().getName()); + return "I%s".formatted(resourceName); + } + + public String publicMethodNameForOperation( + final OperationShape operationShape + ) { + return StringUtils.capitalize(operationShape.getId().getName()); + } + + public String methodNameToImplementForResourceOperation( + final OperationShape operationShape + ) { + return "%s'".formatted(publicMethodNameForOperation(operationShape)); + } + + public String historicalCallEventsForOperation( + final OperationShape operationShape + ) { + // This works because the history is stored in its own object + return publicMethodNameForOperation(operationShape); + } + + public String historicalCallHistoryClassForResource( + final ResourceShape resource + ) { + return "%s%s".formatted( + baseTypeForShape(resource.getId()), + historicalCallHistoryPostfix() + ); + } + + public String historicalCallHistoryClassForService( + final ServiceShape service + ) { + return "%s%s".formatted( + baseTypeForShape(service.getId()), + historicalCallHistoryPostfix() + ); + } + + public Boolean isFunction( + final ServiceShape serviceShape, + final OperationShape operationShape + ) { + // Operations that are declared as `@readOnly` + // on services that are `@localService` + // are treated as Dafny functions. + // This is useful for proof. + // Most languages do not have such a strict + // no side effects mathematical construct. + return ( + serviceShape.hasTrait(LocalServiceTrait.class) && + operationShape.hasTrait(ReadonlyTrait.class) + ); + } + + public String executableType( + final ServiceShape serviceShape, + final OperationShape operationShape + ) { + return isFunction(serviceShape, operationShape) + ? "function method" + : "method"; + } + + public String ensuresPubliclyPredicate(final OperationShape operationShape) { + return "%sEnsuresPublicly".formatted( + publicMethodNameForOperation(operationShape) + ); + } + + /** + * Returns the return type for an operation of this service. + * This is {@code Result}, + * where {@code T} is either... + *
    + *
  • ... the corresponding Dafny output type, if the operation has output.
  • + *
  • ... {@code ()} ("unit"), if the operation does not have output.
  • + *
+ */ + public String returnTypeForOperation(final OperationShape operationShape) { + final String outputType = operationShape + .getOutput() + .map(this::baseTypeForShape) + .orElse("()"); + return "Result<%s, %s>".formatted(outputType, "Error"); + } + + public Optional returnTypeForResult( + final OperationShape operationShape + ) { + if (operationShape.getOutput().isPresent()) { + return Optional.of( + this.baseTypeForShape(operationShape.getOutput().get()) + ); + } + return Optional.empty(); + } + + public String validityPredicateForShape(final ShapeId shapeId) { + final String unqualifiedTypeName = baseTypeForShape(shapeId); + return "IsValid_%s".formatted(unqualifiedTypeName); + } + + //TODO: Figure which of these public static string methods should go to DafnyNameResolverHelpers + + // i.e. "AwsCryptographyMaterialProvidersTypes" + // This is the Dafny module name for the smithy->Dafny types file. + public static String dafnyTypesModuleName(final String namespace) { + return dafnyBaseModuleName(namespace) + "Types"; + } + + // i.e. "AwsCryptographyMaterialProviders" + // This is used as a base to build various names for generated Dafny types and traits. + public static String dafnyBaseModuleName(final String namespace) { + final Stream namespaceParts = Arrays + .stream(namespace.split("\\.")) + .map(StringUtils::capitalize); + return Joiner.on("").join(namespaceParts.iterator()); + } + + public String dafnyModulePrefixForShape(final Shape shape) { + final String shapeNamespace = shape.getId().getNamespace(); + if (!namespace.equals(shapeNamespace)) { + // Unfortunate side effect + // Need to add these so that they can be included + // because we are obviously using them! + dependentModels.add(DependentSmithyModel.of(shape, dependentModelPaths)); + + // Append `.` so that it is easy to use. + // If you only want the name use localDafnyModuleName + return dafnyTypesModuleName(shapeNamespace) + "."; + } else { + // This is "local" and so does not need any Module name... + return ""; + } + } + + /** + * Outside of {@code smithydafny}, this should not be called directly. + * Instead, call + * {@link software.amazon.polymorph.utils.DafnyNameResolverHelpers#packageNameForNamespace}. + */ + // i.e. "software.amazon.cryptography.materialproviders.internaldafny" + // The base namespace at which all smithy->Dafny->X generated code is built to, + // used in {:extern}. + // TODO: Currently converts the smithy namespace into a Java idiomatic one. + public static String dafnyExternNamespace(final String namespace) { + return NamespaceHelper.standardize(namespace) + ".internaldafny"; + } + + /** + * Outside of {@code smithydafny}, this should not be called directly. + * Instead, call + * {@link software.amazon.polymorph.utils.DafnyNameResolverHelpers#dafnyExternNamespaceForNamespace}. + */ + // i.e. "software.amazon.cryptography.materialproviders.internaldafny.types" + // The namespace for all the smithy->Dafny->X generated types, + // i.e. the {:extern} for the Dafny Types module + public static String dafnyTypesModuleExternNamespace(final String namespace) { + return dafnyExternNamespace(namespace) + ".types"; + } + + public String callEventTypeName() { + return "DafnyCallEvent"; + } + + public String mutableStateFunctionName() { + return "Modifies"; + } + + public String validStateInvariantName() { + return "ValidState"; + } + + public String callHistoryFieldName() { + return "History"; + } + + public String historicalCallHistoryPostfix() { + return "CallHistory"; + } + + public static Stream modulePreludeStandardImports() { + return Stream.of( + "import opened Wrappers", + "import opened StandardLibrary.UInt", + "import opened UTF8" + ); + } - public static String abstractOperationsModuleName(ServiceShape serviceShape) - { - final String moduleNamespace = moduleNamespace(serviceShape.getId().getNamespace()); - return "Abstract%sOperations".formatted(moduleNamespace); - } + public static Stream abstractModulePrelude( + ServiceShape serviceShape + ) { + final String typesModuleName = dafnyTypesModuleName( + serviceShape.getId().getNamespace() + ); - public static Stream wrappedAbstractModulePrelude(ServiceShape serviceShape) - { - return Stream - .concat( - abstractModulePrelude(serviceShape), - Stream.of(TokenTree.of("import WrappedService : %s" - .formatted(abstractServiceModuleName(serviceShape)))) - ); - } + return Stream + .concat( + modulePreludeStandardImports(), + Stream.of("import opened Types = %s".formatted(typesModuleName)) + ) + .map(i -> Token.of(i)); + } + + public static String abstractServiceModuleName(ServiceShape serviceShape) { + final String moduleNamespace = moduleNamespace( + serviceShape.getId().getNamespace() + ); + return "Abstract%sService".formatted(moduleNamespace); + } + + // TODO: I am so confused by what all these dafny*Namespace methods are doing. + // There has to be duplication. I do not know where. But it must exist. + // Let's give them documentation and then reduce. + /** "com.amazonaws.kms" -> "ComAmazonAwsKms" */ + @Nonnull + public static String moduleNamespace(String namespace) { + return DafnyNameResolver.dafnyBaseModuleName(namespace); + } + + public static String abstractOperationsModuleName(ServiceShape serviceShape) { + final String moduleNamespace = moduleNamespace( + serviceShape.getId().getNamespace() + ); + return "Abstract%sOperations".formatted(moduleNamespace); + } + + public static Stream wrappedAbstractModulePrelude( + ServiceShape serviceShape + ) { + return Stream.concat( + abstractModulePrelude(serviceShape), + Stream.of( + TokenTree.of( + "import WrappedService : %s".formatted( + abstractServiceModuleName(serviceShape) + ) + ) + ) + ); + } - public static String internalConfigType() { - return "InternalConfig"; - } + public static String internalConfigType() { + return "InternalConfig"; + } - public static String validConfigPredicate() { - return "Valid%s?".formatted(internalConfigType()); - } + public static String validConfigPredicate() { + return "Valid%s?".formatted(internalConfigType()); + } - public static String modifiesInternalConfig() { - return "ModifiesInternalConfig"; - } + public static String modifiesInternalConfig() { + return "ModifiesInternalConfig"; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyVersion.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyVersion.java index 374826e230..a6be0bb12a 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyVersion.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DafnyVersion.java @@ -16,147 +16,155 @@ */ public class DafnyVersion implements Comparable { - private final int major; - private final int minor; - private final int patch; - // Will be non-null only if there was a pre-release suffix - private final String suffix; - - // Anything with a pre-release suffix should be considered less - // than a matching version without one. - private static final Comparator SUFFIX_COMPARATOR = Comparator.nullsLast(Comparator.naturalOrder()); - - public static DafnyVersion parse(String versionString) { - if (!versionString.matches("[0-9\\.A-Za-z\\-]*")) { - throw new IllegalArgumentException(); - } - int firstHyphenIndex = versionString.indexOf("-"); - String majorMinorPatch = versionString; - String suffix = null; - if (firstHyphenIndex >= 0) { - majorMinorPatch = versionString.substring(0, firstHyphenIndex); - suffix = versionString.substring(firstHyphenIndex + 1); - } - String[] splitByDots = majorMinorPatch.split("\\."); - switch (splitByDots.length) { - case 1: - return new DafnyVersion( - Integer.parseInt(splitByDots[0]), - 0, - 0, - suffix); - case 2: - return new DafnyVersion( - Integer.parseInt(splitByDots[0]), - Integer.parseInt(splitByDots[1]), - 0, - suffix); - case 3: - return new DafnyVersion( - Integer.parseInt(splitByDots[0]), - Integer.parseInt(splitByDots[1]), - Integer.parseInt(splitByDots[2]), - suffix); - default: - throw new IllegalArgumentException(); - } + private final int major; + private final int minor; + private final int patch; + // Will be non-null only if there was a pre-release suffix + private final String suffix; + + // Anything with a pre-release suffix should be considered less + // than a matching version without one. + private static final Comparator SUFFIX_COMPARATOR = + Comparator.nullsLast(Comparator.naturalOrder()); + + public static DafnyVersion parse(String versionString) { + if (!versionString.matches("[0-9\\.A-Za-z\\-]*")) { + throw new IllegalArgumentException(); } - - public DafnyVersion(int major, int minor, int patch) { - this(major, minor, patch, null); + int firstHyphenIndex = versionString.indexOf("-"); + String majorMinorPatch = versionString; + String suffix = null; + if (firstHyphenIndex >= 0) { + majorMinorPatch = versionString.substring(0, firstHyphenIndex); + suffix = versionString.substring(firstHyphenIndex + 1); } - - public DafnyVersion(int major, int minor, int patch, String suffix) { - this.major = requireNonNegative(major); - this.minor = requireNonNegative(minor); - this.patch = requireNonNegative(patch); - this.suffix = suffix; + String[] splitByDots = majorMinorPatch.split("\\."); + switch (splitByDots.length) { + case 1: + return new DafnyVersion(Integer.parseInt(splitByDots[0]), 0, 0, suffix); + case 2: + return new DafnyVersion( + Integer.parseInt(splitByDots[0]), + Integer.parseInt(splitByDots[1]), + 0, + suffix + ); + case 3: + return new DafnyVersion( + Integer.parseInt(splitByDots[0]), + Integer.parseInt(splitByDots[1]), + Integer.parseInt(splitByDots[2]), + suffix + ); + default: + throw new IllegalArgumentException(); } - - private int requireNonNegative(int value) { - if (value < 0) { - throw new IllegalArgumentException(); - } - return value; + } + + public DafnyVersion(int major, int minor, int patch) { + this(major, minor, patch, null); + } + + public DafnyVersion(int major, int minor, int patch, String suffix) { + this.major = requireNonNegative(major); + this.minor = requireNonNegative(minor); + this.patch = requireNonNegative(patch); + this.suffix = suffix; + } + + private int requireNonNegative(int value) { + if (value < 0) { + throw new IllegalArgumentException(); } + return value; + } - public int getMajor() { - return major; - } + public int getMajor() { + return major; + } - public int getMinor() { - return minor; - } + public int getMinor() { + return minor; + } - public int getPatch() { - return patch; - } + public int getPatch() { + return patch; + } - public String getSuffix() { - return suffix; - } + public String getSuffix() { + return suffix; + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - DafnyVersion that = (DafnyVersion) o; - return major == that.major - && minor == that.minor - && patch == that.patch - && Objects.equals(suffix, that.suffix); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public int hashCode() { - return Objects.hash(major, minor, patch, suffix); + if (o == null || getClass() != o.getClass()) { + return false; + } + DafnyVersion that = (DafnyVersion) o; + return ( + major == that.major && + minor == that.minor && + patch == that.patch && + Objects.equals(suffix, that.suffix) + ); + } + + @Override + public int hashCode() { + return Objects.hash(major, minor, patch, suffix); + } + + @Override + public int compareTo(DafnyVersion other) { + int majorComparison = Integer.compare(this.major, other.major); + if (majorComparison != 0) { + return majorComparison; } - @Override - public int compareTo(DafnyVersion other) { - int majorComparison = Integer.compare(this.major, other.major); - if (majorComparison != 0) { - return majorComparison; - } - - int minorComparison = Integer.compare(this.minor, other.minor); - if (minorComparison != 0) { - return minorComparison; - } - - int patchComparison = Integer.compare(this.patch, other.patch); - if (patchComparison != 0) { - return patchComparison; - } - - return SUFFIX_COMPARATOR.compare(this.suffix, other.suffix); + int minorComparison = Integer.compare(this.minor, other.minor); + if (minorComparison != 0) { + return minorComparison; } - public String unparse() { - StringBuilder builder = new StringBuilder(); - builder.append(major); - builder.append('.'); - builder.append(minor); - builder.append('.'); - builder.append(patch); - if (suffix != null) { - builder.append('-'); - builder.append(suffix); - } - return builder.toString(); + int patchComparison = Integer.compare(this.patch, other.patch); + if (patchComparison != 0) { + return patchComparison; } - @Override - public String toString() { - return "DafnyVersion{" + - "major=" + major + - ", minor=" + minor + - ", patch=" + patch + - ", suffix='" + suffix + '\'' + - '}'; + return SUFFIX_COMPARATOR.compare(this.suffix, other.suffix); + } + + public String unparse() { + StringBuilder builder = new StringBuilder(); + builder.append(major); + builder.append('.'); + builder.append(minor); + builder.append('.'); + builder.append(patch); + if (suffix != null) { + builder.append('-'); + builder.append(suffix); } + return builder.toString(); + } + + @Override + public String toString() { + return ( + "DafnyVersion{" + + "major=" + + major + + ", minor=" + + minor + + ", patch=" + + patch + + ", suffix='" + + suffix + + '\'' + + '}' + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DependentSmithyModel.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DependentSmithyModel.java index 892cf2749a..3e72c0d27a 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DependentSmithyModel.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydafny/DependentSmithyModel.java @@ -3,25 +3,24 @@ package software.amazon.polymorph.smithydafny; - -import software.amazon.smithy.model.shapes.Shape; - import java.nio.file.Path; import java.util.stream.Stream; +import software.amazon.smithy.model.shapes.Shape; -public record DependentSmithyModel( - Path modelPath, - String namespace -) implements Comparable -{ +public record DependentSmithyModel(Path modelPath, String namespace) + implements Comparable { public static DependentSmithyModel of(final Shape shape, Path[] modelPaths) { final String namespace = shape.getId().getNamespace(); - final Path sourceLocation = Path.of(shape.getSourceLocation().getFilename()); + final Path sourceLocation = Path.of( + shape.getSourceLocation().getFilename() + ); final Path modelPath = Stream .of(modelPaths) .filter(sourceLocation::startsWith) - .reduce((a,b) -> { - throw new IllegalStateException("A dependent model can not be a sub directory of another dependent model"); + .reduce((a, b) -> { + throw new IllegalStateException( + "A dependent model can not be a sub directory of another dependent model" + ); }) .get(); diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkDotNetNameResolver.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkDotNetNameResolver.java index ba990b90c6..070fae7a68 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkDotNetNameResolver.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkDotNetNameResolver.java @@ -3,6 +3,7 @@ package software.amazon.polymorph.smithydotnet; +import java.util.Optional; import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; import software.amazon.polymorph.utils.ModelUtils; import software.amazon.smithy.aws.traits.ServiceTrait; @@ -22,172 +23,236 @@ import software.amazon.smithy.model.traits.TraitDefinition; import software.amazon.smithy.utils.StringUtils; -import java.util.Optional; - public class AwsSdkDotNetNameResolver extends DotNetNameResolver { - public static final String KMS_SERVICE_NAME = "KMS"; - public static final String KEY_MANAGEMENT_SERVICE_NAME = "KeyManagementService"; - // The following are used to resolve namespace errors when generating - // code that uses the DynamoDBv2 service model - public static final String DDB_NAMESPACE = "com.amazonaws.dynamodb"; - public static final String DDB_SERVICE_NAME = "DynamoDB"; - public static final String DDB_SERVICE_NAME_V2 = "DynamoDBv2"; - public static final String DDB_V2_ATTRIBUTE_VALUE = "Amazon.DynamoDBv2.Model.AttributeValue"; - public static final String DDB_NET_INTERFACE_NAME = "Amazon.DynamoDBv2.IAmazonDynamoDB"; - public static final String DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE = "Com.Amazonaws.Dynamodb.AttributeValue"; - public static final String REQUEST = "Request"; - public static final String RESPONSE = "Response"; - - public AwsSdkDotNetNameResolver(final Model model, final ServiceShape serviceShape) { - super(model, serviceShape); - } - private boolean isGeneratedInSdk(final ShapeId shapeId) { - return ModelUtils.isInServiceNamespace(shapeId, getServiceShape()); - } + public static final String KMS_SERVICE_NAME = "KMS"; + public static final String KEY_MANAGEMENT_SERVICE_NAME = + "KeyManagementService"; + // The following are used to resolve namespace errors when generating + // code that uses the DynamoDBv2 service model + public static final String DDB_NAMESPACE = "com.amazonaws.dynamodb"; + public static final String DDB_SERVICE_NAME = "DynamoDB"; + public static final String DDB_SERVICE_NAME_V2 = "DynamoDBv2"; + public static final String DDB_V2_ATTRIBUTE_VALUE = + "Amazon.DynamoDBv2.Model.AttributeValue"; + public static final String DDB_NET_INTERFACE_NAME = + "Amazon.DynamoDBv2.IAmazonDynamoDB"; + public static final String DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE = + "Com.Amazonaws.Dynamodb.AttributeValue"; + public static final String REQUEST = "Request"; + public static final String RESPONSE = "Response"; + + public AwsSdkDotNetNameResolver( + final Model model, + final ServiceShape serviceShape + ) { + super(model, serviceShape); + } - @Override - protected String baseTypeForString(final StringShape stringShape) { - if (isGeneratedInSdk(stringShape.getId()) && stringShape.hasTrait(EnumTrait.class)) { - return "%s.%s".formatted(namespaceForService(), classForEnum(stringShape.getId())); - } + private boolean isGeneratedInSdk(final ShapeId shapeId) { + return ModelUtils.isInServiceNamespace(shapeId, getServiceShape()); + } - return super.baseTypeForString(stringShape); + @Override + protected String baseTypeForString(final StringShape stringShape) { + if ( + isGeneratedInSdk(stringShape.getId()) && + stringShape.hasTrait(EnumTrait.class) + ) { + return "%s.%s".formatted( + namespaceForService(), + classForEnum(stringShape.getId()) + ); } - @Override - protected String baseTypeForList(final ListShape listShape) { - final MemberShape memberShape = listShape.getMember(); - final Shape targetShape = getModel().expectShape(memberShape.getTarget()); + return super.baseTypeForString(stringShape); + } - // The .NET AWS SDK represents a list-of-enums as a list-of-strings, even though it represents enums as the - // corresponding enum class every where else AFAICT. - final String memberType = targetShape.hasTrait(EnumTrait.class) ? "string" : baseTypeForMember(memberShape); + @Override + protected String baseTypeForList(final ListShape listShape) { + final MemberShape memberShape = listShape.getMember(); + final Shape targetShape = getModel().expectShape(memberShape.getTarget()); - // we need to return the name AttributeValue in the sdk not the name in the model - if (StringUtils.equals(memberType, DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE)) { - return "System.Collections.Generic.List<%s>".formatted(DDB_V2_ATTRIBUTE_VALUE); - } - return "System.Collections.Generic.List<%s>".formatted(memberType); - } + // The .NET AWS SDK represents a list-of-enums as a list-of-strings, even though it represents enums as the + // corresponding enum class every where else AFAICT. + final String memberType = targetShape.hasTrait(EnumTrait.class) + ? "string" + : baseTypeForMember(memberShape); - @Override - protected String baseTypeForMap(MapShape mapShape) { - final MemberShape keyShape = mapShape.getKey(); - final Shape keyTargetShape = getModel().expectShape(keyShape.getTarget()); - final MemberShape valueShape = mapShape.getValue(); - final Shape valueTargetShape = getModel().expectShape(valueShape.getTarget()); - - // The .NET AWS SDK represents enums as strings in map values, even though it represents enums as the - // corresponding enum class everywhere else AFAICT. - final String keyType = keyTargetShape.hasTrait(EnumTrait.class) ? "string" : baseTypeForMember(keyShape); - final String valueType = valueTargetShape.hasTrait(EnumTrait.class) ? "string" : baseTypeForMember(valueShape); - - if (StringUtils.equals(valueType, AwsSdkDotNetNameResolver.DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE)){ - return "System.Collections.Generic.Dictionary<%s, %s>".formatted( - keyType, - AwsSdkDotNetNameResolver.DDB_V2_ATTRIBUTE_VALUE); - } - - return "System.Collections.Generic.Dictionary<%s, %s>".formatted(keyType, valueType); + // we need to return the name AttributeValue in the sdk not the name in the model + if (StringUtils.equals(memberType, DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE)) { + return "System.Collections.Generic.List<%s>".formatted( + DDB_V2_ATTRIBUTE_VALUE + ); } + return "System.Collections.Generic.List<%s>".formatted(memberType); + } - @Override - protected String baseTypeForStructure(final StructureShape structureShape) { - if (isGeneratedInSdk(structureShape.getId())) { - if (structureShape.hasTrait(TraitDefinition.class)) { - throw new IllegalArgumentException("Trait definition structures have no corresponding generated type"); - } - // The NET SDK uses Request/Response - // rather than the structure name for operation input/output structures - Optional shapeId = Optional.of(structureShape.getId()); - Optional operation = getModel().getOperationShapes().stream().filter(o -> o.getInput().equals(shapeId)).findFirst(); - if (operation.isPresent()) { - return "%s.Model.%s".formatted(namespaceForService(), operation.get().getId().getName() + REQUEST); - } - operation = getModel().getOperationShapes().stream().filter(o -> o.getOutput().equals(shapeId)).findFirst(); - if (operation.isPresent()) { - return "%s.Model.%s".formatted(namespaceForService(), operation.get().getId().getName() + RESPONSE); - } - - // The base type of an error structure is the corresponding generated exception class - if (structureShape.hasTrait(ErrorTrait.class)) { - return "%s.Model.%s".formatted(namespaceForService(), classForSpecificServiceException(structureShape.getId())); - } - - return "%s.Model.%s".formatted(namespaceForService(), structureShape.getId().getName()); - } - - return super.baseTypeForStructure(structureShape); - } + @Override + protected String baseTypeForMap(MapShape mapShape) { + final MemberShape keyShape = mapShape.getKey(); + final Shape keyTargetShape = getModel().expectShape(keyShape.getTarget()); + final MemberShape valueShape = mapShape.getValue(); + final Shape valueTargetShape = getModel() + .expectShape(valueShape.getTarget()); - @Override - protected String baseTypeForService(final ServiceShape serviceShape) { - if (isGeneratedInSdk(serviceShape.getId())) { - return "%s.IAmazon%s".formatted(namespaceForService(), getServiceName()); - } + // The .NET AWS SDK represents enums as strings in map values, even though it represents enums as the + // corresponding enum class everywhere else AFAICT. + final String keyType = keyTargetShape.hasTrait(EnumTrait.class) + ? "string" + : baseTypeForMember(keyShape); + final String valueType = valueTargetShape.hasTrait(EnumTrait.class) + ? "string" + : baseTypeForMember(valueShape); - return super.baseTypeForService(serviceShape); + if ( + StringUtils.equals( + valueType, + AwsSdkDotNetNameResolver.DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE + ) + ) { + return "System.Collections.Generic.Dictionary<%s, %s>".formatted( + keyType, + AwsSdkDotNetNameResolver.DDB_V2_ATTRIBUTE_VALUE + ); } - public String implForServiceClient() { - // The Client Implementation MUST be DynamoDB - although the NET SDK is using DynamoDBv2 - // It does not append v2 in the client for backwards compatability purposes. - if (StringUtils.equals(getServiceName(), DDB_SERVICE_NAME_V2)) { - return "%s.Amazon%sClient".formatted(namespaceForService(), DDB_SERVICE_NAME); - } - return "%s.Amazon%sClient".formatted(namespaceForService(), getServiceName()); - } + return "System.Collections.Generic.Dictionary<%s, %s>".formatted( + keyType, + valueType + ); + } - private String getServiceName() { - Optional serviceTraitOptional = serviceShape.getTrait(ServiceTrait.class); - if (serviceTraitOptional.isPresent()) { - String sdkId = serviceTraitOptional.get().getSdkId(); - - // Account for known legacy identifiers for a few services. - // See the metadata at https://github.com/aws/aws-sdk-net/tree/master/generator/ServiceModels - // for details. - if (StringUtils.equals(sdkId, DDB_SERVICE_NAME)) { - return StringUtils.capitalize(DDB_SERVICE_NAME_V2); - } - if (StringUtils.equals(sdkId, KMS_SERVICE_NAME)) { - return KEY_MANAGEMENT_SERVICE_NAME; - } - - return AwsSdkNameResolverHelpers.mungeSdkId(sdkId); - } else { - return StringUtils.capitalize(getServiceShape().getId().getName()); - } - } + @Override + protected String baseTypeForStructure(final StructureShape structureShape) { + if (isGeneratedInSdk(structureShape.getId())) { + if (structureShape.hasTrait(TraitDefinition.class)) { + throw new IllegalArgumentException( + "Trait definition structures have no corresponding generated type" + ); + } + // The NET SDK uses Request/Response + // rather than the structure name for operation input/output structures + Optional shapeId = Optional.of(structureShape.getId()); + Optional operation = getModel() + .getOperationShapes() + .stream() + .filter(o -> o.getInput().equals(shapeId)) + .findFirst(); + if (operation.isPresent()) { + return "%s.Model.%s".formatted( + namespaceForService(), + operation.get().getId().getName() + REQUEST + ); + } + operation = + getModel() + .getOperationShapes() + .stream() + .filter(o -> o.getOutput().equals(shapeId)) + .findFirst(); + if (operation.isPresent()) { + return "%s.Model.%s".formatted( + namespaceForService(), + operation.get().getId().getName() + RESPONSE + ); + } - @Override - public String namespaceForService() { - return "Amazon.%s".formatted(getServiceName()); - } + // The base type of an error structure is the corresponding generated exception class + if (structureShape.hasTrait(ErrorTrait.class)) { + return "%s.Model.%s".formatted( + namespaceForService(), + classForSpecificServiceException(structureShape.getId()) + ); + } - public String syntheticNamespaceForService() { - return super.namespaceForService(); + return "%s.Model.%s".formatted( + namespaceForService(), + structureShape.getId().getName() + ); } - public String shimClassForService() { - return "%sShim".formatted(getServiceName()); - } + return super.baseTypeForStructure(structureShape); + } - @Override - public String classForBaseServiceException() { - // Although using V2 of the DynamoDB Client Exceptions MUST use DynamoDB as opposed to DynamoDBv2 - return StringUtils.equals(getServiceName(), DDB_SERVICE_NAME_V2) - ? "Amazon%sException".formatted(DDB_SERVICE_NAME) - : "Amazon%sException".formatted(getServiceName()); + @Override + protected String baseTypeForService(final ServiceShape serviceShape) { + if (isGeneratedInSdk(serviceShape.getId())) { + return "%s.IAmazon%s".formatted(namespaceForService(), getServiceName()); } - public String qualifiedClassForBaseServiceException() { - return "%s.%s".formatted(namespaceForService(), classForBaseServiceException()); + return super.baseTypeForService(serviceShape); + } + + public String implForServiceClient() { + // The Client Implementation MUST be DynamoDB - although the NET SDK is using DynamoDBv2 + // It does not append v2 in the client for backwards compatability purposes. + if (StringUtils.equals(getServiceName(), DDB_SERVICE_NAME_V2)) { + return "%s.Amazon%sClient".formatted( + namespaceForService(), + DDB_SERVICE_NAME + ); } + return "%s.Amazon%sClient".formatted( + namespaceForService(), + getServiceName() + ); + } + + private String getServiceName() { + Optional serviceTraitOptional = serviceShape.getTrait( + ServiceTrait.class + ); + if (serviceTraitOptional.isPresent()) { + String sdkId = serviceTraitOptional.get().getSdkId(); - @Override - public String classForSpecificServiceException(ShapeId structureShapeId) { - String name = super.classForSpecificServiceException(structureShapeId); - return !name.endsWith("Exception") ? "%sException".formatted(name) : name; + // Account for known legacy identifiers for a few services. + // See the metadata at https://github.com/aws/aws-sdk-net/tree/master/generator/ServiceModels + // for details. + if (StringUtils.equals(sdkId, DDB_SERVICE_NAME)) { + return StringUtils.capitalize(DDB_SERVICE_NAME_V2); + } + if (StringUtils.equals(sdkId, KMS_SERVICE_NAME)) { + return KEY_MANAGEMENT_SERVICE_NAME; + } + + return AwsSdkNameResolverHelpers.mungeSdkId(sdkId); + } else { + return StringUtils.capitalize(getServiceShape().getId().getName()); } + } + + @Override + public String namespaceForService() { + return "Amazon.%s".formatted(getServiceName()); + } + + public String syntheticNamespaceForService() { + return super.namespaceForService(); + } + + public String shimClassForService() { + return "%sShim".formatted(getServiceName()); + } + + @Override + public String classForBaseServiceException() { + // Although using V2 of the DynamoDB Client Exceptions MUST use DynamoDB as opposed to DynamoDBv2 + return StringUtils.equals(getServiceName(), DDB_SERVICE_NAME_V2) + ? "Amazon%sException".formatted(DDB_SERVICE_NAME) + : "Amazon%sException".formatted(getServiceName()); + } + + public String qualifiedClassForBaseServiceException() { + return "%s.%s".formatted( + namespaceForService(), + classForBaseServiceException() + ); + } + + @Override + public String classForSpecificServiceException(ShapeId structureShapeId) { + String name = super.classForSpecificServiceException(structureShapeId); + return !name.endsWith("Exception") ? "%sException".formatted(name) : name; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkShimCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkShimCodegen.java index 4cdc1d1411..31d8ed7715 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkShimCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkShimCodegen.java @@ -3,133 +3,213 @@ package software.amazon.polymorph.smithydotnet; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; + import java.nio.file.Path; import java.util.HashMap; import java.util.Map; - import software.amazon.polymorph.utils.Token; import software.amazon.polymorph.utils.TokenTree; - import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.ShapeId; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; - public class AwsSdkShimCodegen { - private final Model model; - private final ServiceShape serviceShape; - private final AwsSdkDotNetNameResolver nameResolver; - - private static final String IMPL_NAME = "_impl"; - - public AwsSdkShimCodegen( - final Model model, - final ServiceShape serviceShape - ) { - this.model = model; - this.serviceShape = serviceShape; - this.nameResolver = new AwsSdkDotNetNameResolver(model, serviceShape); - } - - public Map generate() { - final Map codeByPath = new HashMap<>(); - final TokenTree prelude = TokenTree.of( - "using System;", - "using System.IO;", - "using System.Collections.Generic;" - ).lineSeparated(); - - // Service shim - final Path serviceShimPath = Path.of(String.format("%s.cs", nameResolver.shimClassForService())); - final TokenTree serviceShimCode = generateServiceShim(); - codeByPath.put(serviceShimPath, serviceShimCode.prepend(prelude)); - - return codeByPath; - } - - // Why are these constructors public? - // Because the underlying implementation is a replica - // of the Dafny wrapper. - // There is no _safety_ introduced here per se, - // so making is `internal` or `private` - // just complicates other Dafny libraries working with the wrapper. - public TokenTree generateServiceShim() { - final TokenTree header = Token.of("public class %s : %s".formatted( - nameResolver.shimClassForService(), - nameResolver.dafnyTypeForShape(serviceShape.getId()))); - - final TokenTree impl = Token.of("public %s %s;".formatted(nameResolver.implForServiceClient(), IMPL_NAME)); - final TokenTree constructor = generateServiceShimConstructor(); - final TokenTree operationShims = TokenTree.of(serviceShape.getAllOperations() - .stream() - .map(this::generateOperationShim)).lineSeparated(); - - final TokenTree classBody = TokenTree.of(impl, constructor, operationShims).lineSeparated(); - return header - .append(classBody.braced()) - .namespaced(Token.of(nameResolver.syntheticNamespaceForService())); - } - - public TokenTree generateServiceShimConstructor() { - return Token.of(""" - public %s(%s impl) { - this.%s = impl; - }""".formatted(nameResolver.shimClassForService(), nameResolver.implForServiceClient(), IMPL_NAME)); - } - - public TokenTree generateOperationShim(final ShapeId operationShapeId) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - final String dafnyOutputType = nameResolver.dafnyTypeForServiceOperationOutput(operationShape, true); - final String implOperationName = nameResolver.methodForOperation(operationShapeId) + "Async"; - - final TokenTree sdkRequest = Token.of(operationShape.getInput() - .map(requestShapeId -> "%s sdkRequest = %s(request);".formatted( - nameResolver.baseTypeForShape(requestShapeId), - AwsSdkDotNetNameResolver.qualifiedTypeConverter(requestShapeId, FROM_DAFNY))) - .orElse("")); - - final TokenTree assignSdkResponse = Token.of(operationShape.getOutput() - .map(responseShapeId -> "%s sdkResponse =".formatted(nameResolver.baseTypeForShape(responseShapeId))) - .orElse("")); - - final String requestArg = operationShape.getInput().isPresent() ? "sdkRequest" : ""; - final String blockOnResponse = operationShape.getOutput().isPresent() ? ".Result" : ".Wait()"; - final TokenTree callImpl = Token.of("this.%s.%s(%s)%s;".formatted( - IMPL_NAME, implOperationName, requestArg, blockOnResponse)); - - final TokenTree returnResponse = Token.of(operationShape.getOutput() - .map(responseShapeId -> "return %s.create_Success(%s(sdkResponse));".formatted( - dafnyOutputType, - AwsSdkDotNetNameResolver.qualifiedTypeConverter(responseShapeId, TO_DAFNY))) - .orElse("return %s.create_Success(%s);".formatted( - dafnyOutputType, nameResolver.dafnyValueForUnit()))); - - final TokenTree tryBody = TokenTree.of(assignSdkResponse, callImpl, returnResponse).lineSeparated(); - final TokenTree tryBlock = Token.of("try").append(tryBody.braced()); - - final String baseExceptionForService = nameResolver.qualifiedClassForBaseServiceException(); - final TokenTree catchBlock = Token.of(""" - catch (System.AggregateException aggregate) { - return %s.create_Failure(TypeConversion.ToDafny_CommonError(aggregate.InnerException)); - } catch (System.Exception ex) { - return %s.create_Failure(TypeConversion.ToDafny_CommonError(ex)); - } - """.formatted(dafnyOutputType, dafnyOutputType)); - - final TokenTree methodSignature = generateOperationShimSignature(operationShape); - final TokenTree methodBody = TokenTree.of(sdkRequest, tryBlock, catchBlock); - return methodSignature.append(methodBody.braced()); - } - - private TokenTree generateOperationShimSignature(final OperationShape operationShape) { - final String responseType = nameResolver.dafnyTypeForServiceOperationOutput(operationShape); - final String methodName = nameResolver.methodForOperation(operationShape.getId()); - final String requestType = operationShape.getInput() - .map(requestShapeId -> nameResolver.dafnyTypeForShape(requestShapeId) + " request") - .orElse(""); - return Token.of("public %s %s(%s)".formatted(responseType, methodName, requestType)); - } + + private final Model model; + private final ServiceShape serviceShape; + private final AwsSdkDotNetNameResolver nameResolver; + + private static final String IMPL_NAME = "_impl"; + + public AwsSdkShimCodegen(final Model model, final ServiceShape serviceShape) { + this.model = model; + this.serviceShape = serviceShape; + this.nameResolver = new AwsSdkDotNetNameResolver(model, serviceShape); + } + + public Map generate() { + final Map codeByPath = new HashMap<>(); + final TokenTree prelude = TokenTree + .of( + "using System;", + "using System.IO;", + "using System.Collections.Generic;" + ) + .lineSeparated(); + + // Service shim + final Path serviceShimPath = Path.of( + String.format("%s.cs", nameResolver.shimClassForService()) + ); + final TokenTree serviceShimCode = generateServiceShim(); + codeByPath.put(serviceShimPath, serviceShimCode.prepend(prelude)); + + return codeByPath; + } + + // Why are these constructors public? + // Because the underlying implementation is a replica + // of the Dafny wrapper. + // There is no _safety_ introduced here per se, + // so making is `internal` or `private` + // just complicates other Dafny libraries working with the wrapper. + public TokenTree generateServiceShim() { + final TokenTree header = Token.of( + "public class %s : %s".formatted( + nameResolver.shimClassForService(), + nameResolver.dafnyTypeForShape(serviceShape.getId()) + ) + ); + + final TokenTree impl = Token.of( + "public %s %s;".formatted(nameResolver.implForServiceClient(), IMPL_NAME) + ); + final TokenTree constructor = generateServiceShimConstructor(); + final TokenTree operationShims = TokenTree + .of( + serviceShape + .getAllOperations() + .stream() + .map(this::generateOperationShim) + ) + .lineSeparated(); + + final TokenTree classBody = TokenTree + .of(impl, constructor, operationShims) + .lineSeparated(); + return header + .append(classBody.braced()) + .namespaced(Token.of(nameResolver.syntheticNamespaceForService())); + } + + public TokenTree generateServiceShimConstructor() { + return Token.of( + """ + public %s(%s impl) { + this.%s = impl; + }""".formatted( + nameResolver.shimClassForService(), + nameResolver.implForServiceClient(), + IMPL_NAME + ) + ); + } + + public TokenTree generateOperationShim(final ShapeId operationShapeId) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + final String dafnyOutputType = + nameResolver.dafnyTypeForServiceOperationOutput(operationShape, true); + final String implOperationName = + nameResolver.methodForOperation(operationShapeId) + "Async"; + + final TokenTree sdkRequest = Token.of( + operationShape + .getInput() + .map(requestShapeId -> + "%s sdkRequest = %s(request);".formatted( + nameResolver.baseTypeForShape(requestShapeId), + AwsSdkDotNetNameResolver.qualifiedTypeConverter( + requestShapeId, + FROM_DAFNY + ) + ) + ) + .orElse("") + ); + + final TokenTree assignSdkResponse = Token.of( + operationShape + .getOutput() + .map(responseShapeId -> + "%s sdkResponse =".formatted( + nameResolver.baseTypeForShape(responseShapeId) + ) + ) + .orElse("") + ); + + final String requestArg = operationShape.getInput().isPresent() + ? "sdkRequest" + : ""; + final String blockOnResponse = operationShape.getOutput().isPresent() + ? ".Result" + : ".Wait()"; + final TokenTree callImpl = Token.of( + "this.%s.%s(%s)%s;".formatted( + IMPL_NAME, + implOperationName, + requestArg, + blockOnResponse + ) + ); + + final TokenTree returnResponse = Token.of( + operationShape + .getOutput() + .map(responseShapeId -> + "return %s.create_Success(%s(sdkResponse));".formatted( + dafnyOutputType, + AwsSdkDotNetNameResolver.qualifiedTypeConverter( + responseShapeId, + TO_DAFNY + ) + ) + ) + .orElse( + "return %s.create_Success(%s);".formatted( + dafnyOutputType, + nameResolver.dafnyValueForUnit() + ) + ) + ); + + final TokenTree tryBody = TokenTree + .of(assignSdkResponse, callImpl, returnResponse) + .lineSeparated(); + final TokenTree tryBlock = Token.of("try").append(tryBody.braced()); + + final String baseExceptionForService = + nameResolver.qualifiedClassForBaseServiceException(); + final TokenTree catchBlock = Token.of( + """ + catch (System.AggregateException aggregate) { + return %s.create_Failure(TypeConversion.ToDafny_CommonError(aggregate.InnerException)); + } catch (System.Exception ex) { + return %s.create_Failure(TypeConversion.ToDafny_CommonError(ex)); + } + """.formatted(dafnyOutputType, dafnyOutputType) + ); + + final TokenTree methodSignature = generateOperationShimSignature( + operationShape + ); + final TokenTree methodBody = TokenTree.of(sdkRequest, tryBlock, catchBlock); + return methodSignature.append(methodBody.braced()); + } + + private TokenTree generateOperationShimSignature( + final OperationShape operationShape + ) { + final String responseType = nameResolver.dafnyTypeForServiceOperationOutput( + operationShape + ); + final String methodName = nameResolver.methodForOperation( + operationShape.getId() + ); + final String requestType = operationShape + .getInput() + .map(requestShapeId -> + nameResolver.dafnyTypeForShape(requestShapeId) + " request" + ) + .orElse(""); + return Token.of( + "public %s %s(%s)".formatted(responseType, methodName, requestType) + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkTypeConversionCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkTypeConversionCodegen.java index 944a14d751..9a50e9b4f0 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkTypeConversionCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/AwsSdkTypeConversionCodegen.java @@ -3,11 +3,13 @@ package software.amazon.polymorph.smithydotnet; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; + import java.util.Set; import java.util.TreeSet; import java.util.stream.Collectors; import java.util.stream.Stream; - import software.amazon.polymorph.utils.DafnyNameResolverHelpers; import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.utils.Token; @@ -17,172 +19,237 @@ import software.amazon.smithy.model.traits.ErrorTrait; import software.amazon.smithy.utils.StringUtils; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; - /** * Generates a {@code TypeConversion} class that includes all {@link TypeConversionCodegen.TypeConverter}s needed * for AWS SDK-specific types. */ public class AwsSdkTypeConversionCodegen extends TypeConversionCodegen { - private static final ShapeId SMITHY_STRING_SHAPE_ID = ShapeId.from("smithy.api#String"); - - public AwsSdkTypeConversionCodegen(final Model model, final ServiceShape serviceShape) { - super(model, serviceShape, - new AwsSdkDotNetNameResolver(model, serviceShape)); - } - - @Override - public Set findShapeIdsToConvert() { - final Set shapeIds = super.findShapeIdsToConvert(); - shapeIds.add(SMITHY_STRING_SHAPE_ID); // needed for converting the message of an unknown error type - return shapeIds; - } - - @Override - public TypeConverter generateStructureConverter(final StructureShape structureShape) { - if (structureShape.hasTrait(ErrorTrait.class)) { - return generateSpecificModeledErrorConverter(structureShape); - } - - return super.generateStructureConverter(structureShape); - } - /** - * We can't call the {@code IsSet} methods on AWS SDK classes' member properties because they're internal. - * The best we can do is to call the properties' getters, which calls {@code GetValueOrDefault}, which in turn may - * improperly coalesce absent optional values to 0 (for example). - */ - @Override - public TokenTree generateExtractOptionalMember(MemberShape memberShape) { - final String type; - if (StringUtils.equals(nameResolver.baseTypeForShape(memberShape.getId()), - AwsSdkDotNetNameResolver.DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE)) { - type = AwsSdkDotNetNameResolver.DDB_V2_ATTRIBUTE_VALUE; - } else { - type = nameResolver.baseTypeForShape(memberShape.getId()); - } - final String varName = nameResolver.variableNameForClassProperty(memberShape); - final String propertyName = nameResolver.classPropertyForStructureMember(memberShape); - return TokenTree.of( - type, - varName, - "= value.%s;".formatted(propertyName)); + private static final ShapeId SMITHY_STRING_SHAPE_ID = ShapeId.from( + "smithy.api#String" + ); + + public AwsSdkTypeConversionCodegen( + final Model model, + final ServiceShape serviceShape + ) { + super( + model, + serviceShape, + new AwsSdkDotNetNameResolver(model, serviceShape) + ); + } + + @Override + public Set findShapeIdsToConvert() { + final Set shapeIds = super.findShapeIdsToConvert(); + shapeIds.add(SMITHY_STRING_SHAPE_ID); // needed for converting the message of an unknown error type + return shapeIds; + } + + @Override + public TypeConverter generateStructureConverter( + final StructureShape structureShape + ) { + if (structureShape.hasTrait(ErrorTrait.class)) { + return generateSpecificModeledErrorConverter(structureShape); } - @Override - protected boolean enumListAndMapMembersAreStringsInCSharp() { - return true; + return super.generateStructureConverter(structureShape); + } + + /** + * We can't call the {@code IsSet} methods on AWS SDK classes' member properties because they're internal. + * The best we can do is to call the properties' getters, which calls {@code GetValueOrDefault}, which in turn may + * improperly coalesce absent optional values to 0 (for example). + */ + @Override + public TokenTree generateExtractOptionalMember(MemberShape memberShape) { + final String type; + if ( + StringUtils.equals( + nameResolver.baseTypeForShape(memberShape.getId()), + AwsSdkDotNetNameResolver.DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE + ) + ) { + type = AwsSdkDotNetNameResolver.DDB_V2_ATTRIBUTE_VALUE; + } else { + type = nameResolver.baseTypeForShape(memberShape.getId()); } + final String varName = nameResolver.variableNameForClassProperty( + memberShape + ); + final String propertyName = nameResolver.classPropertyForStructureMember( + memberShape + ); + return TokenTree.of(type, varName, "= value.%s;".formatted(propertyName)); + } + + @Override + protected boolean enumListAndMapMembersAreStringsInCSharp() { + return true; + } + + public record DafnyConverterBodies( + TokenTree fromDafnyBody, + TokenTree toDafnyBody + ) {} + + DafnyConverterBodies generateAwsSdkServiceReferenceStructureConverter( + final StructureShape structureShape + ) { + final String sdkServiceImpl = + ((AwsSdkDotNetNameResolver) nameResolver).implForServiceClient(); + + final String serviceClientShim = + "%s.%s".formatted( + ((AwsSdkDotNetNameResolver) nameResolver).syntheticNamespaceForService(), + ((AwsSdkDotNetNameResolver) nameResolver).shimClassForService() + ); + final String serviceInterfaceType = nameResolver.baseTypeForShape( + serviceShape.getId() + ); + + final String throwCustomImplException = + "throw new System.ArgumentException(\"Custom implementations of %s are not supported yet\");".formatted( + serviceInterfaceType + ); + final TokenTree fromDafnyBody = Token.of( + "if (value is %s shim) { return shim._impl; }".formatted( + serviceClientShim + ), + throwCustomImplException + ); + final TokenTree toDafnyBody = TokenTree.of( + "if (value is %s impl) { return new %s(impl); }".formatted( + sdkServiceImpl, + serviceClientShim + ), + throwCustomImplException + ); + + return new DafnyConverterBodies(fromDafnyBody, toDafnyBody); + } + + @Override + protected String getTypeConversionNamespace() { + return ( + (AwsSdkDotNetNameResolver) nameResolver + ).syntheticNamespaceForService(); + } + + /** + * No unmodeled converters are needed for the AWS SDK shims. + */ + @Override + protected Stream generateUnmodeledConverters() { + return Stream.of(generateCommonExceptionConverter()); + } + + @Override + protected TokenTree errorToDafnyBody( + final TreeSet errorShapes + ) { + final String dafnyUnknownErrorType = + "%s.Error_Opaque".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId( + serviceShape.getId() + ) + ); - public record DafnyConverterBodies( - TokenTree fromDafnyBody, - TokenTree toDafnyBody - ){} - - DafnyConverterBodies generateAwsSdkServiceReferenceStructureConverter(final StructureShape structureShape) { - final String sdkServiceImpl = ((AwsSdkDotNetNameResolver) nameResolver).implForServiceClient(); - - final String serviceClientShim = "%s.%s".formatted( - ((AwsSdkDotNetNameResolver) nameResolver).syntheticNamespaceForService(), - ((AwsSdkDotNetNameResolver) nameResolver).shimClassForService()); - final String serviceInterfaceType = nameResolver.baseTypeForShape(serviceShape.getId()); - - final String throwCustomImplException = - "throw new System.ArgumentException(\"Custom implementations of %s are not supported yet\");" - .formatted(serviceInterfaceType); - final TokenTree fromDafnyBody = Token.of( - "if (value is %s shim) { return shim._impl; }".formatted(serviceClientShim), - throwCustomImplException); - final TokenTree toDafnyBody = TokenTree.of( - "if (value is %s impl) { return new %s(impl); }".formatted(sdkServiceImpl, serviceClientShim), - throwCustomImplException); - - return new DafnyConverterBodies(fromDafnyBody, toDafnyBody); - } - - @Override - protected String getTypeConversionNamespace() { - return ((AwsSdkDotNetNameResolver)nameResolver).syntheticNamespaceForService(); - } - - /** - * No unmodeled converters are needed for the AWS SDK shims. - */ - @Override - protected Stream generateUnmodeledConverters() { - return Stream.of(generateCommonExceptionConverter()); - } - - @Override - protected TokenTree errorToDafnyBody(final TreeSet errorShapes) { - final String dafnyUnknownErrorType = "%s.Error_Opaque" - .formatted(DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(serviceShape.getId())); - - // Collect into TreeSet so that we generate code in a deterministic order (lexicographic, in particular) - final TokenTree knownErrorCases = TokenTree.of(errorShapes.stream() + // Collect into TreeSet so that we generate code in a deterministic order (lexicographic, in particular) + final TokenTree knownErrorCases = TokenTree + .of( + errorShapes + .stream() .map(errorShape -> { - final ShapeId errorShapeId = errorShape.getId(); - final String sdkErrorType = nameResolver.baseTypeForShape(errorShapeId); - final String errorConverter = DotNetNameResolver.qualifiedTypeConverter(errorShapeId, TO_DAFNY); - // InvalidEndpointException does not exist in v2 of the sdk - if (sdkErrorType.endsWith("InvalidEndpointException")) { - return Token.of(""); - } - return Token.of(""" - case %s e: - return %s(e); - """.formatted(sdkErrorType, errorConverter)); - })).lineSeparated(); - - final TokenTree unknownErrorCase = Token.of(""" - default: - return new %s(value); - """.formatted(dafnyUnknownErrorType)); - final TokenTree cases = TokenTree.of(knownErrorCases, unknownErrorCase).lineSeparated(); - final TokenTree body = Token.of("switch (value)").append(cases.braced()); - return body; - } - - @Override - protected TokenTree errorFromDanyBody(final TreeSet errorShapes) { - // Handle the modeled exceptions. - final TokenTree modeledExceptionsFromDafny = TokenTree.of(errorShapes + final ShapeId errorShapeId = errorShape.getId(); + final String sdkErrorType = nameResolver.baseTypeForShape( + errorShapeId + ); + final String errorConverter = + DotNetNameResolver.qualifiedTypeConverter(errorShapeId, TO_DAFNY); + // InvalidEndpointException does not exist in v2 of the sdk + if (sdkErrorType.endsWith("InvalidEndpointException")) { + return Token.of(""); + } + return Token.of( + """ + case %s e: + return %s(e); + """.formatted(sdkErrorType, errorConverter) + ); + }) + ) + .lineSeparated(); + + final TokenTree unknownErrorCase = Token.of( + """ + default: + return new %s(value); + """.formatted(dafnyUnknownErrorType) + ); + final TokenTree cases = TokenTree + .of(knownErrorCases, unknownErrorCase) + .lineSeparated(); + final TokenTree body = Token.of("switch (value)").append(cases.braced()); + return body; + } + + @Override + protected TokenTree errorFromDanyBody( + final TreeSet errorShapes + ) { + // Handle the modeled exceptions. + final TokenTree modeledExceptionsFromDafny = TokenTree + .of( + errorShapes .stream() .map(errorShape -> { - final ShapeId modeledErrorShapeId = errorShape.getId(); - if (modeledErrorShapeId.getName().endsWith("InvalidEndpointException")) { - return Token.of(""); - } - return Token.of("case %1$s dafnyVal:\nreturn %2$s(dafnyVal);".formatted( - nameResolver.dafnyTypeForShape(modeledErrorShapeId), - DotNetNameResolver.typeConverterForShape(modeledErrorShapeId, FROM_DAFNY) - )); - })).lineSeparated(); - - // Handle the special cases that were cast to the root service exception. - // TODO: We could look up the AWS SDK Base Service Exception, and possibly return that... - final TokenTree handleBaseFromDafny = TokenTree - .of( - "case %1$s dafnyVal:" - .formatted(DotNetNameResolver.dafnyUnknownErrorTypeForServiceShape(serviceShape)), - "return new SystemException(dafnyVal._obj.ToString());", - "default:", - "// The switch MUST be complete for _IError, so `value` MUST NOT be an _IError. (How did you get here?)", - "return new SystemException();;" - ) - .lineSeparated(); - - // Wrap all the converters into a switch statement. - final TokenTree fromDafnySwitchCases = TokenTree - .of( - modeledExceptionsFromDafny, - handleBaseFromDafny - ).lineSeparated() - .braced(); - - final TokenTree fromDafnyBody = TokenTree.of( - TokenTree.of("switch(value)"), fromDafnySwitchCases).lineSeparated(); - return fromDafnyBody; - } + final ShapeId modeledErrorShapeId = errorShape.getId(); + if ( + modeledErrorShapeId.getName().endsWith("InvalidEndpointException") + ) { + return Token.of(""); + } + return Token.of( + "case %1$s dafnyVal:\nreturn %2$s(dafnyVal);".formatted( + nameResolver.dafnyTypeForShape(modeledErrorShapeId), + DotNetNameResolver.typeConverterForShape( + modeledErrorShapeId, + FROM_DAFNY + ) + ) + ); + }) + ) + .lineSeparated(); + + // Handle the special cases that were cast to the root service exception. + // TODO: We could look up the AWS SDK Base Service Exception, and possibly return that... + final TokenTree handleBaseFromDafny = TokenTree + .of( + "case %1$s dafnyVal:".formatted( + DotNetNameResolver.dafnyUnknownErrorTypeForServiceShape( + serviceShape + ) + ), + "return new SystemException(dafnyVal._obj.ToString());", + "default:", + "// The switch MUST be complete for _IError, so `value` MUST NOT be an _IError. (How did you get here?)", + "return new SystemException();;" + ) + .lineSeparated(); + + // Wrap all the converters into a switch statement. + final TokenTree fromDafnySwitchCases = TokenTree + .of(modeledExceptionsFromDafny, handleBaseFromDafny) + .lineSeparated() + .braced(); + + final TokenTree fromDafnyBody = TokenTree + .of(TokenTree.of("switch(value)"), fromDafnySwitchCases) + .lineSeparated(); + return fromDafnyBody; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/DotNetNameResolver.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/DotNetNameResolver.java index 5f23f8e26e..377a03987b 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/DotNetNameResolver.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/DotNetNameResolver.java @@ -6,6 +6,17 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Joiner; import com.google.common.base.Splitter; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import java.util.Set; +import java.util.function.Function; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Stream; +import javax.annotation.Nullable; import software.amazon.polymorph.smithydafny.DafnyNameResolver; import software.amazon.polymorph.smithydotnet.nativeWrapper.NativeWrapperCodegen; import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; @@ -21,933 +32,1148 @@ import software.amazon.smithy.model.traits.ErrorTrait; import software.amazon.smithy.utils.StringUtils; -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.function.Function; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Stream; - /** * Provides a consistent mapping between names of model Shapes and generated identifiers. */ public class DotNetNameResolver { - private final Model model; - protected final ServiceShape serviceShape; - - public DotNetNameResolver(Model model, ServiceShape serviceShape) { - this.model = model; - this.serviceShape = serviceShape; - } - private static final Set C_SHARP_BUILT_IN_VALUE_TYPES = Set.of( - // integral numeric types - "sbyte", "byte", "short", "ushort", "int", "uint", "long", "ulong", "nint", "nuint", - // floating-point numeric types - "float", "double", "decimal", - // other primitives - "bool", "char", - // other non-primitive value types - "System.DateTime" + private final Model model; + protected final ServiceShape serviceShape; + + public DotNetNameResolver(Model model, ServiceShape serviceShape) { + this.model = model; + this.serviceShape = serviceShape; + } + + private static final Set C_SHARP_BUILT_IN_VALUE_TYPES = Set.of( + // integral numeric types + "sbyte", + "byte", + "short", + "ushort", + "int", + "uint", + "long", + "ulong", + "nint", + "nuint", + // floating-point numeric types + "float", + "double", + "decimal", + // other primitives + "bool", + "char", + // other non-primitive value types + "System.DateTime" + ); + + public static final String TYPE_CONVERSION_CLASS_NAME = "TypeConversion"; + + /** + * Returns the C# namespace containing the C# implementation/interface for the given shape ID. + */ + public String namespaceForShapeId(final ShapeId shapeId) { + // TODO remove special AWS SDK special-case when https://github.com/smithy-lang/smithy-dafny/issues/7 is resolved + final Function segmentMapper = + AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId) + ? StringUtils::capitalize + : DotNetNameResolver::capitalizeNamespaceSegment; + + return convertToCSharpNamespaceWithSegmentMapper( + shapeId.getNamespace(), + segmentMapper ); - - public static final String TYPE_CONVERSION_CLASS_NAME = "TypeConversion"; - - /** - * Returns the C# namespace containing the C# implementation/interface for the given shape ID. - */ - public String namespaceForShapeId(final ShapeId shapeId) { - // TODO remove special AWS SDK special-case when https://github.com/smithy-lang/smithy-dafny/issues/7 is resolved - final Function segmentMapper = AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId) - ? StringUtils::capitalize - : DotNetNameResolver::capitalizeNamespaceSegment; - - return convertToCSharpNamespaceWithSegmentMapper(shapeId.getNamespace(), segmentMapper); - } - - public static String convertToCSharpNamespaceWithSegmentMapper(final String namespace, final Function segmentMapper) { - Stream parts = Splitter.on('.') - .splitToList(namespace) - .stream() - .map(segmentMapper); - return Joiner.on('.').join(parts.iterator()); - } - - /** - * Returns the correctly-capitalized form of the given namespace segment. - * This is PascalCase except that known acronyms are UPPERCASE. - * The input segment must be strict PascalCase; only - *

- * Examples: - *

    - *
  • "fooBar" becomes "FooBar"
  • - *
  • "encryptionSdk" becomes "EncryptionSDK"
  • - *
  • "KmsKeyring" becomes "KMSKeyring"
  • - *
- */ - @VisibleForTesting - public static String capitalizeNamespaceSegment(final String segment) { - final StringBuilder result = new StringBuilder(segment.length()); - final Matcher matcher = NAMESPACE_SEGMENT_WORD.matcher(segment); - // Invariant: offset is either 0, or one more than the end index of a word - int offset = 0; - while (offset < segment.length()) { - if (!(matcher.find(offset) && (matcher.start() == offset))) { - // No characters allowed between words - throw new IllegalArgumentException("No namespace segment found starting at index %s".formatted(offset)); - } - final String uppercased = matcher.group().toUpperCase(); - if (KNOWN_ACRONYMS.contains(uppercased)) { - result.append(uppercased); - } else { - result.append(StringUtils.capitalize(matcher.group())); - } - offset = matcher.end(); - } - assert offset == segment.length(); - return result.toString(); - } - - // A "word" is either a nonempty sequence of digits, - // or a nonempty sequence of letters of which only the first may be uppercase. - private static final Pattern NAMESPACE_SEGMENT_WORD = Pattern.compile("\\d+|\\p{Alpha}\\p{Lower}*"); - - private static final Set KNOWN_ACRONYMS = Set.of( - "AWS", - "KMS", - "SDK", - "AES", - "RSA" + } + + public static String convertToCSharpNamespaceWithSegmentMapper( + final String namespace, + final Function segmentMapper + ) { + Stream parts = Splitter + .on('.') + .splitToList(namespace) + .stream() + .map(segmentMapper); + return Joiner.on('.').join(parts.iterator()); + } + + /** + * Returns the correctly-capitalized form of the given namespace segment. + * This is PascalCase except that known acronyms are UPPERCASE. + * The input segment must be strict PascalCase; only + *

+ * Examples: + *

    + *
  • "fooBar" becomes "FooBar"
  • + *
  • "encryptionSdk" becomes "EncryptionSDK"
  • + *
  • "KmsKeyring" becomes "KMSKeyring"
  • + *
+ */ + @VisibleForTesting + public static String capitalizeNamespaceSegment(final String segment) { + final StringBuilder result = new StringBuilder(segment.length()); + final Matcher matcher = NAMESPACE_SEGMENT_WORD.matcher(segment); + // Invariant: offset is either 0, or one more than the end index of a word + int offset = 0; + while (offset < segment.length()) { + if (!(matcher.find(offset) && (matcher.start() == offset))) { + // No characters allowed between words + throw new IllegalArgumentException( + "No namespace segment found starting at index %s".formatted(offset) + ); + } + final String uppercased = matcher.group().toUpperCase(); + if (KNOWN_ACRONYMS.contains(uppercased)) { + result.append(uppercased); + } else { + result.append(StringUtils.capitalize(matcher.group())); + } + offset = matcher.end(); + } + assert offset == segment.length(); + return result.toString(); + } + + // A "word" is either a nonempty sequence of digits, + // or a nonempty sequence of letters of which only the first may be uppercase. + private static final Pattern NAMESPACE_SEGMENT_WORD = Pattern.compile( + "\\d+|\\p{Alpha}\\p{Lower}*" + ); + + private static final Set KNOWN_ACRONYMS = Set.of( + "AWS", + "KMS", + "SDK", + "AES", + "RSA" + ); + + public String namespaceForService() { + return namespaceForShapeId(serviceShape.getId()); + } + + public String clientForService() { + return serviceShape.hasTrait(LocalServiceTrait.class) + ? serviceShape.expectTrait(LocalServiceTrait.class).getSdkId() + : serviceShape.getId().getName(); + } + + /** + * Returns the name for the service's base exception class. This exception class does not appear in the model, but + * instead serves as the parent class of all modeled (concrete) exception classes. + */ + public String classForBaseServiceException(final ServiceShape serviceShape) { + // TODO Currently we have this hardcoded to remove 'Factory' from service names + // that include it, however this should likely be controlled via a custom trait + final String serviceName = ModelUtils.serviceNameWithoutTrailingFactory( + serviceShape + ); + return "%sBaseException".formatted(serviceName); + } + + /** + * Returns the concrete service exception, as compared to + * {@link DotNetNameResolver#classForBaseServiceException(ServiceShape)}, + * which returns the service's common Exception. + */ + public static String classForConcreteServiceException( + final ServiceShape serviceShape + ) { + // TODO Currently we have this hardcoded to remove 'Factory' from service names + // that include it, however this should likely be controlled via a custom trait + final String serviceName = ModelUtils.serviceNameWithoutTrailingFactory( + serviceShape + ); + return "%sException".formatted(serviceName); + } + + public String classForBaseServiceException() { + return classForBaseServiceException(serviceShape); + } + + public String classForSpecificServiceException( + final ShapeId structureShapeId + ) { + final StructureShape shape = model.expectShape( + structureShapeId, + StructureShape.class + ); + // Sanity check + assert shape.hasTrait(ErrorTrait.class); + return structureShapeId.getName(); + } + + public String methodForOperation(final ShapeId operationShapeId) { + return model + .expectShape(operationShapeId, OperationShape.class) + .getId() + .getName(); + } + + public String abstractMethodForOperation(final ShapeId operationShapeId) { + return String.format("_%s", methodForOperation(operationShapeId)); + } + + /** + * Returns the name of the class generated for the given structure shape. Note that this method is only valid for + * structure shapes that will have a corresponding generated class. + */ + public String classForStructure(final ShapeId structureShapeId) { + final StructureShape structureShape = model.expectShape( + structureShapeId, + StructureShape.class ); - public String namespaceForService() { - return namespaceForShapeId(serviceShape.getId()); - } - - public String clientForService() { - return serviceShape.hasTrait(LocalServiceTrait.class) - ? serviceShape.expectTrait(LocalServiceTrait.class).getSdkId() - : serviceShape.getId().getName(); - } + // Sanity check that we aren't using this method for non-generated structures + assert !structureShape.hasTrait(ReferenceTrait.class); + assert !structureShape.hasTrait(PositionalTrait.class); - /** - * Returns the name for the service's base exception class. This exception class does not appear in the model, but - * instead serves as the parent class of all modeled (concrete) exception classes. - */ - public String classForBaseServiceException(final ServiceShape serviceShape) { - // TODO Currently we have this hardcoded to remove 'Factory' from service names - // that include it, however this should likely be controlled via a custom trait - final String serviceName = ModelUtils.serviceNameWithoutTrailingFactory(serviceShape); - return "%sBaseException".formatted(serviceName); - } + // Sanity check that we aren't using this method for generated error structures + assert !structureShape.hasTrait(ErrorTrait.class); - /** - * Returns the concrete service exception, as compared to - * {@link DotNetNameResolver#classForBaseServiceException(ServiceShape)}, - * which returns the service's common Exception. - */ - public static String classForConcreteServiceException(final ServiceShape serviceShape) { - // TODO Currently we have this hardcoded to remove 'Factory' from service names - // that include it, however this should likely be controlled via a custom trait - final String serviceName = ModelUtils.serviceNameWithoutTrailingFactory(serviceShape); - return "%sException".formatted(serviceName); - } + return structureShape.getId().getName(); + } - public String classForBaseServiceException() { - return classForBaseServiceException(serviceShape); - } + public String classForUnion(final ShapeId unionShapeId) { + final UnionShape unionShape = model.expectShape( + unionShapeId, + UnionShape.class + ); - public String classForSpecificServiceException(final ShapeId structureShapeId) { - final StructureShape shape = model.expectShape(structureShapeId, StructureShape.class); - // Sanity check - assert shape.hasTrait(ErrorTrait.class); - return structureShapeId.getName(); + return unionShape.getId().getName(); + } + + private static final Map< + String, + String + > NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME; + private static final Map NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE; + + static { + NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME = + Map.ofEntries( + Map.entry("String", "string"), + Map.entry("Blob", "System.IO.MemoryStream"), + Map.entry("Boolean", "bool"), + Map.entry("PrimitiveBoolean", "bool"), + Map.entry("Byte", "sbyte"), + Map.entry("PrimitiveByte", "sbyte"), + Map.entry("Short", "short"), + Map.entry("PrimitiveShort", "short"), + Map.entry("Integer", "int"), + Map.entry("PrimitiveInteger", "int"), + Map.entry("Long", "long"), + Map.entry("PrimitiveLong", "long"), + Map.entry("Float", "float"), + Map.entry("PrimitiveFloat", "float"), + Map.entry("Double", "double"), + Map.entry("PrimitiveDouble", "double"), + Map.entry("Timestamp", "System.DateTime") + ); + NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE = + Map.ofEntries( + Map.entry(ShapeType.BLOB, "System.IO.MemoryStream"), + Map.entry(ShapeType.BOOLEAN, "bool"), + Map.entry(ShapeType.STRING, "string"), + Map.entry(ShapeType.BYTE, "sbyte"), + Map.entry(ShapeType.SHORT, "short"), + Map.entry(ShapeType.INTEGER, "int"), + Map.entry(ShapeType.LONG, "long"), + Map.entry(ShapeType.FLOAT, "float"), + Map.entry(ShapeType.DOUBLE, "double"), + Map.entry(ShapeType.TIMESTAMP, "System.DateTime") + ); + } + + /** + * Returns the C# type used to store values of the given member shape within a structure class. + *

+ * This is always nullable, so it can represent uninitialized values. + */ + public String classFieldTypeForStructureMember( + final MemberShape memberShape + ) { + return nullableTypeForStructureMember(memberShape); + } + + /** + * Returns the C# type used to expose values of the given member shape as a property of its structure class. + *

+ * This is always non-nullable. + */ + public String classPropertyTypeForStructureMember( + final MemberShape memberShape + ) { + if (memberShape.getTarget().getName().endsWith("DdbClientReference")) { + return AwsSdkDotNetNameResolver.DDB_NET_INTERFACE_NAME; + } + return baseTypeForShape(memberShape.getTarget()); + } + + protected String baseTypeForString(final StringShape stringShape) { + final ShapeId shapeId = stringShape.getId(); + final String namespace = namespaceForShapeId(shapeId); + return stringShape.hasTrait(EnumTrait.class) + ? "%s.%s".formatted(namespace, classForEnum(shapeId)) + : "string"; + } + + protected String baseTypeForList(final ListShape listShape) { + if ( + StringUtils.equals( + baseTypeForMember(listShape.getMember()), + AwsSdkDotNetNameResolver.DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE + ) + ) { + return "System.Collections.Generic.List<%s>".formatted( + AwsSdkDotNetNameResolver.DDB_V2_ATTRIBUTE_VALUE + ); } - - public String methodForOperation(final ShapeId operationShapeId) { - return model.expectShape(operationShapeId, OperationShape.class).getId().getName(); + return "System.Collections.Generic.List<%s>".formatted( + baseTypeForMember(listShape.getMember()) + ); + } + + protected String baseTypeForMap(final MapShape mapShape) { + if ( + StringUtils.equals( + baseTypeForMember(mapShape.getValue()), + AwsSdkDotNetNameResolver.DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE + ) + ) { + return "System.Collections.Generic.Dictionary<%s, %s>".formatted( + baseTypeForMember(mapShape.getKey()), + AwsSdkDotNetNameResolver.DDB_V2_ATTRIBUTE_VALUE + ); } - - public String abstractMethodForOperation(final ShapeId operationShapeId) { - return String.format("_%s", methodForOperation(operationShapeId)); + return "System.Collections.Generic.Dictionary<%s, %s>".formatted( + baseTypeForMember(mapShape.getKey()), + baseTypeForMember(mapShape.getValue()) + ); + } + + protected String baseTypeForStructure(final StructureShape structureShape) { + // The base type of a reference structure is the base trait for its referent + final Optional referenceTraitOptional = + structureShape.getTrait(ReferenceTrait.class); + if (referenceTraitOptional.isPresent()) { + final ReferenceTrait referenceTrait = referenceTraitOptional.get(); + final ShapeId referentShapeId = referenceTrait.getReferentId(); + if (model.getShape(referentShapeId).isEmpty()) { + // TODO: support external referents + throw new IllegalStateException( + "Structure %s has external referent %s, this is unsupported".formatted( + structureShape.getId(), + referentShapeId + ) + ); + } + return baseTypeForShape(referentShapeId); } - /** - * Returns the name of the class generated for the given structure shape. Note that this method is only valid for - * structure shapes that will have a corresponding generated class. - */ - public String classForStructure(final ShapeId structureShapeId) { - final StructureShape structureShape = model.expectShape(structureShapeId, StructureShape.class); - - // Sanity check that we aren't using this method for non-generated structures - assert !structureShape.hasTrait(ReferenceTrait.class); - assert !structureShape.hasTrait(PositionalTrait.class); - - // Sanity check that we aren't using this method for generated error structures - assert !structureShape.hasTrait(ErrorTrait.class); - - return structureShape.getId().getName(); + // The base type of a positional structure is the base type of its sole member + final Optional positionalMember = + ModelUtils.getPositionalStructureMember(structureShape); + if (positionalMember.isPresent()) { + return baseTypeForShape(positionalMember.get()); } - public String classForUnion(final ShapeId unionShapeId) { - final UnionShape unionShape = model.expectShape(unionShapeId, UnionShape.class); + final String structureNamespace = namespaceForShapeId( + structureShape.getId() + ); - return unionShape.getId().getName(); + // The base type of an error structure is the corresponding generated exception class + if (structureShape.hasTrait(ErrorTrait.class)) { + return "%s.%s".formatted( + structureNamespace, + classForSpecificServiceException(structureShape.getId()) + ); } - private static final Map NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME; - private static final Map NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE; - - static { - NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME = Map.ofEntries( - Map.entry("String", "string"), - Map.entry("Blob", "System.IO.MemoryStream"), - Map.entry("Boolean", "bool"), - Map.entry("PrimitiveBoolean", "bool"), - Map.entry("Byte", "sbyte"), - Map.entry("PrimitiveByte", "sbyte"), - Map.entry("Short", "short"), - Map.entry("PrimitiveShort", "short"), - Map.entry("Integer", "int"), - Map.entry("PrimitiveInteger", "int"), - Map.entry("Long", "long"), - Map.entry("PrimitiveLong", "long"), - Map.entry("Float", "float"), - Map.entry("PrimitiveFloat", "float"), - Map.entry("Double", "double"), - Map.entry("PrimitiveDouble", "double"), - Map.entry("Timestamp", "System.DateTime") + // The base type of any other structure is the name of the corresponding generated class + return "%s.%s".formatted( + structureNamespace, + classForStructure(structureShape.getId()) + ); + } + + protected String baseTypeForUnion(final UnionShape unionShape) { + final ShapeId unionId = unionShape.getId(); + final String namespace = namespaceForShapeId(unionId); + + return "%s.%s".formatted(namespace, unionId.getName()); + } + + protected String baseTypeForMember(final MemberShape memberShape) { + final String baseType = baseTypeForShape(memberShape.getTarget()); + final boolean isOptional = memberShapeIsOptional(memberShape); + return isOptional ? baseTypeForOptionalMember(memberShape) : baseType; + } + + protected String baseTypeForOptionalMember(final MemberShape memberShape) { + final String baseType = baseTypeForShape(memberShape.getTarget()); + if (StringUtils.equals(baseType, "Amazon.DynamoDBv2.IAmazonDynamoDBv2")) { + return AwsSdkDotNetNameResolver.DDB_NET_INTERFACE_NAME; + } + // We annotate C# value types with `?` to make them nullable. + // We cannot do the same for C# reference types since those types are already nullable by design. + // TODO: nullable reference types appear to be supported in C# 8.0+. Maybe revisit this. + return isValueType(memberShape.getTarget()) ? baseType + "?" : baseType; + } + + protected String baseTypeForService(final ServiceShape serviceShape) { + final ShapeId shapeId = serviceShape.getId(); + + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { + return new AwsSdkDotNetNameResolver(model, serviceShape) + .baseTypeForService(serviceShape); + } + + // Base type for local service is defined here + return "%s.%s".formatted(namespaceForShapeId(shapeId), shapeId.getName()); + } + + protected String baseTypeForResource(final ResourceShape resourceShape) { + final ShapeId shapeId = resourceShape.getId(); + return "%s.%s".formatted( + namespaceForShapeId(shapeId), + interfaceForResource(shapeId) + ); + } + + public boolean isValueType(final ShapeId shapeId) { + final String baseType = baseTypeForShape(shapeId); + return C_SHARP_BUILT_IN_VALUE_TYPES.contains(baseType); + } + + @SuppressWarnings("OptionalGetWithoutIsPresent") + public String baseTypeForShape(final ShapeId shapeId) { + final Shape shape = model.expectShape(shapeId); + + // First check if this is a built-in Smithy shape. If so, we just map it to the native type and return + if (ModelUtils.isSmithyApiShape(shapeId)) { + @Nullable + final String nativeTypeName = + NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME.get(shapeId.getName()); + return Objects.requireNonNull( + nativeTypeName, + () -> String.format("No native type for prelude shape %s", shapeId) + ); + } + + if (!AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { + // The shape is not in an AWS Service, + // so use the base type switch + return baseTypeSwitch(shape); + } else { + // The shape *is* an AWS Service shape, + // therefore it MAY have specific naming requirements. + // These requirements SHOULD be handled in the `AwsSdkDotNetNameResolver`. + final ServiceShape awsSdkService = + AwsSdkNameResolverHelpers.getAwsServiceShape(model, shapeId); + String value = new AwsSdkDotNetNameResolver(model, awsSdkService) + .baseTypeSwitch(shape); + if (value.equals("Com.Amazonaws.Dynamodb.AttributeValue")) { + return "Amazon.DynamoDBv2.Model.AttributeValue"; + } else { + return value; + } + } + } + + // There is a relationship between the AWS SDK and LocalService Dafny development. + // While many of the type names are the same they are not all the same. + // As types are used from different namespaces, + // `baseTypeForShape` needs some way to swap between + // the AWS naming conventions and LocalService conventions. + // However, the current AwsSdkDotNetNameResolver defers to the DotNetNameResolver + // without this extra method we would have a stack overflow when generating AWS SDK models. + protected String baseTypeSwitch(final Shape shape) { + return switch (shape.getType()) { + // For supported simple shapes, just map to native types + case BLOB, BOOLEAN, INTEGER, LONG, TIMESTAMP, DOUBLE -> { + @Nullable + final String nativeTypeName = NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE.get( + shape.getType() ); - NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE = Map.ofEntries( - Map.entry(ShapeType.BLOB, "System.IO.MemoryStream"), - Map.entry(ShapeType.BOOLEAN, "bool"), - Map.entry(ShapeType.STRING, "string"), - Map.entry(ShapeType.BYTE, "sbyte"), - Map.entry(ShapeType.SHORT, "short"), - Map.entry(ShapeType.INTEGER, "int"), - Map.entry(ShapeType.LONG, "long"), - Map.entry(ShapeType.FLOAT, "float"), - Map.entry(ShapeType.DOUBLE, "double"), - Map.entry(ShapeType.TIMESTAMP, "System.DateTime") + yield Objects.requireNonNull( + nativeTypeName, + () -> + String.format("No native type for shape type %s", shape.getType()) ); - } - - /** - * Returns the C# type used to store values of the given member shape within a structure class. - *

- * This is always nullable, so it can represent uninitialized values. - */ - public String classFieldTypeForStructureMember(final MemberShape memberShape) { - return nullableTypeForStructureMember(memberShape); - } - - /** - * Returns the C# type used to expose values of the given member shape as a property of its structure class. - *

- * This is always non-nullable. - */ - public String classPropertyTypeForStructureMember(final MemberShape memberShape) { - if (memberShape.getTarget().getName().endsWith("DdbClientReference")) { - return AwsSdkDotNetNameResolver.DDB_NET_INTERFACE_NAME; - } - return baseTypeForShape(memberShape.getTarget()); - } - - protected String baseTypeForString(final StringShape stringShape) { - final ShapeId shapeId = stringShape.getId(); - final String namespace = namespaceForShapeId(shapeId); - return stringShape.hasTrait(EnumTrait.class) - ? "%s.%s".formatted(namespace, classForEnum(shapeId)) - : "string"; - } - - protected String baseTypeForList(final ListShape listShape) { - if (StringUtils.equals(baseTypeForMember(listShape.getMember()), - AwsSdkDotNetNameResolver.DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE)) { - return "System.Collections.Generic.List<%s>".formatted( - AwsSdkDotNetNameResolver.DDB_V2_ATTRIBUTE_VALUE); - } - return "System.Collections.Generic.List<%s>".formatted(baseTypeForMember(listShape.getMember())); - } - - protected String baseTypeForMap(final MapShape mapShape) { - if (StringUtils.equals(baseTypeForMember(mapShape.getValue()), - AwsSdkDotNetNameResolver.DDB_ATTRIBUTE_VALUE_MODEL_NAMESPACE)){ - return "System.Collections.Generic.Dictionary<%s, %s>".formatted( - baseTypeForMember(mapShape.getKey()), - AwsSdkDotNetNameResolver.DDB_V2_ATTRIBUTE_VALUE); - } - return "System.Collections.Generic.Dictionary<%s, %s>".formatted( - baseTypeForMember(mapShape.getKey()), - baseTypeForMember(mapShape.getValue())); - } - - protected String baseTypeForStructure(final StructureShape structureShape) { - // The base type of a reference structure is the base trait for its referent - final Optional referenceTraitOptional = structureShape.getTrait(ReferenceTrait.class); - if (referenceTraitOptional.isPresent()) { - final ReferenceTrait referenceTrait = referenceTraitOptional.get(); - final ShapeId referentShapeId = referenceTrait.getReferentId(); - if (model.getShape(referentShapeId).isEmpty()) { - // TODO: support external referents - throw new IllegalStateException("Structure %s has external referent %s, this is unsupported" - .formatted(structureShape.getId(), referentShapeId)); - } - return baseTypeForShape(referentShapeId); - } - - // The base type of a positional structure is the base type of its sole member - final Optional positionalMember = ModelUtils.getPositionalStructureMember(structureShape); - if (positionalMember.isPresent()) { - return baseTypeForShape(positionalMember.get()); - } - - final String structureNamespace = namespaceForShapeId(structureShape.getId()); - - // The base type of an error structure is the corresponding generated exception class - if (structureShape.hasTrait(ErrorTrait.class)) { - return "%s.%s".formatted(structureNamespace, classForSpecificServiceException(structureShape.getId())); - } - - // The base type of any other structure is the name of the corresponding generated class - return "%s.%s".formatted(structureNamespace, classForStructure(structureShape.getId())); - } - - protected String baseTypeForUnion(final UnionShape unionShape) { - final ShapeId unionId = unionShape.getId(); - final String namespace = namespaceForShapeId(unionId); - - return "%s.%s".formatted(namespace, unionId.getName()); - } - - - protected String baseTypeForMember(final MemberShape memberShape) { - final String baseType = baseTypeForShape(memberShape.getTarget()); - final boolean isOptional = memberShapeIsOptional(memberShape); - return isOptional ? baseTypeForOptionalMember(memberShape) : baseType; - } - - protected String baseTypeForOptionalMember(final MemberShape memberShape) { - final String baseType = baseTypeForShape(memberShape.getTarget()); - if (StringUtils.equals(baseType, "Amazon.DynamoDBv2.IAmazonDynamoDBv2")) { - return AwsSdkDotNetNameResolver.DDB_NET_INTERFACE_NAME; - } - // We annotate C# value types with `?` to make them nullable. - // We cannot do the same for C# reference types since those types are already nullable by design. - // TODO: nullable reference types appear to be supported in C# 8.0+. Maybe revisit this. - return isValueType(memberShape.getTarget()) ? baseType + "?" : baseType; - } - - protected String baseTypeForService(final ServiceShape serviceShape) { - final ShapeId shapeId = serviceShape.getId(); - - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { - return new AwsSdkDotNetNameResolver(model, serviceShape).baseTypeForService(serviceShape); - } - - // Base type for local service is defined here - return "%s.%s".formatted( - namespaceForShapeId(shapeId), shapeId.getName()); - } - - protected String baseTypeForResource(final ResourceShape resourceShape) { - final ShapeId shapeId = resourceShape.getId(); - return "%s.%s".formatted( - namespaceForShapeId(shapeId), interfaceForResource(shapeId)); - } - - public boolean isValueType(final ShapeId shapeId) { - final String baseType = baseTypeForShape(shapeId); - return C_SHARP_BUILT_IN_VALUE_TYPES.contains(baseType); - } - - @SuppressWarnings("OptionalGetWithoutIsPresent") - public String baseTypeForShape(final ShapeId shapeId) { - final Shape shape = model.expectShape(shapeId); - - // First check if this is a built-in Smithy shape. If so, we just map it to the native type and return - if (ModelUtils.isSmithyApiShape(shapeId)) { - @Nullable final String nativeTypeName = NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME.get(shapeId.getName()); - return Objects.requireNonNull(nativeTypeName, - () -> String.format("No native type for prelude shape %s", shapeId)); - } - - if (!AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { - // The shape is not in an AWS Service, - // so use the base type switch - return baseTypeSwitch(shape); - } else { - // The shape *is* an AWS Service shape, - // therefore it MAY have specific naming requirements. - // These requirements SHOULD be handled in the `AwsSdkDotNetNameResolver`. - final ServiceShape awsSdkService = AwsSdkNameResolverHelpers.getAwsServiceShape(model, shapeId); - String value = new AwsSdkDotNetNameResolver(model, awsSdkService).baseTypeSwitch(shape); - if (value.equals("Com.Amazonaws.Dynamodb.AttributeValue")) { - return "Amazon.DynamoDBv2.Model.AttributeValue"; - } else { - return value; - } - } - } - - // There is a relationship between the AWS SDK and LocalService Dafny development. - // While many of the type names are the same they are not all the same. - // As types are used from different namespaces, - // `baseTypeForShape` needs some way to swap between - // the AWS naming conventions and LocalService conventions. - // However, the current AwsSdkDotNetNameResolver defers to the DotNetNameResolver - // without this extra method we would have a stack overflow when generating AWS SDK models. - protected String baseTypeSwitch(final Shape shape) - { - return switch (shape.getType()) { - // For supported simple shapes, just map to native types - case BLOB, BOOLEAN, INTEGER, LONG, TIMESTAMP, DOUBLE -> { - @Nullable final String nativeTypeName = NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE.get(shape.getType()); - yield Objects.requireNonNull(nativeTypeName, - () -> String.format("No native type for shape type %s", shape.getType())); - } - - case STRING -> baseTypeForString(shape.asStringShape().get()); - case LIST -> baseTypeForList(shape.asListShape().get()); - case MAP -> baseTypeForMap(shape.asMapShape().get()); - case STRUCTURE -> baseTypeForStructure(shape.asStructureShape().get()); - case MEMBER -> baseTypeForMember(shape.asMemberShape().get()); - case SERVICE -> baseTypeForService(shape.asServiceShape().get()); - case RESOURCE -> baseTypeForResource(shape.asResourceShape().get()); - case UNION -> baseTypeForUnion(shape.asUnionShape().get()); - - default -> throw new UnsupportedOperationException("Shape %s has unsupported type %s" - .formatted(shape.getId(), shape.getType())); - }; - } - - private String nullableTypeForStructureMember(final MemberShape memberShape) { - return baseTypeForOptionalMember(memberShape); - } - - /** - * Returns the name of the (private) structure class field for the given member shape. - */ - public String classFieldForStructureMember(final MemberShape memberShape) { - return "_%s".formatted(StringUtils.uncapitalize(memberShape.getMemberName())); - } - - /** - * Returns the name of the (public) structure class property for the given member shape. - */ - public String classPropertyForStructureMember(final MemberShape memberShape) { - return StringUtils.capitalize(dafnyCompilesExtra_(memberShape.getMemberName())); - } - - /** - * Returns the name of the given member shape's IsSet method. - */ - public String isSetMethodForStructureMember(final MemberShape memberShape) { - return "IsSet%s".formatted(classPropertyForStructureMember(memberShape)); - } - - /** - * Returns the name of the given member shape's IsSet member - */ - public String isSetMemberForStructureMember(final MemberShape memberShape) { - return "Is%sSet".formatted(classPropertyForStructureMember(memberShape)); - } - - /** - * Returns the name of the class property fur use as a variable name, i.e. the first letter is lower case - */ - public String variableNameForClassProperty(final MemberShape memberShape) { - String classProperty = StringUtils.capitalize(memberShape.getMemberName()); - return "var_%s%s".formatted( - StringUtils.uncapitalize(classProperty.substring(0,1)), - classProperty.substring(1)); - } - - public String interfaceForResource(final ShapeId resourceShapeId) { - return String.format("I%s", StringUtils.capitalize(resourceShapeId.getName())); - } + } + case STRING -> baseTypeForString(shape.asStringShape().get()); + case LIST -> baseTypeForList(shape.asListShape().get()); + case MAP -> baseTypeForMap(shape.asMapShape().get()); + case STRUCTURE -> baseTypeForStructure(shape.asStructureShape().get()); + case MEMBER -> baseTypeForMember(shape.asMemberShape().get()); + case SERVICE -> baseTypeForService(shape.asServiceShape().get()); + case RESOURCE -> baseTypeForResource(shape.asResourceShape().get()); + case UNION -> baseTypeForUnion(shape.asUnionShape().get()); + default -> throw new UnsupportedOperationException( + "Shape %s has unsupported type %s".formatted( + shape.getId(), + shape.getType() + ) + ); + }; + } + + private String nullableTypeForStructureMember(final MemberShape memberShape) { + return baseTypeForOptionalMember(memberShape); + } + + /** + * Returns the name of the (private) structure class field for the given member shape. + */ + public String classFieldForStructureMember(final MemberShape memberShape) { + return "_%s".formatted( + StringUtils.uncapitalize(memberShape.getMemberName()) + ); + } + + /** + * Returns the name of the (public) structure class property for the given member shape. + */ + public String classPropertyForStructureMember(final MemberShape memberShape) { + return StringUtils.capitalize( + dafnyCompilesExtra_(memberShape.getMemberName()) + ); + } + + /** + * Returns the name of the given member shape's IsSet method. + */ + public String isSetMethodForStructureMember(final MemberShape memberShape) { + return "IsSet%s".formatted(classPropertyForStructureMember(memberShape)); + } + + /** + * Returns the name of the given member shape's IsSet member + */ + public String isSetMemberForStructureMember(final MemberShape memberShape) { + return "Is%sSet".formatted(classPropertyForStructureMember(memberShape)); + } + + /** + * Returns the name of the class property fur use as a variable name, i.e. the first letter is lower case + */ + public String variableNameForClassProperty(final MemberShape memberShape) { + String classProperty = StringUtils.capitalize(memberShape.getMemberName()); + return "var_%s%s".formatted( + StringUtils.uncapitalize(classProperty.substring(0, 1)), + classProperty.substring(1) + ); + } + + public String interfaceForResource(final ShapeId resourceShapeId) { + return String.format( + "I%s", + StringUtils.capitalize(resourceShapeId.getName()) + ); + } - public String baseClassForResource(final ShapeId resourceShapeId) { - return String.format("%sBase", StringUtils.capitalize(resourceShapeId.getName())); + public String baseClassForResource(final ShapeId resourceShapeId) { + return String.format( + "%sBase", + StringUtils.capitalize(resourceShapeId.getName()) + ); + } + + public String shimClassForResource(final ShapeId resourceShapeId) { + return StringUtils.capitalize(resourceShapeId.getName()); + } + + public String nativeWrapperClassForResource(final ShapeId resourceShapeId) { + return "%s_%s".formatted( + NativeWrapperCodegen.CLASS_PREFIX, + shimClassForResource(resourceShapeId) + ); + } + + public String classForEnum(final ShapeId enumShapeId) { + return StringUtils.capitalize(enumShapeId.getName()); + } + + public static String baseClassForCollectionOfErrors() { + return "CollectionOfErrors"; + } + + public static String baseClassForUnknownError() { + return "OpaqueError"; + } + + /** + * Implements {@code DafnyAst.NonglobalVariable.CompilerizeName} for strings which are valid enum definition names + * according to {@link ModelUtils#isValidEnumDefinitionName(String)}. + * + * @see CompilerizeName + */ + public static String dafnyCompiledNameForEnumDefinitionName( + final String name + ) { + if (!ModelUtils.isValidEnumDefinitionName(name)) { + throw new IllegalArgumentException( + "The enum definition name '%s' is forbidden".formatted(name) + ); + } + + // We only allow uppercase ASCII letters and underscores in enum definition names, so it suffices to replace + // each underscore with two underscores. + return dafnyCompilesExtra_(name); + } + + /** + * Returns a unique type converter method name for the given shape and type conversion direction. + *

+ * This is necessary because all type converter methods for a given model will coexist in a single class. There is a + * one-to-one mapping between shapes used in the model and type converters in the class, so the function that names + * converter methods must also be one-to-one. + */ + public static String typeConverterForShape( + final ShapeId shapeId, + final TypeConversionDirection direction + ) { + final String encodedShapeId = encodedIdentForShapeId(shapeId); + return String.format("%s_%s", direction.toString(), encodedShapeId); + } + + /** + * Returns the converter method name for the given shape and type conversion direction, qualified with the type + * conversion class name. + */ + public static String qualifiedTypeConverter( + final ShapeId shapeId, + final TypeConversionDirection direction + ) { + final String methodName = DotNetNameResolver.typeConverterForShape( + shapeId, + direction + ); + return "%s.%s".formatted( + DotNetNameResolver.TYPE_CONVERSION_CLASS_NAME, + methodName + ); + } + + /** + * Returns the type converter method name for the given service's common error shape and the given direction. + */ + public String typeConverterForCommonError( + final ServiceShape serviceShape, + final TypeConversionDirection direction + ) { + // TODO remove the service shape + return "%s_CommonError".formatted(direction.toString()); + } + + /** + * Like {@link DotNetNameResolver#typeConverterForCommonError(ServiceShape, TypeConversionDirection)}, but + * qualified with the type conversion class name. + */ + public String qualifiedTypeConverterForCommonError( + final ServiceShape serviceShape, + final TypeConversionDirection direction + ) { + final String methodName = typeConverterForCommonError( + serviceShape, + direction + ); + return "%s.%s".formatted( + DotNetNameResolver.TYPE_CONVERSION_CLASS_NAME, + methodName + ); + } + + /** + * Returns the abstract Dafny-compiled-C# type corresponding to the given shape, or the concrete type if no such + * abstract type exists. For example, a list shape is a {@code Dafny.ISequence} rather than a + * {@code Dafny.Sequence}, but an integer shape is simply an {@code int}. + *

+ * Note that this method is mutually recursive with the "dafnyTypeForA" methods (for aggregate shape types A), but + * termination is guaranteed. This is because the Smithy specification requires that if an aggregate shape has a + * path to itself (by recursively traversing through members and their targets), then the path must include a + * structure or union shape (which have no type variables). The core Smithy validation logic takes responsibility to + * ensure this. + */ + @SuppressWarnings("OptionalGetWithoutIsPresent") + public String dafnyTypeForShape(final ShapeId shapeId) { + final Shape shape = model + .getShape(shapeId) + .orElseThrow(() -> + new IllegalStateException("Cannot find shape " + shapeId) + ); + + return switch (shape.getType()) { + case BLOB, DOUBLE -> "Dafny.ISequence"; + case BOOLEAN -> "bool"; + case STRING -> dafnyTypeForString(shape.asStringShape().get()); + case INTEGER -> "int"; + case LONG -> "long"; + // TODO create/use better timestamp type in Dafny libraries + case TIMESTAMP -> "Dafny.ISequence"; + case LIST -> dafnyTypeForList(shape.asListShape().get()); + case MAP -> dafnyTypeForMap(shape.asMapShape().get()); + case STRUCTURE -> dafnyTypeForStructure(shape.asStructureShape().get()); + case MEMBER -> dafnyTypeForMember(shape.asMemberShape().get()); + case SERVICE -> dafnyTypeForService(shape.asServiceShape().get()); + case RESOURCE -> dafnyTypeForResource(shape.asResourceShape().get()); + case UNION -> dafnyTypeForUnion(shape.asUnionShape().get()); + default -> throw new UnsupportedOperationException( + "Unsupported shape " + shapeId + ); + }; + } + + public String dafnyConcreteTypeForEnum(final ShapeId shapeId) { + return dafnyTypeForEnum(shapeId, true); + } + + private String dafnyTypeForEnum( + final ShapeId shapeId, + final boolean concrete + ) { + final String typePrefix = concrete ? "" : "_I"; + // We explicitly specify the Dafny namespace just in case of collisions. + return "%s.%s%s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), + typePrefix, + shapeId.getName() + ); + } + + private String dafnyTypeForString(final StringShape stringShape) { + final ShapeId shapeId = stringShape.getId(); + if (stringShape.hasTrait(EnumTrait.class)) { + return dafnyTypeForEnum(shapeId, false); + } + if (stringShape.hasTrait(DafnyUtf8BytesTrait.class)) { + return "Dafny.ISequence"; + } + return "Dafny.ISequence"; + } + + private String dafnyTypeForList(final ListShape listShape) { + return "Dafny.ISequence<%s>".formatted( + dafnyTypeForMember(listShape.getMember()) + ); + } + + private String dafnyTypeForMap(final MapShape mapShape) { + return "Dafny.IMap<%s, %s>".formatted( + dafnyTypeForMember(mapShape.getKey()), + dafnyTypeForMember(mapShape.getValue()) + ); + } + + private String dafnyTypeForStructure(final StructureShape structureShape) { + final ShapeId shapeId = structureShape.getId(); + + // The Dafny type of a reference structure is the Dafny trait for its referent + final Optional referenceTrait = structureShape.getTrait( + ReferenceTrait.class + ); + if (referenceTrait.isPresent()) { + return dafnyTypeForShape(referenceTrait.get().getReferentId()); } - public String shimClassForResource(final ShapeId resourceShapeId) { - return StringUtils.capitalize(resourceShapeId.getName()); + // The Dafny type of a positional structure is the Dafny type of its sole member + final Optional positionalMember = + ModelUtils.getPositionalStructureMember(structureShape); + if (positionalMember.isPresent()) { + return dafnyTypeForShape(positionalMember.get()); } - public String nativeWrapperClassForResource(final ShapeId resourceShapeId) { - return "%s_%s".formatted( - NativeWrapperCodegen.CLASS_PREFIX, - shimClassForResource(resourceShapeId) + // The Dafny type of an error structure is the corresponding generated Dafny class + if (structureShape.hasTrait(ErrorTrait.class)) { + // TODO: This Error_ should be consolidated + return "%s.Error_%s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), + dafnyCompilesExtra_(shapeId) ); } - public String classForEnum(final ShapeId enumShapeId) { - return StringUtils.capitalize(enumShapeId.getName()); - } - - public static String baseClassForCollectionOfErrors() { - return "CollectionOfErrors"; - } - - public static String baseClassForUnknownError() { - return "OpaqueError"; - } - - /** - * Implements {@code DafnyAst.NonglobalVariable.CompilerizeName} for strings which are valid enum definition names - * according to {@link ModelUtils#isValidEnumDefinitionName(String)}. - * - * @see CompilerizeName - */ - public static String dafnyCompiledNameForEnumDefinitionName(final String name) { - if (!ModelUtils.isValidEnumDefinitionName(name)) { - throw new IllegalArgumentException("The enum definition name '%s' is forbidden".formatted(name)); - } - - // We only allow uppercase ASCII letters and underscores in enum definition names, so it suffices to replace - // each underscore with two underscores. - return dafnyCompilesExtra_(name); - } - - /** - * Returns a unique type converter method name for the given shape and type conversion direction. - *

- * This is necessary because all type converter methods for a given model will coexist in a single class. There is a - * one-to-one mapping between shapes used in the model and type converters in the class, so the function that names - * converter methods must also be one-to-one. - */ - public static String typeConverterForShape(final ShapeId shapeId, final TypeConversionDirection direction) { - final String encodedShapeId = encodedIdentForShapeId(shapeId); - return String.format("%s_%s", direction.toString(), encodedShapeId); - } - - /** - * Returns the converter method name for the given shape and type conversion direction, qualified with the type - * conversion class name. - */ - public static String qualifiedTypeConverter(final ShapeId shapeId, final TypeConversionDirection direction) { - final String methodName = DotNetNameResolver.typeConverterForShape(shapeId, direction); - return "%s.%s".formatted(DotNetNameResolver.TYPE_CONVERSION_CLASS_NAME, methodName); - } - - /** - * Returns the type converter method name for the given service's common error shape and the given direction. - */ - public String typeConverterForCommonError(final ServiceShape serviceShape, final TypeConversionDirection direction) { - // TODO remove the service shape - return "%s_CommonError".formatted(direction.toString()); - } - - /** - * Like {@link DotNetNameResolver#typeConverterForCommonError(ServiceShape, TypeConversionDirection)}, but - * qualified with the type conversion class name. - */ - public String qualifiedTypeConverterForCommonError(final ServiceShape serviceShape, final TypeConversionDirection direction) { - final String methodName = typeConverterForCommonError(serviceShape, direction); - return "%s.%s".formatted(DotNetNameResolver.TYPE_CONVERSION_CLASS_NAME, methodName); - } - - /** - * Returns the abstract Dafny-compiled-C# type corresponding to the given shape, or the concrete type if no such - * abstract type exists. For example, a list shape is a {@code Dafny.ISequence} rather than a - * {@code Dafny.Sequence}, but an integer shape is simply an {@code int}. - *

- * Note that this method is mutually recursive with the "dafnyTypeForA" methods (for aggregate shape types A), but - * termination is guaranteed. This is because the Smithy specification requires that if an aggregate shape has a - * path to itself (by recursively traversing through members and their targets), then the path must include a - * structure or union shape (which have no type variables). The core Smithy validation logic takes responsibility to - * ensure this. - */ - @SuppressWarnings("OptionalGetWithoutIsPresent") - public String dafnyTypeForShape(final ShapeId shapeId) { - final Shape shape = model.getShape(shapeId) - .orElseThrow(() -> new IllegalStateException("Cannot find shape " + shapeId)); - - return switch (shape.getType()) { - case BLOB, DOUBLE -> "Dafny.ISequence"; - case BOOLEAN -> "bool"; - case STRING -> dafnyTypeForString(shape.asStringShape().get()); - case INTEGER -> "int"; - case LONG -> "long"; - // TODO create/use better timestamp type in Dafny libraries - case TIMESTAMP -> "Dafny.ISequence"; - case LIST -> dafnyTypeForList(shape.asListShape().get()); - case MAP -> dafnyTypeForMap(shape.asMapShape().get()); - case STRUCTURE -> dafnyTypeForStructure(shape.asStructureShape().get()); - case MEMBER -> dafnyTypeForMember(shape.asMemberShape().get()); - case SERVICE -> dafnyTypeForService(shape.asServiceShape().get()); - case RESOURCE -> dafnyTypeForResource(shape.asResourceShape().get()); - case UNION -> dafnyTypeForUnion(shape.asUnionShape().get()); - default -> throw new UnsupportedOperationException("Unsupported shape " + shapeId); - }; - } - - public String dafnyConcreteTypeForEnum(final ShapeId shapeId) { - return dafnyTypeForEnum(shapeId, true); - } - - private String dafnyTypeForEnum(final ShapeId shapeId, final boolean concrete) { - final String typePrefix = concrete ? "" : "_I"; - // We explicitly specify the Dafny namespace just in case of collisions. - return "%s.%s%s".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), - typePrefix, - shapeId.getName()); - } - - private String dafnyTypeForString(final StringShape stringShape) { - final ShapeId shapeId = stringShape.getId(); - if (stringShape.hasTrait(EnumTrait.class)) { - return dafnyTypeForEnum(shapeId, false); - } - if (stringShape.hasTrait(DafnyUtf8BytesTrait.class)) { - return "Dafny.ISequence"; - } - return "Dafny.ISequence"; - } - - private String dafnyTypeForList(final ListShape listShape) { - return "Dafny.ISequence<%s>".formatted(dafnyTypeForMember(listShape.getMember())); - } - - private String dafnyTypeForMap(final MapShape mapShape) { - return "Dafny.IMap<%s, %s>".formatted( - dafnyTypeForMember(mapShape.getKey()), - dafnyTypeForMember(mapShape.getValue())); - } - - private String dafnyTypeForStructure(final StructureShape structureShape) { - final ShapeId shapeId = structureShape.getId(); - - // The Dafny type of a reference structure is the Dafny trait for its referent - final Optional referenceTrait = structureShape.getTrait(ReferenceTrait.class); - if (referenceTrait.isPresent()) { - return dafnyTypeForShape(referenceTrait.get().getReferentId()); - } - - // The Dafny type of a positional structure is the Dafny type of its sole member - final Optional positionalMember = ModelUtils.getPositionalStructureMember(structureShape); - if (positionalMember.isPresent()) { - return dafnyTypeForShape(positionalMember.get()); - } - - // The Dafny type of an error structure is the corresponding generated Dafny class - if (structureShape.hasTrait(ErrorTrait.class)) { - // TODO: This Error_ should be consolidated - return "%s.Error_%s".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), - dafnyCompilesExtra_(shapeId)); - } - - // The Dafny type of other structures is simply the structure's name. - // We explicitly specify the Dafny namespace just in case of collisions. - return "%s._I%s".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), - dafnyCompilesExtra_(shapeId)); - } - - private static String dafnyCompilesExtra_(final ShapeId shapeId) { - return dafnyCompilesExtra_(shapeId.getName()); - } - private static String dafnyCompilesExtra_(final String name) { - return name.replace("_", "__"); - } - - private String dafnyTypeForUnion(final UnionShape unionShape) { - final ShapeId unionId = unionShape.getId(); - - // TODO is this adequate - return "%s._I%s".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(unionId), - unionId.getName()); - } - - - /** - * Returns the name of the concrete Dafny type for the given regular (i.e. not an enum or reference) structure. - *

- * This should only be used to access members absent from the abstract type, e.g. the constructor. - */ - public String dafnyConcreteTypeForRegularStructure(final StructureShape structureShape) { - final ShapeId shapeId = structureShape.getId(); - return "%s.%s".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), - dafnyCompilesExtra_(shapeId)); - } - - public String dafnyConcreteTypeForUnion(final UnionShape unionShape) { - final ShapeId shapeId = unionShape.getId(); - return "%s.%s".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), - dafnyCompilesExtra_(shapeId)); - } - - public String dafnyConcreteTypeForUnionMember(final MemberShape memberShape) { - final ShapeId shapeId = memberShape.getTarget(); - return "%s.%s".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), - dafnyCompilesExtra_(shapeId)); - } - - private String dafnyTypeForMember(final MemberShape memberShape) { - return memberShapeIsOptional(memberShape) - ? dafnyTypeForOptionalMember(memberShape, false) - : dafnyTypeForShape(memberShape.getTarget()); - - } - - public String dafnyConcreteTypeForOptionalMember(final MemberShape memberShape) { - return dafnyTypeForOptionalMember(memberShape, true); - } - - private String dafnyTypeForOptionalMember(final MemberShape memberShape, final boolean concrete) { - if (!memberShapeIsOptional(memberShape)) { - throw new IllegalArgumentException("memberShape must be optional"); - } - - final String baseType = dafnyTypeForShape(memberShape.getTarget()); - final String prefix = concrete ? "" : "_I"; - return "Wrappers_Compile.%sOption<%s>".formatted(prefix, baseType); - } - - private String dafnyTypeForService(final ServiceShape serviceShape) { - final ShapeId serviceShapeId = serviceShape.getId(); - - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(serviceShapeId)) { - return "%s.%s" - .formatted(DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(serviceShapeId), - DafnyNameResolver.traitNameForServiceClient(serviceShape)); - } - - // Qualify extern namespace - if (!DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(serviceShapeId) - .equals(serviceShape.getId().getNamespace())) { - return "%s.%s".formatted(DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(serviceShapeId), - DafnyNameResolver.traitNameForServiceClient(serviceShape)); - } - - return DafnyNameResolver.traitNameForServiceClient(serviceShape); - } - - private String dafnyTypeForResource(final ResourceShape resourceShape) { - final ShapeId resourceShapeId = resourceShape.getId(); - return "%s.%s" - .formatted(DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(resourceShapeId), - interfaceForResource(resourceShapeId)); - } - - /** - * Returns the most abstract concrete type representing errors for the given service. - *

- * This will return "%s.%sBaseException", formatted with the Dafny service - * namespace and service name. - * It should ONLY be used by the TypeConversionCodegen. - *

- */ - public static String dafnyBaseTypeForServiceError(final ServiceShape serviceShape) { - final String serviceName = ModelUtils.serviceNameWithoutTrailingFactory(serviceShape); - return "%s.%sBaseException".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(serviceShape.getId()), - serviceName + // The Dafny type of other structures is simply the structure's name. + // We explicitly specify the Dafny namespace just in case of collisions. + return "%s._I%s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), + dafnyCompilesExtra_(shapeId) + ); + } + + private static String dafnyCompilesExtra_(final ShapeId shapeId) { + return dafnyCompilesExtra_(shapeId.getName()); + } + + private static String dafnyCompilesExtra_(final String name) { + return name.replace("_", "__"); + } + + private String dafnyTypeForUnion(final UnionShape unionShape) { + final ShapeId unionId = unionShape.getId(); + + // TODO is this adequate + return "%s._I%s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(unionId), + unionId.getName() + ); + } + + /** + * Returns the name of the concrete Dafny type for the given regular (i.e. not an enum or reference) structure. + *

+ * This should only be used to access members absent from the abstract type, e.g. the constructor. + */ + public String dafnyConcreteTypeForRegularStructure( + final StructureShape structureShape + ) { + final ShapeId shapeId = structureShape.getId(); + return "%s.%s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), + dafnyCompilesExtra_(shapeId) + ); + } + + public String dafnyConcreteTypeForUnion(final UnionShape unionShape) { + final ShapeId shapeId = unionShape.getId(); + return "%s.%s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), + dafnyCompilesExtra_(shapeId) + ); + } + + public String dafnyConcreteTypeForUnionMember(final MemberShape memberShape) { + final ShapeId shapeId = memberShape.getTarget(); + return "%s.%s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId), + dafnyCompilesExtra_(shapeId) + ); + } + + private String dafnyTypeForMember(final MemberShape memberShape) { + return memberShapeIsOptional(memberShape) + ? dafnyTypeForOptionalMember(memberShape, false) + : dafnyTypeForShape(memberShape.getTarget()); + } + + public String dafnyConcreteTypeForOptionalMember( + final MemberShape memberShape + ) { + return dafnyTypeForOptionalMember(memberShape, true); + } + + private String dafnyTypeForOptionalMember( + final MemberShape memberShape, + final boolean concrete + ) { + if (!memberShapeIsOptional(memberShape)) { + throw new IllegalArgumentException("memberShape must be optional"); + } + + final String baseType = dafnyTypeForShape(memberShape.getTarget()); + final String prefix = concrete ? "" : "_I"; + return "Wrappers_Compile.%sOption<%s>".formatted(prefix, baseType); + } + + private String dafnyTypeForService(final ServiceShape serviceShape) { + final ShapeId serviceShapeId = serviceShape.getId(); + + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(serviceShapeId)) { + return "%s.%s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId( + serviceShapeId + ), + DafnyNameResolver.traitNameForServiceClient(serviceShape) ); } - public String dafnyBaseTypeForServiceError() { - return dafnyBaseTypeForServiceError(this.serviceShape); - } - - public String dafnyConcreteTypeForErrorStructure(final StructureShape errorShape) { - assert errorShape.hasTrait(ErrorTrait.class); - final ShapeId errorShapeId = errorShape.getId(); - // TODO: This Error_ string is unfortunate, move it somewhere - return "%s.Error_%s".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(errorShapeId), - errorShapeId.getName()); - } - - public static String dafnyCollectionOfErrorsTypeForServiceShape(final ServiceShape serviceShape) { - return "%s.Error_CollectionOfErrors".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(serviceShape.getId())); - } - - public static String dafnyUnknownErrorTypeForServiceShape(final ServiceShape serviceShape) { - return "%s.Error_Opaque".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(serviceShape.getId())); - } - - /** - * Returns this service name, without the trailing "Factory" if it's present. - */ - public String serviceNameWithoutFactory() { - return ModelUtils.serviceNameWithoutTrailingFactory(serviceShape); - } - - /** - * Returns the Dafny trait implemented by all errors in the given service. - *

- * This is distinct from the specific Dafny error classes, - * since the trait / common error shape is not modeled. - * To get the type for a specific Dafny error class, pass the corresponding structure shape to - * {@link DotNetNameResolver#dafnyTypeForShape(ShapeId)}. - */ - public static String dafnyTypeForCommonServiceError(final ServiceShape serviceShape) { - // TODO The Error string should be consolidated - return "%s._IError".formatted( - DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(serviceShape.getId()) + // Qualify extern namespace + if ( + !DafnyNameResolverHelpers + .dafnyExternNamespaceForShapeId(serviceShapeId) + .equals(serviceShape.getId().getNamespace()) + ) { + return "%s.%s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId( + serviceShapeId + ), + DafnyNameResolver.traitNameForServiceClient(serviceShape) ); } - /** - * Returns the compiled-Dafny return type for an operation of this service. - * This is the compiled-Dafny {@code Result}, - * where {@code T} is the corresponding Dafny-compiled value type as determined below, - * and where {@code E} is the Dafny-compiled common error type for this service. - *

    - *
  • If the operation has output, the value type is the corresponding compiled-Dafny output type.
  • - *
  • If the operation has no output, the value type is the compiled-Dafny {@code ()} ("unit").
  • - *
- */ - public String dafnyTypeForServiceOperationOutput(final OperationShape operationShape) { - return dafnyTypeForServiceOperationOutput(operationShape, false); - } - - /** - * Like {@link DotNetNameResolver#dafnyTypeForServiceOperationOutput(OperationShape)}, but if the {@code concrete} - * parameter is {@code true}, then the concrete compiled-Dafny {@code Result} is returned instead of the abstract - * compiled-Dafny {@code Result} ("_IResult"). - *

- * The difference is that the abstract {@code Result} is emitted by the Dafny compiler when specifying contracts - * (such as method parameter and return types), - * whereas the concrete {@code Result} must be used to invoke the {@code create_Success} and - * {@code create_Failure} constructors. - */ - public String dafnyTypeForServiceOperationOutput(final OperationShape operationShape, final boolean concrete) { - final String outputType = operationShape.getOutput() - .map(this::dafnyTypeForShape) - .orElse(dafnyTypeForUnit()); - final String errorType = dafnyTypeForCommonServiceError(serviceShape); - return dafnyTypeForResult(outputType, errorType, concrete); - } - - public String dafnyTypeForStructure(final ShapeId shapeId, final boolean concrete) { - final String outputType = dafnyTypeForShape(shapeId); - final String errorType = dafnyTypeForCommonServiceError(serviceShape); - return dafnyTypeForResult(outputType, errorType, concrete); - } - - private String dafnyTypeForResult(final String valueType, final String errorType, final boolean concrete) { - final String resultType = concrete ? "Result" : "_IResult"; - return "Wrappers_Compile.%s<%s, %s>".formatted(resultType, valueType, errorType); - } - - public String dafnyTypeForUnit() { - return "_System._ITuple0"; - } - - public String dafnyValueForUnit() { - return "_System.Tuple0.Default()"; - } - - /** - * Returns the name of the compiled-Dafny implementation of the service client. - */ - public String dafnyImplForServiceClient() { - return "%1$s.%2$s" - .formatted( - DafnyNameResolverHelpers.defaultForNamespace( - serviceShape.getId().getNamespace()), - clientForService() - ); - } - - public boolean memberShapeIsOptional(final MemberShape memberShape) { - return ModelUtils.memberShapeIsOptional(model, memberShape); - } - - /** - * Encodes a shape ID as a unique valid C# identifier. - *

- * The encoding of a shape ID consists of type-length-value encodings of each of its "parts", separated by two - * underscores. For example, "foo.bar#Shape$Member" is encoded as N3_foo__N3_bar__S5_Shape__M6_Member. - *

- * The encoding scheme has some redundancy in order to aid legibility of encoded "normal" shape IDs, such as the - * redundant double-underscore between "parts". But even an inscrutable encoding (arising from a pathological shape - * ID) has a unique parse, so there is no concern for an encoding collision. - *

- * (Note: we never need to actually parse this identifier.) - */ - @VisibleForTesting - public static String encodedIdentForShapeId(final ShapeId shapeId) { - // TODO We should make these methods more discoverable - // I suggest that instead of something like this - // FromDafny_N3_com__N9_amazonaws__N3_kms__S26_InvalidGrantTokenException( - // Something like this: - // InvalidGrantTokenException_FromDafny_N3_com__N9_amazonaws__N3_kms__S26( - // The advantage here is that is moves the human information to the front of the line. - - final String namespace = shapeId.getNamespace(); - final String relativeShape = shapeId.getName(); - final Optional memberOptional = shapeId.getMember(); - - // "N" for namespace - final List encodedParts = new ArrayList<>(); - for (final String namespacePart : namespace.split("\\.")) { - encodedParts.add(String.format("N%d_%s", namespacePart.length(), namespacePart)); - } - // "S" for relative shape - encodedParts.add(String.format("S%d_%s", relativeShape.length(), relativeShape)); - // "M" for member - if (memberOptional.isPresent()) { - final String member = memberOptional.get(); - encodedParts.add(String.format("M%d_%s", member.length(), member)); - } - - return Joiner.on("__").join(encodedParts); - } - - public Model getModel() { - return model; - } - - public ServiceShape getServiceShape() { - return serviceShape; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) return true; - if (obj == null || obj.getClass() != this.getClass()) return false; - var that = (DotNetNameResolver) obj; - return Objects.equals(this.model, that.model) && - Objects.equals(this.serviceShape, that.serviceShape); - } - - @Override - public int hashCode() { - return Objects.hash(model, serviceShape); - } - - @Override - public String toString() { - return "CSharpNameResolver[" + - "model=" + model + ", " + - "serviceShape=" + serviceShape + ']'; - } - - // The member name of something converted from Dafny - // will not exactly match the member name in Dafny. - // See: https://github.com/dafny-lang/dafny/pull/2525 - public static String memberName(final MemberShape memberShape) { - return "_%s".formatted(memberShape.getMemberName()); - } - /** Return the DotNet Type for a Union Member */ - public String unionMemberName(final MemberShape memberShape) { - return "_%s".formatted(dafnyCompilesExtra_(memberShape.getMemberName())); - } + return DafnyNameResolver.traitNameForServiceClient(serviceShape); + } + + private String dafnyTypeForResource(final ResourceShape resourceShape) { + final ShapeId resourceShapeId = resourceShape.getId(); + return "%s.%s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId( + resourceShapeId + ), + interfaceForResource(resourceShapeId) + ); + } + + /** + * Returns the most abstract concrete type representing errors for the given service. + *

+ * This will return "%s.%sBaseException", formatted with the Dafny service + * namespace and service name. + * It should ONLY be used by the TypeConversionCodegen. + *

+ */ + public static String dafnyBaseTypeForServiceError( + final ServiceShape serviceShape + ) { + final String serviceName = ModelUtils.serviceNameWithoutTrailingFactory( + serviceShape + ); + return "%s.%sBaseException".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId( + serviceShape.getId() + ), + serviceName + ); + } + + public String dafnyBaseTypeForServiceError() { + return dafnyBaseTypeForServiceError(this.serviceShape); + } + + public String dafnyConcreteTypeForErrorStructure( + final StructureShape errorShape + ) { + assert errorShape.hasTrait(ErrorTrait.class); + final ShapeId errorShapeId = errorShape.getId(); + // TODO: This Error_ string is unfortunate, move it somewhere + return "%s.Error_%s".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(errorShapeId), + errorShapeId.getName() + ); + } + + public static String dafnyCollectionOfErrorsTypeForServiceShape( + final ServiceShape serviceShape + ) { + return "%s.Error_CollectionOfErrors".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId( + serviceShape.getId() + ) + ); + } + + public static String dafnyUnknownErrorTypeForServiceShape( + final ServiceShape serviceShape + ) { + return "%s.Error_Opaque".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId( + serviceShape.getId() + ) + ); + } + + /** + * Returns this service name, without the trailing "Factory" if it's present. + */ + public String serviceNameWithoutFactory() { + return ModelUtils.serviceNameWithoutTrailingFactory(serviceShape); + } + + /** + * Returns the Dafny trait implemented by all errors in the given service. + *

+ * This is distinct from the specific Dafny error classes, + * since the trait / common error shape is not modeled. + * To get the type for a specific Dafny error class, pass the corresponding structure shape to + * {@link DotNetNameResolver#dafnyTypeForShape(ShapeId)}. + */ + public static String dafnyTypeForCommonServiceError( + final ServiceShape serviceShape + ) { + // TODO The Error string should be consolidated + return "%s._IError".formatted( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId( + serviceShape.getId() + ) + ); + } + + /** + * Returns the compiled-Dafny return type for an operation of this service. + * This is the compiled-Dafny {@code Result}, + * where {@code T} is the corresponding Dafny-compiled value type as determined below, + * and where {@code E} is the Dafny-compiled common error type for this service. + *

    + *
  • If the operation has output, the value type is the corresponding compiled-Dafny output type.
  • + *
  • If the operation has no output, the value type is the compiled-Dafny {@code ()} ("unit").
  • + *
+ */ + public String dafnyTypeForServiceOperationOutput( + final OperationShape operationShape + ) { + return dafnyTypeForServiceOperationOutput(operationShape, false); + } + + /** + * Like {@link DotNetNameResolver#dafnyTypeForServiceOperationOutput(OperationShape)}, but if the {@code concrete} + * parameter is {@code true}, then the concrete compiled-Dafny {@code Result} is returned instead of the abstract + * compiled-Dafny {@code Result} ("_IResult"). + *

+ * The difference is that the abstract {@code Result} is emitted by the Dafny compiler when specifying contracts + * (such as method parameter and return types), + * whereas the concrete {@code Result} must be used to invoke the {@code create_Success} and + * {@code create_Failure} constructors. + */ + public String dafnyTypeForServiceOperationOutput( + final OperationShape operationShape, + final boolean concrete + ) { + final String outputType = operationShape + .getOutput() + .map(this::dafnyTypeForShape) + .orElse(dafnyTypeForUnit()); + final String errorType = dafnyTypeForCommonServiceError(serviceShape); + return dafnyTypeForResult(outputType, errorType, concrete); + } + + public String dafnyTypeForStructure( + final ShapeId shapeId, + final boolean concrete + ) { + final String outputType = dafnyTypeForShape(shapeId); + final String errorType = dafnyTypeForCommonServiceError(serviceShape); + return dafnyTypeForResult(outputType, errorType, concrete); + } + + private String dafnyTypeForResult( + final String valueType, + final String errorType, + final boolean concrete + ) { + final String resultType = concrete ? "Result" : "_IResult"; + return "Wrappers_Compile.%s<%s, %s>".formatted( + resultType, + valueType, + errorType + ); + } + + public String dafnyTypeForUnit() { + return "_System._ITuple0"; + } + + public String dafnyValueForUnit() { + return "_System.Tuple0.Default()"; + } + + /** + * Returns the name of the compiled-Dafny implementation of the service client. + */ + public String dafnyImplForServiceClient() { + return "%1$s.%2$s".formatted( + DafnyNameResolverHelpers.defaultForNamespace( + serviceShape.getId().getNamespace() + ), + clientForService() + ); + } + + public boolean memberShapeIsOptional(final MemberShape memberShape) { + return ModelUtils.memberShapeIsOptional(model, memberShape); + } + + /** + * Encodes a shape ID as a unique valid C# identifier. + *

+ * The encoding of a shape ID consists of type-length-value encodings of each of its "parts", separated by two + * underscores. For example, "foo.bar#Shape$Member" is encoded as N3_foo__N3_bar__S5_Shape__M6_Member. + *

+ * The encoding scheme has some redundancy in order to aid legibility of encoded "normal" shape IDs, such as the + * redundant double-underscore between "parts". But even an inscrutable encoding (arising from a pathological shape + * ID) has a unique parse, so there is no concern for an encoding collision. + *

+ * (Note: we never need to actually parse this identifier.) + */ + @VisibleForTesting + public static String encodedIdentForShapeId(final ShapeId shapeId) { + // TODO We should make these methods more discoverable + // I suggest that instead of something like this + // FromDafny_N3_com__N9_amazonaws__N3_kms__S26_InvalidGrantTokenException( + // Something like this: + // InvalidGrantTokenException_FromDafny_N3_com__N9_amazonaws__N3_kms__S26( + // The advantage here is that is moves the human information to the front of the line. + + final String namespace = shapeId.getNamespace(); + final String relativeShape = shapeId.getName(); + final Optional memberOptional = shapeId.getMember(); + + // "N" for namespace + final List encodedParts = new ArrayList<>(); + for (final String namespacePart : namespace.split("\\.")) { + encodedParts.add( + String.format("N%d_%s", namespacePart.length(), namespacePart) + ); + } + // "S" for relative shape + encodedParts.add( + String.format("S%d_%s", relativeShape.length(), relativeShape) + ); + // "M" for member + if (memberOptional.isPresent()) { + final String member = memberOptional.get(); + encodedParts.add(String.format("M%d_%s", member.length(), member)); + } + + return Joiner.on("__").join(encodedParts); + } + + public Model getModel() { + return model; + } + + public ServiceShape getServiceShape() { + return serviceShape; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (obj == null || obj.getClass() != this.getClass()) return false; + var that = (DotNetNameResolver) obj; + return ( + Objects.equals(this.model, that.model) && + Objects.equals(this.serviceShape, that.serviceShape) + ); + } + + @Override + public int hashCode() { + return Objects.hash(model, serviceShape); + } + + @Override + public String toString() { + return ( + "CSharpNameResolver[" + + "model=" + + model + + ", " + + "serviceShape=" + + serviceShape + + ']' + ); + } + + // The member name of something converted from Dafny + // will not exactly match the member name in Dafny. + // See: https://github.com/dafny-lang/dafny/pull/2525 + public static String memberName(final MemberShape memberShape) { + return "_%s".formatted(memberShape.getMemberName()); + } + + /** Return the DotNet Type for a Union Member */ + public String unionMemberName(final MemberShape memberShape) { + return "_%s".formatted(dafnyCompilesExtra_(memberShape.getMemberName())); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/ServiceCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/ServiceCodegen.java index c5dbde4789..6d95a268d8 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/ServiceCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/ServiceCodegen.java @@ -233,8 +233,7 @@ protected boolean shouldGenerateNativeWrapper(ShapeId shapeId) { @VisibleForTesting boolean shouldGenerateStructure(final StructureShape structureShape) { - return // Traits are structures, but aren't needed outside Smithy - ( + return ( // Traits are structures, but aren't needed outside Smithy !structureShape.hasTrait(TraitDefinition.class) && // References are transparent in C#, so we don't need to generate a class for them !structureShape.hasTrait(ReferenceTrait.class) && diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/ShimCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/ShimCodegen.java index 8690c94941..1f67ea2f30 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/ShimCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/ShimCodegen.java @@ -3,8 +3,14 @@ package software.amazon.polymorph.smithydotnet; -import com.google.common.annotations.VisibleForTesting; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.*; +import com.google.common.annotations.VisibleForTesting; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; import software.amazon.polymorph.traits.LocalServiceTrait; import software.amazon.polymorph.utils.DafnyNameResolverHelpers; import software.amazon.polymorph.utils.ModelUtils; @@ -13,289 +19,406 @@ import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.*; -import java.nio.file.Path; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; - -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.*; - public class ShimCodegen { - private final Model model; - private final ServiceShape serviceShape; - private final DotNetNameResolver nameResolver; - - static final String SHIM_UMWRAP_METHOD_NAME = "impl"; - private static final String IMPL_NAME = "_impl"; - private static final String INPUT_NAME = "input"; - private static final String INTERNAL_INPUT_NAME = "internalInput"; - private static final String RESULT_NAME = "result"; - - public ShimCodegen(final Model model, final ServiceShape serviceShape) { - this.model = model; - this.serviceShape = serviceShape; - this.nameResolver = new DotNetNameResolver(model, serviceShape); - } - - // TODO: get smarter about imports. maybe just fully qualify all model-agnostic types? - private final static List UNCONDITIONAL_IMPORTS = List.of( - "System", - "System.IO", - "System.Collections.Generic" + + private final Model model; + private final ServiceShape serviceShape; + private final DotNetNameResolver nameResolver; + + static final String SHIM_UMWRAP_METHOD_NAME = "impl"; + private static final String IMPL_NAME = "_impl"; + private static final String INPUT_NAME = "input"; + private static final String INTERNAL_INPUT_NAME = "internalInput"; + private static final String RESULT_NAME = "result"; + + public ShimCodegen(final Model model, final ServiceShape serviceShape) { + this.model = model; + this.serviceShape = serviceShape; + this.nameResolver = new DotNetNameResolver(model, serviceShape); + } + + // TODO: get smarter about imports. maybe just fully qualify all model-agnostic types? + private static final List UNCONDITIONAL_IMPORTS = List.of( + "System", + "System.IO", + "System.Collections.Generic" + ); + + /** + * Returns a map of service's and all resources' shim file paths to their generated ASTs. + */ + public Map generate() { + final Map codeByPath = new HashMap<>(); + + // Use LinkedHashSet to dedupe while maintaining insertion order + final LinkedHashSet importNamespaces = new LinkedHashSet<>( + UNCONDITIONAL_IMPORTS ); + importNamespaces.add(nameResolver.namespaceForService()); + importNamespaces.add( + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId( + serviceShape.getId() + ) + ); + final TokenTree prelude = TokenTree + .of(importNamespaces.stream().map("using %s;"::formatted).map(Token::of)) + .lineSeparated(); - /** - * Returns a map of service's and all resources' shim file paths to their generated ASTs. - */ - public Map generate() { - final Map codeByPath = new HashMap<>(); - - // Use LinkedHashSet to dedupe while maintaining insertion order - final LinkedHashSet importNamespaces = new LinkedHashSet<>(UNCONDITIONAL_IMPORTS); - importNamespaces.add(nameResolver.namespaceForService()); - importNamespaces.add(DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(serviceShape.getId())); - final TokenTree prelude = TokenTree.of( - importNamespaces.stream().map("using %s;"::formatted).map(Token::of) - ).lineSeparated(); - - // Service shim - final Path serviceShimPath = Path.of(String.format("%s.cs", nameResolver.clientForService())); - final TokenTree serviceShimCode = generateServiceShim(); - codeByPath.put(serviceShimPath, serviceShimCode.prepend(prelude)); - - // Resource shims - model.getResourceShapes() - .stream() - .map(ResourceShape::getId) - .filter(resourceShapeId -> ModelUtils.isInServiceNamespace(resourceShapeId, serviceShape)) - .forEach(resourceShapeId -> { - final Path resourceShimPath = Path.of( - String.format("%s.cs", nameResolver.shimClassForResource(resourceShapeId))); - final TokenTree resourceShim = generateResourceShim(resourceShapeId); - codeByPath.put(resourceShimPath, resourceShim.prepend(prelude)); - }); - - return codeByPath; - } - - public TokenTree generateServiceShim() { - final TokenTree header = Token - .of("public class %s".formatted(nameResolver.clientForService())); - - final TokenTree body = TokenTree - .of( - generateServiceImplDeclaration(serviceShape), - generateServiceShimConstructor(), - generateServiceShimDeconstructor(), - generateServiceConstructor(serviceShape), - generateServiceOperationShims(serviceShape.getId()) + // Service shim + final Path serviceShimPath = Path.of( + String.format("%s.cs", nameResolver.clientForService()) + ); + final TokenTree serviceShimCode = generateServiceShim(); + codeByPath.put(serviceShimPath, serviceShimCode.prepend(prelude)); + + // Resource shims + model + .getResourceShapes() + .stream() + .map(ResourceShape::getId) + .filter(resourceShapeId -> + ModelUtils.isInServiceNamespace(resourceShapeId, serviceShape) + ) + .forEach(resourceShapeId -> { + final Path resourceShimPath = Path.of( + String.format( + "%s.cs", + nameResolver.shimClassForResource(resourceShapeId) ) - .lineSeparated(); - return header - .append(body.braced()) - .namespaced(Token.of(nameResolver.namespaceForService())); - } - - public TokenTree generateServiceShimConstructor() { - return Token.of(""" - public %s(%s impl) { - this.%s = impl; - }""".formatted(nameResolver.clientForService(), + ); + final TokenTree resourceShim = generateResourceShim(resourceShapeId); + codeByPath.put(resourceShimPath, resourceShim.prepend(prelude)); + }); + + return codeByPath; + } + + public TokenTree generateServiceShim() { + final TokenTree header = Token.of( + "public class %s".formatted(nameResolver.clientForService()) + ); + + final TokenTree body = TokenTree + .of( + generateServiceImplDeclaration(serviceShape), + generateServiceShimConstructor(), + generateServiceShimDeconstructor(), + generateServiceConstructor(serviceShape), + generateServiceOperationShims(serviceShape.getId()) + ) + .lineSeparated(); + return header + .append(body.braced()) + .namespaced(Token.of(nameResolver.namespaceForService())); + } + + public TokenTree generateServiceShimConstructor() { + return Token.of( + """ + public %s(%s impl) { + this.%s = impl; + }""".formatted( + nameResolver.clientForService(), + nameResolver.dafnyTypeForShape(serviceShape.getId()), + IMPL_NAME + ) + ); + } + + public TokenTree generateServiceShimDeconstructor() { + return Token.of( + """ + public %s %s() { + return this.%s; + }""".formatted( nameResolver.dafnyTypeForShape(serviceShape.getId()), - IMPL_NAME)); - } - - public TokenTree generateServiceShimDeconstructor() { - return Token.of(""" - public %s %s() { - return this.%s; - }""".formatted(nameResolver.dafnyTypeForShape(serviceShape.getId()), SHIM_UMWRAP_METHOD_NAME, - IMPL_NAME)); - } - - public TokenTree generateServiceImplDeclaration(ServiceShape serviceShape) { - return Token.of("private readonly %s %s;" - .formatted( - nameResolver.dafnyTypeForShape(serviceShape.getId()), - IMPL_NAME - ) - ); - } - - public TokenTree generateServiceOperationShims(final ShapeId entityShapeId) { - final EntityShape entityShape = model.expectShape(entityShapeId, EntityShape.class); - return TokenTree.of(entityShape.getAllOperations().stream().map(this::generateServiceOperationShim)).lineSeparated(); - } - - public TokenTree generateServiceOperationShim(final ShapeId operationShapeId) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - - final String outputType = operationShape.getOutput().map(nameResolver::baseTypeForShape).orElse("void"); - final String methodName = nameResolver.methodForOperation(operationShapeId); - final String param = operationShape.getInput() - .map(inputShapeId -> nameResolver.baseTypeForShape(inputShapeId) + " " + INPUT_NAME) - .orElse(""); - final TokenTree signature = Token.of("public %s %s(%s)".formatted(outputType, methodName, param)); - - final TokenTree convertInput = generateConvertInput(operationShapeId); - final TokenTree callImpl = Token.of("%s %s = %s.%s(%s);".formatted( - nameResolver.dafnyTypeForServiceOperationOutput(operationShape), - RESULT_NAME, - IMPL_NAME, - nameResolver.methodForOperation(operationShapeId), - operationShape.getInput().isPresent() ? INTERNAL_INPUT_NAME : "" - )); - final TokenTree checkAndConvertFailure = generateCheckAndConvertFailure(); - final TokenTree convertAndReturnOutput = generateConvertAndReturnOutput(operationShapeId); - - return TokenTree.of(convertInput, callImpl, checkAndConvertFailure, convertAndReturnOutput) - .lineSeparated() - .braced() - .prepend(signature); - } - - public TokenTree generateServiceConstructor(final ServiceShape serviceShape) { - final LocalServiceTrait localServiceTrait = serviceShape.expectTrait(LocalServiceTrait.class); - final StructureShape configShape = model.expectShape(localServiceTrait.getConfigId(), StructureShape.class); - final TokenTree signature = TokenTree.of("public %s(%s %s)" - .formatted( - nameResolver.clientForService(), - nameResolver.baseTypeForStructure(configShape), - INPUT_NAME - )); - - final TokenTree body = TokenTree - .of( - generateConvertShape(localServiceTrait.getConfigId()), - Token.of("%s %s = %s(%s);" - .formatted( - // TODO really type me plz - "var", - RESULT_NAME, - nameResolver.dafnyImplForServiceClient(), - INTERNAL_INPUT_NAME - )), - generateCheckAndConvertFailure(), - Token.of("this._impl = %s.dtor_value;".formatted(RESULT_NAME)) - ) - .lineSeparated() - .braced(); + IMPL_NAME + ) + ); + } - return TokenTree - .of( - signature, - body - ) - .lineSeparated(); - } - - public TokenTree generateConvertInput(final ShapeId operationShapeId) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - return TokenTree - .of(operationShape.getInput() - .map(this::generateConvertShape) - .orElse(TokenTree.empty())); - } - - public TokenTree generateConvertShape(final ShapeId shapeId) { - return Token - .of("%s %s = %s(%s);" - .formatted( - nameResolver.dafnyTypeForShape(shapeId), - INTERNAL_INPUT_NAME, - DotNetNameResolver.qualifiedTypeConverter(shapeId, TO_DAFNY), - INPUT_NAME)); - } - - public TokenTree generateCheckAndConvertFailure() { - return Token.of("if (%s.is_Failure) throw TypeConversion.FromDafny_CommonError(%s.dtor_error);" - .formatted( - RESULT_NAME, - RESULT_NAME - )); - } - - public TokenTree generateConvertAndReturnOutput(final ShapeId operationShapeId) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - return Token.of(operationShape.getOutput() - .map(outputShapeId -> "return %s(%s.dtor_value);".formatted( - DotNetNameResolver.qualifiedTypeConverter(outputShapeId, FROM_DAFNY), - RESULT_NAME)) - .orElse("")); - } - - /** - * Generate a shim that wraps a Dafny-compiled implementation of the given resource interface. - * - * TODO: generate a shim that wraps a native C# implementation (i.e. customer-implemented) - */ - public TokenTree generateResourceShim(final ShapeId resourceShapeId) { - final TokenTree header = Token.of("internal class %s : %s".formatted( - nameResolver.shimClassForResource(resourceShapeId), - nameResolver.baseClassForResource(resourceShapeId))); - final TokenTree body = TokenTree.of( - generateResourceImplDeclaration(resourceShapeId), - generateResourceConstructor(resourceShapeId), - generateOperationShims(resourceShapeId) - ).lineSeparated(); - return header - .append(body.braced()) - .namespaced(Token.of(nameResolver.namespaceForService())); - } - - public TokenTree generateResourceConstructor(final ShapeId resourceShapeId) { - return Token.of("internal %s(%s impl) { this.%s = impl; }".formatted( - nameResolver.shimClassForResource(resourceShapeId), - nameResolver.dafnyTypeForShape(resourceShapeId), - IMPL_NAME)); - } - - public TokenTree generateResourceImplDeclaration(final ShapeId entityShapeId) { - return Token.of("internal readonly %s %s;".formatted( - nameResolver.dafnyTypeForShape(entityShapeId), IMPL_NAME)); - } - - public TokenTree generateOperationShims(final ShapeId entityShapeId) { - final EntityShape entityShape = model.expectShape(entityShapeId, EntityShape.class); - return TokenTree.of(entityShape.getAllOperations().stream().map(this::generateOperationShim)).lineSeparated(); - } - - public TokenTree generateOperationShim(final ShapeId operationShapeId) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - - final String outputType = operationShape.getOutput().map(nameResolver::baseTypeForShape).orElse("void"); - final String methodName = nameResolver.abstractMethodForOperation(operationShapeId); - final String param = operationShape.getInput() - .map(inputShapeId -> nameResolver.baseTypeForShape(inputShapeId) + " " + INPUT_NAME) - .orElse(""); - final TokenTree signature = Token.of("protected override %s %s(%s)".formatted(outputType, methodName, param)); - - final TokenTree convertInput = generateConvertInput(operationShapeId); - final TokenTree callImpl = Token.of("%s %s = this.%s.%s(%s);".formatted( - nameResolver.dafnyTypeForServiceOperationOutput(operationShape), - RESULT_NAME, - IMPL_NAME, - nameResolver.methodForOperation(operationShapeId), - operationShape.getInput().isPresent() ? INTERNAL_INPUT_NAME : "" - )); - final TokenTree checkAndConvertFailure = generateCheckAndConvertFailure(); - final TokenTree convertAndReturnOutput = generateConvertAndReturnOutput(operationShapeId); - - return TokenTree.of(convertInput, callImpl, checkAndConvertFailure, convertAndReturnOutput) - .lineSeparated() - .braced() - .prepend(signature); - } - - @VisibleForTesting - public Model getModel() { - return model; - } - - @VisibleForTesting - public DotNetNameResolver getNameResolver() { - return nameResolver; - } + public TokenTree generateServiceImplDeclaration(ServiceShape serviceShape) { + return Token.of( + "private readonly %s %s;".formatted( + nameResolver.dafnyTypeForShape(serviceShape.getId()), + IMPL_NAME + ) + ); + } + + public TokenTree generateServiceOperationShims(final ShapeId entityShapeId) { + final EntityShape entityShape = model.expectShape( + entityShapeId, + EntityShape.class + ); + return TokenTree + .of( + entityShape + .getAllOperations() + .stream() + .map(this::generateServiceOperationShim) + ) + .lineSeparated(); + } + + public TokenTree generateServiceOperationShim( + final ShapeId operationShapeId + ) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + + final String outputType = operationShape + .getOutput() + .map(nameResolver::baseTypeForShape) + .orElse("void"); + final String methodName = nameResolver.methodForOperation(operationShapeId); + final String param = operationShape + .getInput() + .map(inputShapeId -> + nameResolver.baseTypeForShape(inputShapeId) + " " + INPUT_NAME + ) + .orElse(""); + final TokenTree signature = Token.of( + "public %s %s(%s)".formatted(outputType, methodName, param) + ); + + final TokenTree convertInput = generateConvertInput(operationShapeId); + final TokenTree callImpl = Token.of( + "%s %s = %s.%s(%s);".formatted( + nameResolver.dafnyTypeForServiceOperationOutput(operationShape), + RESULT_NAME, + IMPL_NAME, + nameResolver.methodForOperation(operationShapeId), + operationShape.getInput().isPresent() ? INTERNAL_INPUT_NAME : "" + ) + ); + final TokenTree checkAndConvertFailure = generateCheckAndConvertFailure(); + final TokenTree convertAndReturnOutput = generateConvertAndReturnOutput( + operationShapeId + ); + + return TokenTree + .of( + convertInput, + callImpl, + checkAndConvertFailure, + convertAndReturnOutput + ) + .lineSeparated() + .braced() + .prepend(signature); + } + + public TokenTree generateServiceConstructor(final ServiceShape serviceShape) { + final LocalServiceTrait localServiceTrait = serviceShape.expectTrait( + LocalServiceTrait.class + ); + final StructureShape configShape = model.expectShape( + localServiceTrait.getConfigId(), + StructureShape.class + ); + final TokenTree signature = TokenTree.of( + "public %s(%s %s)".formatted( + nameResolver.clientForService(), + nameResolver.baseTypeForStructure(configShape), + INPUT_NAME + ) + ); + + final TokenTree body = TokenTree + .of( + generateConvertShape(localServiceTrait.getConfigId()), + Token.of( + "%s %s = %s(%s);".formatted( + // TODO really type me plz + "var", + RESULT_NAME, + nameResolver.dafnyImplForServiceClient(), + INTERNAL_INPUT_NAME + ) + ), + generateCheckAndConvertFailure(), + Token.of("this._impl = %s.dtor_value;".formatted(RESULT_NAME)) + ) + .lineSeparated() + .braced(); + + return TokenTree.of(signature, body).lineSeparated(); + } + + public TokenTree generateConvertInput(final ShapeId operationShapeId) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + return TokenTree.of( + operationShape + .getInput() + .map(this::generateConvertShape) + .orElse(TokenTree.empty()) + ); + } + + public TokenTree generateConvertShape(final ShapeId shapeId) { + return Token.of( + "%s %s = %s(%s);".formatted( + nameResolver.dafnyTypeForShape(shapeId), + INTERNAL_INPUT_NAME, + DotNetNameResolver.qualifiedTypeConverter(shapeId, TO_DAFNY), + INPUT_NAME + ) + ); + } + + public TokenTree generateCheckAndConvertFailure() { + return Token.of( + "if (%s.is_Failure) throw TypeConversion.FromDafny_CommonError(%s.dtor_error);".formatted( + RESULT_NAME, + RESULT_NAME + ) + ); + } + + public TokenTree generateConvertAndReturnOutput( + final ShapeId operationShapeId + ) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + return Token.of( + operationShape + .getOutput() + .map(outputShapeId -> + "return %s(%s.dtor_value);".formatted( + DotNetNameResolver.qualifiedTypeConverter( + outputShapeId, + FROM_DAFNY + ), + RESULT_NAME + ) + ) + .orElse("") + ); + } + + /** + * Generate a shim that wraps a Dafny-compiled implementation of the given resource interface. + * + * TODO: generate a shim that wraps a native C# implementation (i.e. customer-implemented) + */ + public TokenTree generateResourceShim(final ShapeId resourceShapeId) { + final TokenTree header = Token.of( + "internal class %s : %s".formatted( + nameResolver.shimClassForResource(resourceShapeId), + nameResolver.baseClassForResource(resourceShapeId) + ) + ); + final TokenTree body = TokenTree + .of( + generateResourceImplDeclaration(resourceShapeId), + generateResourceConstructor(resourceShapeId), + generateOperationShims(resourceShapeId) + ) + .lineSeparated(); + return header + .append(body.braced()) + .namespaced(Token.of(nameResolver.namespaceForService())); + } + + public TokenTree generateResourceConstructor(final ShapeId resourceShapeId) { + return Token.of( + "internal %s(%s impl) { this.%s = impl; }".formatted( + nameResolver.shimClassForResource(resourceShapeId), + nameResolver.dafnyTypeForShape(resourceShapeId), + IMPL_NAME + ) + ); + } + + public TokenTree generateResourceImplDeclaration( + final ShapeId entityShapeId + ) { + return Token.of( + "internal readonly %s %s;".formatted( + nameResolver.dafnyTypeForShape(entityShapeId), + IMPL_NAME + ) + ); + } + + public TokenTree generateOperationShims(final ShapeId entityShapeId) { + final EntityShape entityShape = model.expectShape( + entityShapeId, + EntityShape.class + ); + return TokenTree + .of( + entityShape.getAllOperations().stream().map(this::generateOperationShim) + ) + .lineSeparated(); + } + + public TokenTree generateOperationShim(final ShapeId operationShapeId) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + + final String outputType = operationShape + .getOutput() + .map(nameResolver::baseTypeForShape) + .orElse("void"); + final String methodName = nameResolver.abstractMethodForOperation( + operationShapeId + ); + final String param = operationShape + .getInput() + .map(inputShapeId -> + nameResolver.baseTypeForShape(inputShapeId) + " " + INPUT_NAME + ) + .orElse(""); + final TokenTree signature = Token.of( + "protected override %s %s(%s)".formatted(outputType, methodName, param) + ); + + final TokenTree convertInput = generateConvertInput(operationShapeId); + final TokenTree callImpl = Token.of( + "%s %s = this.%s.%s(%s);".formatted( + nameResolver.dafnyTypeForServiceOperationOutput(operationShape), + RESULT_NAME, + IMPL_NAME, + nameResolver.methodForOperation(operationShapeId), + operationShape.getInput().isPresent() ? INTERNAL_INPUT_NAME : "" + ) + ); + final TokenTree checkAndConvertFailure = generateCheckAndConvertFailure(); + final TokenTree convertAndReturnOutput = generateConvertAndReturnOutput( + operationShapeId + ); + + return TokenTree + .of( + convertInput, + callImpl, + checkAndConvertFailure, + convertAndReturnOutput + ) + .lineSeparated() + .braced() + .prepend(signature); + } + + @VisibleForTesting + public Model getModel() { + return model; + } + + @VisibleForTesting + public DotNetNameResolver getNameResolver() { + return nameResolver; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/TypeConversionDirection.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/TypeConversionDirection.java index d4a0d6a28c..315310b73a 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/TypeConversionDirection.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/TypeConversionDirection.java @@ -4,14 +4,14 @@ package software.amazon.polymorph.smithydotnet; public enum TypeConversionDirection { - TO_DAFNY, - FROM_DAFNY; + TO_DAFNY, + FROM_DAFNY; - @Override - public String toString() { - return switch (this) { - case TO_DAFNY -> "ToDafny"; - case FROM_DAFNY -> "FromDafny"; - }; - } + @Override + public String toString() { + return switch (this) { + case TO_DAFNY -> "ToDafny"; + case FROM_DAFNY -> "FromDafny"; + }; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedCodegen.java index 3285702734..8882fde757 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedCodegen.java @@ -2,6 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithydotnet.localServiceWrapper; +import java.nio.file.Path; +import java.util.HashMap; +import java.util.Map; import software.amazon.polymorph.smithydotnet.ServiceCodegen; import software.amazon.polymorph.smithydotnet.nativeWrapper.NativeWrapperCodegen; import software.amazon.polymorph.traits.LocalServiceTrait; @@ -12,18 +15,19 @@ import software.amazon.smithy.model.shapes.ResourceShape; import software.amazon.smithy.model.shapes.ServiceShape; -import java.nio.file.Path; -import java.util.HashMap; -import java.util.Map; - public class LocalServiceWrappedCodegen extends ServiceCodegen { - public LocalServiceWrappedCodegen(final Model model, final ServiceShape serviceShape) { - super(model, serviceShape, - new LocalServiceWrappedNameResolver(model, serviceShape)); + public LocalServiceWrappedCodegen( + final Model model, + final ServiceShape serviceShape + ) { + super( + model, + serviceShape, + new LocalServiceWrappedNameResolver(model, serviceShape) + ); } - @Override public Map generate() { final Map codeByPath = new HashMap<>(); @@ -31,21 +35,31 @@ public Map generate() { // TODO see: generateWrappedServiceExtern The extern for wrapping can be fully generated // Resources - model.getResourceShapes() + model + .getResourceShapes() .stream() .map(ResourceShape::getId) - .filter(resourceShapeId -> ModelUtils.isInServiceNamespace(resourceShapeId, serviceShape)) + .filter(resourceShapeId -> + ModelUtils.isInServiceNamespace(resourceShapeId, serviceShape) + ) .forEach(resourceShapeId -> { if (shouldGenerateNativeWrapper(resourceShapeId)) { // This SHOULD be a shared component without any changes. // If the wrapped version begins to differ from the native type // then this wrapped version begins to be a less valuable test bed. - final NativeWrapperCodegen nativeWrapperCodegen = new NativeWrapperCodegen( - model, serviceShape.getId(), resourceShapeId, nameResolver); + final NativeWrapperCodegen nativeWrapperCodegen = + new NativeWrapperCodegen( + model, + serviceShape.getId(), + resourceShapeId, + nameResolver + ); final Path nativeWrapperPath = Path.of( - String.format("%s.cs", - nameResolver.nativeWrapperClassForResource( - resourceShapeId))); + String.format( + "%s.cs", + nameResolver.nativeWrapperClassForResource(resourceShapeId) + ) + ); final TokenTree nativeWrapperClass = nativeWrapperCodegen.generate(); codeByPath.put(nativeWrapperPath, nativeWrapperClass); } @@ -54,28 +68,30 @@ public Map generate() { return codeByPath; } - - public TokenTree generateWrappedServiceExtern(final ServiceShape serviceShape) { - if (!serviceShape.hasTrait(LocalServiceTrait.class)) throw new IllegalStateException("MUST be an LocalService"); - final LocalServiceTrait localServiceTrait = serviceShape.expectTrait(LocalServiceTrait.class); + public TokenTree generateWrappedServiceExtern( + final ServiceShape serviceShape + ) { + if ( + !serviceShape.hasTrait(LocalServiceTrait.class) + ) throw new IllegalStateException("MUST be an LocalService"); + final LocalServiceTrait localServiceTrait = serviceShape.expectTrait( + LocalServiceTrait.class + ); final String configTypeName = localServiceTrait.getConfigId().getName(); - final TokenTree defaultClass = TokenTree - .of( - "public partial class __default" - ); + final TokenTree defaultClass = TokenTree.of( + "public partial class __default" + ); final TokenTree externSignature = TokenTree .of( "public static", // TODO fix the Error and don't hard code it :( - "Wrappers_Compile._IResult" - .formatted( + "Wrappers_Compile._IResult".formatted( nameResolver.dafnyTypeForShape(serviceShape.getId()) ), - "Wrapped%s(Types.%s config)" - .formatted( + "Wrapped%s(Types.%s config)".formatted( localServiceTrait.getSdkId(), configTypeName ) @@ -84,15 +100,15 @@ public TokenTree generateWrappedServiceExtern(final ServiceShape serviceShape) { final TokenTree externBody = TokenTree .of( -"var wrappedConfig = %s(config);" - .formatted("asdf"), - "var impl = new %s(wrappedConfig);" - .formatted(((LocalServiceWrappedNameResolver) nameResolver).implForServiceClient()), - "var wrappedClient = new %s(impl);" - .formatted(((LocalServiceWrappedNameResolver) nameResolver).shimClassForService()), + "var wrappedConfig = %s(config);".formatted("asdf"), + "var impl = new %s(wrappedConfig);".formatted( + ((LocalServiceWrappedNameResolver) nameResolver).implForServiceClient() + ), + "var wrappedClient = new %s(impl);".formatted( + ((LocalServiceWrappedNameResolver) nameResolver).shimClassForService() + ), // TODO fix the Error and don't hard code it :( - "return Wrappers_Compile.Result.create_Success(wrappedClient);" - .formatted( + "return Wrappers_Compile.Result.create_Success(wrappedClient);".formatted( nameResolver.dafnyTypeForShape(serviceShape.getId()) ) ) @@ -100,7 +116,11 @@ public TokenTree generateWrappedServiceExtern(final ServiceShape serviceShape) { return defaultClass .append(externSignature.append(externBody.braced()).braced()) - .namespaced(DafnyNameResolverHelpers.packageNameForNamespace(serviceShape.getId().getNamespace()) + ".Wrapped"); + .namespaced( + DafnyNameResolverHelpers.packageNameForNamespace( + serviceShape.getId().getNamespace() + ) + + ".Wrapped" + ); } - } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedConversionCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedConversionCodegen.java index ff87449410..873399aacb 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedConversionCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedConversionCodegen.java @@ -3,186 +3,239 @@ package software.amazon.polymorph.smithydotnet.localServiceWrapper; +import static software.amazon.polymorph.smithydotnet.DotNetNameResolver.typeConverterForShape; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; + +import software.amazon.polymorph.smithydotnet.TypeConversionCodegen; import software.amazon.polymorph.traits.ExtendableTrait; import software.amazon.polymorph.traits.ReferenceTrait; import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.utils.Token; import software.amazon.polymorph.utils.TokenTree; -import software.amazon.polymorph.smithydotnet.TypeConversionCodegen; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.*; -import static software.amazon.polymorph.smithydotnet.DotNetNameResolver.typeConverterForShape; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; - /** * Generates a {@code TypeConversion} class that includes all {@link TypeConverter}s needed * for LocalService-specific types. * The purpose here is to wrap an existing LocalService * mostly for testing. */ -public class LocalServiceWrappedConversionCodegen extends TypeConversionCodegen { - - public LocalServiceWrappedConversionCodegen(final Model model, final ServiceShape serviceShape) { - super(model, serviceShape, - new LocalServiceWrappedNameResolver(model, serviceShape)); +public class LocalServiceWrappedConversionCodegen + extends TypeConversionCodegen { + + public LocalServiceWrappedConversionCodegen( + final Model model, + final ServiceShape serviceShape + ) { + super( + model, + serviceShape, + new LocalServiceWrappedNameResolver(model, serviceShape) + ); + } + + // TODO override generateCommonExceptionConverter + // At this time we generate the same code + // but really we should defer `ToDafny_CommonError` + // to the wrapped type converter. + + @Override + protected TypeConverter buildConverterFromMethodBodies( + final Shape shape, + final TokenTree fromDafnyBody, + final TokenTree toDafnyBody + ) { + // In this case we want to ONLY wrap resources + // in the Wrapped namespace. + final boolean shouldWrapLocalResource = shouldWrapLocalResource(shape); + + if (!shouldWrapLocalResource) { + return super.buildConverterFromMethodBodies( + shape, + fromDafnyBody, + toDafnyBody + ); + } else { + // This is going to create nested resources! + // This means every time a resource crosses into Dafny + // it will be wrapped again. + // This is NOT for PRODUCTION + // This is for test vectors and general correctness testing! + // On the upside, + // when such resources are tested, + // This wrapped NativeWrapper will be exercised + // as well as the normal .NET wrapper. + // While this _does not_ test the NativeWrapper + // in the wrapped module, + // These two classes are generated by the same code. + // So there is some analog. + // See the type conversions for Resources + // for more details. + + final ShapeId id = shape.getId(); + final ShapeId resourceShapeId = shape + .expectTrait(ReferenceTrait.class) + .getReferentId(); + final String dafnyType = nameResolver.dafnyTypeForShape(id); + final String cSharpType = nameResolver.baseTypeForShape(id); + + final String fromDafnyConverterName = typeConverterForShape( + shape.getId(), + FROM_DAFNY + ); + final TokenTree fromDafnyConverterSignature = TokenTree.of( + "internal static", + cSharpType, + fromDafnyConverterName, + "(%s value)".formatted(dafnyType) + ); + + final String toDafnyConverterName = typeConverterForShape( + shape.getId(), + TO_DAFNY + ); + final TokenTree toDafnyConverterSignature = TokenTree.of( + "internal static", + dafnyType, + toDafnyConverterName, + "(%s value)".formatted(cSharpType) + ); + + final String namespaceForReferent = nameResolver.namespaceForShapeId(id); + final TokenTree fromDafnyBodyOverride = TokenTree + .of( + "// This is converting a reference type in a dependant module.", + "// Therefore it defers to the dependant module for conversion", + "return %s.TypeConversion.%s(value);".formatted( + namespaceForReferent, + fromDafnyConverterName + ) + ) + .lineSeparated(); + + final TokenTree toDafnyBodyOverride = TokenTree + .of( + "// This is converting a reference type in a dependant module.", + "// Therefore it defers to the dependant module for conversion", + "return new %s((%s)value);".formatted( + nameResolver.nativeWrapperClassForResource(resourceShapeId), + nameResolver.baseClassForResource(resourceShapeId) + ) + ) + .lineSeparated(); + + final TokenTree fromDafnyConverterMethod = TokenTree.of( + fromDafnyConverterSignature, + fromDafnyBodyOverride.braced() + ); + final TokenTree toDafnyConverterMethod = TokenTree.of( + toDafnyConverterSignature, + toDafnyBodyOverride.braced() + ); + return new TypeConverter( + shape.getId(), + fromDafnyConverterMethod, + toDafnyConverterMethod + ); } - - - // TODO override generateCommonExceptionConverter - // At this time we generate the same code - // but really we should defer `ToDafny_CommonError` - // to the wrapped type converter. - - @Override - protected TypeConverter buildConverterFromMethodBodies( - final Shape shape, - final TokenTree fromDafnyBody, - final TokenTree toDafnyBody + } + + /** + * This should not be called directly, instead call + * {@link TypeConversionCodegen#generateStructureConverter(StructureShape)}. + */ + @Override + protected TypeConverter generateLocalServiceReferenceStructureConverter( + final StructureShape structureShape, + final ServiceShape serviceShape + ) { + LocalServiceWrappedNameResolver serviceWrappedNameResolver = + new LocalServiceWrappedNameResolver(model, serviceShape); + final ShapeId resourceShapeId = serviceShape.getId(); + final String shimClass = serviceWrappedNameResolver.shimClassForService(); + final String baseType = nameResolver.baseTypeForShape(resourceShapeId); + + final String throwCustomImplException = + "throw new System.ArgumentException(\"Custom implementations of %s are not supported yet\");".formatted( + baseType + ); + + final TokenTree fromDafnyBody = Token.of( + """ + if (value is %s.Wrapped.%s shim) { + return shim._impl; + } + """.formatted( + nameResolver.namespaceForShapeId(resourceShapeId), + shimClass + ), + throwCustomImplException + ); + + final TokenTree toDafnyBody = Token.of( + """ + if (value is %s impl) { + return new %s.Wrapped.%s(value); + } + """.formatted( + nameResolver.baseTypeForShape(resourceShapeId), + nameResolver.namespaceForShapeId(resourceShapeId), + shimClass + ), + throwCustomImplException + ); + + return buildConverterFromMethodBodies( + structureShape, + fromDafnyBody, + toDafnyBody + ); + } + + /** + * To test @extendable resources they need to be wrapped + * This wrap/unwrap happens in TypeConversion. + * However, the conversions are build to avoid nesting + * and to be generally correct. + * This means if we want to test the type conversion + * for operations on a resource we need some additional wrapping. + * Because the NativeWrappers are not public + * we build our own NativeWrappers and then wrap any such resource. + * + * But here is the rub. + * We need to identify resources that are + * - @extendable + * - In the module we are wrapping + * + * Resources that are not @extendable can not be wrapped at this time. + * Resources in dependent modules are not under test. + * + * + */ + private Boolean shouldWrapLocalResource(final Shape shape) { + if ( + ModelUtils.isReferenceDependantModuleType( + shape, + nameResolver.namespaceForService() + ) ) { - - // In this case we want to ONLY wrap resources - // in the Wrapped namespace. - final boolean shouldWrapLocalResource = shouldWrapLocalResource(shape); - - if (!shouldWrapLocalResource) { - return super.buildConverterFromMethodBodies(shape, fromDafnyBody, toDafnyBody); - } else { - // This is going to create nested resources! - // This means every time a resource crosses into Dafny - // it will be wrapped again. - // This is NOT for PRODUCTION - // This is for test vectors and general correctness testing! - // On the upside, - // when such resources are tested, - // This wrapped NativeWrapper will be exercised - // as well as the normal .NET wrapper. - // While this _does not_ test the NativeWrapper - // in the wrapped module, - // These two classes are generated by the same code. - // So there is some analog. - // See the type conversions for Resources - // for more details. - - final ShapeId id = shape.getId(); - final ShapeId resourceShapeId = shape.expectTrait(ReferenceTrait.class).getReferentId(); - final String dafnyType = nameResolver.dafnyTypeForShape(id); - final String cSharpType = nameResolver.baseTypeForShape(id); - - final String fromDafnyConverterName = typeConverterForShape(shape.getId(), FROM_DAFNY); - final TokenTree fromDafnyConverterSignature = TokenTree.of( - "internal static", cSharpType, fromDafnyConverterName, "(%s value)".formatted(dafnyType)); - - final String toDafnyConverterName = typeConverterForShape(shape.getId(), TO_DAFNY); - final TokenTree toDafnyConverterSignature = TokenTree.of( - "internal static", dafnyType, toDafnyConverterName, "(%s value)".formatted(cSharpType)); - - final String namespaceForReferent = nameResolver.namespaceForShapeId(id); - final TokenTree fromDafnyBodyOverride = TokenTree - .of( - "// This is converting a reference type in a dependant module.", - "// Therefore it defers to the dependant module for conversion", - "return %s.TypeConversion.%s(value);" - .formatted( - namespaceForReferent, - fromDafnyConverterName - ) - - ) - .lineSeparated(); - - final TokenTree toDafnyBodyOverride = TokenTree - .of( - "// This is converting a reference type in a dependant module.", - "// Therefore it defers to the dependant module for conversion", - "return new %s((%s)value);" - .formatted( - nameResolver.nativeWrapperClassForResource(resourceShapeId), - nameResolver.baseClassForResource(resourceShapeId) - ) - ) - .lineSeparated(); - - final TokenTree fromDafnyConverterMethod = TokenTree.of(fromDafnyConverterSignature, fromDafnyBodyOverride.braced()); - final TokenTree toDafnyConverterMethod = TokenTree.of(toDafnyConverterSignature, toDafnyBodyOverride.braced()); - return new TypeConverter(shape.getId(), fromDafnyConverterMethod, toDafnyConverterMethod); - } - } - - /** - * This should not be called directly, instead call - * {@link TypeConversionCodegen#generateStructureConverter(StructureShape)}. - */ - @Override - protected TypeConverter generateLocalServiceReferenceStructureConverter( - final StructureShape structureShape, final ServiceShape serviceShape) { - - LocalServiceWrappedNameResolver serviceWrappedNameResolver - = new LocalServiceWrappedNameResolver(model, serviceShape); - final ShapeId resourceShapeId = serviceShape.getId(); - final String shimClass = serviceWrappedNameResolver.shimClassForService(); - final String baseType = nameResolver.baseTypeForShape(resourceShapeId); - - final String throwCustomImplException = - "throw new System.ArgumentException(\"Custom implementations of %s are not supported yet\");" - .formatted(baseType); - - final TokenTree fromDafnyBody = Token.of(""" - if (value is %s.Wrapped.%s shim) { - return shim._impl; - } - """ - .formatted( - nameResolver.namespaceForShapeId(resourceShapeId), - shimClass), - throwCustomImplException); - - final TokenTree toDafnyBody = Token.of(""" - if (value is %s impl) { - return new %s.Wrapped.%s(value); - } - """ - .formatted(nameResolver.baseTypeForShape(resourceShapeId), - nameResolver.namespaceForShapeId(resourceShapeId), - shimClass), - throwCustomImplException); - - return buildConverterFromMethodBodies(structureShape, fromDafnyBody, toDafnyBody); - } - - /** - * To test @extendable resources they need to be wrapped - * This wrap/unwrap happens in TypeConversion. - * However, the conversions are build to avoid nesting - * and to be generally correct. - * This means if we want to test the type conversion - * for operations on a resource we need some additional wrapping. - * Because the NativeWrappers are not public - * we build our own NativeWrappers and then wrap any such resource. - * - * But here is the rub. - * We need to identify resources that are - * - @extendable - * - In the module we are wrapping - * - * Resources that are not @extendable can not be wrapped at this time. - * Resources in dependent modules are not under test. - * - * - */ - private Boolean shouldWrapLocalResource(final Shape shape) - { - if (ModelUtils.isReferenceDependantModuleType(shape, nameResolver.namespaceForService())) { - final ShapeId resourceShapeId = shape.expectTrait(ReferenceTrait.class).getReferentId(); - return nameResolver.namespaceForShapeId(serviceShape.getId()) - .equalsIgnoreCase(resourceShapeId.getNamespace()) - // Only wrap if it is @extendable - && ( - !shape.expectTrait(ReferenceTrait.class).isService() && - model.expectShape(resourceShapeId, ResourceShape.class).hasTrait(ExtendableTrait.class)); - } else { - return false; - } + final ShapeId resourceShapeId = shape + .expectTrait(ReferenceTrait.class) + .getReferentId(); + return ( + nameResolver + .namespaceForShapeId(serviceShape.getId()) + .equalsIgnoreCase(resourceShapeId.getNamespace()) && + // Only wrap if it is @extendable + (!shape.expectTrait(ReferenceTrait.class).isService() && + model + .expectShape(resourceShapeId, ResourceShape.class) + .hasTrait(ExtendableTrait.class)) + ); + } else { + return false; } + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedNameResolver.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedNameResolver.java index 73f46f7952..afde92fa6e 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedNameResolver.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedNameResolver.java @@ -9,39 +9,41 @@ import software.amazon.smithy.utils.StringUtils; public class LocalServiceWrappedNameResolver extends DotNetNameResolver { - public LocalServiceWrappedNameResolver(final Model model, final ServiceShape serviceShape) { - super(model, serviceShape); - } - - public String shimClassForService() { - return "%sShim".formatted(getServiceName()); - } - - private String getServiceName() { - return StringUtils.capitalize(getServiceShape().getId().getName()); - } - - public String implForServiceClient() { - return "%s.%s" - .formatted( - super.namespaceForService(), - clientForService() - ); - } - - @Override - public String namespaceForService() { - return super.namespaceForService() + ".Wrapped"; - } - - @Override - public String nativeWrapperClassForResource(final ShapeId resourceShapeId) { - return "Wrapped%s".formatted(super.nativeWrapperClassForResource(resourceShapeId)); - } - - public String qualifiedClassForBaseServiceException() { - // TODO: Is a raw exception really the right thing to be returning? - final String cSharpType = "System.Exception"; - return cSharpType; - } + + public LocalServiceWrappedNameResolver( + final Model model, + final ServiceShape serviceShape + ) { + super(model, serviceShape); + } + + public String shimClassForService() { + return "%sShim".formatted(getServiceName()); + } + + private String getServiceName() { + return StringUtils.capitalize(getServiceShape().getId().getName()); + } + + public String implForServiceClient() { + return "%s.%s".formatted(super.namespaceForService(), clientForService()); + } + + @Override + public String namespaceForService() { + return super.namespaceForService() + ".Wrapped"; + } + + @Override + public String nativeWrapperClassForResource(final ShapeId resourceShapeId) { + return "Wrapped%s".formatted( + super.nativeWrapperClassForResource(resourceShapeId) + ); + } + + public String qualifiedClassForBaseServiceException() { + // TODO: Is a raw exception really the right thing to be returning? + final String cSharpType = "System.Exception"; + return cSharpType; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedShimCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedShimCodegen.java index e7542003f6..0e724a33f8 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedShimCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/localServiceWrapper/LocalServiceWrappedShimCodegen.java @@ -3,244 +3,353 @@ package software.amazon.polymorph.smithydotnet.localServiceWrapper; +import static software.amazon.polymorph.smithydotnet.TypeConversionCodegen.collectionOfErrorsToDafny; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; + +import java.nio.file.Path; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Set; - +import java.util.TreeSet; +import java.util.stream.Collectors; import software.amazon.polymorph.smithydafny.DafnyNameResolver; +import software.amazon.polymorph.smithydotnet.DotNetNameResolver; import software.amazon.polymorph.traits.LocalServiceTrait; import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.utils.Token; import software.amazon.polymorph.utils.TokenTree; -import software.amazon.polymorph.smithydotnet.DotNetNameResolver; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.StructureShape; -import java.nio.file.Path; -import java.util.HashMap; -import java.util.Map; -import java.util.TreeSet; -import java.util.stream.Collectors; - -import static software.amazon.polymorph.smithydotnet.TypeConversionCodegen.collectionOfErrorsToDafny; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; - public class LocalServiceWrappedShimCodegen { - private final Model model; - private final ServiceShape serviceShape; - private final LocalServiceWrappedNameResolver nameResolver; - - private static final String IMPL_NAME = "_impl"; - private static final String CONVERT_ERROR_METHOD = "ConvertError"; - - public LocalServiceWrappedShimCodegen( - final Model model, - final ServiceShape serviceShape - ) { - this.model = model; - this.serviceShape = serviceShape; - this.nameResolver = new LocalServiceWrappedNameResolver(model, serviceShape); - } - - public Map generate() { - final Map codeByPath = new HashMap<>(); - final TokenTree prelude = TokenTree.of( - "using System;", - "using System.Collections.Generic;", - "using System.IO;", - "using System.Linq;" - ).lineSeparated(); - - // Service shim - final Path serviceShimPath = Path.of(String.format("%s.cs", nameResolver.shimClassForService())); - final TokenTree serviceShimCode = generateServiceShim(); - codeByPath.put(serviceShimPath, serviceShimCode.prepend(prelude)); - - return codeByPath; - } - - // Why are these constructors public? - // Because the underlying implementation is a replica - // of the existing Dafny LocalService. - // There is no _safety_ introduced here per se, - // so making is `internal` or `private` - // just complicates other Dafny libraries working with the wrapper. - public TokenTree generateServiceShim() { - final TokenTree header = Token.of("public class %s : %s".formatted( - nameResolver.shimClassForService(), - nameResolver.dafnyTypeForShape(serviceShape.getId()))); - - final TokenTree impl = Token.of("public %s %s;".formatted(nameResolver.implForServiceClient(), IMPL_NAME)); - final TokenTree constructor = generateServiceShimConstructor(); - final TokenTree operationShims = TokenTree.of(serviceShape.getAllOperations() - .stream() - .map(this::generateOperationShim)).lineSeparated(); - final TokenTree errorTypeShim = generateErrorTypeShim(); - - final TokenTree classBody = TokenTree.of(impl, constructor, operationShims, errorTypeShim).lineSeparated(); - return header - .append(classBody.braced()) - .namespaced(Token.of(nameResolver.namespaceForService())); - } - - public TokenTree generateServiceShimConstructor() { - return Token.of(""" - public %s(%s impl) { - this.%s = impl; - }""".formatted(nameResolver.shimClassForService(), nameResolver.implForServiceClient(), IMPL_NAME)); - } - - public TokenTree generateOperationShim(final ShapeId operationShapeId) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - final String dafnyOutputType = nameResolver.dafnyTypeForServiceOperationOutput(operationShape, true); - final String implOperationName = nameResolver.methodForOperation(operationShapeId); - - final TokenTree unWrappedRequest = Token.of(operationShape.getInput() - .map(requestShapeId -> "%s unWrappedRequest = %s(request);".formatted( - nameResolver.baseTypeForShape(requestShapeId), - nameResolver.qualifiedTypeConverter(requestShapeId, FROM_DAFNY))) - .orElse("")); - - final TokenTree assignWrappedResponse = Token.of(operationShape.getOutput() - .map(responseShapeId -> "%s wrappedResponse =".formatted(nameResolver.baseTypeForShape(responseShapeId))) - .orElse("")); - - final String requestArg = operationShape.getInput().isPresent() ? "unWrappedRequest" : ""; - final String blockOnResponse = operationShape.getOutput().isPresent() ? ".Result" : ".Wait()"; - final TokenTree callImpl = Token.of("this.%s.%s(%s);".formatted( - IMPL_NAME, implOperationName, requestArg)); - - final TokenTree returnResponse = Token.of(operationShape.getOutput() - .map(responseShapeId -> "return %s.create_Success(%s(wrappedResponse));".formatted( - dafnyOutputType, - nameResolver.qualifiedTypeConverter(responseShapeId, TO_DAFNY))) - .orElse("return %s.create_Success(%s);".formatted( - dafnyOutputType, nameResolver.dafnyValueForUnit()))); - - final TokenTree tryBody = TokenTree.of(unWrappedRequest, assignWrappedResponse, callImpl, returnResponse).lineSeparated(); - final TokenTree tryBlock = Token.of("try").append(tryBody.braced()); - - final String baseExceptionForService = nameResolver.qualifiedClassForBaseServiceException(); - final TokenTree catchBlock = Token.of(""" - catch (%s ex) { - return %s.create_Failure(this.%s(ex)); - } - """.formatted( - baseExceptionForService, - dafnyOutputType, - CONVERT_ERROR_METHOD)); - - final TokenTree methodSignature = generateOperationShimSignature(operationShape); - final TokenTree methodBody = TokenTree.of(tryBlock, catchBlock); - return methodSignature.append(methodBody.braced()); - } - - private TokenTree generateOperationShimSignature(final OperationShape operationShape) { - final String responseType = nameResolver.dafnyTypeForServiceOperationOutput(operationShape); - final String methodName = nameResolver.methodForOperation(operationShape.getId()); - final String requestType = operationShape.getInput() - .map(requestShapeId -> nameResolver.dafnyTypeForShape(requestShapeId) + " request") - .orElse(""); - return Token.of("public %s %s(%s)".formatted(responseType, methodName, requestType)); - } - /** - * Generates a shim for converting from a "Native" LocalService-defined exception to the corresponding Dafny exception. - * These conversions are really "through" the native runtime. - * Since this is wrapping a LocalService, - * probably this is Dafny types on either side. - *

- * We define this here instead of in {@link LocalServiceWrappedShimCodegen} because the base error type isn't modeled. - */ - public TokenTree generateErrorTypeShim() { - final String dafnyErrorAbstractType = - DotNetNameResolver.dafnyTypeForCommonServiceError(serviceShape); - final String dafnyUnknownErrorType = - DotNetNameResolver.dafnyUnknownErrorTypeForServiceShape(serviceShape); - - // For errors from dependencies: pass anything from a dependency-recognized namespace into Dafny - // This passes all unmodelled errors to the dependency type conversion - if (!serviceShape.hasTrait(LocalServiceTrait.class)) throw new IllegalStateException("MUST be an LocalService"); - final LocalServiceTrait localServiceTrait = serviceShape.expectTrait(LocalServiceTrait.class); - - Set dependentNamespaces = ModelUtils.findAllDependentNamespaces( - new HashSet(Collections.singleton(localServiceTrait.getConfigId())), model); - - // Dependencies may throw "unmodelled" errors that are unknown to Polymorph. Polymorph cannot write - // explicit code to handle these errors because it does not know about unmodelled errors. - // This passes errors from a dependency-recognized namespace into the dependency's error handler. - // This handles both modelled and unmodelled errors. - TokenTree dependencyErrors = TokenTree.empty();; - if (dependentNamespaces.size() > 0) { - List casesList = new ArrayList<>(); - for (String dependentNamespace : dependentNamespaces) { - TokenTree toAppend = TokenTree.of( - """ - case "%1$s": - return %2$s.Error.create_%3$s( - %1$s.TypeConversion.ToDafny_CommonError(error) - );""" - .formatted( - DotNetNameResolver.convertToCSharpNamespaceWithSegmentMapper(dependentNamespace, DotNetNameResolver::capitalizeNamespaceSegment), - DafnyNameResolver.dafnyTypesModuleExternNamespace(serviceShape.getId().getNamespace()), - DafnyNameResolver.dafnyBaseModuleName(dependentNamespace) - ) - ); - casesList.add(toAppend); - } - - final TokenTree cases = TokenTree.of(casesList.stream()).lineSeparated(); - - // This `switch` condition is based on the namespace of the exception, and not the specific exception type. - dependencyErrors = Token.of("switch (error.GetType().Namespace)").append(cases.braced()); - } - - // Generate errors for local wrapped service modelled errors and unmodelled errors - // This code generates a default unrecognized error case, which MUST be generated after all other error - // handlers; this includes other `switch` statements. - // Collect into TreeSet so that we generate code in a deterministic order (lexicographic, in particular) - final TreeSet errorShapes = ModelUtils.streamServiceErrors(model, serviceShape) - .collect(Collectors.toCollection(TreeSet::new)); - final TokenTree knownErrorCases = TokenTree.of(errorShapes.stream() - .map(errorShape -> { - final ShapeId errorShapeId = errorShape.getId(); - final String wrappedErrorType = nameResolver.baseTypeForShape(errorShapeId); - final String errorConverter = DotNetNameResolver.qualifiedTypeConverter(errorShapeId, TO_DAFNY); - return Token.of(""" - case %s e: - return %s(e); - """.formatted(wrappedErrorType, errorConverter)); - })).lineSeparated(); - - // CollectionOfErrors wrapper for list of exceptions - final TokenTree collectionOfErrorsCase = collectionOfErrorsToDafny(serviceShape, nameResolver); - - final TokenTree unknownErrorCase = Token.of(""" - default: - return new %s(error); - """.formatted(dafnyUnknownErrorType)); - - final TokenTree signature = Token.of("private %s %s(%s error)".formatted( - dafnyErrorAbstractType, - CONVERT_ERROR_METHOD, - nameResolver.qualifiedClassForBaseServiceException())); - - - final TokenTree cases = TokenTree.of(knownErrorCases, collectionOfErrorsCase, unknownErrorCase).lineSeparated(); - final TokenTree body = TokenTree.of( - "switch (error)").append(cases.braced()); - - return TokenTree.of( - signature.append(TokenTree.of( - dependencyErrors, - body - ).lineSeparated().braced()) - ).lineSeparated(); + private final Model model; + private final ServiceShape serviceShape; + private final LocalServiceWrappedNameResolver nameResolver; + + private static final String IMPL_NAME = "_impl"; + private static final String CONVERT_ERROR_METHOD = "ConvertError"; + + public LocalServiceWrappedShimCodegen( + final Model model, + final ServiceShape serviceShape + ) { + this.model = model; + this.serviceShape = serviceShape; + this.nameResolver = + new LocalServiceWrappedNameResolver(model, serviceShape); + } + + public Map generate() { + final Map codeByPath = new HashMap<>(); + final TokenTree prelude = TokenTree + .of( + "using System;", + "using System.Collections.Generic;", + "using System.IO;", + "using System.Linq;" + ) + .lineSeparated(); + + // Service shim + final Path serviceShimPath = Path.of( + String.format("%s.cs", nameResolver.shimClassForService()) + ); + final TokenTree serviceShimCode = generateServiceShim(); + codeByPath.put(serviceShimPath, serviceShimCode.prepend(prelude)); + + return codeByPath; + } + + // Why are these constructors public? + // Because the underlying implementation is a replica + // of the existing Dafny LocalService. + // There is no _safety_ introduced here per se, + // so making is `internal` or `private` + // just complicates other Dafny libraries working with the wrapper. + public TokenTree generateServiceShim() { + final TokenTree header = Token.of( + "public class %s : %s".formatted( + nameResolver.shimClassForService(), + nameResolver.dafnyTypeForShape(serviceShape.getId()) + ) + ); + + final TokenTree impl = Token.of( + "public %s %s;".formatted(nameResolver.implForServiceClient(), IMPL_NAME) + ); + final TokenTree constructor = generateServiceShimConstructor(); + final TokenTree operationShims = TokenTree + .of( + serviceShape + .getAllOperations() + .stream() + .map(this::generateOperationShim) + ) + .lineSeparated(); + final TokenTree errorTypeShim = generateErrorTypeShim(); + + final TokenTree classBody = TokenTree + .of(impl, constructor, operationShims, errorTypeShim) + .lineSeparated(); + return header + .append(classBody.braced()) + .namespaced(Token.of(nameResolver.namespaceForService())); + } + + public TokenTree generateServiceShimConstructor() { + return Token.of( + """ + public %s(%s impl) { + this.%s = impl; + }""".formatted( + nameResolver.shimClassForService(), + nameResolver.implForServiceClient(), + IMPL_NAME + ) + ); + } + + public TokenTree generateOperationShim(final ShapeId operationShapeId) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + final String dafnyOutputType = + nameResolver.dafnyTypeForServiceOperationOutput(operationShape, true); + final String implOperationName = nameResolver.methodForOperation( + operationShapeId + ); + + final TokenTree unWrappedRequest = Token.of( + operationShape + .getInput() + .map(requestShapeId -> + "%s unWrappedRequest = %s(request);".formatted( + nameResolver.baseTypeForShape(requestShapeId), + nameResolver.qualifiedTypeConverter(requestShapeId, FROM_DAFNY) + ) + ) + .orElse("") + ); + + final TokenTree assignWrappedResponse = Token.of( + operationShape + .getOutput() + .map(responseShapeId -> + "%s wrappedResponse =".formatted( + nameResolver.baseTypeForShape(responseShapeId) + ) + ) + .orElse("") + ); + + final String requestArg = operationShape.getInput().isPresent() + ? "unWrappedRequest" + : ""; + final String blockOnResponse = operationShape.getOutput().isPresent() + ? ".Result" + : ".Wait()"; + final TokenTree callImpl = Token.of( + "this.%s.%s(%s);".formatted(IMPL_NAME, implOperationName, requestArg) + ); + + final TokenTree returnResponse = Token.of( + operationShape + .getOutput() + .map(responseShapeId -> + "return %s.create_Success(%s(wrappedResponse));".formatted( + dafnyOutputType, + nameResolver.qualifiedTypeConverter(responseShapeId, TO_DAFNY) + ) + ) + .orElse( + "return %s.create_Success(%s);".formatted( + dafnyOutputType, + nameResolver.dafnyValueForUnit() + ) + ) + ); + + final TokenTree tryBody = TokenTree + .of(unWrappedRequest, assignWrappedResponse, callImpl, returnResponse) + .lineSeparated(); + final TokenTree tryBlock = Token.of("try").append(tryBody.braced()); + + final String baseExceptionForService = + nameResolver.qualifiedClassForBaseServiceException(); + final TokenTree catchBlock = Token.of( + """ + catch (%s ex) { + return %s.create_Failure(this.%s(ex)); + } + """.formatted( + baseExceptionForService, + dafnyOutputType, + CONVERT_ERROR_METHOD + ) + ); + + final TokenTree methodSignature = generateOperationShimSignature( + operationShape + ); + final TokenTree methodBody = TokenTree.of(tryBlock, catchBlock); + return methodSignature.append(methodBody.braced()); + } + + private TokenTree generateOperationShimSignature( + final OperationShape operationShape + ) { + final String responseType = nameResolver.dafnyTypeForServiceOperationOutput( + operationShape + ); + final String methodName = nameResolver.methodForOperation( + operationShape.getId() + ); + final String requestType = operationShape + .getInput() + .map(requestShapeId -> + nameResolver.dafnyTypeForShape(requestShapeId) + " request" + ) + .orElse(""); + return Token.of( + "public %s %s(%s)".formatted(responseType, methodName, requestType) + ); + } + + /** + * Generates a shim for converting from a "Native" LocalService-defined exception to the corresponding Dafny exception. + * These conversions are really "through" the native runtime. + * Since this is wrapping a LocalService, + * probably this is Dafny types on either side. + *

+ * We define this here instead of in {@link LocalServiceWrappedShimCodegen} because the base error type isn't modeled. + */ + public TokenTree generateErrorTypeShim() { + final String dafnyErrorAbstractType = + DotNetNameResolver.dafnyTypeForCommonServiceError(serviceShape); + final String dafnyUnknownErrorType = + DotNetNameResolver.dafnyUnknownErrorTypeForServiceShape(serviceShape); + + // For errors from dependencies: pass anything from a dependency-recognized namespace into Dafny + // This passes all unmodelled errors to the dependency type conversion + if ( + !serviceShape.hasTrait(LocalServiceTrait.class) + ) throw new IllegalStateException("MUST be an LocalService"); + final LocalServiceTrait localServiceTrait = serviceShape.expectTrait( + LocalServiceTrait.class + ); + + Set dependentNamespaces = ModelUtils.findAllDependentNamespaces( + new HashSet( + Collections.singleton(localServiceTrait.getConfigId()) + ), + model + ); + + // Dependencies may throw "unmodelled" errors that are unknown to Polymorph. Polymorph cannot write + // explicit code to handle these errors because it does not know about unmodelled errors. + // This passes errors from a dependency-recognized namespace into the dependency's error handler. + // This handles both modelled and unmodelled errors. + TokenTree dependencyErrors = TokenTree.empty(); + if (dependentNamespaces.size() > 0) { + List casesList = new ArrayList<>(); + for (String dependentNamespace : dependentNamespaces) { + TokenTree toAppend = TokenTree.of( + """ + case "%1$s": + return %2$s.Error.create_%3$s( + %1$s.TypeConversion.ToDafny_CommonError(error) + );""".formatted( + DotNetNameResolver.convertToCSharpNamespaceWithSegmentMapper( + dependentNamespace, + DotNetNameResolver::capitalizeNamespaceSegment + ), + DafnyNameResolver.dafnyTypesModuleExternNamespace( + serviceShape.getId().getNamespace() + ), + DafnyNameResolver.dafnyBaseModuleName(dependentNamespace) + ) + ); + casesList.add(toAppend); + } + + final TokenTree cases = TokenTree.of(casesList.stream()).lineSeparated(); + + // This `switch` condition is based on the namespace of the exception, and not the specific exception type. + dependencyErrors = + Token.of("switch (error.GetType().Namespace)").append(cases.braced()); } + // Generate errors for local wrapped service modelled errors and unmodelled errors + // This code generates a default unrecognized error case, which MUST be generated after all other error + // handlers; this includes other `switch` statements. + // Collect into TreeSet so that we generate code in a deterministic order (lexicographic, in particular) + final TreeSet errorShapes = ModelUtils + .streamServiceErrors(model, serviceShape) + .collect(Collectors.toCollection(TreeSet::new)); + + final TokenTree knownErrorCases = TokenTree + .of( + errorShapes + .stream() + .map(errorShape -> { + final ShapeId errorShapeId = errorShape.getId(); + final String wrappedErrorType = nameResolver.baseTypeForShape( + errorShapeId + ); + final String errorConverter = + DotNetNameResolver.qualifiedTypeConverter(errorShapeId, TO_DAFNY); + return Token.of( + """ + case %s e: + return %s(e); + """.formatted(wrappedErrorType, errorConverter) + ); + }) + ) + .lineSeparated(); + // CollectionOfErrors wrapper for list of exceptions + final TokenTree collectionOfErrorsCase = collectionOfErrorsToDafny( + serviceShape, + nameResolver + ); + + final TokenTree unknownErrorCase = Token.of( + """ + default: + return new %s(error); + """.formatted(dafnyUnknownErrorType) + ); + + final TokenTree signature = Token.of( + "private %s %s(%s error)".formatted( + dafnyErrorAbstractType, + CONVERT_ERROR_METHOD, + nameResolver.qualifiedClassForBaseServiceException() + ) + ); + + final TokenTree cases = TokenTree + .of(knownErrorCases, collectionOfErrorsCase, unknownErrorCase) + .lineSeparated(); + + final TokenTree body = TokenTree + .of("switch (error)") + .append(cases.braced()); + return TokenTree + .of( + signature.append( + TokenTree.of(dependencyErrors, body).lineSeparated().braced() + ) + ) + .lineSeparated(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegen.java index 2efc7c99e5..099d84d084 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegen.java @@ -3,10 +3,16 @@ package software.amazon.polymorph.smithydotnet.nativeWrapper; +import static software.amazon.polymorph.smithydotnet.DotNetNameResolver.*; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; + +import java.util.List; +import java.util.Optional; +import software.amazon.polymorph.smithydotnet.DotNetNameResolver; import software.amazon.polymorph.traits.PositionalTrait; import software.amazon.polymorph.utils.Token; import software.amazon.polymorph.utils.TokenTree; -import software.amazon.polymorph.smithydotnet.DotNetNameResolver; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.EntityShape; import software.amazon.smithy.model.shapes.OperationShape; @@ -15,13 +21,6 @@ import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.StructureShape; -import java.util.List; -import java.util.Optional; - -import static software.amazon.polymorph.smithydotnet.DotNetNameResolver.*; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; - /** * NativeWrapperCodegen generates a Native Wrapper for a resource implemented in the native language. *

@@ -33,268 +32,375 @@ * */ public class NativeWrapperCodegen { - public final Model model; - public final ServiceShape serviceShape; - public final ResourceShape resourceShape; - public final DotNetNameResolver nameResolver; - public final ShapeId resourceShapeId; - public static final String CLASS_PREFIX = "NativeWrapper"; - protected static final String NATIVE_BASE_PROPERTY = "_impl"; - protected static final String NATIVE_IMPL_INPUT = "nativeImpl"; - protected static final String NATIVE_INPUT = "nativeInput"; - protected static final String NATIVE_OUTPUT = "nativeOutput"; - protected static final String INPUT = "input"; - protected static final String IGNORE_IMPORT = - """ - // ReSharper disable RedundantUsingDirective - // ReSharper disable RedundantNameQualifier - // ReSharper disable SuggestVarOrType_SimpleTypes - """; - protected static final List UNCONDITIONAL_IMPORTS = List.of( - "System", - "_System", - "Wrappers_Compile" - ); + public final Model model; + public final ServiceShape serviceShape; + public final ResourceShape resourceShape; + public final DotNetNameResolver nameResolver; + public final ShapeId resourceShapeId; - public NativeWrapperCodegen( - final Model model, - final ShapeId serviceShapeId, - final ShapeId resourceShapeId, - final DotNetNameResolver nameResolver - ) { - this.model = model; - this.serviceShape = model.expectShape(serviceShapeId, ServiceShape.class); - this.resourceShape = model.expectShape(resourceShapeId, ResourceShape.class); - this.nameResolver = nameResolver; - this.resourceShapeId = resourceShapeId; - } + public static final String CLASS_PREFIX = "NativeWrapper"; + protected static final String NATIVE_BASE_PROPERTY = "_impl"; + protected static final String NATIVE_IMPL_INPUT = "nativeImpl"; + protected static final String NATIVE_INPUT = "nativeInput"; + protected static final String NATIVE_OUTPUT = "nativeOutput"; + protected static final String INPUT = "input"; + protected static final String IGNORE_IMPORT = + """ + // ReSharper disable RedundantUsingDirective + // ReSharper disable RedundantNameQualifier + // ReSharper disable SuggestVarOrType_SimpleTypes + """; + protected static final List UNCONDITIONAL_IMPORTS = List.of( + "System", + "_System", + "Wrappers_Compile" + ); - /** - * Generates concrete NativeWrapper class, complete with import statements. - */ - public TokenTree generate() { - TokenTree clazz = generateClass(); - return TokenTree - .of(getPrelude()) - .append(TokenTree.of("\n")) - .append(clazz) - .lineSeparated(); - } + public NativeWrapperCodegen( + final Model model, + final ShapeId serviceShapeId, + final ShapeId resourceShapeId, + final DotNetNameResolver nameResolver + ) { + this.model = model; + this.serviceShape = model.expectShape(serviceShapeId, ServiceShape.class); + this.resourceShape = + model.expectShape(resourceShapeId, ResourceShape.class); + this.nameResolver = nameResolver; + this.resourceShapeId = resourceShapeId; + } - /** - * Returns Import statement - */ - static TokenTree getPrelude() { - final TokenTree imports = TokenTree.of(UNCONDITIONAL_IMPORTS - .stream() - .map("using %s;"::formatted) - .map(Token::of)).lineSeparated(); - return TokenTree.of(IGNORE_IMPORT) - .append(imports); - } + /** + * Generates concrete NativeWrapper class, complete with import statements. + */ + public TokenTree generate() { + TokenTree clazz = generateClass(); + return TokenTree + .of(getPrelude()) + .append(TokenTree.of("\n")) + .append(clazz) + .lineSeparated(); + } - TokenTree generateClass() { - String className = nameResolver.nativeWrapperClassForResource(resourceShapeId); - final TokenTree header = Token.of("internal class %s : %s ".formatted( - className, - nameResolver.dafnyTypeForShape(resourceShapeId) - )); - final TokenTree nativeBaseProperty = TokenTree.of( - "internal readonly %s %s;".formatted( - nameResolver.baseClassForResource(resourceShapeId), - NATIVE_BASE_PROPERTY - )); - final TokenTree constructor = generateConstructor(className); - final TokenTree operationWrappers = TokenTree.of( - model.expectShape(resourceShapeId, EntityShape.class) - .getAllOperations().stream() - .map(this::generateOperationWrapper)) - .lineSeparated(); - final TokenTree body = TokenTree - .of(nativeBaseProperty, constructor, operationWrappers) - .lineSeparated() - .braced(); - return header - .append(body) - .lineSeparated() - .namespaced(Token.of(nameResolver.namespaceForService())); - } + /** + * Returns Import statement + */ + static TokenTree getPrelude() { + final TokenTree imports = TokenTree + .of( + UNCONDITIONAL_IMPORTS + .stream() + .map("using %s;"::formatted) + .map(Token::of) + ) + .lineSeparated(); + return TokenTree.of(IGNORE_IMPORT).append(imports); + } - TokenTree generateConstructor(String className) { - final String methodName = "public %s(%s %s)".formatted( - className, - nameResolver.baseClassForResource(resourceShapeId), - NATIVE_IMPL_INPUT - ); - final String body = "%s = %s;".formatted( - NATIVE_BASE_PROPERTY, - NATIVE_IMPL_INPUT + TokenTree generateClass() { + String className = nameResolver.nativeWrapperClassForResource( + resourceShapeId + ); + final TokenTree header = Token.of( + "internal class %s : %s ".formatted( + className, + nameResolver.dafnyTypeForShape(resourceShapeId) + ) + ); + final TokenTree nativeBaseProperty = TokenTree.of( + "internal readonly %s %s;".formatted( + nameResolver.baseClassForResource(resourceShapeId), + NATIVE_BASE_PROPERTY + ) + ); + final TokenTree constructor = generateConstructor(className); + final TokenTree operationWrappers = TokenTree + .of( + model + .expectShape(resourceShapeId, EntityShape.class) + .getAllOperations() + .stream() + .map(this::generateOperationWrapper) + ) + .lineSeparated(); + final TokenTree body = TokenTree + .of(nativeBaseProperty, constructor, operationWrappers) + .lineSeparated() + .braced(); + return header + .append(body) + .lineSeparated() + .namespaced(Token.of(nameResolver.namespaceForService())); + } + + TokenTree generateConstructor(String className) { + final String methodName = + "public %s(%s %s)".formatted( + className, + nameResolver.baseClassForResource(resourceShapeId), + NATIVE_IMPL_INPUT ); - return TokenTree.of(methodName) - .append(TokenTree.of(body).braced()) - .lineSeparated(); - } + final String body = + "%s = %s;".formatted(NATIVE_BASE_PROPERTY, NATIVE_IMPL_INPUT); + return TokenTree + .of(methodName) + .append(TokenTree.of(body).braced()) + .lineSeparated(); + } - TokenTree generateOperationWrapper(final ShapeId operationShapeId) { - final OperationShape operationShape = model.expectShape(operationShapeId, OperationShape.class); - final String abstractDafnyOutput = nameResolver.dafnyTypeForServiceOperationOutput(operationShape); - final String concreteDafnyOutput = nameResolver.dafnyTypeForServiceOperationOutput(operationShape, true); - final String methodName = nameResolver.methodForOperation(operationShapeId); - final Optional nativeOutputType = operationShape.getOutput() - .map(nameResolver::baseTypeForShape); + TokenTree generateOperationWrapper(final ShapeId operationShapeId) { + final OperationShape operationShape = model.expectShape( + operationShapeId, + OperationShape.class + ); + final String abstractDafnyOutput = + nameResolver.dafnyTypeForServiceOperationOutput(operationShape); + final String concreteDafnyOutput = + nameResolver.dafnyTypeForServiceOperationOutput(operationShape, true); + final String methodName = nameResolver.methodForOperation(operationShapeId); + final Optional nativeOutputType = operationShape + .getOutput() + .map(nameResolver::baseTypeForShape); - final Optional input = operationShape.getInput() - .map(shapeId -> "%s %s".formatted( - nameResolver.dafnyTypeForShape(shapeId), INPUT)); - final String signature = "public %s %s(%s)".formatted( - abstractDafnyOutput, methodName, input.orElse("")); - final TokenTree inputConversion = generateInputConversion(operationShape.getInput()); - final TokenTree tryBlock = generateTryNativeCall( - operationShape, - methodName, - input, - nativeOutputType, - concreteDafnyOutput); - final TokenTree body = TokenTree.of( - generateValidateNativeOutputMethod( - operationShape.getOutput(), nativeOutputType, methodName), - inputConversion, - tryBlock, - // See generateTryNativeCall for details on why we MUST try/catch here. - generateCatchThatReturnsFailure("Exception", concreteDafnyOutput) - ) - .lineSeparated().braced(); + final Optional input = operationShape + .getInput() + .map(shapeId -> + "%s %s".formatted(nameResolver.dafnyTypeForShape(shapeId), INPUT) + ); + final String signature = + "public %s %s(%s)".formatted( + abstractDafnyOutput, + methodName, + input.orElse("") + ); + final TokenTree inputConversion = generateInputConversion( + operationShape.getInput() + ); + final TokenTree tryBlock = generateTryNativeCall( + operationShape, + methodName, + input, + nativeOutputType, + concreteDafnyOutput + ); + final TokenTree body = TokenTree + .of( + generateValidateNativeOutputMethod( + operationShape.getOutput(), + nativeOutputType, + methodName + ), + inputConversion, + tryBlock, + // See generateTryNativeCall for details on why we MUST try/catch here. + generateCatchThatReturnsFailure("Exception", concreteDafnyOutput) + ) + .lineSeparated() + .braced(); - // The current Dafny generates a public method and `method'`. - // This means that Dafny can hook this function - // and provide a clean interface for validated mocks. - // However, this exposes this name publicly. - // TODO migrate the internal construction to abstract modules - final String signature_K = "public %s %s_k(%s)".formatted( - abstractDafnyOutput, methodName, input.orElse("")); - final TokenTree body_k = TokenTree - .of("throw new %s(\"Not supported at this time.\");" - .formatted(classForConcreteServiceException(serviceShape))) - .braced(); + // The current Dafny generates a public method and `method'`. + // This means that Dafny can hook this function + // and provide a clean interface for validated mocks. + // However, this exposes this name publicly. + // TODO migrate the internal construction to abstract modules + final String signature_K = + "public %s %s_k(%s)".formatted( + abstractDafnyOutput, + methodName, + input.orElse("") + ); + final TokenTree body_k = TokenTree + .of( + "throw new %s(\"Not supported at this time.\");".formatted( + classForConcreteServiceException(serviceShape) + ) + ) + .braced(); - return TokenTree.of(TokenTree.of(signature), body, TokenTree.of(signature_K), body_k).lineSeparated(); - } + return TokenTree + .of(TokenTree.of(signature), body, TokenTree.of(signature_K), body_k) + .lineSeparated(); + } - TokenTree generateInputConversion(Optional inputShapeId) { - if (inputShapeId.isEmpty()) return TokenTree.empty(); - return TokenTree.of("%s %s = %s(%s);".formatted( - nameResolver.baseTypeForShape(inputShapeId.get()), - NATIVE_INPUT, - qualifiedTypeConverter(inputShapeId.get(), FROM_DAFNY), - INPUT)); - } + TokenTree generateInputConversion(Optional inputShapeId) { + if (inputShapeId.isEmpty()) return TokenTree.empty(); + return TokenTree.of( + "%s %s = %s(%s);".formatted( + nameResolver.baseTypeForShape(inputShapeId.get()), + NATIVE_INPUT, + qualifiedTypeConverter(inputShapeId.get(), FROM_DAFNY), + INPUT + ) + ); + } - // This is calling the underlying native implementation - // of a Dafny interface. - // This means we are leaving the verified boundary - // and crossing into the native runtime. - // This is problematic because Dafny expects - // to be able to reason about this component. - // Dafny expects that this will return a Result. - // But more importantly, that it MUST NOT throw. - // This is because Dafny does not have throw/try/catch semantics. - // If a natively implemented resource throws unexpectedly, - // this can introduce unsoundness into our Dafny model. - // Therefore, we MUST try and then wrap the error - // so that we can return a Dafny result. - TokenTree generateTryNativeCall( - OperationShape operationShape, - String methodName, - Optional input, - Optional nativeOutputType, - String concreteDafnyOutput - ) { - final Optional nativeCallPrefix = - nativeOutputType.map(s -> "%s %s =".formatted( - s, NATIVE_OUTPUT)); - final TokenTree nativeCall = TokenTree.of("%s %s.%s(%s);".formatted( - nativeCallPrefix.orElse(""), NATIVE_BASE_PROPERTY, - methodName, input.isPresent() ? NATIVE_INPUT : "")); - final TokenTree isNativeOutputNull = generateIsNativeOutputNull( - methodName, nativeOutputType); - final TokenTree validateNativeOutput = generateValidateNativeOutput( - operationShape.getOutput()); - final Optional successConversion = operationShape - .getOutput() - .map(shapeId -> "%s(%s)".formatted( - qualifiedTypeConverter(shapeId, TO_DAFNY), - NATIVE_OUTPUT)); - final String outputType = operationShape.getOutput() - .map(nameResolver::dafnyTypeForShape) - .orElse(nameResolver.dafnyTypeForUnit()).replace("_System._I", ""); - final TokenTree returnSuccess = TokenTree.of("return %s.create_Success(%s);".formatted( - concreteDafnyOutput, successConversion.orElse("%s.create()".formatted(outputType)))); + // This is calling the underlying native implementation + // of a Dafny interface. + // This means we are leaving the verified boundary + // and crossing into the native runtime. + // This is problematic because Dafny expects + // to be able to reason about this component. + // Dafny expects that this will return a Result. + // But more importantly, that it MUST NOT throw. + // This is because Dafny does not have throw/try/catch semantics. + // If a natively implemented resource throws unexpectedly, + // this can introduce unsoundness into our Dafny model. + // Therefore, we MUST try and then wrap the error + // so that we can return a Dafny result. + TokenTree generateTryNativeCall( + OperationShape operationShape, + String methodName, + Optional input, + Optional nativeOutputType, + String concreteDafnyOutput + ) { + final Optional nativeCallPrefix = nativeOutputType.map(s -> + "%s %s =".formatted(s, NATIVE_OUTPUT) + ); + final TokenTree nativeCall = TokenTree.of( + "%s %s.%s(%s);".formatted( + nativeCallPrefix.orElse(""), + NATIVE_BASE_PROPERTY, + methodName, + input.isPresent() ? NATIVE_INPUT : "" + ) + ); + final TokenTree isNativeOutputNull = generateIsNativeOutputNull( + methodName, + nativeOutputType + ); + final TokenTree validateNativeOutput = generateValidateNativeOutput( + operationShape.getOutput() + ); + final Optional successConversion = operationShape + .getOutput() + .map(shapeId -> + "%s(%s)".formatted( + qualifiedTypeConverter(shapeId, TO_DAFNY), + NATIVE_OUTPUT + ) + ); + final String outputType = operationShape + .getOutput() + .map(nameResolver::dafnyTypeForShape) + .orElse(nameResolver.dafnyTypeForUnit()) + .replace("_System._I", ""); + final TokenTree returnSuccess = TokenTree.of( + "return %s.create_Success(%s);".formatted( + concreteDafnyOutput, + successConversion.orElse("%s.create()".formatted(outputType)) + ) + ); - return TokenTree.of("try").append( - TokenTree.of(nativeCall, isNativeOutputNull, validateNativeOutput, returnSuccess) - .lineSeparated().braced() - ); - } + return TokenTree + .of("try") + .append( + TokenTree + .of( + nativeCall, + isNativeOutputNull, + validateNativeOutput, + returnSuccess + ) + .lineSeparated() + .braced() + ); + } - TokenTree generateIsNativeOutputNull( - String methodName, - Optional nativeOutputType - ) { - if (nativeOutputType.isEmpty()) return TokenTree.empty(); - final String nullMessage = "$\"{%s}._%s returned null, should be {typeof(%s)}\"" - .formatted(NATIVE_BASE_PROPERTY, methodName, nativeOutputType.get()); - final String exception = classForConcreteServiceException(serviceShape); - final String nullCheck = "_ = %s ?? throw new %s(%s);" - .formatted(NATIVE_OUTPUT, exception, nullMessage); - return TokenTree.of(nullCheck); - } + TokenTree generateIsNativeOutputNull( + String methodName, + Optional nativeOutputType + ) { + if (nativeOutputType.isEmpty()) return TokenTree.empty(); + final String nullMessage = + "$\"{%s}._%s returned null, should be {typeof(%s)}\"".formatted( + NATIVE_BASE_PROPERTY, + methodName, + nativeOutputType.get() + ); + final String exception = classForConcreteServiceException(serviceShape); + final String nullCheck = + "_ = %s ?? throw new %s(%s);".formatted( + NATIVE_OUTPUT, + exception, + nullMessage + ); + return TokenTree.of(nullCheck); + } - TokenTree generateValidateNativeOutput(Optional outputShapeId) { - if (outputShapeId.isEmpty()) return TokenTree.empty(); - StructureShape structureShape = model.expectShape(outputShapeId.get(), StructureShape.class); - if (structureShape.hasTrait(PositionalTrait.class)) return TokenTree.empty(); - return TokenTree.of("validateOutput(%s);".formatted(NATIVE_OUTPUT)); - } + TokenTree generateValidateNativeOutput(Optional outputShapeId) { + if (outputShapeId.isEmpty()) return TokenTree.empty(); + StructureShape structureShape = model.expectShape( + outputShapeId.get(), + StructureShape.class + ); + if ( + structureShape.hasTrait(PositionalTrait.class) + ) return TokenTree.empty(); + return TokenTree.of("validateOutput(%s);".formatted(NATIVE_OUTPUT)); + } - TokenTree generateValidateNativeOutputMethod( - Optional outputShapeId, - Optional nativeOutputType, - String methodName - ) { - if (outputShapeId.isEmpty() || nativeOutputType.isEmpty()) return TokenTree.empty(); - StructureShape structureShape = model.expectShape(outputShapeId.get(), StructureShape.class); - if (structureShape.hasTrait(PositionalTrait.class)) return TokenTree.empty(); - final String signature = "void validateOutput(%s %s)".formatted( - nativeOutputType.get(), NATIVE_OUTPUT + TokenTree generateValidateNativeOutputMethod( + Optional outputShapeId, + Optional nativeOutputType, + String methodName + ) { + if ( + outputShapeId.isEmpty() || nativeOutputType.isEmpty() + ) return TokenTree.empty(); + StructureShape structureShape = model.expectShape( + outputShapeId.get(), + StructureShape.class + ); + if ( + structureShape.hasTrait(PositionalTrait.class) + ) return TokenTree.empty(); + final String signature = + "void validateOutput(%s %s)".formatted( + nativeOutputType.get(), + NATIVE_OUTPUT ); - final String tryCatch = "try { %s.Validate(); } catch (ArgumentException e)" - .formatted(NATIVE_OUTPUT); - final TokenTree catchBlock = TokenTree.of( - "var message = $\"Output of {%s}._%s is invalid. {e.Message}\";" - .formatted(NATIVE_BASE_PROPERTY, methodName), - "throw new %s(message);" - .formatted(classForConcreteServiceException(serviceShape)) - ) - .lineSeparated().braced(); - final TokenTree body = TokenTree.of(TokenTree.of(tryCatch), catchBlock) - .lineSeparated().braced(); - return TokenTree.of(signature).append(body); - } + final String tryCatch = + "try { %s.Validate(); } catch (ArgumentException e)".formatted( + NATIVE_OUTPUT + ); + final TokenTree catchBlock = TokenTree + .of( + "var message = $\"Output of {%s}._%s is invalid. {e.Message}\";".formatted( + NATIVE_BASE_PROPERTY, + methodName + ), + "throw new %s(message);".formatted( + classForConcreteServiceException(serviceShape) + ) + ) + .lineSeparated() + .braced(); + final TokenTree body = TokenTree + .of(TokenTree.of(tryCatch), catchBlock) + .lineSeparated() + .braced(); + return TokenTree.of(signature).append(body); + } - TokenTree generateCatchThatReturnsFailure( - final String caughtException, - final String dafnyOutput - ) { - final String catchStatement = "catch(%s e)".formatted(caughtException); - final TokenTree caughtStatement = TokenTree.of("return %s.create_Failure(%s(e));". - formatted( - dafnyOutput, - nameResolver.qualifiedTypeConverterForCommonError(serviceShape, TO_DAFNY) - )); - return TokenTree - .of(catchStatement) - .append(TokenTree.of(caughtStatement).braced()) - .lineSeparated(); - } + TokenTree generateCatchThatReturnsFailure( + final String caughtException, + final String dafnyOutput + ) { + final String catchStatement = "catch(%s e)".formatted(caughtException); + final TokenTree caughtStatement = TokenTree.of( + "return %s.create_Failure(%s(e));".formatted( + dafnyOutput, + nameResolver.qualifiedTypeConverterForCommonError( + serviceShape, + TO_DAFNY + ) + ) + ); + return TokenTree + .of(catchStatement) + .append(TokenTree.of(caughtStatement).braced()) + .lineSeparated(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuildMethod.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuildMethod.java index 585c6cf1dc..8c22d68363 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuildMethod.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuildMethod.java @@ -5,164 +5,235 @@ import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.MethodSpec; - import java.util.List; import java.util.Objects; - import javax.lang.model.element.Modifier; - -import software.amazon.polymorph.utils.ConstrainTraitUtils; import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; import software.amazon.polymorph.smithyjava.modeled.ModeledUnion; - +import software.amazon.polymorph.utils.ConstrainTraitUtils; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.traits.LengthTrait; import software.amazon.smithy.model.traits.RangeTrait; public class BuildMethod { - /** - * Generates a build method for a BuilderImpl that respects a shapes constraint traits. - * The code here assumes access to a Builder's normal getter methods via `this.fieldName()`. - *

- * NOTE: Our builder pattern does NOT invoke a super's build(), - * so a sub-class will not invoke the super's trait validation. - * This is OK, as: - *

    - *
  • We only intend to use super/class-hierarchy for exceptions - *
  • This method takes in the shape only, not the super shape, so it only knows about the local fields - *
  • For smithy-modeled shapes, all the fields should be defined on the shape anyhow. - *
- */ - public static MethodSpec implBuildMethod( - boolean overrideSuper, - Shape shape, - JavaLibrary subject, - String packageName - ) { - ClassName className = ClassName.get(packageName, shape.getId().getName()); - List polyFieldSpecs = PolymorphFieldSpec.shapeToPolyFieldSpecs(shape, subject); - MethodSpec.Builder buildMethod = MethodSpec.methodBuilder("build") - .addModifiers(Modifier.PUBLIC) - .returns(className); - if (overrideSuper) { buildMethod.addAnnotation(Override.class); } - - polyFieldSpecs.forEach(polyField -> { - // Required Trait - if (polyField.isRequired()) { - buildMethod.addCode(requiredCheck(polyField.fieldSpec)); - } - - // Range Trait - RangeTrait rangeTrait = polyField.rangeTrait().isPresent() ? - polyField.rangeTrait().get() : null; - if (rangeTrait != null && polyField.rangeMin().isPresent()) { - buildMethod.addCode(rangeMinCheck(polyField, rangeTrait)); - } - if (rangeTrait != null && polyField.rangeMax().isPresent()) { - buildMethod.addCode(rangeMaxCheck(polyField, rangeTrait)); - } - - // Length Trait - LengthTrait lengthTrait = polyField.lengthTrait().isPresent() ? - polyField.lengthTrait().get() : null; - if (lengthTrait != null && polyField.lengthMin().isPresent()) { - buildMethod.addCode(lengthMinCheck(polyField, lengthTrait)); - } - if (lengthTrait != null && polyField.lengthMax().isPresent()) { - buildMethod.addCode(lengthMaxCheck(polyField, lengthTrait)); - } - }); - - // Union check - if (shape.isUnionShape()) { - buildMethod.addCode(unionCheck(shape.getId().getName())); - } - - buildMethod.addStatement("return new $T(this)", className); - return buildMethod.build(); - } - static CodeBlock fieldNonNull(BuilderMemberSpec field) { - if (field.type.isPrimitive()) { - return CodeBlock.of("this.$L", isSetFieldName(field)); - } - return CodeBlock.of("$T.nonNull(this.$L())", Objects.class, field.name); + /** + * Generates a build method for a BuilderImpl that respects a shapes constraint traits. + * The code here assumes access to a Builder's normal getter methods via `this.fieldName()`. + *

+ * NOTE: Our builder pattern does NOT invoke a super's build(), + * so a sub-class will not invoke the super's trait validation. + * This is OK, as: + *

    + *
  • We only intend to use super/class-hierarchy for exceptions + *
  • This method takes in the shape only, not the super shape, so it only knows about the local fields + *
  • For smithy-modeled shapes, all the fields should be defined on the shape anyhow. + *
+ */ + public static MethodSpec implBuildMethod( + boolean overrideSuper, + Shape shape, + JavaLibrary subject, + String packageName + ) { + ClassName className = ClassName.get(packageName, shape.getId().getName()); + List polyFieldSpecs = + PolymorphFieldSpec.shapeToPolyFieldSpecs(shape, subject); + MethodSpec.Builder buildMethod = MethodSpec + .methodBuilder("build") + .addModifiers(Modifier.PUBLIC) + .returns(className); + if (overrideSuper) { + buildMethod.addAnnotation(Override.class); } - static String isSetFieldName(BuilderMemberSpec field) { - return "_%sSet".formatted(field.name); + polyFieldSpecs.forEach(polyField -> { + // Required Trait + if (polyField.isRequired()) { + buildMethod.addCode(requiredCheck(polyField.fieldSpec)); + } + + // Range Trait + RangeTrait rangeTrait = polyField.rangeTrait().isPresent() + ? polyField.rangeTrait().get() + : null; + if (rangeTrait != null && polyField.rangeMin().isPresent()) { + buildMethod.addCode(rangeMinCheck(polyField, rangeTrait)); + } + if (rangeTrait != null && polyField.rangeMax().isPresent()) { + buildMethod.addCode(rangeMaxCheck(polyField, rangeTrait)); + } + + // Length Trait + LengthTrait lengthTrait = polyField.lengthTrait().isPresent() + ? polyField.lengthTrait().get() + : null; + if (lengthTrait != null && polyField.lengthMin().isPresent()) { + buildMethod.addCode(lengthMinCheck(polyField, lengthTrait)); + } + if (lengthTrait != null && polyField.lengthMax().isPresent()) { + buildMethod.addCode(lengthMaxCheck(polyField, lengthTrait)); + } + }); + + // Union check + if (shape.isUnionShape()) { + buildMethod.addCode(unionCheck(shape.getId().getName())); } - public static CodeBlock requiredCheck(BuilderMemberSpec field) { - CodeBlock.Builder check = CodeBlock.builder(); - if (field.type.isPrimitive()) { - check.beginControlFlow("if (!this.$L)", isSetFieldName(field)); - } else { - check.beginControlFlow("if ($T.isNull(this.$L())) ", Objects.class, field.name); - } - return check.addStatement( - "throw new $T($S)", - IllegalArgumentException.class, - "Missing value for required field `%s`".formatted(field.name)) - .endControlFlow() - .build(); - } + buildMethod.addStatement("return new $T(this)", className); + return buildMethod.build(); + } - static CodeBlock rangeMinCheck(PolymorphFieldSpec polyField, RangeTrait trait) { - String min = ConstrainTraitUtils.RangeTraitUtils.minAsShapeType(polyField.getTargetShape(), trait); - return CodeBlock.builder() - .beginControlFlow("if ($L && this.$L() < $L)", fieldNonNull(polyField.fieldSpec), polyField.name, min) - .addStatement( - "throw new $T($S)", - IllegalArgumentException.class, - "`%s` must be greater than or equal to %s".formatted(polyField.name, min)) - .endControlFlow().build(); + static CodeBlock fieldNonNull(BuilderMemberSpec field) { + if (field.type.isPrimitive()) { + return CodeBlock.of("this.$L", isSetFieldName(field)); } - - static CodeBlock rangeMaxCheck(PolymorphFieldSpec polyField, RangeTrait trait) { - String max = ConstrainTraitUtils.RangeTraitUtils.maxAsShapeType(polyField.getTargetShape(), trait); - return CodeBlock.builder() - .beginControlFlow("if ($L && this.$L() > $L)", fieldNonNull(polyField.fieldSpec), polyField.name, max) - .addStatement( - "throw new $T($S)", - IllegalArgumentException.class, - "`%s` must be less than or equal to %s.".formatted(polyField.name, max)) - .endControlFlow().build(); - } - - static CodeBlock lengthMinCheck(PolymorphFieldSpec polyField, LengthTrait trait) { - String min = ConstrainTraitUtils.LengthTraitUtils.min(trait); - return CodeBlock.builder() - .beginControlFlow("if ($L && this.$L().$L < $L)", - fieldNonNull(polyField.fieldSpec), - polyField.name, polyField.getLengthMethod(), min) - .addStatement( - "throw new $T($S)", - IllegalArgumentException.class, - "The size of `%s` must be greater than or equal to %s".formatted(polyField.name, min)) - .endControlFlow().build(); - } - - static CodeBlock lengthMaxCheck(PolymorphFieldSpec polyField, LengthTrait trait) { - String max = ConstrainTraitUtils.LengthTraitUtils.max(trait); - return CodeBlock.builder() - .beginControlFlow("if ($L && this.$L().$L > $L)", - fieldNonNull(polyField.fieldSpec), - polyField.name, polyField.getLengthMethod(), max) - .addStatement( - "throw new $T($S)", - IllegalArgumentException.class, - "The size of `%s` must be less than or equal to %s".formatted(polyField.name, max)) - .endControlFlow().build(); - } - - static CodeBlock unionCheck(String className) { - return CodeBlock.builder() - .beginControlFlow("if (!$L())", ModeledUnion.UNION_VALIDATE_METHOD_NAME) - .addStatement( - "throw new $T($S)", - IllegalArgumentException.class, - "`%s` is a Union. A Union MUST have one and only one value set.".formatted(className)) - .endControlFlow().build(); + return CodeBlock.of("$T.nonNull(this.$L())", Objects.class, field.name); + } + + static String isSetFieldName(BuilderMemberSpec field) { + return "_%sSet".formatted(field.name); + } + + public static CodeBlock requiredCheck(BuilderMemberSpec field) { + CodeBlock.Builder check = CodeBlock.builder(); + if (field.type.isPrimitive()) { + check.beginControlFlow("if (!this.$L)", isSetFieldName(field)); + } else { + check.beginControlFlow( + "if ($T.isNull(this.$L())) ", + Objects.class, + field.name + ); } + return check + .addStatement( + "throw new $T($S)", + IllegalArgumentException.class, + "Missing value for required field `%s`".formatted(field.name) + ) + .endControlFlow() + .build(); + } + + static CodeBlock rangeMinCheck( + PolymorphFieldSpec polyField, + RangeTrait trait + ) { + String min = ConstrainTraitUtils.RangeTraitUtils.minAsShapeType( + polyField.getTargetShape(), + trait + ); + return CodeBlock + .builder() + .beginControlFlow( + "if ($L && this.$L() < $L)", + fieldNonNull(polyField.fieldSpec), + polyField.name, + min + ) + .addStatement( + "throw new $T($S)", + IllegalArgumentException.class, + "`%s` must be greater than or equal to %s".formatted( + polyField.name, + min + ) + ) + .endControlFlow() + .build(); + } + + static CodeBlock rangeMaxCheck( + PolymorphFieldSpec polyField, + RangeTrait trait + ) { + String max = ConstrainTraitUtils.RangeTraitUtils.maxAsShapeType( + polyField.getTargetShape(), + trait + ); + return CodeBlock + .builder() + .beginControlFlow( + "if ($L && this.$L() > $L)", + fieldNonNull(polyField.fieldSpec), + polyField.name, + max + ) + .addStatement( + "throw new $T($S)", + IllegalArgumentException.class, + "`%s` must be less than or equal to %s.".formatted(polyField.name, max) + ) + .endControlFlow() + .build(); + } + + static CodeBlock lengthMinCheck( + PolymorphFieldSpec polyField, + LengthTrait trait + ) { + String min = ConstrainTraitUtils.LengthTraitUtils.min(trait); + return CodeBlock + .builder() + .beginControlFlow( + "if ($L && this.$L().$L < $L)", + fieldNonNull(polyField.fieldSpec), + polyField.name, + polyField.getLengthMethod(), + min + ) + .addStatement( + "throw new $T($S)", + IllegalArgumentException.class, + "The size of `%s` must be greater than or equal to %s".formatted( + polyField.name, + min + ) + ) + .endControlFlow() + .build(); + } + + static CodeBlock lengthMaxCheck( + PolymorphFieldSpec polyField, + LengthTrait trait + ) { + String max = ConstrainTraitUtils.LengthTraitUtils.max(trait); + return CodeBlock + .builder() + .beginControlFlow( + "if ($L && this.$L().$L > $L)", + fieldNonNull(polyField.fieldSpec), + polyField.name, + polyField.getLengthMethod(), + max + ) + .addStatement( + "throw new $T($S)", + IllegalArgumentException.class, + "The size of `%s` must be less than or equal to %s".formatted( + polyField.name, + max + ) + ) + .endControlFlow() + .build(); + } + + static CodeBlock unionCheck(String className) { + return CodeBlock + .builder() + .beginControlFlow("if (!$L())", ModeledUnion.UNION_VALIDATE_METHOD_NAME) + .addStatement( + "throw new $T($S)", + IllegalArgumentException.class, + "`%s` is a Union. A Union MUST have one and only one value set.".formatted( + className + ) + ) + .endControlFlow() + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuilderMemberSpec.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuilderMemberSpec.java index bc2787032f..f09dca461a 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuilderMemberSpec.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuilderMemberSpec.java @@ -2,144 +2,186 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava; +import static software.amazon.polymorph.smithyjava.generator.Generator.INTERFACE_VAR; +import static software.amazon.polymorph.utils.AwsSdkNameResolverHelpers.isInAwsSdkNamespace; +import static software.amazon.polymorph.utils.ModelUtils.resolveShape; + import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.TypeName; - import java.util.List; import java.util.Objects; import java.util.Optional; - import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.lang.model.element.Modifier; - import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; import software.amazon.polymorph.smithyjava.nameresolver.Native; import software.amazon.polymorph.smithyjava.unmodeled.CollectionOfErrors; import software.amazon.polymorph.traits.JavaDocTrait; import software.amazon.polymorph.traits.LocalServiceTrait; import software.amazon.polymorph.utils.ModelUtils.ResolvedShapeId; - import software.amazon.smithy.model.shapes.MemberShape; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.StructureShape; import software.amazon.smithy.model.traits.StringTrait; -import static software.amazon.polymorph.smithyjava.generator.Generator.INTERFACE_VAR; -import static software.amazon.polymorph.utils.AwsSdkNameResolverHelpers.isInAwsSdkNamespace; -import static software.amazon.polymorph.utils.ModelUtils.resolveShape; - // TODO: We can shrink our code base by combining // BuilderMemberSpec w/ PolymorphFieldSpec. // They serve very similar purposes: // Parsing Traits from Smithy Shapes for Builder Class generators. public class BuilderMemberSpec { - private final static BuilderMemberSpec _MESSAGE = - new BuilderMemberSpec( - TypeName.get(String.class), - "message", - "The detailed message. The detail message is saved for" + - " later retrieval by the {@link #getMessage()} method."); - private final static BuilderMemberSpec _CAUSE = - new BuilderMemberSpec( - TypeName.get(Throwable.class), - "cause", - "The cause (which is saved for later retrieval by the" + - " {@link #getCause()} method). (A {@code null} value is" + - " permitted, and indicates that the cause is nonexistent or" + - " unknown.)"); - public final static List THROWABLE_ARGS = List.of(_MESSAGE, _CAUSE); - public final static List OPAQUE_ARGS = List.of( - _MESSAGE, _CAUSE, - new BuilderMemberSpec( - TypeName.get(Object.class), - "obj", - "The unexpected object encountered. It MIGHT BE an Exception," + - " but that is not guaranteed.") - ); - public static final List COLLECTION_ARGS = List.of( - _MESSAGE, _CAUSE, - new BuilderMemberSpec( - CollectionOfErrors.exceptionList(), - "list", - "The list of Exceptions encountered.") - ); - @Nonnull public final TypeName type; - @Nonnull public final String name; - @Nullable public final TypeName interfaceType; - @Nullable public final CodeBlock wrapCall; - @Nullable public final String javaDoc; + private static final BuilderMemberSpec _MESSAGE = new BuilderMemberSpec( + TypeName.get(String.class), + "message", + "The detailed message. The detail message is saved for" + + " later retrieval by the {@link #getMessage()} method." + ); + private static final BuilderMemberSpec _CAUSE = new BuilderMemberSpec( + TypeName.get(Throwable.class), + "cause", + "The cause (which is saved for later retrieval by the" + + " {@link #getCause()} method). (A {@code null} value is" + + " permitted, and indicates that the cause is nonexistent or" + + " unknown.)" + ); + public static final List THROWABLE_ARGS = List.of( + _MESSAGE, + _CAUSE + ); + public static final List OPAQUE_ARGS = List.of( + _MESSAGE, + _CAUSE, + new BuilderMemberSpec( + TypeName.get(Object.class), + "obj", + "The unexpected object encountered. It MIGHT BE an Exception," + + " but that is not guaranteed." + ) + ); + public static final List COLLECTION_ARGS = List.of( + _MESSAGE, + _CAUSE, + new BuilderMemberSpec( + CollectionOfErrors.exceptionList(), + "list", + "The list of Exceptions encountered." + ) + ); - public BuilderMemberSpec(MemberShape memberShape, JavaLibrary subject) { - ResolvedShapeId resolvedShapeId = resolveShape(memberShape.getTarget(), subject.model); - Shape resolvedShape = subject.model.expectShape(resolvedShapeId.resolvedId()); - this.type = subject.nativeNameResolver.typeForShape(resolvedShapeId.naiveId()); - this.name = memberShape.getMemberName(); - if ( - (resolvedShape.isResourceShape()) - && !isInAwsSdkNamespace(resolvedShapeId.resolvedId()) - ) { - // If target is a non-AWS Resource, - // the output type should be an interface - this.interfaceType = Native.classNameForInterfaceOrLocalService( - resolvedShape, subject.sdkVersion); - // And we will need to wrap it - this.wrapCall = subject.wrapWithShim(resolvedShapeId.resolvedId(), - CodeBlock.of(this.name)); - } else { - this.interfaceType = null; - this.wrapCall = null; - } - Optional maybeJavaDoc = memberShape.getMemberTrait(subject.model, JavaDocTrait.class); - this.javaDoc = maybeJavaDoc.map(StringTrait::getValue).orElse(null); - } + @Nonnull + public final TypeName type; - /** Private Method for handling Edge Cases or cases where - * the target shape cannot be a member shape. */ - private BuilderMemberSpec(@Nonnull TypeName type, @Nonnull String name, @Nullable String javaDoc) { - this.interfaceType = null; - this.wrapCall = null; - this.name = name; - this.type = type; - this.javaDoc = javaDoc; - } + @Nonnull + public final String name; + @Nullable + public final TypeName interfaceType; - /** A Local Service Shim is built with a Configuration object, - * which is stored as a field of the shim. */ - // TODO: Should the Config object be optional? - public static BuilderMemberSpec localServiceConfigMemberSpec( - LocalServiceTrait trait, JavaLibrary subject) - { - TypeName type = subject.nativeNameResolver.typeForShape(trait.getConfigId()); - String name = trait.getConfigId().getName(); - StructureShape structureShape = subject.model.expectShape(trait.getConfigId(), StructureShape.class); - Optional maybeJavaDoc = structureShape.getTrait(JavaDocTrait.class); - String javaDoc = maybeJavaDoc.map(StringTrait::getValue).orElse(null); - return new BuilderMemberSpec(type, name, javaDoc); - } + @Nullable + public final CodeBlock wrapCall; - public static BuilderMemberSpec localServiceAsMemberSpec( - JavaLibrary subject + @Nullable + public final String javaDoc; + + public BuilderMemberSpec(MemberShape memberShape, JavaLibrary subject) { + ResolvedShapeId resolvedShapeId = resolveShape( + memberShape.getTarget(), + subject.model + ); + Shape resolvedShape = subject.model.expectShape( + resolvedShapeId.resolvedId() + ); + this.type = + subject.nativeNameResolver.typeForShape(resolvedShapeId.naiveId()); + this.name = memberShape.getMemberName(); + if ( + (resolvedShape.isResourceShape()) && + !isInAwsSdkNamespace(resolvedShapeId.resolvedId()) ) { - TypeName type = subject.nativeNameResolver.classNameForService(subject.serviceShape); - String name = INTERFACE_VAR; - Optional maybeJavaDoc = subject.serviceShape.getTrait(JavaDocTrait.class); - String javaDoc = maybeJavaDoc.map(StringTrait::getValue).orElse(null); - return new BuilderMemberSpec(type, name, javaDoc); + // If target is a non-AWS Resource, + // the output type should be an interface + this.interfaceType = + Native.classNameForInterfaceOrLocalService( + resolvedShape, + subject.sdkVersion + ); + // And we will need to wrap it + this.wrapCall = + subject.wrapWithShim( + resolvedShapeId.resolvedId(), + CodeBlock.of(this.name) + ); + } else { + this.interfaceType = null; + this.wrapCall = null; } + Optional maybeJavaDoc = memberShape.getMemberTrait( + subject.model, + JavaDocTrait.class + ); + this.javaDoc = maybeJavaDoc.map(StringTrait::getValue).orElse(null); + } - public FieldSpec toFieldSpec(@Nullable Modifier... modifiers) { - FieldSpec.Builder fieldSpec = FieldSpec - .builder(this.type, this.name); - if (Objects.nonNull(modifiers)) { - fieldSpec.addModifiers(modifiers); - } - if (Objects.nonNull(this.javaDoc)) { - fieldSpec.addJavadoc(this.javaDoc); - } - return fieldSpec.build(); + /** Private Method for handling Edge Cases or cases where + * the target shape cannot be a member shape. */ + private BuilderMemberSpec( + @Nonnull TypeName type, + @Nonnull String name, + @Nullable String javaDoc + ) { + this.interfaceType = null; + this.wrapCall = null; + this.name = name; + this.type = type; + this.javaDoc = javaDoc; + } + + /** A Local Service Shim is built with a Configuration object, + * which is stored as a field of the shim. */ + // TODO: Should the Config object be optional? + public static BuilderMemberSpec localServiceConfigMemberSpec( + LocalServiceTrait trait, + JavaLibrary subject + ) { + TypeName type = subject.nativeNameResolver.typeForShape( + trait.getConfigId() + ); + String name = trait.getConfigId().getName(); + StructureShape structureShape = subject.model.expectShape( + trait.getConfigId(), + StructureShape.class + ); + Optional maybeJavaDoc = structureShape.getTrait( + JavaDocTrait.class + ); + String javaDoc = maybeJavaDoc.map(StringTrait::getValue).orElse(null); + return new BuilderMemberSpec(type, name, javaDoc); + } + + public static BuilderMemberSpec localServiceAsMemberSpec( + JavaLibrary subject + ) { + TypeName type = subject.nativeNameResolver.classNameForService( + subject.serviceShape + ); + String name = INTERFACE_VAR; + Optional maybeJavaDoc = subject.serviceShape.getTrait( + JavaDocTrait.class + ); + String javaDoc = maybeJavaDoc.map(StringTrait::getValue).orElse(null); + return new BuilderMemberSpec(type, name, javaDoc); + } + + public FieldSpec toFieldSpec(@Nullable Modifier... modifiers) { + FieldSpec.Builder fieldSpec = FieldSpec.builder(this.type, this.name); + if (Objects.nonNull(modifiers)) { + fieldSpec.addModifiers(modifiers); + } + if (Objects.nonNull(this.javaDoc)) { + fieldSpec.addJavadoc(this.javaDoc); } + return fieldSpec.build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuilderSpecs.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuilderSpecs.java index 5b8d2f8eab..8326d14276 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuilderSpecs.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/BuilderSpecs.java @@ -2,311 +2,357 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava; +import static javax.lang.model.element.Modifier.ABSTRACT; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PROTECTED; +import static javax.lang.model.element.Modifier.PUBLIC; +import static javax.lang.model.element.Modifier.STATIC; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; - import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; - import javax.annotation.Nonnull; import javax.annotation.Nullable; import javax.lang.model.element.Modifier; - import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; import software.amazon.smithy.model.shapes.Shape; -import static javax.lang.model.element.Modifier.ABSTRACT; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PROTECTED; -import static javax.lang.model.element.Modifier.PUBLIC; -import static javax.lang.model.element.Modifier.STATIC; - /** Creates a Builder Interface and Implementation for a Shape. */ public class BuilderSpecs { - /** Also the name of the method to initialize a builder. */ - public static String BUILDER_VAR = "builder"; - @Nonnull private final ClassName className; - @Nullable private final ClassName superName; - @Nonnull private final List localFields; - @Nonnull private final List superFields; + /** Also the name of the method to initialize a builder. */ + public static String BUILDER_VAR = "builder"; - public static List shapeToArgs(Shape shape, JavaLibrary subject) { - return shape.members().stream() - .map(member -> new BuilderMemberSpec(member, subject)) - .collect(Collectors.toList()); - } + @Nonnull + private final ClassName className; - // TODO: We have removed all users of superName & superFields, - // and have no tests for their usage. - // We SHOULD remove them entirely. - public BuilderSpecs( - @Nonnull ClassName className, - @Nullable ClassName superName, - @Nonnull List localFields, - @Nonnull List superFields - ) { - if (superName == null && superFields.size() != 0) { - throw new IllegalArgumentException( - "Cannot provide a populated superFields but no superName"); - } - this.className = className; - this.superName = superName; - this.superFields = superFields; - Set superFieldNames = this.superFields.stream() - .map(field -> field.name) - .collect(Collectors.toSet()); - this.localFields = localFields.stream() - .filter(field -> !superFieldNames.contains(field.name)) - .collect(Collectors.toList()); - } + @Nullable + private final ClassName superName; - public static ClassName builderInterfaceName(ClassName className) { - return className.nestedClass("Builder"); - } + @Nonnull + private final List localFields; + + @Nonnull + private final List superFields; - static ClassName builderImplName(ClassName className) { - return className.nestedClass("BuilderImpl"); + public static List shapeToArgs( + Shape shape, + JavaLibrary subject + ) { + return shape + .members() + .stream() + .map(member -> new BuilderMemberSpec(member, subject)) + .collect(Collectors.toList()); + } + + // TODO: We have removed all users of superName & superFields, + // and have no tests for their usage. + // We SHOULD remove them entirely. + public BuilderSpecs( + @Nonnull ClassName className, + @Nullable ClassName superName, + @Nonnull List localFields, + @Nonnull List superFields + ) { + if (superName == null && superFields.size() != 0) { + throw new IllegalArgumentException( + "Cannot provide a populated superFields but no superName" + ); } + this.className = className; + this.superName = superName; + this.superFields = superFields; + Set superFieldNames = + this.superFields.stream() + .map(field -> field.name) + .collect(Collectors.toSet()); + this.localFields = + localFields + .stream() + .filter(field -> !superFieldNames.contains(field.name)) + .collect(Collectors.toList()); + } - public ClassName builderInterfaceName() { return builderInterfaceName(className); } + public static ClassName builderInterfaceName(ClassName className) { + return className.nestedClass("Builder"); + } - public ClassName builderImplName() { return builderImplName(className); } + static ClassName builderImplName(ClassName className) { + return className.nestedClass("BuilderImpl"); + } - /** - * The Builder Interface defines the builder's - * getter, setters, and build method.

- * Note: The method that takes an instance of the class and - * returns a builder derived from that an instance, - * (here, called the modelConstructor) - * is NOT defined in the interface. - * @return The nested public interface "Builder". - */ - public TypeSpec builderInterface() { - TypeSpec.Builder builder = TypeSpec - .interfaceBuilder(builderInterfaceName()) - .addModifiers(PUBLIC); - if (superName != null) { - builder.addSuperinterface(builderInterfaceName(superName)); - } - superFields.forEach(field -> - builder.addMethod(interfaceSetter(field)) - ); - localFields.forEach( - field -> { - builder.addMethod(interfaceSetter(field)); - builder.addMethod(interfaceGetter(field)); - }); - builder.addMethod(builderInterfaceBuildMethod()); - return builder.build(); - } + public ClassName builderInterfaceName() { + return builderInterfaceName(className); + } - @Nonnull - private MethodSpec interfaceGetter(BuilderMemberSpec field) { - MethodSpec.Builder method = MethodSpec.methodBuilder(field.name) - .returns(field.type) - .addModifiers(PUBLIC, ABSTRACT); - if (Objects.nonNull(field.javaDoc)) { - method.addJavadoc("@return $L", field.javaDoc);; - } - return method.build(); - } + public ClassName builderImplName() { + return builderImplName(className); + } - @Nonnull - private MethodSpec interfaceSetter(BuilderMemberSpec field) { - MethodSpec.Builder method = MethodSpec.methodBuilder(field.name) - // If the type is a Reference to a Resource, the method should take an interface - .addParameter(field.interfaceType != null ? field.interfaceType : field.type, field.name) - .returns(builderInterfaceName()) - .addModifiers(ABSTRACT, PUBLIC); - if (Objects.nonNull(field.javaDoc)) { - method.addJavadoc( - "@param $L $L", field.name, field.javaDoc); - } - return method.build(); + /** + * The Builder Interface defines the builder's + * getter, setters, and build method.

+ * Note: The method that takes an instance of the class and + * returns a builder derived from that an instance, + * (here, called the modelConstructor) + * is NOT defined in the interface. + * @return The nested public interface "Builder". + */ + public TypeSpec builderInterface() { + TypeSpec.Builder builder = TypeSpec + .interfaceBuilder(builderInterfaceName()) + .addModifiers(PUBLIC); + if (superName != null) { + builder.addSuperinterface(builderInterfaceName(superName)); } + superFields.forEach(field -> builder.addMethod(interfaceSetter(field))); + localFields.forEach(field -> { + builder.addMethod(interfaceSetter(field)); + builder.addMethod(interfaceGetter(field)); + }); + builder.addMethod(builderInterfaceBuildMethod()); + return builder.build(); + } - private MethodSpec builderInterfaceBuildMethod() { - return MethodSpec.methodBuilder("build") - .returns(className) - .addModifiers(PUBLIC, ABSTRACT) - .build(); + @Nonnull + private MethodSpec interfaceGetter(BuilderMemberSpec field) { + MethodSpec.Builder method = MethodSpec + .methodBuilder(field.name) + .returns(field.type) + .addModifiers(PUBLIC, ABSTRACT); + if (Objects.nonNull(field.javaDoc)) { + method.addJavadoc("@return $L", field.javaDoc); } + return method.build(); + } - /** - * @param overrideSuper If True, add Override annotation to `build` and to "builder setter" methods from superFields - * @param modelConstructor The Constructor for the BuilderImpl that takes an instance of the class and - * uses the instance's fields to initialize the builder.

- * If null, no modelConstructor is generated. - * @param buildMethod The `build` method of a Builder(Impl) returns a new instance of the class. - * For modeled shapes, use {@link BuildMethod#implBuildMethod} - * to generate a method that respects smithy constraint traits. - * @return The nested public class that implements the Builder Interface. - */ - public TypeSpec builderImpl( - // TODO: We have removed all use of overrideSuper, - // and have no tests for it usage. - // We SHOULD remove it entirely. - boolean overrideSuper, - @Nullable MethodSpec modelConstructor, - @Nonnull MethodSpec buildMethod - ) { - if (overrideSuper && superName == null) { - throw new IllegalArgumentException("Cannot overrideSuper if there is no super"); - } - TypeSpec.Builder builder = TypeSpec - .classBuilder(builderImplName()) - .addSuperinterface(builderInterfaceName()) - .addModifiers(STATIC); - if (superName != null) { builder.superclass(builderImplName(superName)); } - // Add Fields - localFields.forEach(field -> addField(builder, field)); - // Add Constructors - builder.addMethod(MethodSpec.constructorBuilder() - .addModifiers(PROTECTED) - .build()); - if (Objects.nonNull(modelConstructor)) { - builder.addMethod(modelConstructor); - } - // for local fields - localFields.forEach(field -> { - // Builder Setter Method - builder.addMethod(setterMethod(field)); - // Getter Method - builder.addMethod(MethodSpec - .methodBuilder(field.name) - .addModifiers(Modifier.PUBLIC) - .returns(field.type) - .addStatement("return this.$L", field.name) - .build()); - }); - // Builder for super's fields - superFields.forEach(field -> { - MethodSpec.Builder method = MethodSpec - .methodBuilder(field.name) - .returns(builderInterfaceName()) - .addModifiers(Modifier.PUBLIC) - .addParameter(field.type, field.name) - .addStatement("super.$L($L)", field.name, field.name) - .addStatement("return this"); - if (overrideSuper) { method.addAnnotation(Override.class); } - builder.addMethod(method.build()); - }); - // build - builder.addMethod(buildMethod); - return builder.build(); + @Nonnull + private MethodSpec interfaceSetter(BuilderMemberSpec field) { + MethodSpec.Builder method = MethodSpec + .methodBuilder(field.name) + // If the type is a Reference to a Resource, the method should take an interface + .addParameter( + field.interfaceType != null ? field.interfaceType : field.type, + field.name + ) + .returns(builderInterfaceName()) + .addModifiers(ABSTRACT, PUBLIC); + if (Objects.nonNull(field.javaDoc)) { + method.addJavadoc("@param $L $L", field.name, field.javaDoc); } + return method.build(); + } - private TypeSpec.Builder addField(TypeSpec.Builder builder, BuilderMemberSpec field) { - builder.addField(field.type, field.name, PROTECTED); - // If primitive type, there MUST be a private field to track setting the field - if (field.type.isPrimitive()) { - builder.addField(FieldSpec - .builder(TypeName.BOOLEAN, BuildMethod.isSetFieldName(field)) - .addModifiers(PRIVATE) - .initializer(CodeBlock.of("false")) - .build()); - } - return builder; - } + private MethodSpec builderInterfaceBuildMethod() { + return MethodSpec + .methodBuilder("build") + .returns(className) + .addModifiers(PUBLIC, ABSTRACT) + .build(); + } - private MethodSpec setterMethod(BuilderMemberSpec field) { - MethodSpec.Builder setter = MethodSpec + /** + * @param overrideSuper If True, add Override annotation to `build` and to "builder setter" methods from superFields + * @param modelConstructor The Constructor for the BuilderImpl that takes an instance of the class and + * uses the instance's fields to initialize the builder.

+ * If null, no modelConstructor is generated. + * @param buildMethod The `build` method of a Builder(Impl) returns a new instance of the class. + * For modeled shapes, use {@link BuildMethod#implBuildMethod} + * to generate a method that respects smithy constraint traits. + * @return The nested public class that implements the Builder Interface. + */ + public TypeSpec builderImpl( + // TODO: We have removed all use of overrideSuper, + // and have no tests for it usage. + // We SHOULD remove it entirely. + boolean overrideSuper, + @Nullable MethodSpec modelConstructor, + @Nonnull MethodSpec buildMethod + ) { + if (overrideSuper && superName == null) { + throw new IllegalArgumentException( + "Cannot overrideSuper if there is no super" + ); + } + TypeSpec.Builder builder = TypeSpec + .classBuilder(builderImplName()) + .addSuperinterface(builderInterfaceName()) + .addModifiers(STATIC); + if (superName != null) { + builder.superclass(builderImplName(superName)); + } + // Add Fields + localFields.forEach(field -> addField(builder, field)); + // Add Constructors + builder.addMethod( + MethodSpec.constructorBuilder().addModifiers(PROTECTED).build() + ); + if (Objects.nonNull(modelConstructor)) { + builder.addMethod(modelConstructor); + } + // for local fields + localFields.forEach(field -> { + // Builder Setter Method + builder.addMethod(setterMethod(field)); + // Getter Method + builder.addMethod( + MethodSpec .methodBuilder(field.name) - .addModifiers(PUBLIC) - .returns(builderInterfaceName()) - // If the type is a Reference to a Resource, the method should take an interface - .addParameter(field.interfaceType != null ? field.interfaceType : field.type, field.name) - // If the type is a Reference to a Resource, and not in AWS-SDK, we need to "wrap" it - .addStatement("this.$L = $L", field.name, field.wrapCall != null ? field.wrapCall : field.name); - if (field.type.isPrimitive()) { - // If primitive type, Setter MUST record that the field was set. - setter.addStatement( - "this.$L = true", BuildMethod.isSetFieldName(field)); - } - return setter.addStatement("return this").build(); + .addModifiers(Modifier.PUBLIC) + .returns(field.type) + .addStatement("return this.$L", field.name) + .build() + ); + }); + // Builder for super's fields + superFields.forEach(field -> { + MethodSpec.Builder method = MethodSpec + .methodBuilder(field.name) + .returns(builderInterfaceName()) + .addModifiers(Modifier.PUBLIC) + .addParameter(field.type, field.name) + .addStatement("super.$L($L)", field.name, field.name) + .addStatement("return this"); + if (overrideSuper) { + method.addAnnotation(Override.class); + } + builder.addMethod(method.build()); + }); + // build + builder.addMethod(buildMethod); + return builder.build(); + } + + private TypeSpec.Builder addField( + TypeSpec.Builder builder, + BuilderMemberSpec field + ) { + builder.addField(field.type, field.name, PROTECTED); + // If primitive type, there MUST be a private field to track setting the field + if (field.type.isPrimitive()) { + builder.addField( + FieldSpec + .builder(TypeName.BOOLEAN, BuildMethod.isSetFieldName(field)) + .addModifiers(PRIVATE) + .initializer(CodeBlock.of("false")) + .build() + ); } + return builder; + } - /** - * @param override If True, add Override annotation - * @return Method that converts the class to an instance of it's Builder - */ - // TODO: We have removed all use of override=true, - // and have no tests for it usage. - // We SHOULD remove it entirely. - public MethodSpec toBuilderMethod(boolean override) { - MethodSpec.Builder method = MethodSpec - .methodBuilder("toBuilder") - .addModifiers(PUBLIC) - .returns(builderInterfaceName()) - .addStatement("return new $T(this)", builderImplName()); - if (override) { - method.addAnnotation(Override.class); - } - return method.build(); + private MethodSpec setterMethod(BuilderMemberSpec field) { + MethodSpec.Builder setter = MethodSpec + .methodBuilder(field.name) + .addModifiers(PUBLIC) + .returns(builderInterfaceName()) + // If the type is a Reference to a Resource, the method should take an interface + .addParameter( + field.interfaceType != null ? field.interfaceType : field.type, + field.name + ) + // If the type is a Reference to a Resource, and not in AWS-SDK, we need to "wrap" it + .addStatement( + "this.$L = $L", + field.name, + field.wrapCall != null ? field.wrapCall : field.name + ); + if (field.type.isPrimitive()) { + // If primitive type, Setter MUST record that the field was set. + setter.addStatement("this.$L = true", BuildMethod.isSetFieldName(field)); } + return setter.addStatement("return this").build(); + } - /** - * Provides the `builder` method for a class; - * The `builder` method returns a new Builder(Impl) for the class. - */ - public MethodSpec builderMethod() { - MethodSpec.Builder method = MethodSpec - .methodBuilder("builder") - .addModifiers(PUBLIC, STATIC) - .returns(builderInterfaceName()) - .addStatement("return new $T()", builderImplName()); - return method.build(); + /** + * @param override If True, add Override annotation + * @return Method that converts the class to an instance of it's Builder + */ + // TODO: We have removed all use of override=true, + // and have no tests for it usage. + // We SHOULD remove it entirely. + public MethodSpec toBuilderMethod(boolean override) { + MethodSpec.Builder method = MethodSpec + .methodBuilder("toBuilder") + .addModifiers(PUBLIC) + .returns(builderInterfaceName()) + .addStatement("return new $T(this)", builderImplName()); + if (override) { + method.addAnnotation(Override.class); } + return method.build(); + } - /** - * Provides the default Builder Impl model constructor. - * That is, the Constructor for the BuilderImpl that takes an instance of - * the class and uses the instance's fields to initialize the builder. - *

- * The only reason to not use this is if the super class should not be called, - * but there is a super (i.e.: NativeError). - */ - public MethodSpec implModelConstructor() { - MethodSpec.Builder modelConstructor = MethodSpec - .constructorBuilder() - .addModifiers(PROTECTED) - .addParameter(className, "model"); - if (superName != null ) { modelConstructor.addStatement("super(model)"); } - localFields.forEach(field -> - { - modelConstructor.addStatement( - "this.$L = model.$L()", field.name, field.name); - if (field.type.isPrimitive()) { - // If primitive type, MUST record that the field was set - modelConstructor.addStatement( - "this.$L = true", BuildMethod.isSetFieldName(field)); - } - } - ); - return modelConstructor.build(); + /** + * Provides the `builder` method for a class; + * The `builder` method returns a new Builder(Impl) for the class. + */ + public MethodSpec builderMethod() { + MethodSpec.Builder method = MethodSpec + .methodBuilder("builder") + .addModifiers(PUBLIC, STATIC) + .returns(builderInterfaceName()) + .addStatement("return new $T()", builderImplName()); + return method.build(); + } + + /** + * Provides the default Builder Impl model constructor. + * That is, the Constructor for the BuilderImpl that takes an instance of + * the class and uses the instance's fields to initialize the builder. + *

+ * The only reason to not use this is if the super class should not be called, + * but there is a super (i.e.: NativeError). + */ + public MethodSpec implModelConstructor() { + MethodSpec.Builder modelConstructor = MethodSpec + .constructorBuilder() + .addModifiers(PROTECTED) + .addParameter(className, "model"); + if (superName != null) { + modelConstructor.addStatement("super(model)"); } + localFields.forEach(field -> { + modelConstructor.addStatement( + "this.$L = model.$L()", + field.name, + field.name + ); + if (field.type.isPrimitive()) { + // If primitive type, MUST record that the field was set + modelConstructor.addStatement( + "this.$L = true", + BuildMethod.isSetFieldName(field) + ); + } + }); + return modelConstructor.build(); + } - /** - * Provides a BuilderImpl build method for un-modeled objects - * (i.e.: staticErrors). - * The `build` method of a Builder(Impl) returns a new instance of the class. - *

For modeled shapes, use {@link BuildMethod#implBuildMethod} - * to generate a method that respects smithy constraint traits. - */ - public MethodSpec implBuildMethod(boolean overrideSuper) { - MethodSpec.Builder buildMethod = MethodSpec - .methodBuilder("build") - .addModifiers(Modifier.PUBLIC) - .returns(className) - .addStatement("return new $T(this)", className); - if (overrideSuper) { buildMethod.addAnnotation(Override.class); } - return buildMethod.build(); + /** + * Provides a BuilderImpl build method for un-modeled objects + * (i.e.: staticErrors). + * The `build` method of a Builder(Impl) returns a new instance of the class. + *

For modeled shapes, use {@link BuildMethod#implBuildMethod} + * to generate a method that respects smithy constraint traits. + */ + public MethodSpec implBuildMethod(boolean overrideSuper) { + MethodSpec.Builder buildMethod = MethodSpec + .methodBuilder("build") + .addModifiers(Modifier.PUBLIC) + .returns(className) + .addStatement("return new $T(this)", className); + if (overrideSuper) { + buildMethod.addAnnotation(Override.class); } + return buildMethod.build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/MethodReference.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/MethodReference.java index 26875238f5..1a08994d03 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/MethodReference.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/MethodReference.java @@ -4,27 +4,24 @@ import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.TypeName; - import software.amazon.polymorph.smithyjava.generator.Generator; public record MethodReference(TypeName typeName, String methodName) { - public CodeBlock asNormalReference() { - // Special case of Identity, which should not be invoked, or - // it will cast the input to Object. - // Instead, do nothing! - if (this == Generator.Constants.IDENTITY_FUNCTION) { - return CodeBlock.builder().build(); - } - return CodeBlock.of("$T.$L", typeName, methodName); + public CodeBlock asNormalReference() { + // Special case of Identity, which should not be invoked, or + // it will cast the input to Object. + // Instead, do nothing! + if (this == Generator.Constants.IDENTITY_FUNCTION) { + return CodeBlock.builder().build(); } - public CodeBlock asFunctionalReference() { - // Special case of Identity, which cannot be functionally referenced via :: - // but is instead functionally referenced by Function.identity() - if (this == Generator.Constants.IDENTITY_FUNCTION) { - return CodeBlock.of("$T.$L()", typeName, methodName); - } - return CodeBlock.of("$L::$L", typeName, methodName); + return CodeBlock.of("$T.$L", typeName, methodName); + } + public CodeBlock asFunctionalReference() { + // Special case of Identity, which cannot be functionally referenced via :: + // but is instead functionally referenced by Function.identity() + if (this == Generator.Constants.IDENTITY_FUNCTION) { + return CodeBlock.of("$T.$L()", typeName, methodName); } + return CodeBlock.of("$L::$L", typeName, methodName); + } } - - diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/MethodSignature.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/MethodSignature.java index fe768aff62..0802d4c17e 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/MethodSignature.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/MethodSignature.java @@ -3,7 +3,6 @@ package software.amazon.polymorph.smithyjava; import com.squareup.javapoet.MethodSpec; - import software.amazon.polymorph.utils.ModelUtils; /** @@ -13,8 +12,7 @@ * @param resolvedOutput A ResolvedShapeId representing the output */ public record MethodSignature( - MethodSpec.Builder method, - ModelUtils.ResolvedShapeId resolvedInput, - ModelUtils.ResolvedShapeId resolvedOutput -) { -} + MethodSpec.Builder method, + ModelUtils.ResolvedShapeId resolvedInput, + ModelUtils.ResolvedShapeId resolvedOutput +) {} diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/NamespaceHelper.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/NamespaceHelper.java index 55dd1fd16f..ec0ed73c7d 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/NamespaceHelper.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/NamespaceHelper.java @@ -3,18 +3,23 @@ package software.amazon.polymorph.smithyjava; public class NamespaceHelper { - /** - * Crypto Tools has used the namespace `aws.cryptography` in our Smithy Models; - *

But AWS Java uses `software.amazon` instead of `aws`.*/ - // Historically, we have used `encryption` instead of `cryptography`, - // but we are more flexible w.r.t. encryption vs cryptography. - public static String standardize(String namespace) { - String rtn = namespace.toLowerCase(); - if (namespace.startsWith("aws")) { - rtn = rtn.replaceFirst("aws", "software.amazon"); - } else if (namespace.startsWith("com.amazonaws")) { - rtn = rtn.replaceFirst("com.amazonaws", "software.amazon.cryptography.services"); - } - return rtn; + + /** + * Crypto Tools has used the namespace `aws.cryptography` in our Smithy Models; + *

But AWS Java uses `software.amazon` instead of `aws`.*/ + // Historically, we have used `encryption` instead of `cryptography`, + // but we are more flexible w.r.t. encryption vs cryptography. + public static String standardize(String namespace) { + String rtn = namespace.toLowerCase(); + if (namespace.startsWith("aws")) { + rtn = rtn.replaceFirst("aws", "software.amazon"); + } else if (namespace.startsWith("com.amazonaws")) { + rtn = + rtn.replaceFirst( + "com.amazonaws", + "software.amazon.cryptography.services" + ); } + return rtn; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/OperationJavaDoc.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/OperationJavaDoc.java index 600d8d2fe2..173212f724 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/OperationJavaDoc.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/OperationJavaDoc.java @@ -2,12 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava; +import static software.amazon.polymorph.smithyjava.generator.Generator.NATIVE_VAR; + import java.util.List; import java.util.Objects; - import javax.annotation.Nonnull; import javax.annotation.Nullable; - import software.amazon.awssdk.utils.Pair; import software.amazon.awssdk.utils.StringUtils; import software.amazon.polymorph.traits.JavaDocTrait; @@ -15,8 +15,6 @@ import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.traits.StringTrait; -import static software.amazon.polymorph.smithyjava.generator.Generator.NATIVE_VAR; - /** * @param desc JavaDoc Body content * @param params List of {@link Pair} of Strings which will get {@code @param} @@ -27,48 +25,69 @@ public record OperationJavaDoc( @Nullable List> params, @Nullable String returns ) { - static final String LF = System.lineSeparator(); + static final String LF = System.lineSeparator(); - public String getDoc() { - // Note: this is largely copied from another AWS Product: - // https://github.com/aws/aws-sdk-java-v2/blob/79b34ed72b2d39084e3c2b516d150f89b6bf39f8/codegen/src/main/java/software/amazon/awssdk/codegen/docs/DocumentationBuilder.java#L215 - StringBuilder str = new StringBuilder(); - if (StringUtils.isNotBlank(desc)) { - str.append(desc).append(LF); - } - if (Objects.nonNull(params)) { - str.append(LF); - params.forEach(p -> p.apply((paramName, paramDoc) -> formatParam(str, paramName, paramDoc))); - } - if (StringUtils.isNotBlank(returns)) { - str.append("@return ").append(returns); - } - return str.append(LF).toString(); + public String getDoc() { + // Note: this is largely copied from another AWS Product: + // https://github.com/aws/aws-sdk-java-v2/blob/79b34ed72b2d39084e3c2b516d150f89b6bf39f8/codegen/src/main/java/software/amazon/awssdk/codegen/docs/DocumentationBuilder.java#L215 + StringBuilder str = new StringBuilder(); + if (StringUtils.isNotBlank(desc)) { + str.append(desc).append(LF); } - - private StringBuilder formatParam(StringBuilder doc, String paramName, String paramDoc) { - if (StringUtils.isNotBlank(paramDoc)) { - return doc.append("@param ").append(paramName).append(" ").append(paramDoc).append(LF); - } - return doc; + if (Objects.nonNull(params)) { + str.append(LF); + params.forEach(p -> + p.apply((paramName, paramDoc) -> formatParam(str, paramName, paramDoc)) + ); } + if (StringUtils.isNotBlank(returns)) { + str.append("@return ").append(returns); + } + return str.append(LF).toString(); + } - public static OperationJavaDoc fromOperationShape(Model model, OperationShape shape) { - @Nullable String paramDoc = model - .expectShape(shape.getInputShape()) - .getMemberTrait(model, JavaDocTrait.class) - .map(StringTrait::getValue).orElse(null); - @Nonnull String paramName = NATIVE_VAR; - @Nullable String returns = model - .expectShape(shape.getOutputShape()) - .getMemberTrait(model, JavaDocTrait.class) - .map(StringTrait::getValue).orElse(null); - @Nullable String desc = shape - .getTrait(JavaDocTrait.class) - .map(StringTrait::getValue).orElse(null); - List> params = StringUtils.isNotBlank(paramDoc) ? - List.of(Pair.of(paramName, paramDoc)) - : null; - return new OperationJavaDoc(desc, params, returns); + private StringBuilder formatParam( + StringBuilder doc, + String paramName, + String paramDoc + ) { + if (StringUtils.isNotBlank(paramDoc)) { + return doc + .append("@param ") + .append(paramName) + .append(" ") + .append(paramDoc) + .append(LF); } + return doc; + } + + public static OperationJavaDoc fromOperationShape( + Model model, + OperationShape shape + ) { + @Nullable + String paramDoc = model + .expectShape(shape.getInputShape()) + .getMemberTrait(model, JavaDocTrait.class) + .map(StringTrait::getValue) + .orElse(null); + @Nonnull + String paramName = NATIVE_VAR; + @Nullable + String returns = model + .expectShape(shape.getOutputShape()) + .getMemberTrait(model, JavaDocTrait.class) + .map(StringTrait::getValue) + .orElse(null); + @Nullable + String desc = shape + .getTrait(JavaDocTrait.class) + .map(StringTrait::getValue) + .orElse(null); + List> params = StringUtils.isNotBlank(paramDoc) + ? List.of(Pair.of(paramName, paramDoc)) + : null; + return new OperationJavaDoc(desc, params, returns); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/PolymorphFieldSpec.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/PolymorphFieldSpec.java index 0a6164b9f4..a7dcd99231 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/PolymorphFieldSpec.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/PolymorphFieldSpec.java @@ -3,78 +3,81 @@ package software.amazon.polymorph.smithyjava; import com.squareup.javapoet.TypeName; - import java.math.BigDecimal; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; - -import software.amazon.polymorph.utils.ConstrainTraitUtils; import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; import software.amazon.polymorph.smithyjava.nameresolver.Native; - +import software.amazon.polymorph.utils.ConstrainTraitUtils; import software.amazon.smithy.model.shapes.MemberShape; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.traits.LengthTrait; import software.amazon.smithy.model.traits.RangeTrait; public class PolymorphFieldSpec { - public final BuilderMemberSpec fieldSpec; - public final MemberShape shape; - final JavaLibrary subject; - public final TypeName type; - public final String name; - public final boolean hasConstraints; - - public PolymorphFieldSpec(MemberShape shape, JavaLibrary subject) { - this.fieldSpec = new BuilderMemberSpec(shape, subject); - this.shape = shape; - this.subject = subject; - this.name = this.fieldSpec.name; - this.type = this.fieldSpec.type; - this.hasConstraints = ConstrainTraitUtils.hasConstraintTrait(shape); - } - - public static List shapeToPolyFieldSpecs( - Shape shape, - JavaLibrary subject - ) { - return shape.members().stream() - .map(member -> new PolymorphFieldSpec(member, subject)) - .collect(Collectors.toList()); - } - - public boolean isRequired() { - return this.shape.isRequired(); - } - - public Shape getTargetShape() { - return this.subject.model.expectShape(this.shape.getTarget()); - } - - public Optional rangeTrait() { - return this.shape.getMemberTrait(subject.model, RangeTrait.class); - } - - public Optional rangeMin() { - return rangeTrait().flatMap(RangeTrait::getMin); - } - - public Optional rangeMax() { - return rangeTrait().flatMap(RangeTrait::getMax); - } - - public Optional lengthTrait() { - return this.shape.getMemberTrait(subject.model, LengthTrait.class); - } - - public Optional lengthMin() { return lengthTrait().flatMap(LengthTrait::getMin); } - - public Optional lengthMax() { return lengthTrait().flatMap(LengthTrait::getMax); } - - /** Returns the Java method for getting the length of the field's type. */ - public String getLengthMethod() { - return Native.aggregateSizeMethod(getTargetShape().getType()); - } + public final BuilderMemberSpec fieldSpec; + public final MemberShape shape; + final JavaLibrary subject; + public final TypeName type; + public final String name; + public final boolean hasConstraints; + + public PolymorphFieldSpec(MemberShape shape, JavaLibrary subject) { + this.fieldSpec = new BuilderMemberSpec(shape, subject); + this.shape = shape; + this.subject = subject; + this.name = this.fieldSpec.name; + this.type = this.fieldSpec.type; + this.hasConstraints = ConstrainTraitUtils.hasConstraintTrait(shape); + } + + public static List shapeToPolyFieldSpecs( + Shape shape, + JavaLibrary subject + ) { + return shape + .members() + .stream() + .map(member -> new PolymorphFieldSpec(member, subject)) + .collect(Collectors.toList()); + } + + public boolean isRequired() { + return this.shape.isRequired(); + } + + public Shape getTargetShape() { + return this.subject.model.expectShape(this.shape.getTarget()); + } + + public Optional rangeTrait() { + return this.shape.getMemberTrait(subject.model, RangeTrait.class); + } + + public Optional rangeMin() { + return rangeTrait().flatMap(RangeTrait::getMin); + } + + public Optional rangeMax() { + return rangeTrait().flatMap(RangeTrait::getMax); + } + + public Optional lengthTrait() { + return this.shape.getMemberTrait(subject.model, LengthTrait.class); + } + + public Optional lengthMin() { + return lengthTrait().flatMap(LengthTrait::getMin); + } + + public Optional lengthMax() { + return lengthTrait().flatMap(LengthTrait::getMax); + } + + /** Returns the Java method for getting the length of the field's type. */ + public String getLengthMethod() { + return Native.aggregateSizeMethod(getTargetShape().getType()); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/CodegenSubject.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/CodegenSubject.java index 3bc611ee55..327c4b385e 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/CodegenSubject.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/CodegenSubject.java @@ -4,10 +4,9 @@ import java.nio.file.Path; import java.util.Map; - -import software.amazon.polymorph.utils.TokenTree; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; import software.amazon.polymorph.smithyjava.nameresolver.Native; +import software.amazon.polymorph.utils.TokenTree; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.ServiceShape; @@ -19,33 +18,33 @@ */ public abstract class CodegenSubject { - final public Dafny dafnyNameResolver; - final public Native nativeNameResolver; - final public Model model; - final public ServiceShape serviceShape; - final public AwsSdkVersion sdkVersion; - - protected CodegenSubject( - Model model, - ServiceShape serviceShape, - Dafny dafnyNameResolver, - Native nativeNameResolver, - AwsSdkVersion sdkVersion) { - this.model = model; - this.serviceShape = serviceShape; - this.dafnyNameResolver = dafnyNameResolver; - this.nativeNameResolver = nativeNameResolver; - this.sdkVersion = sdkVersion; - } - - - /** - * Generates Java Code for the Subject. - */ - public abstract Map generate(); - - public enum AwsSdkVersion { - V1, - V2 - } + public final Dafny dafnyNameResolver; + public final Native nativeNameResolver; + public final Model model; + public final ServiceShape serviceShape; + public final AwsSdkVersion sdkVersion; + + protected CodegenSubject( + Model model, + ServiceShape serviceShape, + Dafny dafnyNameResolver, + Native nativeNameResolver, + AwsSdkVersion sdkVersion + ) { + this.model = model; + this.serviceShape = serviceShape; + this.dafnyNameResolver = dafnyNameResolver; + this.nativeNameResolver = nativeNameResolver; + this.sdkVersion = sdkVersion; + } + + /** + * Generates Java Code for the Subject. + */ + public abstract Map generate(); + + public enum AwsSdkVersion { + V1, + V2, + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/Generator.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/Generator.java index ac721237a4..1436be9cf3 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/Generator.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/Generator.java @@ -3,13 +3,8 @@ package software.amazon.polymorph.smithyjava.generator; import com.google.common.base.Joiner; - import com.squareup.javapoet.ClassName; import com.squareup.javapoet.JavaFile; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.nio.file.Path; import java.util.Arrays; import java.util.LinkedHashMap; @@ -17,74 +12,90 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; - import javax.lang.model.element.Modifier; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import software.amazon.polymorph.smithyjava.MethodReference; import software.amazon.polymorph.utils.TokenTree; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ShapeType; public abstract class Generator { - public static final Modifier[] PUBLIC_STATIC = new Modifier[]{Modifier.PUBLIC, Modifier.STATIC}; - protected static final Modifier[] PRIVATE_FINAL = new Modifier[]{Modifier.PRIVATE, Modifier.FINAL}; - public static final String INTERFACE_VAR = "impl"; - public static final String INTERFACE_FIELD = "_impl"; - public static final String NATIVE_VAR = "input"; - protected static final String DAFNY_VAR = "dafnyValue"; - protected static final String RESULT_VAR = "result"; - @SuppressWarnings("unused") - private static final Logger LOGGER = LoggerFactory.getLogger(Generator.class); - public CodegenSubject subject; + public static final Modifier[] PUBLIC_STATIC = new Modifier[] { + Modifier.PUBLIC, + Modifier.STATIC, + }; + protected static final Modifier[] PRIVATE_FINAL = new Modifier[] { + Modifier.PRIVATE, + Modifier.FINAL, + }; + public static final String INTERFACE_VAR = "impl"; + public static final String INTERFACE_FIELD = "_impl"; + public static final String NATIVE_VAR = "input"; + protected static final String DAFNY_VAR = "dafnyValue"; + protected static final String RESULT_VAR = "result"; - public Generator( - CodegenSubject subject - ) { - this.subject = subject; - } + @SuppressWarnings("unused") + private static final Logger LOGGER = LoggerFactory.getLogger(Generator.class); + + public CodegenSubject subject; + + public Generator(CodegenSubject subject) { + this.subject = subject; + } - public Map generate() { - final LinkedHashMap rtn = new LinkedHashMap<>(); - final Set javaFiles = javaFiles(); - for (JavaFile javaFile : javaFiles) { - List pathPieces = Arrays - .stream(javaFile.packageName.split("\\.")) - .collect(Collectors.toList()); - pathPieces.add(javaFile.typeSpec.name + ".java"); - final Path path = Path.of(Joiner.on('/').join(pathPieces)); - final TokenTree tokenTree = TokenTree.of( - // Indent - // javaFile.toBuilder().indent(" ").build().toString() - // Don't Indent to reduce git diff: - javaFile.toString() - ); - rtn.put(path, tokenTree); - } - return rtn; + public Map generate() { + final LinkedHashMap rtn = new LinkedHashMap<>(); + final Set javaFiles = javaFiles(); + for (JavaFile javaFile : javaFiles) { + List pathPieces = Arrays + .stream(javaFile.packageName.split("\\.")) + .collect(Collectors.toList()); + pathPieces.add(javaFile.typeSpec.name + ".java"); + final Path path = Path.of(Joiner.on('/').join(pathPieces)); + final TokenTree tokenTree = TokenTree.of( + // Indent + // javaFile.toBuilder().indent(" ").build().toString() + // Don't Indent to reduce git diff: + javaFile.toString() + ); + rtn.put(path, tokenTree); } + return rtn; + } + + public abstract Set javaFiles(); + + protected List getOperationsForTarget() { + return subject.serviceShape + .getOperations() + .stream() + .sorted() + .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) + .collect(Collectors.toList()); + } + + public static class Constants { - public abstract Set javaFiles(); + public static final MethodReference IDENTITY_FUNCTION = new MethodReference( + ClassName.get(java.util.function.Function.class), + "identity" + ); + public static final Set LIST_MAP_SET_SHAPE_TYPES; - protected List getOperationsForTarget() { - return subject.serviceShape.getOperations().stream().sorted() - .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) - .collect(Collectors.toList()); + static { + LIST_MAP_SET_SHAPE_TYPES = + Set.of(ShapeType.LIST, ShapeType.SET, ShapeType.MAP); } - public static class Constants { - public static final MethodReference IDENTITY_FUNCTION = new MethodReference( - ClassName.get(java.util.function.Function.class), - "identity"); - public static final Set LIST_MAP_SET_SHAPE_TYPES; - static { - LIST_MAP_SET_SHAPE_TYPES = Set.of( - ShapeType.LIST, ShapeType.SET, ShapeType.MAP - ); - } - public static final ClassName JAVA_UTIL_STREAM_COLLECTORS = - ClassName.get("java.util.stream", "Collectors"); - public static final ClassName JAVA_UTIL_ARRAYLIST = - ClassName.get("java.util", "ArrayList"); - } + public static final ClassName JAVA_UTIL_STREAM_COLLECTORS = ClassName.get( + "java.util.stream", + "Collectors" + ); + public static final ClassName JAVA_UTIL_ARRAYLIST = ClassName.get( + "java.util", + "ArrayList" + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/ToDafny.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/ToDafny.java index 18908b869d..70b83dfa91 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/ToDafny.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/ToDafny.java @@ -2,33 +2,31 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator; +import static software.amazon.smithy.utils.StringUtils.capitalize; +import static software.amazon.smithy.utils.StringUtils.uncapitalize; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterSpec; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; - import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; - import javax.annotation.Nonnull; import javax.lang.model.element.Modifier; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import software.amazon.polymorph.smithyjava.MethodReference; import software.amazon.polymorph.smithyjava.NamespaceHelper; -import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; -import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.smithyjava.generator.awssdk.v1.ToDafnyAwsV1; import software.amazon.polymorph.smithyjava.generator.awssdk.v2.ToDafnyAwsV2; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; - +import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; +import software.amazon.polymorph.utils.ModelUtils; import software.amazon.smithy.model.shapes.ListShape; import software.amazon.smithy.model.shapes.MapShape; import software.amazon.smithy.model.shapes.MemberShape; @@ -42,333 +40,489 @@ import software.amazon.smithy.model.traits.EnumDefinition; import software.amazon.smithy.model.traits.EnumTrait; -import static software.amazon.smithy.utils.StringUtils.capitalize; -import static software.amazon.smithy.utils.StringUtils.uncapitalize; - public abstract class ToDafny extends Generator { - @SuppressWarnings("unused") - private static final Logger LOGGER = LoggerFactory.getLogger(ToDafny.class); - /** - * The keys are the input type, the values are the method that converts from that input to the Dafny type - */ - protected static final Map AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE; - protected static final Map SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE; - protected static final ClassName COMMON_TO_DAFNY_SIMPLE = ClassName.get("software.amazon.smithy.dafny.conversion", "ToDafny", "Simple"); - protected static final ClassName COMMON_TO_DAFNY_AGGREGATE = ClassName.get("software.amazon.smithy.dafny.conversion", "ToDafny", "Aggregate"); - protected final static String VAR_INPUT = "nativeValue"; - protected static final String TO_DAFNY = "ToDafny"; - /** - * The class name of the Subject's Shim's ToDafny class. - */ - protected final ClassName thisClassName; - public ToDafny(CodegenSubject subject, ClassName className) { - super(subject); - thisClassName = className; - } + @SuppressWarnings("unused") + private static final Logger LOGGER = LoggerFactory.getLogger(ToDafny.class); + + /** + * The keys are the input type, the values are the method that converts from that input to the Dafny type + */ + protected static final Map< + ShapeType, + MethodReference + > AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE; + protected static final Map< + ShapeType, + MethodReference + > SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE; + protected static final ClassName COMMON_TO_DAFNY_SIMPLE = ClassName.get( + "software.amazon.smithy.dafny.conversion", + "ToDafny", + "Simple" + ); + protected static final ClassName COMMON_TO_DAFNY_AGGREGATE = ClassName.get( + "software.amazon.smithy.dafny.conversion", + "ToDafny", + "Aggregate" + ); + protected static final String VAR_INPUT = "nativeValue"; + protected static final String TO_DAFNY = "ToDafny"; + /** + * The class name of the Subject's Shim's ToDafny class. + */ + protected final ClassName thisClassName; + + public ToDafny(CodegenSubject subject, ClassName className) { + super(subject); + thisClassName = className; + } - static { - AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE = Map.ofEntries( - Map.entry(ShapeType.LIST, new MethodReference(COMMON_TO_DAFNY_AGGREGATE, "GenericToSequence")), - Map.entry(ShapeType.SET, new MethodReference(COMMON_TO_DAFNY_AGGREGATE, "GenericToSet")), - Map.entry(ShapeType.MAP, new MethodReference(COMMON_TO_DAFNY_AGGREGATE, "GenericToMap")) + static { + AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE = + Map.ofEntries( + Map.entry( + ShapeType.LIST, + new MethodReference(COMMON_TO_DAFNY_AGGREGATE, "GenericToSequence") + ), + Map.entry( + ShapeType.SET, + new MethodReference(COMMON_TO_DAFNY_AGGREGATE, "GenericToSet") + ), + Map.entry( + ShapeType.MAP, + new MethodReference(COMMON_TO_DAFNY_AGGREGATE, "GenericToMap") + ) + ); + SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE = + Map.ofEntries( + Map.entry( + ShapeType.BLOB, + new MethodReference(COMMON_TO_DAFNY_SIMPLE, "ByteSequence") + ), + Map.entry(ShapeType.BOOLEAN, Constants.IDENTITY_FUNCTION), + Map.entry( + ShapeType.STRING, + new MethodReference(COMMON_TO_DAFNY_SIMPLE, "CharacterSequence") + ), + Map.entry( + ShapeType.TIMESTAMP, + new MethodReference(COMMON_TO_DAFNY_SIMPLE, "CharacterSequence") + ), + Map.entry(ShapeType.BYTE, Constants.IDENTITY_FUNCTION), + Map.entry(ShapeType.SHORT, Constants.IDENTITY_FUNCTION), + Map.entry(ShapeType.INTEGER, Constants.IDENTITY_FUNCTION), + Map.entry(ShapeType.LONG, Constants.IDENTITY_FUNCTION), + Map.entry( + ShapeType.DOUBLE, + new MethodReference(COMMON_TO_DAFNY_SIMPLE, "Double") + ), + Map.entry(ShapeType.BIG_DECIMAL, Constants.IDENTITY_FUNCTION), + Map.entry(ShapeType.BIG_INTEGER, Constants.IDENTITY_FUNCTION) + ); + } + + protected MethodSpec modeledStructure(final StructureShape structureShape) { + final ShapeId shapeId = structureShape.getId(); + String methodName = capitalize(structureShape.getId().getName()); + MethodSpec.Builder builder = MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .returns(subject.dafnyNameResolver.typeForShape(shapeId)) + .addParameter( + subject.nativeNameResolver.classNameForStructure(structureShape), + VAR_INPUT + ); + + if (structureShape.members().size() == 0) { + builder.addStatement( + "return new $T()", + subject.dafnyNameResolver.typeForShape(shapeId) + ); + return builder.build(); + } + List variables = new ArrayList<>( + structureShape.members().size() + ); + structureShape + .members() + .forEach(memberShape -> { + CodeBlock varOut = CodeBlock.of( + "$L", + uncapitalize(memberShape.getMemberName()) ); - SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE = Map.ofEntries( - Map.entry(ShapeType.BLOB, new MethodReference(COMMON_TO_DAFNY_SIMPLE, "ByteSequence")), - Map.entry(ShapeType.BOOLEAN, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.STRING, new MethodReference(COMMON_TO_DAFNY_SIMPLE, "CharacterSequence")), - Map.entry(ShapeType.TIMESTAMP, new MethodReference(COMMON_TO_DAFNY_SIMPLE, "CharacterSequence")), - Map.entry(ShapeType.BYTE, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.SHORT, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.INTEGER, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.LONG, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.DOUBLE, new MethodReference(COMMON_TO_DAFNY_SIMPLE, "Double")), - Map.entry(ShapeType.BIG_DECIMAL, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.BIG_INTEGER, Constants.IDENTITY_FUNCTION) + CodeBlock varIn = getMember(CodeBlock.of(VAR_INPUT), memberShape); + builder.addStatement(memberDeclaration(memberShape, varOut)); + builder.addStatement( + memberConvertAndAssign(memberShape, varOut, varIn) ); - } - - protected MethodSpec modeledStructure( - final StructureShape structureShape - ) { - final ShapeId shapeId = structureShape.getId(); - String methodName = capitalize(structureShape.getId().getName()); - MethodSpec.Builder builder = MethodSpec - .methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .returns(subject.dafnyNameResolver.typeForShape(shapeId)) - .addParameter(subject.nativeNameResolver.classNameForStructure(structureShape), VAR_INPUT); + variables.add(varOut); + }); + builder.addStatement( + "return new $T($L)", + subject.dafnyNameResolver.typeForShape(shapeId), + CodeBlock.join(variables, ", ") + ); + return builder.build(); + } - if (structureShape.members().size() == 0) { - builder.addStatement("return new $T()", subject.dafnyNameResolver.typeForShape(shapeId)); - return builder.build(); - } - List variables = new ArrayList<>(structureShape.members().size()); - structureShape.members().forEach(memberShape -> - { - CodeBlock varOut = CodeBlock.of("$L", uncapitalize(memberShape.getMemberName())); - CodeBlock varIn = getMember(CodeBlock.of(VAR_INPUT), memberShape); - builder.addStatement(memberDeclaration(memberShape, varOut)); - builder.addStatement(memberConvertAndAssign(memberShape, varOut, varIn)); - variables.add(varOut); - } + protected MethodSpec modeledUnion(final UnionShape shape) { + final ShapeId shapeId = shape.getId(); + String methodName = capitalize(shape.getId().getName()); + TypeName returnType = subject.dafnyNameResolver.typeForShape(shapeId); + MethodSpec.Builder method = MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .returns(returnType) + .addParameter( + subject.nativeNameResolver.classNameForStructure(shape), + VAR_INPUT + ); + boolean isRecordType = shape.members().size() == 1; + shape + .members() + .forEach(member -> { + CodeBlock getField = getMember( + CodeBlock.builder().add(VAR_INPUT).build(), + member ); - builder.addStatement("return new $T($L)", - subject.dafnyNameResolver.typeForShape(shapeId), - CodeBlock.join(variables, ", ") + CodeBlock memberConversion = memberConversion(member, getField); + String datatypeConstructorCreate = Dafny.datatypeConstructorCreate( + member.getMemberName(), + isRecordType ); - return builder.build(); - } + method + .beginControlFlow("if ($T.nonNull($L))", Objects.class, getField) + .addStatement( + "return $T.$L($L)", + returnType, + datatypeConstructorCreate, + memberConversion + ) + .endControlFlow(); + }); + method.addStatement( + "throw new $T($S + $L + $S)", + IllegalArgumentException.class, + "Cannot convert ", + VAR_INPUT, + " to %s.".formatted(returnType) + ); + return method.build(); + } - protected MethodSpec modeledUnion(final UnionShape shape) { - final ShapeId shapeId = shape.getId(); - String methodName = capitalize(shape.getId().getName()); - TypeName returnType = subject.dafnyNameResolver.typeForShape(shapeId); - MethodSpec.Builder method = MethodSpec - .methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .returns(returnType) - .addParameter(subject.nativeNameResolver.classNameForStructure(shape), VAR_INPUT); - boolean isRecordType = shape.members().size() == 1; - shape.members().forEach(member -> { - CodeBlock getField = getMember(CodeBlock.builder().add(VAR_INPUT).build(), member); - CodeBlock memberConversion = memberConversion(member, getField); - String datatypeConstructorCreate = Dafny.datatypeConstructorCreate(member.getMemberName(), isRecordType); - method.beginControlFlow("if ($T.nonNull($L))", Objects.class, getField) - .addStatement("return $T.$L($L)", returnType, datatypeConstructorCreate, memberConversion) - .endControlFlow(); - }); - method.addStatement( - "throw new $T($S + $L + $S)", - IllegalArgumentException.class, - "Cannot convert ", - VAR_INPUT, - " to %s.".formatted(returnType)); - return method.build(); + protected CodeBlock memberDeclaration( + final MemberShape memberShape, + CodeBlock variable + ) { + if (memberShape.isRequired()) { + return CodeBlock.of( + "$T $L", + subject.dafnyNameResolver.typeForShape(memberShape.getId()), + variable + ); } + return CodeBlock.of( + "$T $L", + ParameterizedTypeName.get( + ClassName.get("Wrappers_Compile", "Option"), + subject.dafnyNameResolver.typeForShape(memberShape.getId()) + ), + variable + ); + } - protected CodeBlock memberDeclaration(final MemberShape memberShape, CodeBlock variable) { - if (memberShape.isRequired()) { - return CodeBlock.of("$T $L", - subject.dafnyNameResolver.typeForShape(memberShape.getId()), - variable - ); - } - return CodeBlock.of("$T $L", - ParameterizedTypeName.get( - ClassName.get("Wrappers_Compile", "Option"), - subject.dafnyNameResolver.typeForShape(memberShape.getId())), - variable); - } + /** @return CodeBlock invoking member Conversion and assigning the output. */ + protected CodeBlock memberConvertAndAssign( + final MemberShape memberShape, + CodeBlock outputVar, + CodeBlock inputVar + ) { + return memberAssign( + memberShape, + outputVar, + inputVar, + memberConversion(memberShape, inputVar) + ); + } - /** @return CodeBlock invoking member Conversion and assigning the output. */ - protected CodeBlock memberConvertAndAssign( - final MemberShape memberShape, - CodeBlock outputVar, - CodeBlock inputVar - ) { - return memberAssign(memberShape, outputVar, inputVar, memberConversion(memberShape, inputVar)); + /** @return CodeBlock assigning result of member conversion to variable. */ + protected CodeBlock memberAssign( + final MemberShape memberShape, + CodeBlock outputVar, + CodeBlock inputVar, + CodeBlock memberConversion + ) { + if (memberShape.isRequired()) { + return CodeBlock.of("$L = $L", outputVar, memberConversion); } + final CodeBlock isNullCheck = CodeBlock.of( + "$T.nonNull($L)", + ClassName.get(Objects.class), + inputVar + ); + CodeBlock isSetCheck = isNullCheck; + Shape targetShape = subject.model.expectShape(memberShape.getTarget()); + if (Constants.LIST_MAP_SET_SHAPE_TYPES.contains(targetShape.getType())) { + isSetCheck = CodeBlock.of("($L && $L.size() > 0)", isNullCheck, inputVar); + } + CodeBlock typeDescriptor = subject.dafnyNameResolver.typeDescriptor( + memberShape.getTarget() + ); + return CodeBlock.of( + "$L = $L ?\n$L\n: $L", + outputVar, + isSetCheck, + subject.dafnyNameResolver.createSome(typeDescriptor, memberConversion), + subject.dafnyNameResolver.createNone(typeDescriptor) + ); + } - /** @return CodeBlock assigning result of member conversion to variable. */ - protected CodeBlock memberAssign( - final MemberShape memberShape, - CodeBlock outputVar, - CodeBlock inputVar, - CodeBlock memberConversion) { - if (memberShape.isRequired()) { - return CodeBlock.of( - "$L = $L", - outputVar, - memberConversion - ); - } - final CodeBlock isNullCheck = CodeBlock.of( - "$T.nonNull($L)", - ClassName.get(Objects.class), - inputVar); - CodeBlock isSetCheck = isNullCheck; - Shape targetShape = subject.model.expectShape(memberShape.getTarget()); - if (Constants.LIST_MAP_SET_SHAPE_TYPES.contains(targetShape.getType())) { - isSetCheck = CodeBlock.of("($L && $L.size() > 0)", - isNullCheck, - inputVar); - } - CodeBlock typeDescriptor = subject.dafnyNameResolver.typeDescriptor(memberShape.getTarget()); - return CodeBlock.of( - "$L = $L ?\n$L\n: $L", - outputVar, - isSetCheck, - subject.dafnyNameResolver.createSome(typeDescriptor, memberConversion), - subject.dafnyNameResolver.createNone(typeDescriptor) - ); + @SuppressWarnings("OptionalGetWithoutIsPresent") + protected MethodSpec modeledEnum(StringShape shape) { + final ShapeId shapeId = shape.getId(); + String methodName = capitalize(shapeId.getName()); + final EnumTrait enumTrait = shape + .getTrait(EnumTrait.class) + .orElseThrow(() -> + new IllegalArgumentException( + "Shape must have the enum trait. ShapeId: %s".formatted(shapeId) + ) + ); + if (!enumTrait.hasNames()) { + throw new UnsupportedOperationException( + "Unnamed enums not supported. ShapeId: %s".formatted(shapeId) + ); } + TypeName dafnyEnumClass = subject.dafnyNameResolver.typeForShape(shapeId); - @SuppressWarnings("OptionalGetWithoutIsPresent") - protected MethodSpec modeledEnum(StringShape shape) { - final ShapeId shapeId = shape.getId(); - String methodName = capitalize(shapeId.getName()); - final EnumTrait enumTrait = shape.getTrait(EnumTrait.class).orElseThrow( - () -> new IllegalArgumentException( - "Shape must have the enum trait. ShapeId: %s".formatted(shapeId)) - ); - if (!enumTrait.hasNames()) { - throw new UnsupportedOperationException( - "Unnamed enums not supported. ShapeId: %s".formatted(shapeId)); - } - TypeName dafnyEnumClass = subject.dafnyNameResolver.typeForShape(shapeId); + MethodSpec.Builder builder = MethodSpec + .methodBuilder(methodName) + .addModifiers(Modifier.STATIC, Modifier.PUBLIC) + .returns(dafnyEnumClass) + .addParameter(subject.nativeNameResolver.classForEnum(shape), VAR_INPUT) + .beginControlFlow("switch ($L)", VAR_INPUT); - MethodSpec.Builder builder = MethodSpec - .methodBuilder(methodName) - .addModifiers(Modifier.STATIC, Modifier.PUBLIC) - .returns(dafnyEnumClass) - .addParameter(subject.nativeNameResolver.classForEnum(shape), VAR_INPUT) - .beginControlFlow("switch ($L)", VAR_INPUT); + final boolean isRecordType = enumTrait.getValues().size() == 1; - final boolean isRecordType = enumTrait.getValues().size() == 1; + enumTrait + .getValues() + .stream() + .map(EnumDefinition::getName) + .map(Optional::get) + .peek(name -> { + if (!ModelUtils.isValidEnumDefinitionName(name)) { + throw new UnsupportedOperationException( + "Invalid enum definition name: %s".formatted(name) + ); + } + }) + .forEach(name -> + builder + .beginControlFlow("case $L:", name) + .addStatement( + "return $T.$L()", + dafnyEnumClass, + Dafny.datatypeConstructorCreate(name, isRecordType) + ) + .endControlFlow() + ); - enumTrait.getValues().stream() - .map(EnumDefinition::getName) - .map(Optional::get) - .peek(name -> { - if (!ModelUtils.isValidEnumDefinitionName(name)) { - throw new UnsupportedOperationException( - "Invalid enum definition name: %s".formatted(name)); - } - }) - .forEach(name -> builder - .beginControlFlow("case $L:", name) - .addStatement( - "return $T.$L()", - dafnyEnumClass, - Dafny.datatypeConstructorCreate(name, isRecordType)) - .endControlFlow() - ); + builder + .beginControlFlow("default:") + .addStatement( + "throw new $T($S + $L + $S)", + RuntimeException.class, + "Cannot convert ", + VAR_INPUT, + " to %s.".formatted(dafnyEnumClass) + ) + .endControlFlow(); + builder.endControlFlow(); + return builder.build(); + } - builder.beginControlFlow("default:") - .addStatement( - "throw new $T($S + $L + $S)", - RuntimeException.class, - "Cannot convert ", - VAR_INPUT, - " to %s.".formatted(dafnyEnumClass)) - .endControlFlow(); - builder.endControlFlow(); - return builder.build(); - } + protected MethodSpec modeledList(ListShape shape) { + MemberShape memberShape = shape.getMember(); + CodeBlock memberConverter = conversionMethodReference( + subject.model.expectShape(memberShape.getTarget()) + ) + .asFunctionalReference(); + CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(shape.getType()) + .asNormalReference(); + CodeBlock getTypeDescriptor = subject.dafnyNameResolver.typeDescriptor( + memberShape.getTarget() + ); + ParameterSpec parameterSpec = ParameterSpec + .builder( + subject.nativeNameResolver.typeForShape(shape.getId()), + "nativeValue" + ) + .build(); + return MethodSpec + .methodBuilder(capitalize(shape.getId().getName())) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns( + subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId()) + ) + .addParameter(parameterSpec) + .addStatement( + "return $L(\nnativeValue, \n$L, \n$L)", + genericCall, + memberConverter, + getTypeDescriptor + ) + .build(); + } - protected MethodSpec modeledList(ListShape shape) { - MemberShape memberShape = shape.getMember(); - CodeBlock memberConverter = conversionMethodReference(subject.model.expectShape(memberShape.getTarget())).asFunctionalReference(); - CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()).asNormalReference(); - CodeBlock getTypeDescriptor = subject.dafnyNameResolver.typeDescriptor(memberShape.getTarget()); - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.nativeNameResolver.typeForShape(shape.getId()), "nativeValue") - .build(); - return MethodSpec - .methodBuilder(capitalize(shape.getId().getName())) - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - .returns(subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId())) - .addParameter(parameterSpec) - .addStatement("return $L(\nnativeValue, \n$L, \n$L)", - genericCall, memberConverter, getTypeDescriptor) - .build(); - } + protected MethodSpec modeledSet(SetShape shape) { + MemberShape memberShape = shape.getMember(); + CodeBlock memberConverter = conversionMethodReference( + subject.model.expectShape(memberShape.getTarget()) + ) + .asFunctionalReference(); + CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(shape.getType()) + .asNormalReference(); + ParameterSpec parameterSpec = ParameterSpec + .builder( + subject.nativeNameResolver.typeForShape(shape.getId()), + "nativeValue" + ) + .build(); + return MethodSpec + .methodBuilder(capitalize(shape.getId().getName())) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns( + subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId()) + ) + .addParameter(parameterSpec) + .addStatement( + "return $L(\nnativeValue, \n$L)", + genericCall, + memberConverter + ) + .build(); + } - protected MethodSpec modeledSet(SetShape shape) { - MemberShape memberShape = shape.getMember(); - CodeBlock memberConverter = conversionMethodReference(subject.model.expectShape(memberShape.getTarget())).asFunctionalReference(); - CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()).asNormalReference(); - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.nativeNameResolver.typeForShape(shape.getId()), "nativeValue") - .build(); - return MethodSpec - .methodBuilder(capitalize(shape.getId().getName())) - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - .returns(subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId())) - .addParameter(parameterSpec) - .addStatement("return $L(\nnativeValue, \n$L)", - genericCall, memberConverter) - .build(); - } + @SuppressWarnings("OptionalGetWithoutIsPresent") + protected MethodSpec modeledMap(MapShape shape) { + MemberShape keyShape = shape.getKey().asMemberShape().get(); + CodeBlock keyConverter = conversionMethodReference( + subject.model.expectShape(keyShape.getTarget()) + ) + .asFunctionalReference(); + MemberShape valueShape = shape.getValue().asMemberShape().get(); + CodeBlock valueConverter = conversionMethodReference( + subject.model.expectShape(valueShape.getTarget()) + ) + .asFunctionalReference(); + CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(shape.getType()) + .asNormalReference(); + ParameterSpec parameterSpec = ParameterSpec + .builder( + subject.nativeNameResolver.typeForShape(shape.getId()), + "nativeValue" + ) + .build(); + return MethodSpec + .methodBuilder(capitalize(shape.getId().getName())) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns( + subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId()) + ) + .addParameter(parameterSpec) + .addStatement( + "return $L(\nnativeValue, \n$L, \n$L)", + genericCall, + keyConverter, + valueConverter + ) + .build(); + } - @SuppressWarnings("OptionalGetWithoutIsPresent") - protected MethodSpec modeledMap(MapShape shape) { - MemberShape keyShape = shape.getKey().asMemberShape().get(); - CodeBlock keyConverter = conversionMethodReference(subject.model.expectShape(keyShape.getTarget())).asFunctionalReference(); - MemberShape valueShape = shape.getValue().asMemberShape().get(); - CodeBlock valueConverter = conversionMethodReference(subject.model.expectShape(valueShape.getTarget())).asFunctionalReference(); - CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()).asNormalReference(); - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.nativeNameResolver.typeForShape(shape.getId()), "nativeValue") - .build(); - return MethodSpec - .methodBuilder(capitalize(shape.getId().getName())) - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - .returns(subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId())) - .addParameter(parameterSpec) - .addStatement("return $L(\nnativeValue, \n$L, \n$L)", - genericCall, keyConverter, valueConverter) - .build(); - } + /** AWS SDK V1 uses a different getter pattern than Library (or, possibly, SDK V2) */ + protected abstract CodeBlock getMember( + CodeBlock variableName, + MemberShape memberShape + ); - /** AWS SDK V1 uses a different getter pattern than Library (or, possibly, SDK V2) */ - abstract protected CodeBlock getMember(CodeBlock variableName, MemberShape memberShape); + /** CodeBlock invoking the member conversion method. */ + protected CodeBlock memberConversion( + MemberShape memberShape, + CodeBlock inputVar + ) { + return CodeBlock.of( + "$L($L)", + conversionMethodReference( + subject.model.expectShape(memberShape.getTarget()) + ) + .asNormalReference(), + inputVar + ); + } - /** CodeBlock invoking the member conversion method. */ - protected CodeBlock memberConversion(MemberShape memberShape, CodeBlock inputVar) { - return CodeBlock.of("$L($L)", - conversionMethodReference(subject.model.expectShape(memberShape.getTarget())).asNormalReference(), - inputVar - ); + /** + * Returns MethodReference that converts from + * the Java Native Shape to + * the Java Dafny Shape. + */ + @SuppressWarnings({ "DuplicatedCode" }) + protected MethodReference conversionMethodReference(Shape shape) { + if (shape.isMemberShape()) { + throw new IllegalArgumentException( + "MemberShapes MUST BE de-referenced BEFORE calling ToDafny.conversionMethodReference. ShapeId: %s".formatted( + shape.toShapeId() + ) + ); } - - /** - * Returns MethodReference that converts from - * the Java Native Shape to - * the Java Dafny Shape. - */ - @SuppressWarnings({"DuplicatedCode"}) - protected MethodReference conversionMethodReference(Shape shape) { - if (shape.isMemberShape()) { - throw new IllegalArgumentException("MemberShapes MUST BE de-referenced BEFORE calling ToDafny.conversionMethodReference. ShapeId: %s".formatted(shape.toShapeId())); - } - // If the target is simple, use SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE - if (ModelUtils.isSmithyApiOrSimpleShape(shape)) { - return SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()); - } - return nonSimpleConversionMethodReference(shape); + // If the target is simple, use SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE + if (ModelUtils.isSmithyApiOrSimpleShape(shape)) { + return SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()); } + return nonSimpleConversionMethodReference(shape); + } - @SuppressWarnings("DuplicatedCode") - @Nonnull - protected MethodReference nonSimpleConversionMethodReference(Shape shape) { - ShapeId targetId = shape.getId(); - final String methodName = capitalize(targetId.getName()); - // if in AWS SDK namespace, reference converter from AWS SDK ToDafny class - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(targetId)) { - return switch (subject.sdkVersion) { - case V1 -> new MethodReference(ToDafnyAwsV1.className(targetId), methodName); - case V2 -> new MethodReference(ToDafnyAwsV2.className(targetId), methodName); - }; - } - // Otherwise, this target must be in another namespace, - // reference converter from that namespace's ToDafny class - ClassName otherNamespaceToDafny = ClassName.get( - NamespaceHelper.standardize(targetId.getNamespace()), - TO_DAFNY); - return new MethodReference(otherNamespaceToDafny, methodName); + @SuppressWarnings("DuplicatedCode") + @Nonnull + protected MethodReference nonSimpleConversionMethodReference(Shape shape) { + ShapeId targetId = shape.getId(); + final String methodName = capitalize(targetId.getName()); + // if in AWS SDK namespace, reference converter from AWS SDK ToDafny class + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(targetId)) { + return switch (subject.sdkVersion) { + case V1 -> new MethodReference( + ToDafnyAwsV1.className(targetId), + methodName + ); + case V2 -> new MethodReference( + ToDafnyAwsV2.className(targetId), + methodName + ); + }; } + // Otherwise, this target must be in another namespace, + // reference converter from that namespace's ToDafny class + ClassName otherNamespaceToDafny = ClassName.get( + NamespaceHelper.standardize(targetId.getNamespace()), + TO_DAFNY + ); + return new MethodReference(otherNamespaceToDafny, methodName); + } - protected MethodSpec modeledError(final ShapeId shapeId) { - return modeledError(subject.model.expectShape(shapeId, StructureShape.class)); - } + protected MethodSpec modeledError(final ShapeId shapeId) { + return modeledError( + subject.model.expectShape(shapeId, StructureShape.class) + ); + } - protected MethodSpec modeledError(final StructureShape shape) { - MethodSpec structure = modeledStructure(shape); - MethodSpec.Builder builder = structure.toBuilder(); - builder.setName("Error"); - builder.returns(subject.dafnyNameResolver.abstractClassForError()); - return builder.build(); - } + protected MethodSpec modeledError(final StructureShape shape) { + MethodSpec structure = modeledStructure(shape); + MethodSpec.Builder builder = structure.toBuilder(); + builder.setName("Error"); + builder.returns(subject.dafnyNameResolver.abstractClassForError()); + return builder.build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/ToNative.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/ToNative.java index 3fac29c3b0..7778f11386 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/ToNative.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/ToNative.java @@ -2,27 +2,25 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator; +import static software.amazon.smithy.utils.StringUtils.capitalize; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterSpec; import com.squareup.javapoet.TypeName; - import java.util.Map; - import javax.annotation.Nonnull; import javax.lang.model.element.Modifier; - import software.amazon.polymorph.smithyjava.BuilderSpecs; import software.amazon.polymorph.smithyjava.MethodReference; import software.amazon.polymorph.smithyjava.NamespaceHelper; import software.amazon.polymorph.smithyjava.generator.CodegenSubject.AwsSdkVersion; -import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; -import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.smithyjava.generator.awssdk.v1.ToNativeAwsV1; import software.amazon.polymorph.smithyjava.generator.awssdk.v2.ToNativeAwsV2; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; - +import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; +import software.amazon.polymorph.utils.ModelUtils; import software.amazon.smithy.model.shapes.ListShape; import software.amazon.smithy.model.shapes.MapShape; import software.amazon.smithy.model.shapes.MemberShape; @@ -36,295 +34,416 @@ import software.amazon.smithy.model.traits.EnumDefinition; import software.amazon.smithy.model.traits.EnumTrait; -import static software.amazon.smithy.utils.StringUtils.capitalize; - public abstract class ToNative extends Generator { - protected final static String VAR_INPUT = "dafnyValue"; - protected final static String TO_NATIVE = "ToNative"; - protected final static String NATIVE_BUILDER = "nativeBuilder"; - /** - * The keys are the Dafny generated java input type, - * the values are the method that converts from that input to the - * idiomatic java type. - */ - protected static final Map AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE; - protected static final Map SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE; - protected static final ClassName COMMON_TO_NATIVE_SIMPLE = ClassName.get("software.amazon.smithy.dafny.conversion", "ToNative", "Simple"); - protected static final ClassName COMMON_TO_NATIVE_AGGREGATE = ClassName.get("software.amazon.smithy.dafny.conversion", "ToNative", "Aggregate"); - static { - AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE = Map.ofEntries( - Map.entry(ShapeType.LIST, new MethodReference(COMMON_TO_NATIVE_AGGREGATE, "GenericToList")), - Map.entry(ShapeType.SET, new MethodReference(COMMON_TO_NATIVE_AGGREGATE, "GenericToSet")), - Map.entry(ShapeType.MAP, new MethodReference(COMMON_TO_NATIVE_AGGREGATE, "GenericToMap")) - ); - SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE = Map.ofEntries( - Map.entry(ShapeType.BLOB, new MethodReference(COMMON_TO_NATIVE_SIMPLE, "ByteBuffer")), - Map.entry(ShapeType.BOOLEAN, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.STRING, new MethodReference(COMMON_TO_NATIVE_SIMPLE, "String")), - // TODO: Timestamp should be service specific - Map.entry(ShapeType.TIMESTAMP, new MethodReference(COMMON_TO_NATIVE_SIMPLE, "Date")), - Map.entry(ShapeType.BYTE, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.SHORT, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.INTEGER, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.LONG, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.DOUBLE, new MethodReference(COMMON_TO_NATIVE_SIMPLE, "Double")), - Map.entry(ShapeType.BIG_DECIMAL, Constants.IDENTITY_FUNCTION), - Map.entry(ShapeType.BIG_INTEGER, Constants.IDENTITY_FUNCTION) - ); - } - /** - * The class name of the Subject's Shim's ToNative class. - */ - protected final ClassName thisClassName; + protected static final String VAR_INPUT = "dafnyValue"; + protected static final String TO_NATIVE = "ToNative"; + protected static final String NATIVE_BUILDER = "nativeBuilder"; + /** + * The keys are the Dafny generated java input type, + * the values are the method that converts from that input to the + * idiomatic java type. + */ + protected static final Map< + ShapeType, + MethodReference + > AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE; + protected static final Map< + ShapeType, + MethodReference + > SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE; + protected static final ClassName COMMON_TO_NATIVE_SIMPLE = ClassName.get( + "software.amazon.smithy.dafny.conversion", + "ToNative", + "Simple" + ); + protected static final ClassName COMMON_TO_NATIVE_AGGREGATE = ClassName.get( + "software.amazon.smithy.dafny.conversion", + "ToNative", + "Aggregate" + ); - public ToNative(CodegenSubject subject, ClassName className) { - super(subject); - thisClassName = className; - } + static { + AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE = + Map.ofEntries( + Map.entry( + ShapeType.LIST, + new MethodReference(COMMON_TO_NATIVE_AGGREGATE, "GenericToList") + ), + Map.entry( + ShapeType.SET, + new MethodReference(COMMON_TO_NATIVE_AGGREGATE, "GenericToSet") + ), + Map.entry( + ShapeType.MAP, + new MethodReference(COMMON_TO_NATIVE_AGGREGATE, "GenericToMap") + ) + ); + SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE = + Map.ofEntries( + Map.entry( + ShapeType.BLOB, + new MethodReference(COMMON_TO_NATIVE_SIMPLE, "ByteBuffer") + ), + Map.entry(ShapeType.BOOLEAN, Constants.IDENTITY_FUNCTION), + Map.entry( + ShapeType.STRING, + new MethodReference(COMMON_TO_NATIVE_SIMPLE, "String") + ), + // TODO: Timestamp should be service specific + Map.entry( + ShapeType.TIMESTAMP, + new MethodReference(COMMON_TO_NATIVE_SIMPLE, "Date") + ), + Map.entry(ShapeType.BYTE, Constants.IDENTITY_FUNCTION), + Map.entry(ShapeType.SHORT, Constants.IDENTITY_FUNCTION), + Map.entry(ShapeType.INTEGER, Constants.IDENTITY_FUNCTION), + Map.entry(ShapeType.LONG, Constants.IDENTITY_FUNCTION), + Map.entry( + ShapeType.DOUBLE, + new MethodReference(COMMON_TO_NATIVE_SIMPLE, "Double") + ), + Map.entry(ShapeType.BIG_DECIMAL, Constants.IDENTITY_FUNCTION), + Map.entry(ShapeType.BIG_INTEGER, Constants.IDENTITY_FUNCTION) + ); + } - /** Signature of an Error conversion method. */ - protected MethodSpec.Builder initializeErrorMethodSpec( - TypeName inputType, - TypeName returnType - ) { - return initializeMethodSpec("Error", inputType, returnType); - } + /** + * The class name of the Subject's Shim's ToNative class. + */ + protected final ClassName thisClassName; - /** Signature of a ToNative conversion method. */ - protected MethodSpec.Builder initializeMethodSpec( - String methodName, - TypeName inputType, - TypeName returnType - ) { - return MethodSpec.methodBuilder(methodName) - .returns(returnType) - .addModifiers(PUBLIC_STATIC) - .addParameter(inputType, VAR_INPUT); - } + public ToNative(CodegenSubject subject, ClassName className) { + super(subject); + thisClassName = className; + } - /** Declare and assign the native value's builder. */ - protected MethodSpec.Builder createNativeBuilder( - MethodSpec.Builder method, - ClassName returnType - ) { - return method.addStatement("$T $L = $T.$L()", - BuilderSpecs.builderInterfaceName(returnType), - NATIVE_BUILDER, - returnType, - BuilderSpecs.BUILDER_VAR - ); - } + /** Signature of an Error conversion method. */ + protected MethodSpec.Builder initializeErrorMethodSpec( + TypeName inputType, + TypeName returnType + ) { + return initializeMethodSpec("Error", inputType, returnType); + } - /** Return invocation of nativeBuilder's build method. */ - protected MethodSpec buildAndReturn(MethodSpec.Builder method) { - method.addStatement("return $L.build()", NATIVE_BUILDER); - return method.build(); - } + /** Signature of a ToNative conversion method. */ + protected MethodSpec.Builder initializeMethodSpec( + String methodName, + TypeName inputType, + TypeName returnType + ) { + return MethodSpec + .methodBuilder(methodName) + .returns(returnType) + .addModifiers(PUBLIC_STATIC) + .addParameter(inputType, VAR_INPUT); + } - @SuppressWarnings("OptionalGetWithoutIsPresent") - protected MethodSpec modeledMap(MapShape shape) { - Shape keyShape = subject.model.expectShape(shape.getKey().asMemberShape().get().getTarget()); - CodeBlock keyConverter = conversionMethodReference(keyShape).asFunctionalReference(); - Shape valueShape = subject.model.expectShape(shape.getValue().asMemberShape().get().getTarget()); - CodeBlock valueConverter = conversionMethodReference(valueShape).asFunctionalReference(); - CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()).asNormalReference(); - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.dafnyNameResolver.typeForShape(shape.getId()), VAR_INPUT) - .build(); - return MethodSpec - .methodBuilder(capitalize(shape.getId().getName())) - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - .returns(subject.nativeNameResolver.typeForShape(shape.getId())) - .addParameter(parameterSpec) - .addStatement("return $L(\n$L, \n$L, \n$L)", - genericCall, VAR_INPUT, keyConverter, valueConverter) - .build(); - } + /** Declare and assign the native value's builder. */ + protected MethodSpec.Builder createNativeBuilder( + MethodSpec.Builder method, + ClassName returnType + ) { + return method.addStatement( + "$T $L = $T.$L()", + BuilderSpecs.builderInterfaceName(returnType), + NATIVE_BUILDER, + returnType, + BuilderSpecs.BUILDER_VAR + ); + } - /** Uses a Builder to build the native value of Structure. */ - protected MethodSpec modeledStructure(StructureShape structureShape) { - final ShapeId shapeId = structureShape.getId(); - final String methodName = capitalize(shapeId.getName()); - final TypeName inputType = subject.dafnyNameResolver.typeForShape(shapeId); - final ClassName returnType = subject.nativeNameResolver.classNameForStructure(structureShape); - MethodSpec.Builder method = initializeMethodSpec(methodName, inputType, returnType); - createNativeBuilder(method, returnType); - // For each member - structureShape.members() - .forEach(member -> { - // if optional, check if present - if (member.isOptional()) { - method.beginControlFlow( - "if ($L.$L.is_Some())", - VAR_INPUT, - Dafny.getMemberField(member)); - } - method.addStatement(setWithConversionCall(member, Dafny.getMemberFieldValue(member))); - if (member.isOptional()) { - method.endControlFlow(); - } - }); - return buildAndReturn(method); - } + /** Return invocation of nativeBuilder's build method. */ + protected MethodSpec buildAndReturn(MethodSpec.Builder method) { + method.addStatement("return $L.build()", NATIVE_BUILDER); + return method.build(); + } - protected MethodSpec modeledError(final ShapeId shapeId) { - return modeledError(subject.model.expectShape(shapeId, StructureShape.class)); - } + @SuppressWarnings("OptionalGetWithoutIsPresent") + protected MethodSpec modeledMap(MapShape shape) { + Shape keyShape = subject.model.expectShape( + shape.getKey().asMemberShape().get().getTarget() + ); + CodeBlock keyConverter = conversionMethodReference(keyShape) + .asFunctionalReference(); + Shape valueShape = subject.model.expectShape( + shape.getValue().asMemberShape().get().getTarget() + ); + CodeBlock valueConverter = conversionMethodReference(valueShape) + .asFunctionalReference(); + CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(shape.getType()) + .asNormalReference(); + ParameterSpec parameterSpec = ParameterSpec + .builder(subject.dafnyNameResolver.typeForShape(shape.getId()), VAR_INPUT) + .build(); + return MethodSpec + .methodBuilder(capitalize(shape.getId().getName())) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns(subject.nativeNameResolver.typeForShape(shape.getId())) + .addParameter(parameterSpec) + .addStatement( + "return $L(\n$L, \n$L, \n$L)", + genericCall, + VAR_INPUT, + keyConverter, + valueConverter + ) + .build(); + } - /** Uses a Builder to build the native value of Error. */ - protected MethodSpec modeledError(final StructureShape shape) { - MethodSpec structure = modeledStructure(shape); - MethodSpec.Builder builder = structure.toBuilder(); - builder.setName("Error"); - builder.returns(subject.nativeNameResolver.classNameForStructure(shape)); - return builder.build(); - } + /** Uses a Builder to build the native value of Structure. */ + protected MethodSpec modeledStructure(StructureShape structureShape) { + final ShapeId shapeId = structureShape.getId(); + final String methodName = capitalize(shapeId.getName()); + final TypeName inputType = subject.dafnyNameResolver.typeForShape(shapeId); + final ClassName returnType = + subject.nativeNameResolver.classNameForStructure(structureShape); + MethodSpec.Builder method = initializeMethodSpec( + methodName, + inputType, + returnType + ); + createNativeBuilder(method, returnType); + // For each member + structureShape + .members() + .forEach(member -> { + // if optional, check if present + if (member.isOptional()) { + method.beginControlFlow( + "if ($L.$L.is_Some())", + VAR_INPUT, + Dafny.getMemberField(member) + ); + } + method.addStatement( + setWithConversionCall(member, Dafny.getMemberFieldValue(member)) + ); + if (member.isOptional()) { + method.endControlFlow(); + } + }); + return buildAndReturn(method); + } - protected MethodSpec modeledEnum(StringShape shape) { - final ClassName returnType = subject.nativeNameResolver.classForEnum(shape); - MethodSpec.Builder method = modeledEnumCommon(shape, returnType); - // No Enum value matched, throw an Exception - method.addStatement("throw new $T($S + $L)", - IllegalArgumentException.class, - "No entry of %s matches the input : ".formatted(returnType), - VAR_INPUT); - return method.build(); + protected MethodSpec modeledError(final ShapeId shapeId) { + return modeledError( + subject.model.expectShape(shapeId, StructureShape.class) + ); + } + + /** Uses a Builder to build the native value of Error. */ + protected MethodSpec modeledError(final StructureShape shape) { + MethodSpec structure = modeledStructure(shape); + MethodSpec.Builder builder = structure.toBuilder(); + builder.setName("Error"); + builder.returns(subject.nativeNameResolver.classNameForStructure(shape)); + return builder.build(); + } + + protected MethodSpec modeledEnum(StringShape shape) { + final ClassName returnType = subject.nativeNameResolver.classForEnum(shape); + MethodSpec.Builder method = modeledEnumCommon(shape, returnType); + // No Enum value matched, throw an Exception + method.addStatement( + "throw new $T($S + $L)", + IllegalArgumentException.class, + "No entry of %s matches the input : ".formatted(returnType), + VAR_INPUT + ); + return method.build(); + } + + /** @return MethodSpec.Builder with an If-Return for every known enum value.*/ + protected final MethodSpec.Builder modeledEnumCommon( + StringShape shape, + ClassName returnType + ) { + final ShapeId shapeId = shape.getId(); + final String methodName = capitalize(shapeId.getName()); + final TypeName inputType = subject.dafnyNameResolver.typeForShape(shapeId); + MethodSpec.Builder method = initializeMethodSpec( + methodName, + inputType, + returnType + ); + final EnumTrait enumTrait = shape.getTrait(EnumTrait.class).orElseThrow(); + if (!enumTrait.hasNames()) { + throw new UnsupportedOperationException( + "Unnamed enums not supported. ShapeId: %s".formatted(shapeId) + ); } - /** @return MethodSpec.Builder with an If-Return for every known enum value.*/ - protected final MethodSpec.Builder modeledEnumCommon( - StringShape shape, ClassName returnType - ) { - final ShapeId shapeId = shape.getId(); - final String methodName = capitalize(shapeId.getName()); - final TypeName inputType = subject.dafnyNameResolver.typeForShape(shapeId); - MethodSpec.Builder method = initializeMethodSpec(methodName, inputType, returnType); - final EnumTrait enumTrait = shape.getTrait(EnumTrait.class).orElseThrow(); - if (!enumTrait.hasNames()) { - throw new UnsupportedOperationException( - "Unnamed enums not supported. ShapeId: %s".formatted(shapeId)); + enumTrait + .getValues() + .stream() + .map(EnumDefinition::getName) + .map(maybeName -> + maybeName.orElseThrow(() -> + new IllegalArgumentException( + "Unnamed enums not supported. ShapeId: %s".formatted(shapeId) + ) + ) + ) + .peek(name -> { + if (!ModelUtils.isValidEnumDefinitionName(name)) { + throw new UnsupportedOperationException( + "Invalid enum definition name: %s".formatted(name) + ); } + }) + .forEachOrdered(name -> + method + .beginControlFlow( + "if ($L.$L())", + VAR_INPUT, + Dafny.datatypeConstructorIs(name) + ) + .addStatement("return $T.$L", returnType, name) + .endControlFlow() + ); + return method; + } - enumTrait.getValues().stream() - .map(EnumDefinition::getName) - .map(maybeName -> maybeName.orElseThrow( - () -> new IllegalArgumentException( - "Unnamed enums not supported. ShapeId: %s".formatted(shapeId)) - )) - .peek(name -> { - if (!ModelUtils.isValidEnumDefinitionName(name)) { - throw new UnsupportedOperationException( - "Invalid enum definition name: %s".formatted(name)); - } - }) - .forEachOrdered(name -> method - .beginControlFlow("if ($L.$L())", VAR_INPUT, Dafny.datatypeConstructorIs(name)) - .addStatement("return $T.$L", returnType, name) - .endControlFlow() - ); - return method; - } + protected MethodSpec modeledUnion(final UnionShape shape) { + final ShapeId shapeId = shape.getId(); + final String methodName = capitalize(shapeId.getName()); + final TypeName inputType = subject.dafnyNameResolver.typeForShape(shapeId); + final ClassName returnType = + subject.nativeNameResolver.classNameForStructure(shape); + MethodSpec.Builder method = initializeMethodSpec( + methodName, + inputType, + returnType + ); + createNativeBuilder(method, returnType); + shape + .members() + .forEach(member -> { + method + .beginControlFlow( + "if ($L.$L())", + VAR_INPUT, + Dafny.datatypeConstructorIs(member.getMemberName()) + ) + .addStatement( + setWithConversionCall(member, Dafny.getMemberField(member)) + ) + .endControlFlow(); + }); + return buildAndReturn(method); + } - protected MethodSpec modeledUnion(final UnionShape shape) { - final ShapeId shapeId = shape.getId(); - final String methodName = capitalize(shapeId.getName()); - final TypeName inputType = subject.dafnyNameResolver.typeForShape(shapeId); - final ClassName returnType = subject.nativeNameResolver.classNameForStructure(shape); - MethodSpec.Builder method = initializeMethodSpec(methodName, inputType, returnType); - createNativeBuilder(method, returnType); - shape.members() - .forEach(member -> { - method.beginControlFlow("if ($L.$L())", VAR_INPUT, Dafny.datatypeConstructorIs(member.getMemberName())) - .addStatement(setWithConversionCall(member, Dafny.getMemberField(member))) - .endControlFlow(); - }); - return buildAndReturn(method); - } + protected MethodSpec modeledList(ListShape shape) { + return modeledListOrSet(shape.getMember(), shape.getId(), shape.getType()); + } - protected MethodSpec modeledList(ListShape shape) { - return modeledListOrSet(shape.getMember(), shape.getId(), shape.getType()); - } + protected MethodSpec modeledSet(SetShape shape) { + return modeledListOrSet(shape.getMember(), shape.getId(), shape.getType()); + } - protected MethodSpec modeledSet(SetShape shape) { - return modeledListOrSet(shape.getMember(), shape.getId(), shape.getType()); - } + protected MethodSpec modeledListOrSet( + MemberShape memberShape, + ShapeId shapeId, + ShapeType shapeType + ) { + CodeBlock memberConverter = conversionMethodReference( + subject.model.expectShape(memberShape.getTarget()) + ) + .asFunctionalReference(); + CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(shapeType) + .asNormalReference(); + ParameterSpec parameterSpec = ParameterSpec + .builder(subject.dafnyNameResolver.typeForShape(shapeId), VAR_INPUT) + .build(); + return MethodSpec + .methodBuilder(capitalize(shapeId.getName())) + .addModifiers(PUBLIC_STATIC) + .returns(subject.nativeNameResolver.typeForShape(shapeId)) + .addParameter(parameterSpec) + .addStatement( + "return $L(\n$L, \n$L)", + genericCall, + VAR_INPUT, + memberConverter + ) + .build(); + } - protected MethodSpec modeledListOrSet(MemberShape memberShape, ShapeId shapeId, ShapeType shapeType) { - CodeBlock memberConverter = conversionMethodReference(subject.model.expectShape(memberShape.getTarget())).asFunctionalReference(); - CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shapeType).asNormalReference(); - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.dafnyNameResolver.typeForShape(shapeId), VAR_INPUT) - .build(); - return MethodSpec - .methodBuilder(capitalize(shapeId.getName())) - .addModifiers(PUBLIC_STATIC) - .returns(subject.nativeNameResolver.typeForShape(shapeId)) - .addParameter(parameterSpec) - .addStatement("return $L(\n$L, \n$L)", - genericCall, VAR_INPUT, memberConverter) - .build(); - } + /** @param getMember can be a Variable or a method call that returns the member value.*/ + protected CodeBlock setWithConversionCall( + MemberShape member, + CodeBlock getMember + ) { + return CodeBlock.of( + "$L.$L($L($L.$L))", + NATIVE_BUILDER, + setMemberField(member), + conversionMethodReference(subject.model.expectShape(member.getTarget())) + .asNormalReference(), + VAR_INPUT, + getMember + ); + } - /** @param getMember can be a Variable or a method call that returns the member value.*/ - protected CodeBlock setWithConversionCall(MemberShape member, CodeBlock getMember) { - return CodeBlock.of("$L.$L($L($L.$L))", - NATIVE_BUILDER, - setMemberField(member), - conversionMethodReference(subject.model.expectShape(member.getTarget())).asNormalReference(), - VAR_INPUT, - getMember); - } + /** + * This logic assumes we are setting a parameter on a builder + * generated by BuilderSpecs or something equivalent. + * @return CodeBlock of Method to set a member field. */ + protected CodeBlock setMemberField(MemberShape shape) { + return CodeBlock.of("$L", shape.getMemberName()); + } - /** - * This logic assumes we are setting a parameter on a builder - * generated by BuilderSpecs or something equivalent. - * @return CodeBlock of Method to set a member field. */ - protected CodeBlock setMemberField(MemberShape shape) { - return CodeBlock.of("$L", shape.getMemberName()); + /** + * Returns MethodReference that converts from + * the Java Dafny shape to + * the Java Native shape. + */ + @SuppressWarnings({ "DuplicatedCode" }) + protected MethodReference conversionMethodReference(Shape shape) { + if (shape.isMemberShape()) { + throw new IllegalArgumentException( + "MemberShapes MUST BE de-referenced BEFORE calling ToNative.conversionMethodReference." + ); } - - /** - * Returns MethodReference that converts from - * the Java Dafny shape to - * the Java Native shape. - */ - @SuppressWarnings({"DuplicatedCode"}) - protected MethodReference conversionMethodReference(Shape shape) { - if (shape.isMemberShape()) { - throw new IllegalArgumentException("MemberShapes MUST BE de-referenced BEFORE calling ToNative.conversionMethodReference."); - } - // If the target is simple, use SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE - if (ModelUtils.isSmithyApiOrSimpleShape(shape)) { - return SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()); - } - return nonSimpleConversionMethodReference(shape); + // If the target is simple, use SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE + if (ModelUtils.isSmithyApiOrSimpleShape(shape)) { + return SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()); } + return nonSimpleConversionMethodReference(shape); + } - @Nonnull - protected MethodReference nonSimpleConversionMethodReference(Shape targetShape) { - ShapeId targetId = targetShape.getId(); - final String methodName = capitalize(targetId.getName()); - final ClassName toNativeClassName = ToNativeClassNameForShape(targetShape, subject.sdkVersion); - return new MethodReference(toNativeClassName, methodName); - } + @Nonnull + protected MethodReference nonSimpleConversionMethodReference( + Shape targetShape + ) { + ShapeId targetId = targetShape.getId(); + final String methodName = capitalize(targetId.getName()); + final ClassName toNativeClassName = ToNativeClassNameForShape( + targetShape, + subject.sdkVersion + ); + return new MethodReference(toNativeClassName, methodName); + } - public static ClassName ToNativeClassNameForShape( - final Shape targetShape, - final AwsSdkVersion sdkVersion - ) { - ShapeId targetId = targetShape.getId(); - // if in AWS SDK namespace, reference ToNative from AWS SDK - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(targetId)) { - return switch (sdkVersion) { - case V1 -> ToNativeAwsV1.className(targetId); - case V2 -> ToNativeAwsV2.className(targetId); - }; - } - // Otherwise, must be one of our Local Service's - return ClassName.get( - NamespaceHelper.standardize(targetId.getNamespace()), - TO_NATIVE - ); + public static ClassName ToNativeClassNameForShape( + final Shape targetShape, + final AwsSdkVersion sdkVersion + ) { + ShapeId targetId = targetShape.getId(); + // if in AWS SDK namespace, reference ToNative from AWS SDK + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(targetId)) { + return switch (sdkVersion) { + case V1 -> ToNativeAwsV1.className(targetId); + case V2 -> ToNativeAwsV2.className(targetId); + }; } + // Otherwise, must be one of our Local Service's + return ClassName.get( + NamespaceHelper.standardize(targetId.getNamespace()), + TO_NATIVE + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/JavaAwsSdkV1.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/JavaAwsSdkV1.java index ac62b78af2..1b577d1b78 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/JavaAwsSdkV1.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/JavaAwsSdkV1.java @@ -5,12 +5,11 @@ import java.nio.file.Path; import java.util.HashMap; import java.util.Map; - import software.amazon.polymorph.smithyjava.generator.CodegenSubject; -import software.amazon.polymorph.utils.DafnyNameResolverHelpers; -import software.amazon.polymorph.utils.TokenTree; import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkDafnyV1; import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkNativeV1; +import software.amazon.polymorph.utils.DafnyNameResolverHelpers; +import software.amazon.polymorph.utils.TokenTree; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.ServiceShape; @@ -20,44 +19,59 @@ * the AWS SDK for Java V1. */ public class JavaAwsSdkV1 extends CodegenSubject { - // Hack to override Name Resolvers to Aws Sdk V1 specific ones - // See code comment on ../library/ModelCodegen for details. - final AwsSdkDafnyV1 dafnyNameResolver; - final AwsSdkNativeV1 nativeNameResolver; - /** Public Java Interfaces will go here. */ - public final String packageName; + // Hack to override Name Resolvers to Aws Sdk V1 specific ones + // See code comment on ../library/ModelCodegen for details. + final AwsSdkDafnyV1 dafnyNameResolver; + final AwsSdkNativeV1 nativeNameResolver; + + /** Public Java Interfaces will go here. */ + public final String packageName; - private JavaAwsSdkV1( - ServiceShape serviceShape, - Model model, - AwsSdkDafnyV1 dafnyNameResolver, - AwsSdkNativeV1 nativeNameResolver) { - super(model, serviceShape, dafnyNameResolver, nativeNameResolver, AwsSdkVersion.V1); - this.dafnyNameResolver = dafnyNameResolver; - this.nativeNameResolver = nativeNameResolver; - this.packageName = DafnyNameResolverHelpers.packageNameForNamespace(serviceShape.getId().getNamespace()); - } + private JavaAwsSdkV1( + ServiceShape serviceShape, + Model model, + AwsSdkDafnyV1 dafnyNameResolver, + AwsSdkNativeV1 nativeNameResolver + ) { + super( + model, + serviceShape, + dafnyNameResolver, + nativeNameResolver, + AwsSdkVersion.V1 + ); + this.dafnyNameResolver = dafnyNameResolver; + this.nativeNameResolver = nativeNameResolver; + this.packageName = + DafnyNameResolverHelpers.packageNameForNamespace( + serviceShape.getId().getNamespace() + ); + } - public static JavaAwsSdkV1 createJavaAwsSdkV1(ServiceShape serviceShape, Model model) { - throw new UnsupportedOperationException("The AWS SDK for Java V1 support has not been tested since we implemented Double support"); - // We need to keep the ball rolling, and I do not have time to refactor & test the AWS-SDK V1 code. - // For now, I am just marking it as un-supported. - // If/When we need it (Java Keyrings?), we can resurrect it - /*final AwsSdkDafnyV1 dafnyNameResolver = new AwsSdkDafnyV1(serviceShape, model); + public static JavaAwsSdkV1 createJavaAwsSdkV1( + ServiceShape serviceShape, + Model model + ) { + throw new UnsupportedOperationException( + "The AWS SDK for Java V1 support has not been tested since we implemented Double support" + ); + // We need to keep the ball rolling, and I do not have time to refactor & test the AWS-SDK V1 code. + // For now, I am just marking it as un-supported. + // If/When we need it (Java Keyrings?), we can resurrect it + /*final AwsSdkDafnyV1 dafnyNameResolver = new AwsSdkDafnyV1(serviceShape, model); final AwsSdkNativeV1 nativeNameResolver = new AwsSdkNativeV1(serviceShape, model); return new JavaAwsSdkV1(serviceShape, model, dafnyNameResolver, nativeNameResolver);*/ - } - - public Map generate() { - Map rtn = new HashMap<>(); - ShimV1 shimGenerator = new ShimV1(this); - ToDafnyAwsV1 toDafnyGenerator = new ToDafnyAwsV1(this); - ToNativeAwsV1 toNativeGenerator = new ToNativeAwsV1(this); - rtn.putAll(shimGenerator.generate()); - rtn.putAll(toDafnyGenerator.generate()); - rtn.putAll(toNativeGenerator.generate()); - return rtn; - } + } + public Map generate() { + Map rtn = new HashMap<>(); + ShimV1 shimGenerator = new ShimV1(this); + ToDafnyAwsV1 toDafnyGenerator = new ToDafnyAwsV1(this); + ToNativeAwsV1 toNativeGenerator = new ToNativeAwsV1(this); + rtn.putAll(shimGenerator.generate()); + rtn.putAll(toDafnyGenerator.generate()); + rtn.putAll(toNativeGenerator.generate()); + return rtn; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ShimV1.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ShimV1.java index bd80be5837..e1ef0d38ad 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ShimV1.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ShimV1.java @@ -2,180 +2,237 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v1; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_TUPLE0_CLASS_NAME; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SMITHY_API_UNIT; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Collections; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; - import javax.lang.model.element.Modifier; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import software.amazon.polymorph.smithyjava.generator.Generator; -import software.amazon.polymorph.utils.DafnyNameResolverHelpers; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; +import software.amazon.polymorph.utils.DafnyNameResolverHelpers; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.utils.StringUtils; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_TUPLE0_CLASS_NAME; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SMITHY_API_UNIT; - //TODO: Create abstract class for V1 & V2 to extend /** * Generates an AWS SDK Shim for the AWS SKD for Java V1 * exposing an AWS Service's operations to Dafny Generated Java. */ public class ShimV1 extends Generator { - public static final String SHIM = "Shim"; - // Hack to override CodegenSubject - // See code comment on ../library/ModelCodegen for details. - private final JavaAwsSdkV1 subject; - private static final Logger LOGGER = LoggerFactory.getLogger(ShimV1.class); - public ShimV1(JavaAwsSdkV1 awsSdk) { - super(awsSdk); - this.subject = awsSdk; - } - public static ClassName className(ServiceShape shape) { - return ClassName.get( - DafnyNameResolverHelpers.packageNameForNamespace( - shape.toShapeId().getNamespace()), SHIM); - } + public static final String SHIM = "Shim"; + // Hack to override CodegenSubject + // See code comment on ../library/ModelCodegen for details. + private final JavaAwsSdkV1 subject; + private static final Logger LOGGER = LoggerFactory.getLogger(ShimV1.class); - @Override - public Set javaFiles() { - JavaFile.Builder builder = JavaFile - .builder(subject.packageName, shim()); - return Collections.singleton(builder.build()); - } + public ShimV1(JavaAwsSdkV1 awsSdk) { + super(awsSdk); + this.subject = awsSdk; + } - TypeSpec shim() { - return TypeSpec - .classBuilder(className(subject.serviceShape)) - .addModifiers(Modifier.PUBLIC) - .addSuperinterface(subject.dafnyNameResolver.typeForShape(subject.serviceShape.getId())) - .addField( - subject.nativeNameResolver.classNameForService(subject.serviceShape), - "_impl", Modifier.PRIVATE, Modifier.FINAL) - .addField( - ClassName.get(String.class), - "region", Modifier.PRIVATE, Modifier.FINAL) - .addMethod(constructor()) - .addMethod(impl()) - .addMethod(region()) - .addMethod(impl()) - .addMethods( - subject.serviceShape.getAllOperations() - .stream().sorted() - .map(this::operation) - .filter(Optional::isPresent) - .map(Optional::get) - .collect(Collectors.toList())) - .build(); - } + public static ClassName className(ServiceShape shape) { + return ClassName.get( + DafnyNameResolverHelpers.packageNameForNamespace( + shape.toShapeId().getNamespace() + ), + SHIM + ); + } - protected MethodSpec impl() { - return MethodSpec.methodBuilder("impl") - .addModifiers(Modifier.PUBLIC) - .addStatement("return this._impl") - .returns(subject.nativeNameResolver.classNameForService(subject.serviceShape)) - .build(); - } + @Override + public Set javaFiles() { + JavaFile.Builder builder = JavaFile.builder(subject.packageName, shim()); + return Collections.singleton(builder.build()); + } - MethodSpec constructor() { - return MethodSpec - .constructorBuilder() - .addModifiers(Modifier.PUBLIC) - .addParameter( - subject.nativeNameResolver.classNameForService(subject.serviceShape), - "impl", - Modifier.FINAL) - .addParameter( - ClassName.get(String.class), - "region", - Modifier.FINAL) - .addStatement("this._impl = impl") - .addStatement("this.region = region") - .build(); - } + TypeSpec shim() { + return TypeSpec + .classBuilder(className(subject.serviceShape)) + .addModifiers(Modifier.PUBLIC) + .addSuperinterface( + subject.dafnyNameResolver.typeForShape(subject.serviceShape.getId()) + ) + .addField( + subject.nativeNameResolver.classNameForService(subject.serviceShape), + "_impl", + Modifier.PRIVATE, + Modifier.FINAL + ) + .addField( + ClassName.get(String.class), + "region", + Modifier.PRIVATE, + Modifier.FINAL + ) + .addMethod(constructor()) + .addMethod(impl()) + .addMethod(region()) + .addMethod(impl()) + .addMethods( + subject.serviceShape + .getAllOperations() + .stream() + .sorted() + .map(this::operation) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.toList()) + ) + .build(); + } - MethodSpec region() { - return MethodSpec - .methodBuilder("region") - .addModifiers(Modifier.PUBLIC) - .returns(ClassName.get(String.class)) - .addStatement("return this.region") - .build(); - } + protected MethodSpec impl() { + return MethodSpec + .methodBuilder("impl") + .addModifiers(Modifier.PUBLIC) + .addStatement("return this._impl") + .returns( + subject.nativeNameResolver.classNameForService(subject.serviceShape) + ) + .build(); + } - Optional operation(final ShapeId operationShapeId) { - final OperationShape operationShape = subject.model.expectShape(operationShapeId, OperationShape.class); - ShapeId inputShapeId = operationShape.getInputShape(); - ShapeId outputShapeId = operationShape.getOutputShape(); - TypeName dafnyOutput = subject.dafnyNameResolver.typeForShape(outputShapeId); - String operationName = operationShape.toShapeId().getName(); - MethodSpec.Builder builder = MethodSpec - .methodBuilder(StringUtils.capitalize(operationName)) - .addAnnotation(Override.class) - .addModifiers(Modifier.PUBLIC) - .returns( - Dafny.asDafnyResult( - dafnyOutput, - subject.dafnyNameResolver.abstractClassForError() - )) - .addParameter(subject.dafnyNameResolver.typeForShape(inputShapeId), "input") - .addStatement("$T converted = ToNative.$L(input)", - subject.nativeNameResolver.typeForShape(inputShapeId), - StringUtils.capitalize(inputShapeId.getName())) - .beginControlFlow("try"); - CodeBlock successTypeDescriptor; - if (outputShapeId.equals(SMITHY_API_UNIT)) { - successTypeDescriptor = CodeBlock.of(DAFNY_TUPLE0_CLASS_NAME + "._typeDescriptor()"); - builder.addStatement("_impl.$L(converted)", - StringUtils.uncapitalize(operationName)) - .addStatement("return $L", - subject.dafnyNameResolver.createSuccess( - successTypeDescriptor, - CodeBlock.of("$T.create()", DAFNY_TUPLE0_CLASS_NAME))); - } else { - successTypeDescriptor = subject.dafnyNameResolver.typeDescriptor(outputShapeId); - builder.addStatement("$T result = _impl.$L(converted)", - subject.nativeNameResolver.typeForOperationOutput(outputShapeId), - StringUtils.uncapitalize(operationName)) - .addStatement("$T dafnyResponse = ToDafny.$L(result)", - dafnyOutput, - StringUtils.capitalize(outputShapeId.getName())) - .addStatement("return $L", - subject.dafnyNameResolver.createSuccess( - successTypeDescriptor, - CodeBlock.of("dafnyResponse"))); - } + MethodSpec constructor() { + return MethodSpec + .constructorBuilder() + .addModifiers(Modifier.PUBLIC) + .addParameter( + subject.nativeNameResolver.classNameForService(subject.serviceShape), + "impl", + Modifier.FINAL + ) + .addParameter(ClassName.get(String.class), "region", Modifier.FINAL) + .addStatement("this._impl = impl") + .addStatement("this.region = region") + .build(); + } - operationShape.getErrors().stream().sorted().forEach(shapeId -> - builder - .nextControlFlow("catch ($T ex)", subject.nativeNameResolver.typeForShape(shapeId)) - .addStatement("return $L", - subject.dafnyNameResolver.createFailure( - successTypeDescriptor, - CodeBlock.of("ToDafny.Error(ex)"))) + MethodSpec region() { + return MethodSpec + .methodBuilder("region") + .addModifiers(Modifier.PUBLIC) + .returns(ClassName.get(String.class)) + .addStatement("return this.region") + .build(); + } + + Optional operation(final ShapeId operationShapeId) { + final OperationShape operationShape = subject.model.expectShape( + operationShapeId, + OperationShape.class + ); + ShapeId inputShapeId = operationShape.getInputShape(); + ShapeId outputShapeId = operationShape.getOutputShape(); + TypeName dafnyOutput = subject.dafnyNameResolver.typeForShape( + outputShapeId + ); + String operationName = operationShape.toShapeId().getName(); + MethodSpec.Builder builder = MethodSpec + .methodBuilder(StringUtils.capitalize(operationName)) + .addAnnotation(Override.class) + .addModifiers(Modifier.PUBLIC) + .returns( + Dafny.asDafnyResult( + dafnyOutput, + subject.dafnyNameResolver.abstractClassForError() + ) + ) + .addParameter( + subject.dafnyNameResolver.typeForShape(inputShapeId), + "input" + ) + .addStatement( + "$T converted = ToNative.$L(input)", + subject.nativeNameResolver.typeForShape(inputShapeId), + StringUtils.capitalize(inputShapeId.getName()) + ) + .beginControlFlow("try"); + CodeBlock successTypeDescriptor; + if (outputShapeId.equals(SMITHY_API_UNIT)) { + successTypeDescriptor = + CodeBlock.of(DAFNY_TUPLE0_CLASS_NAME + "._typeDescriptor()"); + builder + .addStatement( + "_impl.$L(converted)", + StringUtils.uncapitalize(operationName) + ) + .addStatement( + "return $L", + subject.dafnyNameResolver.createSuccess( + successTypeDescriptor, + CodeBlock.of("$T.create()", DAFNY_TUPLE0_CLASS_NAME) + ) + ); + } else { + successTypeDescriptor = + subject.dafnyNameResolver.typeDescriptor(outputShapeId); + builder + .addStatement( + "$T result = _impl.$L(converted)", + subject.nativeNameResolver.typeForOperationOutput(outputShapeId), + StringUtils.uncapitalize(operationName) + ) + .addStatement( + "$T dafnyResponse = ToDafny.$L(result)", + dafnyOutput, + StringUtils.capitalize(outputShapeId.getName()) + ) + .addStatement( + "return $L", + subject.dafnyNameResolver.createSuccess( + successTypeDescriptor, + CodeBlock.of("dafnyResponse") + ) ); - return Optional.of(builder - .nextControlFlow("catch ($T ex)", subject.nativeNameResolver.baseErrorForService()) - .addStatement("return $L", - subject.dafnyNameResolver.createFailure( - successTypeDescriptor, - CodeBlock.of("ToDafny.Error(ex)"))) - .endControlFlow() - .build()); } + + operationShape + .getErrors() + .stream() + .sorted() + .forEach(shapeId -> + builder + .nextControlFlow( + "catch ($T ex)", + subject.nativeNameResolver.typeForShape(shapeId) + ) + .addStatement( + "return $L", + subject.dafnyNameResolver.createFailure( + successTypeDescriptor, + CodeBlock.of("ToDafny.Error(ex)") + ) + ) + ); + return Optional.of( + builder + .nextControlFlow( + "catch ($T ex)", + subject.nativeNameResolver.baseErrorForService() + ) + .addStatement( + "return $L", + subject.dafnyNameResolver.createFailure( + successTypeDescriptor, + CodeBlock.of("ToDafny.Error(ex)") + ) + ) + .endControlFlow() + .build() + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1.java index 36f28c5de6..23c8a8edb0 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1.java @@ -2,6 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v1; +import static software.amazon.smithy.utils.StringUtils.capitalize; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; @@ -11,7 +13,6 @@ import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import com.squareup.javapoet.WildcardTypeName; - import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; @@ -19,17 +20,15 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; - import javax.lang.model.element.Modifier; - import software.amazon.polymorph.smithyjava.generator.ToDafny; +import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkDafnyV1; +import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkNativeV1; import software.amazon.polymorph.smithyjava.nameresolver.Constants; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; import software.amazon.polymorph.utils.DafnyNameResolverHelpers; import software.amazon.polymorph.utils.ModelUtils; -import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkDafnyV1; -import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkNativeV1; import software.amazon.smithy.model.shapes.ListShape; import software.amazon.smithy.model.shapes.MapShape; import software.amazon.smithy.model.shapes.MemberShape; @@ -44,8 +43,6 @@ import software.amazon.smithy.model.shapes.UnionShape; import software.amazon.smithy.model.traits.EnumTrait; -import static software.amazon.smithy.utils.StringUtils.capitalize; - //TODO: Create abstract class for V1 & V2 to extend /** * ToDafnyAwsV1 generates ToDafny. @@ -69,305 +66,436 @@ * */ public class ToDafnyAwsV1 extends ToDafny { - // Hack to override subject to JavaAwsSdkV1 - // See code comment on ../library/ModelCodegen for details. - final JavaAwsSdkV1 subject; - public static ClassName className(ShapeId shapeId) { - if (!AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { - throw new IllegalArgumentException("ShapeId MUST BE in an AWS SDK Namespace"); - } - return ClassName.get( - DafnyNameResolverHelpers.packageNameForNamespace(shapeId.getNamespace()), - TO_DAFNY); - } + // Hack to override subject to JavaAwsSdkV1 + // See code comment on ../library/ModelCodegen for details. + final JavaAwsSdkV1 subject; - public ToDafnyAwsV1(JavaAwsSdkV1 awsSdk) { - super(awsSdk, className(awsSdk.serviceShape.toShapeId())); - this.subject = awsSdk; + public static ClassName className(ShapeId shapeId) { + if (!AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { + throw new IllegalArgumentException( + "ShapeId MUST BE in an AWS SDK Namespace" + ); } + return ClassName.get( + DafnyNameResolverHelpers.packageNameForNamespace(shapeId.getNamespace()), + TO_DAFNY + ); + } - @Override - public Set javaFiles() { - JavaFile.Builder builder = JavaFile - .builder(subject.dafnyNameResolver.packageName(), toDafny()); - return Collections.singleton(builder.build()); - } + public ToDafnyAwsV1(JavaAwsSdkV1 awsSdk) { + super(awsSdk, className(awsSdk.serviceShape.toShapeId())); + this.subject = awsSdk; + } - TypeSpec toDafny() { - List operations = subject.serviceShape - .getOperations().stream().sorted() - .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) - .toList(); - LinkedHashSet operationOutputs = operations.stream() - .map(OperationShape::getOutputShape).sorted() - .collect(Collectors.toCollection(LinkedHashSet::new)); - LinkedHashSet operationInputs = operations.stream() - .map(OperationShape::getInputShape).sorted() - .collect(Collectors.toCollection(LinkedHashSet::new)); - LinkedHashSet serviceErrors = operations.stream() - .map(OperationShape::getErrors) - .flatMap(Collection::stream).sorted() - .collect(Collectors.toCollection(LinkedHashSet::new)); - ModelUtils.streamServiceErrors(subject.model, subject.serviceShape) - .map(Shape::toShapeId).sorted() - .forEachOrdered(serviceErrors::add); + @Override + public Set javaFiles() { + JavaFile.Builder builder = JavaFile.builder( + subject.dafnyNameResolver.packageName(), + toDafny() + ); + return Collections.singleton(builder.build()); + } - LinkedHashSet operationStructures = new LinkedHashSet<>(); - operationStructures.addAll(operationOutputs); - operationStructures.addAll(operationInputs); - operationStructures.addAll(serviceErrors); - Set allRelevantShapeIds = ModelUtils.findAllDependentShapes(operationStructures, subject.model); + TypeSpec toDafny() { + List operations = subject.serviceShape + .getOperations() + .stream() + .sorted() + .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) + .toList(); + LinkedHashSet operationOutputs = operations + .stream() + .map(OperationShape::getOutputShape) + .sorted() + .collect(Collectors.toCollection(LinkedHashSet::new)); + LinkedHashSet operationInputs = operations + .stream() + .map(OperationShape::getInputShape) + .sorted() + .collect(Collectors.toCollection(LinkedHashSet::new)); + LinkedHashSet serviceErrors = operations + .stream() + .map(OperationShape::getErrors) + .flatMap(Collection::stream) + .sorted() + .collect(Collectors.toCollection(LinkedHashSet::new)); + ModelUtils + .streamServiceErrors(subject.model, subject.serviceShape) + .map(Shape::toShapeId) + .sorted() + .forEachOrdered(serviceErrors::add); - // In the AWS SDK for Java V1, Operation Outputs are special - allRelevantShapeIds.removeAll(operationOutputs); - // Errors are special case for all generators - allRelevantShapeIds.removeAll(serviceErrors); - allRelevantShapeIds.remove(ShapeId.fromParts("smithy.api", "Unit")); - // Enums are also a special case - LinkedHashSet enumShapeIds = new LinkedHashSet<>(); - allRelevantShapeIds.forEach(shapeId -> { - Shape shape = subject.model.expectShape(shapeId); - if (shape.hasTrait(EnumTrait.class)) { - enumShapeIds.add(shapeId); - } - }); - allRelevantShapeIds.removeAll(enumShapeIds); + LinkedHashSet operationStructures = new LinkedHashSet<>(); + operationStructures.addAll(operationOutputs); + operationStructures.addAll(operationInputs); + operationStructures.addAll(serviceErrors); + Set allRelevantShapeIds = ModelUtils.findAllDependentShapes( + operationStructures, + subject.model + ); - final List convertOutputs = operationOutputs.stream() - .map(this::generateConvertResponseV1).toList(); - final List convertAllRelevant = allRelevantShapeIds.stream().sorted() - .map(this::generateConvert).filter(Objects::nonNull).toList(); - final List convertServiceErrors = serviceErrors.stream().sorted() - .map(this::modeledError).collect(Collectors.toList()); - convertServiceErrors.add(generateConvertOpaqueError()); - // For enums, we generate overloaded methods, - // one to convert instances of the Enum - final List convertEnumEnum = enumShapeIds - .stream().sorted().map(this::generateConvertEnumEnum).toList(); - // The other to convert String representatives of the enum - final List convertEnumString = enumShapeIds - .stream().sorted().map(this::generateConvertEnumString).toList(); + // In the AWS SDK for Java V1, Operation Outputs are special + allRelevantShapeIds.removeAll(operationOutputs); + // Errors are special case for all generators + allRelevantShapeIds.removeAll(serviceErrors); + allRelevantShapeIds.remove(ShapeId.fromParts("smithy.api", "Unit")); + // Enums are also a special case + LinkedHashSet enumShapeIds = new LinkedHashSet<>(); + allRelevantShapeIds.forEach(shapeId -> { + Shape shape = subject.model.expectShape(shapeId); + if (shape.hasTrait(EnumTrait.class)) { + enumShapeIds.add(shapeId); + } + }); + allRelevantShapeIds.removeAll(enumShapeIds); - return TypeSpec - .classBuilder(className(subject.serviceShape.toShapeId())) - .addModifiers(Modifier.PUBLIC) - .addMethods(convertOutputs) - .addMethods(convertAllRelevant) - .addMethods(convertServiceErrors) - .addMethods(convertEnumEnum) - .addMethods(convertEnumString) - .addMethod(modeledService(subject.serviceShape)) - .build(); - } + final List convertOutputs = operationOutputs + .stream() + .map(this::generateConvertResponseV1) + .toList(); + final List convertAllRelevant = allRelevantShapeIds + .stream() + .sorted() + .map(this::generateConvert) + .filter(Objects::nonNull) + .toList(); + final List convertServiceErrors = serviceErrors + .stream() + .sorted() + .map(this::modeledError) + .collect(Collectors.toList()); + convertServiceErrors.add(generateConvertOpaqueError()); + // For enums, we generate overloaded methods, + // one to convert instances of the Enum + final List convertEnumEnum = enumShapeIds + .stream() + .sorted() + .map(this::generateConvertEnumEnum) + .toList(); + // The other to convert String representatives of the enum + final List convertEnumString = enumShapeIds + .stream() + .sorted() + .map(this::generateConvertEnumString) + .toList(); - MethodSpec modeledService(ServiceShape shape) { - // public static IKeyManagementServiceClient KeyManagementService(AWSKMS nativeValue) { - // return new Shim(nativeValue, null); - // } - String methodName = capitalize(shape.toShapeId().getName()); - ClassName nativeClass = AwsSdkNativeV1.classNameForServiceClient(shape); - ClassName dafnyClass = AwsSdkDafnyV1.classNameForAwsService(shape); - ClassName shim = ShimV1.className(shape); - return MethodSpec.methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .addParameter(nativeClass, VAR_INPUT) - .returns(dafnyClass) - .addStatement("return new $T($L, null)", shim, VAR_INPUT) - .build(); - } + return TypeSpec + .classBuilder(className(subject.serviceShape.toShapeId())) + .addModifiers(Modifier.PUBLIC) + .addMethods(convertOutputs) + .addMethods(convertAllRelevant) + .addMethods(convertServiceErrors) + .addMethods(convertEnumEnum) + .addMethods(convertEnumString) + .addMethod(modeledService(subject.serviceShape)) + .build(); + } - /** This method: - * 1. Determines the Shape Type - * 2. invokes the correct generate for that shape type - */ - @SuppressWarnings({"OptionalGetWithoutIsPresent", "DuplicatedCode"}) - MethodSpec generateConvert(final ShapeId shapeId) { - final Shape shape = subject.model.getShape(shapeId) - .orElseThrow(() -> new IllegalStateException("Cannot find shape " + shapeId)); - return switch (shape.getType()) { - // For the AWS SDK for Java, we do not generate converters for simple shapes - case BLOB, BOOLEAN, STRING, TIMESTAMP, BYTE, SHORT, DOUBLE, - INTEGER, LONG, BIG_DECIMAL, BIG_INTEGER, MEMBER -> null; - case LIST -> modeledList(shape.asListShape().get()); - case MAP -> modeledMap(shape.asMapShape().get()); - case SET -> modeledSet(shape.asSetShape().get()); - case STRUCTURE -> generateConvertStructure(shapeId); - case UNION -> generateConvertUnion(shapeId); - default -> throw new UnsupportedOperationException( - "ShapeId %s is of Type %s, which is not yet supported for ToDafny" - .formatted(shapeId, shape.getType())); - }; - } + MethodSpec modeledService(ServiceShape shape) { + // public static IKeyManagementServiceClient KeyManagementService(AWSKMS nativeValue) { + // return new Shim(nativeValue, null); + // } + String methodName = capitalize(shape.toShapeId().getName()); + ClassName nativeClass = AwsSdkNativeV1.classNameForServiceClient(shape); + ClassName dafnyClass = AwsSdkDafnyV1.classNameForAwsService(shape); + ClassName shim = ShimV1.className(shape); + return MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .addParameter(nativeClass, VAR_INPUT) + .returns(dafnyClass) + .addStatement("return new $T($L, null)", shim, VAR_INPUT) + .build(); + } - MethodSpec generateConvertEnumString(ShapeId shapeId) { - final StringShape shape = subject.model.expectShape(shapeId, StringShape.class); - String methodName = capitalize(shapeId.getName()); - TypeName dafnyEnumClass = subject.dafnyNameResolver.typeForShape(shapeId); + /** This method: + * 1. Determines the Shape Type + * 2. invokes the correct generate for that shape type + */ + @SuppressWarnings({ "OptionalGetWithoutIsPresent", "DuplicatedCode" }) + MethodSpec generateConvert(final ShapeId shapeId) { + final Shape shape = subject.model + .getShape(shapeId) + .orElseThrow(() -> + new IllegalStateException("Cannot find shape " + shapeId) + ); + return switch (shape.getType()) { + // For the AWS SDK for Java, we do not generate converters for simple shapes + case BLOB, + BOOLEAN, + STRING, + TIMESTAMP, + BYTE, + SHORT, + DOUBLE, + INTEGER, + LONG, + BIG_DECIMAL, + BIG_INTEGER, + MEMBER -> null; + case LIST -> modeledList(shape.asListShape().get()); + case MAP -> modeledMap(shape.asMapShape().get()); + case SET -> modeledSet(shape.asSetShape().get()); + case STRUCTURE -> generateConvertStructure(shapeId); + case UNION -> generateConvertUnion(shapeId); + default -> throw new UnsupportedOperationException( + "ShapeId %s is of Type %s, which is not yet supported for ToDafny".formatted( + shapeId, + shape.getType() + ) + ); + }; + } - MethodSpec.Builder builder = MethodSpec - .methodBuilder(methodName) - .addModifiers(Modifier.STATIC, Modifier.PUBLIC) - .returns(dafnyEnumClass) - .addParameter(subject.nativeNameResolver.classForString(), "nativeValue"); - builder.addStatement( - "return $L($T.fromValue(nativeValue))", - methodName, - subject.nativeNameResolver.classForEnum(shape) - ); - return builder.build(); - } + MethodSpec generateConvertEnumString(ShapeId shapeId) { + final StringShape shape = subject.model.expectShape( + shapeId, + StringShape.class + ); + String methodName = capitalize(shapeId.getName()); + TypeName dafnyEnumClass = subject.dafnyNameResolver.typeForShape(shapeId); - protected MethodSpec generateConvertEnumEnum(ShapeId shapeId) { - final StringShape shape = subject.model.expectShape(shapeId, StringShape.class); - return super.modeledEnum(shape); - } + MethodSpec.Builder builder = MethodSpec + .methodBuilder(methodName) + .addModifiers(Modifier.STATIC, Modifier.PUBLIC) + .returns(dafnyEnumClass) + .addParameter(subject.nativeNameResolver.classForString(), "nativeValue"); + builder.addStatement( + "return $L($T.fromValue(nativeValue))", + methodName, + subject.nativeNameResolver.classForEnum(shape) + ); + return builder.build(); + } - /** - * Should be called for all of a service's operations' outputs. - */ - MethodSpec generateConvertResponseV1(final ShapeId shapeId) { - MethodSpec structure = generateConvertStructure(shapeId); - MethodSpec.Builder builder = structure.toBuilder(); - builder.parameters.clear(); - builder.addParameter(subject.nativeNameResolver.typeForOperationOutput(shapeId), "nativeValue"); - return builder.build(); - } + protected MethodSpec generateConvertEnumEnum(ShapeId shapeId) { + final StringShape shape = subject.model.expectShape( + shapeId, + StringShape.class + ); + return super.modeledEnum(shape); + } - MethodSpec generateConvertStructure(final ShapeId shapeId) { - final StructureShape structureShape = subject.model.expectShape(shapeId, StructureShape.class); - return super.modeledStructure(structureShape); - } + /** + * Should be called for all of a service's operations' outputs. + */ + MethodSpec generateConvertResponseV1(final ShapeId shapeId) { + MethodSpec structure = generateConvertStructure(shapeId); + MethodSpec.Builder builder = structure.toBuilder(); + builder.parameters.clear(); + builder.addParameter( + subject.nativeNameResolver.typeForOperationOutput(shapeId), + "nativeValue" + ); + return builder.build(); + } - MethodSpec generateConvertUnion(final ShapeId shapeId) { - final UnionShape unionShape = subject.model.expectShape(shapeId, UnionShape.class); - return super.modeledUnion(unionShape); - } + MethodSpec generateConvertStructure(final ShapeId shapeId) { + final StructureShape structureShape = subject.model.expectShape( + shapeId, + StructureShape.class + ); + return super.modeledStructure(structureShape); + } - /** For AWS SDK structure members, the getter is `get + capitalized member name`. */ - @Override - protected CodeBlock getMember(CodeBlock variableName, MemberShape memberShape) { - return CodeBlock.of("$L.get$L()", variableName, capitalize(memberShape.getMemberName())); - } + MethodSpec generateConvertUnion(final ShapeId shapeId) { + final UnionShape unionShape = subject.model.expectShape( + shapeId, + UnionShape.class + ); + return super.modeledUnion(unionShape); + } - /** - * We have to customize - * List conversion for the AWS SDK for Java V1 because - * AWS SDK Java V1 treats Enums in a special way. - * See the comment on - * {@link AwsSdkNativeV1#typeForShapeNoEnum} - **/ - @Override - protected MethodSpec modeledList(ListShape shape) { - MemberShape memberShape = shape.getMember(); - CodeBlock memberConverter = conversionMethodReference(subject.model.expectShape(memberShape.getTarget())).asFunctionalReference(); - CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()).asNormalReference(); - CodeBlock getTypeDescriptor = subject.dafnyNameResolver.typeDescriptor(memberShape.getTarget()); - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), "nativeValue") - .build(); - return MethodSpec - .methodBuilder(capitalize(shape.getId().getName())) - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - .returns(subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId())) - .addParameter(parameterSpec) - .addStatement("return $L(\nnativeValue, \n$L, \n$L)", - genericCall, memberConverter, getTypeDescriptor) - .build(); - } + /** For AWS SDK structure members, the getter is `get + capitalized member name`. */ + @Override + protected CodeBlock getMember( + CodeBlock variableName, + MemberShape memberShape + ) { + return CodeBlock.of( + "$L.get$L()", + variableName, + capitalize(memberShape.getMemberName()) + ); + } - /** - * We have to customize - * Set conversion for the AWS SDK for Java V1 because - * AWS SDK Java V1 treats Enums in a special way. - * See the comment on - * {@link AwsSdkNativeV1#typeForShapeNoEnum} - **/ - @Override - protected MethodSpec modeledSet(SetShape shape) { - MemberShape memberShape = shape.getMember(); - CodeBlock memberConverter = conversionMethodReference(subject.model.expectShape(memberShape.getTarget())).asFunctionalReference(); - CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()).asNormalReference(); - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), "nativeValue") - .build(); - return MethodSpec - .methodBuilder(capitalize(shape.getId().getName())) - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - .returns(subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId())) - .addParameter(parameterSpec) - .addStatement("return $L(\nnativeValue, \n$L)", - genericCall, memberConverter) - .build(); - } + /** + * We have to customize + * List conversion for the AWS SDK for Java V1 because + * AWS SDK Java V1 treats Enums in a special way. + * See the comment on + * {@link AwsSdkNativeV1#typeForShapeNoEnum} + **/ + @Override + protected MethodSpec modeledList(ListShape shape) { + MemberShape memberShape = shape.getMember(); + CodeBlock memberConverter = conversionMethodReference( + subject.model.expectShape(memberShape.getTarget()) + ) + .asFunctionalReference(); + CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(shape.getType()) + .asNormalReference(); + CodeBlock getTypeDescriptor = subject.dafnyNameResolver.typeDescriptor( + memberShape.getTarget() + ); + ParameterSpec parameterSpec = ParameterSpec + .builder( + subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), + "nativeValue" + ) + .build(); + return MethodSpec + .methodBuilder(capitalize(shape.getId().getName())) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns( + subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId()) + ) + .addParameter(parameterSpec) + .addStatement( + "return $L(\nnativeValue, \n$L, \n$L)", + genericCall, + memberConverter, + getTypeDescriptor + ) + .build(); + } - /** - * We have to customize - * Map conversion for the AWS SDK for Java V1 because - * AWS SDK Java V1 treats Enums in a special way. - * See the comment on - * {@link AwsSdkNativeV1#typeForShapeNoEnum} - **/ - @Override - @SuppressWarnings("OptionalGetWithoutIsPresent") - protected MethodSpec modeledMap(MapShape shape) { - MemberShape keyShape = shape.getKey().asMemberShape().get(); - CodeBlock keyConverter = conversionMethodReference(subject.model.expectShape(keyShape.getTarget())).asFunctionalReference(); - MemberShape valueShape = shape.getValue().asMemberShape().get(); - CodeBlock valueConverter = conversionMethodReference(subject.model.expectShape(valueShape.getTarget())).asFunctionalReference(); - CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()).asNormalReference(); - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), "nativeValue") - .build(); - return MethodSpec - .methodBuilder(capitalize(shape.getId().getName())) - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - .returns(subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId())) - .addParameter(parameterSpec) - .addStatement("return $L(\nnativeValue, \n$L, \n$L)", - genericCall, keyConverter, valueConverter) - .build(); - } + /** + * We have to customize + * Set conversion for the AWS SDK for Java V1 because + * AWS SDK Java V1 treats Enums in a special way. + * See the comment on + * {@link AwsSdkNativeV1#typeForShapeNoEnum} + **/ + @Override + protected MethodSpec modeledSet(SetShape shape) { + MemberShape memberShape = shape.getMember(); + CodeBlock memberConverter = conversionMethodReference( + subject.model.expectShape(memberShape.getTarget()) + ) + .asFunctionalReference(); + CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(shape.getType()) + .asNormalReference(); + ParameterSpec parameterSpec = ParameterSpec + .builder( + subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), + "nativeValue" + ) + .build(); + return MethodSpec + .methodBuilder(capitalize(shape.getId().getName())) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns( + subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId()) + ) + .addParameter(parameterSpec) + .addStatement( + "return $L(\nnativeValue, \n$L)", + genericCall, + memberConverter + ) + .build(); + } - MethodSpec generateConvertOpaqueError() { - // Opaque Errors are not in the model, - // so we cannot use any of our helper methods for this method. + /** + * We have to customize + * Map conversion for the AWS SDK for Java V1 because + * AWS SDK Java V1 treats Enums in a special way. + * See the comment on + * {@link AwsSdkNativeV1#typeForShapeNoEnum} + **/ + @Override + @SuppressWarnings("OptionalGetWithoutIsPresent") + protected MethodSpec modeledMap(MapShape shape) { + MemberShape keyShape = shape.getKey().asMemberShape().get(); + CodeBlock keyConverter = conversionMethodReference( + subject.model.expectShape(keyShape.getTarget()) + ) + .asFunctionalReference(); + MemberShape valueShape = shape.getValue().asMemberShape().get(); + CodeBlock valueConverter = conversionMethodReference( + subject.model.expectShape(valueShape.getTarget()) + ) + .asFunctionalReference(); + CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(shape.getType()) + .asNormalReference(); + ParameterSpec parameterSpec = ParameterSpec + .builder( + subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), + "nativeValue" + ) + .build(); + return MethodSpec + .methodBuilder(capitalize(shape.getId().getName())) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns( + subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId()) + ) + .addParameter(parameterSpec) + .addStatement( + "return $L(\nnativeValue, \n$L, \n$L)", + genericCall, + keyConverter, + valueConverter + ) + .build(); + } - // This is memberDeclaration from above, - // but with calls to target.dafnyNameResolver replaced with their expected response. - CodeBlock memberDeclaration = CodeBlock.of( - "$T $L", - ParameterizedTypeName.get( - ClassName.get("Wrappers_Compile", "Option"), - ParameterizedTypeName.get( - software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_SEQUENCE_CLASS_NAME, - WildcardTypeName.subtypeOf(Character.class)) - ), - "message" - ); - // This is memberAssignment from above, - // but with calls to dafnyNameResolver replaced with their expected response. - CodeBlock stringTypeDescriptor = Dafny.TYPE_DESCRIPTOR_BY_SHAPE_TYPE.get(ShapeType.STRING); - CodeBlock memberAssignment = CodeBlock.of( - "$L = $T.nonNull($L) ?\n$T.create_Some($L, $T.$L($L))\n: $T.create_None($L)", - "message", - ClassName.get(Objects.class), - "nativeValue.getMessage()", - ClassName.get("Wrappers_Compile", "Option"), - stringTypeDescriptor, - COMMON_TO_DAFNY_SIMPLE, - SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(ShapeType.STRING).methodName(), - "nativeValue.getMessage()", - ClassName.get("Wrappers_Compile", "Option"), - stringTypeDescriptor - ); - return MethodSpec.methodBuilder("Error") - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - .returns(subject.dafnyNameResolver.abstractClassForError()) - .addParameter(subject.nativeNameResolver.baseErrorForService(), "nativeValue") - .addStatement(memberDeclaration) - .addStatement(memberAssignment) - .addStatement("return new $T(message)", subject.dafnyNameResolver.classForOpaqueError()) - .build(); - } + MethodSpec generateConvertOpaqueError() { + // Opaque Errors are not in the model, + // so we cannot use any of our helper methods for this method. + + // This is memberDeclaration from above, + // but with calls to target.dafnyNameResolver replaced with their expected response. + CodeBlock memberDeclaration = CodeBlock.of( + "$T $L", + ParameterizedTypeName.get( + ClassName.get("Wrappers_Compile", "Option"), + ParameterizedTypeName.get( + software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_SEQUENCE_CLASS_NAME, + WildcardTypeName.subtypeOf(Character.class) + ) + ), + "message" + ); + // This is memberAssignment from above, + // but with calls to dafnyNameResolver replaced with their expected response. + CodeBlock stringTypeDescriptor = Dafny.TYPE_DESCRIPTOR_BY_SHAPE_TYPE.get( + ShapeType.STRING + ); + CodeBlock memberAssignment = CodeBlock.of( + "$L = $T.nonNull($L) ?\n$T.create_Some($L, $T.$L($L))\n: $T.create_None($L)", + "message", + ClassName.get(Objects.class), + "nativeValue.getMessage()", + ClassName.get("Wrappers_Compile", "Option"), + stringTypeDescriptor, + COMMON_TO_DAFNY_SIMPLE, + SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(ShapeType.STRING) + .methodName(), + "nativeValue.getMessage()", + ClassName.get("Wrappers_Compile", "Option"), + stringTypeDescriptor + ); + return MethodSpec + .methodBuilder("Error") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns(subject.dafnyNameResolver.abstractClassForError()) + .addParameter( + subject.nativeNameResolver.baseErrorForService(), + "nativeValue" + ) + .addStatement(memberDeclaration) + .addStatement(memberAssignment) + .addStatement( + "return new $T(message)", + subject.dafnyNameResolver.classForOpaqueError() + ) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeAwsV1.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeAwsV1.java index b205678837..277a2b1ba0 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeAwsV1.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeAwsV1.java @@ -2,12 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v1; +import static software.amazon.smithy.utils.StringUtils.capitalize; +import static software.amazon.smithy.utils.StringUtils.uncapitalize; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeSpec; - import java.util.Collection; import java.util.Collections; import java.util.LinkedHashSet; @@ -15,17 +17,14 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; - import javax.lang.model.element.Modifier; - import software.amazon.polymorph.smithyjava.generator.ToNative; -import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; -import software.amazon.polymorph.utils.DafnyNameResolverHelpers; -import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkDafnyV1; import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkNativeV1; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; - +import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; +import software.amazon.polymorph.utils.DafnyNameResolverHelpers; +import software.amazon.polymorph.utils.ModelUtils; import software.amazon.smithy.model.shapes.MemberShape; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ServiceShape; @@ -35,9 +34,6 @@ import software.amazon.smithy.model.shapes.StructureShape; import software.amazon.smithy.model.traits.EnumTrait; -import static software.amazon.smithy.utils.StringUtils.capitalize; -import static software.amazon.smithy.utils.StringUtils.uncapitalize; - //TODO: Create abstract class for V1 & V2 to extend /** * ToNativeAwsV1 generates ToNative. @@ -62,227 +58,320 @@ * */ public class ToNativeAwsV1 extends ToNative { - protected final static String VAR_OUTPUT = "converted"; - protected final static String VAR_TEMP = "temp"; - // TODO: for V2 support, use abstract AwsSdk name resolvers and sub class for V1 or V2. + protected static final String VAR_OUTPUT = "converted"; + protected static final String VAR_TEMP = "temp"; - // Hack to override CodegenSubject - // See code comment on ../library/ModelCodegen for details. - private final JavaAwsSdkV1 subject; + // TODO: for V2 support, use abstract AwsSdk name resolvers and sub class for V1 or V2. - public static ClassName className(ShapeId shapeId) { - if (!AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { - throw new IllegalArgumentException("ShapeId MUST BE in an AWS SDK Namespace"); - } - return ClassName.get( - DafnyNameResolverHelpers.packageNameForNamespace(shapeId.getNamespace()), - TO_NATIVE); - } + // Hack to override CodegenSubject + // See code comment on ../library/ModelCodegen for details. + private final JavaAwsSdkV1 subject; - public ToNativeAwsV1(JavaAwsSdkV1 awsSdk) { - super(awsSdk, className(awsSdk.serviceShape.toShapeId())); - this.subject = awsSdk; + public static ClassName className(ShapeId shapeId) { + if (!AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { + throw new IllegalArgumentException( + "ShapeId MUST BE in an AWS SDK Namespace" + ); } + return ClassName.get( + DafnyNameResolverHelpers.packageNameForNamespace(shapeId.getNamespace()), + TO_NATIVE + ); + } - @Override - public Set javaFiles() { - JavaFile.Builder builder = JavaFile.builder(subject.packageName, toNative()); - return Collections.singleton(builder.build()); - } + public ToNativeAwsV1(JavaAwsSdkV1 awsSdk) { + super(awsSdk, className(awsSdk.serviceShape.toShapeId())); + this.subject = awsSdk; + } - TypeSpec toNative() { - List operations = subject.serviceShape - .getOperations().stream().sorted() - .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) - .toList(); - LinkedHashSet operationOutputs = operations.stream() - .map(OperationShape::getOutputShape).sorted() - .collect(Collectors.toCollection(LinkedHashSet::new)); - LinkedHashSet operationInputs = operations.stream() - .map(OperationShape::getInputShape).sorted() - .collect(Collectors.toCollection(LinkedHashSet::new)); - LinkedHashSet serviceErrors = operations.stream() - .map(OperationShape::getErrors) - .flatMap(Collection::stream).sorted() - .collect(Collectors.toCollection(LinkedHashSet::new)); - ModelUtils.streamServiceErrors(subject.model, subject.serviceShape) - .map(Shape::toShapeId).sorted() - .forEachOrdered(serviceErrors::add); + @Override + public Set javaFiles() { + JavaFile.Builder builder = JavaFile.builder( + subject.packageName, + toNative() + ); + return Collections.singleton(builder.build()); + } - LinkedHashSet operationStructures = new LinkedHashSet<>(); - operationStructures.addAll(operationOutputs); - operationStructures.addAll(operationInputs); - operationStructures.addAll(serviceErrors); - Set allRelevantShapeIds = ModelUtils.findAllDependentShapes(operationStructures, subject.model); + TypeSpec toNative() { + List operations = subject.serviceShape + .getOperations() + .stream() + .sorted() + .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) + .toList(); + LinkedHashSet operationOutputs = operations + .stream() + .map(OperationShape::getOutputShape) + .sorted() + .collect(Collectors.toCollection(LinkedHashSet::new)); + LinkedHashSet operationInputs = operations + .stream() + .map(OperationShape::getInputShape) + .sorted() + .collect(Collectors.toCollection(LinkedHashSet::new)); + LinkedHashSet serviceErrors = operations + .stream() + .map(OperationShape::getErrors) + .flatMap(Collection::stream) + .sorted() + .collect(Collectors.toCollection(LinkedHashSet::new)); + ModelUtils + .streamServiceErrors(subject.model, subject.serviceShape) + .map(Shape::toShapeId) + .sorted() + .forEachOrdered(serviceErrors::add); - // In the AWS SDK for Java V1, Operation Outputs are special - allRelevantShapeIds.removeAll(operationOutputs); - // Errors are special case for all generators - allRelevantShapeIds.removeAll(serviceErrors); - allRelevantShapeIds.remove(ShapeId.fromParts("smithy.api", "Unit")); + LinkedHashSet operationStructures = new LinkedHashSet<>(); + operationStructures.addAll(operationOutputs); + operationStructures.addAll(operationInputs); + operationStructures.addAll(serviceErrors); + Set allRelevantShapeIds = ModelUtils.findAllDependentShapes( + operationStructures, + subject.model + ); - final List convertOutputs = operationOutputs.stream() - .map(this::generateConvertResponseV1).toList(); - final List convertAllRelevant = allRelevantShapeIds.stream().sorted() - .map(this::generateConvert).filter(Objects::nonNull).toList(); - final List convertServiceErrors = serviceErrors.stream().sorted() - .map(this::modeledError).collect(Collectors.toList()); + // In the AWS SDK for Java V1, Operation Outputs are special + allRelevantShapeIds.removeAll(operationOutputs); + // Errors are special case for all generators + allRelevantShapeIds.removeAll(serviceErrors); + allRelevantShapeIds.remove(ShapeId.fromParts("smithy.api", "Unit")); - return TypeSpec - .classBuilder(className(subject.serviceShape.toShapeId())) - .addModifiers(Modifier.PUBLIC) - .addMethods(convertOutputs) - .addMethods(convertAllRelevant) - .addMethods(convertServiceErrors) - .addMethod(modeledService(subject.serviceShape)) - .build(); - } + final List convertOutputs = operationOutputs + .stream() + .map(this::generateConvertResponseV1) + .toList(); + final List convertAllRelevant = allRelevantShapeIds + .stream() + .sorted() + .map(this::generateConvert) + .filter(Objects::nonNull) + .toList(); + final List convertServiceErrors = serviceErrors + .stream() + .sorted() + .map(this::modeledError) + .collect(Collectors.toList()); - MethodSpec modeledService(ServiceShape shape) { - // public static AWSKMS KeyManagementService(IKeyManagementServiceClient dafnyValue) { - // return ((Shim) dafnyValue).impl(); - // } - String methodName = capitalize(shape.toShapeId().getName()); - ClassName nativeClass = AwsSdkNativeV1.classNameForServiceClient(shape); - ClassName dafnyClass = AwsSdkDafnyV1.classNameForAwsService(shape); - ClassName shim = ShimV1.className(shape); - return MethodSpec.methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .addParameter(dafnyClass, VAR_INPUT) - .returns(nativeClass) - .addStatement("return (($T) $L).impl()", shim, VAR_INPUT) - .build(); - } + return TypeSpec + .classBuilder(className(subject.serviceShape.toShapeId())) + .addModifiers(Modifier.PUBLIC) + .addMethods(convertOutputs) + .addMethods(convertAllRelevant) + .addMethods(convertServiceErrors) + .addMethod(modeledService(subject.serviceShape)) + .build(); + } - @SuppressWarnings({"OptionalGetWithoutIsPresent"}) - MethodSpec generateConvert(ShapeId shapeId) { - final Shape shape = subject.model.getShape(shapeId) - .orElseThrow(() -> new IllegalStateException("Cannot find shape " + shapeId)); - return switch (shape.getType()) { - // For the AWS SDK for Java V1, we do not generate converters for simple shapes - case BLOB, BOOLEAN, TIMESTAMP, BYTE, SHORT, DOUBLE, - INTEGER, LONG, BIG_DECIMAL, BIG_INTEGER, MEMBER -> null; - case STRING -> generateConvertString(shapeId); // STRING handles enums - case LIST -> modeledList(shape.asListShape().get()); - case SET -> modeledSet(shape.asSetShape().get()); - case MAP -> modeledMap(shape.asMapShape().get()); - case STRUCTURE -> modeledStructure(shape.asStructureShape().get()); - case UNION -> modeledUnion(shape.asUnionShape().get()); - default -> throw new UnsupportedOperationException( - "ShapeId %s is of Type %s, which is not yet supported for ToDafny" - .formatted(shapeId, shape.getType())); - }; - } + MethodSpec modeledService(ServiceShape shape) { + // public static AWSKMS KeyManagementService(IKeyManagementServiceClient dafnyValue) { + // return ((Shim) dafnyValue).impl(); + // } + String methodName = capitalize(shape.toShapeId().getName()); + ClassName nativeClass = AwsSdkNativeV1.classNameForServiceClient(shape); + ClassName dafnyClass = AwsSdkDafnyV1.classNameForAwsService(shape); + ClassName shim = ShimV1.className(shape); + return MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .addParameter(dafnyClass, VAR_INPUT) + .returns(nativeClass) + .addStatement("return (($T) $L).impl()", shim, VAR_INPUT) + .build(); + } - @Override - protected MethodSpec modeledStructure(StructureShape structureShape) { - String methodName = capitalize(structureShape.getId().getName()); - ClassName nativeClassName = subject.nativeNameResolver.classNameForStructure(structureShape); - MethodSpec.Builder builder = MethodSpec - .methodBuilder(methodName) - .addModifiers(Modifier.STATIC, Modifier.PUBLIC) - .returns(nativeClassName) - .addParameter(subject.dafnyNameResolver.typeForShape(structureShape.getId()), VAR_INPUT); + @SuppressWarnings({ "OptionalGetWithoutIsPresent" }) + MethodSpec generateConvert(ShapeId shapeId) { + final Shape shape = subject.model + .getShape(shapeId) + .orElseThrow(() -> + new IllegalStateException("Cannot find shape " + shapeId) + ); + return switch (shape.getType()) { + // For the AWS SDK for Java V1, we do not generate converters for simple shapes + case BLOB, + BOOLEAN, + TIMESTAMP, + BYTE, + SHORT, + DOUBLE, + INTEGER, + LONG, + BIG_DECIMAL, + BIG_INTEGER, + MEMBER -> null; + case STRING -> generateConvertString(shapeId); // STRING handles enums + case LIST -> modeledList(shape.asListShape().get()); + case SET -> modeledSet(shape.asSetShape().get()); + case MAP -> modeledMap(shape.asMapShape().get()); + case STRUCTURE -> modeledStructure(shape.asStructureShape().get()); + case UNION -> modeledUnion(shape.asUnionShape().get()); + default -> throw new UnsupportedOperationException( + "ShapeId %s is of Type %s, which is not yet supported for ToDafny".formatted( + shapeId, + shape.getType() + ) + ); + }; + } - if (structureShape.members().size() == 0) { - builder.addStatement("return new $T()", nativeClassName); - return builder.build(); - } - builder.addStatement("$T $L = new $T()", nativeClassName, VAR_OUTPUT, nativeClassName); + @Override + protected MethodSpec modeledStructure(StructureShape structureShape) { + String methodName = capitalize(structureShape.getId().getName()); + ClassName nativeClassName = + subject.nativeNameResolver.classNameForStructure(structureShape); + MethodSpec.Builder builder = MethodSpec + .methodBuilder(methodName) + .addModifiers(Modifier.STATIC, Modifier.PUBLIC) + .returns(nativeClassName) + .addParameter( + subject.dafnyNameResolver.typeForShape(structureShape.getId()), + VAR_INPUT + ); - // For each member - structureShape.members().stream().sorted() - .forEach(member -> { - // if optional, check if present - if (member.isOptional()) { - builder.beginControlFlow("if ($L.$L.is_Some())", VAR_INPUT, Dafny.getMemberField(member)); - } - // if converting a LIST or SET of enums - if (ModelUtils.isListOrSetOfEnums(member.getTarget(), subject.model)) { - // create temp array - builder.addStatement(initTempArray(member)); - // set with conversion call and toArray - builder.addStatement(setWithConversionCallAndToArray(member)); - } else { - // set with conversion call - builder.addStatement(setWithConversionCall(member, Dafny.getMemberFieldValue(member))); - } - if (member.isOptional()) builder.endControlFlow(); - }); - return builder.addStatement("return $L", VAR_OUTPUT).build(); + if (structureShape.members().size() == 0) { + builder.addStatement("return new $T()", nativeClassName); + return builder.build(); } + builder.addStatement( + "$T $L = new $T()", + nativeClassName, + VAR_OUTPUT, + nativeClassName + ); - /** - * Generates an Array of member's type with size of input's field. - * i.e:

{@code MemberType[] member_temp = new MemberType[dafnyValue.Member.length()];} - */ - CodeBlock initTempArray(MemberShape member) { - return CodeBlock.of("$T[] $L_$L = new $T[$L.$L.$L]", - subject.nativeNameResolver.typeForListOrSetMember(member.getTarget()), - uncapitalize(member.getMemberName()), VAR_TEMP, - subject.nativeNameResolver.typeForListOrSetMember(member.getTarget()), - VAR_INPUT, Dafny.getMemberFieldValue(member), - Dafny.aggregateSizeMethod(subject.model.expectShape(member.getTarget()).getType())); - } + // For each member + structureShape + .members() + .stream() + .sorted() + .forEach(member -> { + // if optional, check if present + if (member.isOptional()) { + builder.beginControlFlow( + "if ($L.$L.is_Some())", + VAR_INPUT, + Dafny.getMemberField(member) + ); + } + // if converting a LIST or SET of enums + if (ModelUtils.isListOrSetOfEnums(member.getTarget(), subject.model)) { + // create temp array + builder.addStatement(initTempArray(member)); + // set with conversion call and toArray + builder.addStatement(setWithConversionCallAndToArray(member)); + } else { + // set with conversion call + builder.addStatement( + setWithConversionCall(member, Dafny.getMemberFieldValue(member)) + ); + } + if (member.isOptional()) builder.endControlFlow(); + }); + return builder.addStatement("return $L", VAR_OUTPUT).build(); + } - @Override - protected CodeBlock setWithConversionCall(MemberShape member, CodeBlock getMember) { - return CodeBlock.of("$L.$L($L($L.$L))", - VAR_OUTPUT, - setMemberField(member), - conversionMethodReference(subject.model.expectShape(member.getTarget())) - .asNormalReference(), - VAR_INPUT, - Dafny.getMemberFieldValue(member)); - } + /** + * Generates an Array of member's type with size of input's field. + * i.e:

{@code MemberType[] member_temp = new MemberType[dafnyValue.Member.length()];} + */ + CodeBlock initTempArray(MemberShape member) { + return CodeBlock.of( + "$T[] $L_$L = new $T[$L.$L.$L]", + subject.nativeNameResolver.typeForListOrSetMember(member.getTarget()), + uncapitalize(member.getMemberName()), + VAR_TEMP, + subject.nativeNameResolver.typeForListOrSetMember(member.getTarget()), + VAR_INPUT, + Dafny.getMemberFieldValue(member), + Dafny.aggregateSizeMethod( + subject.model.expectShape(member.getTarget()).getType() + ) + ); + } - CodeBlock setWithConversionCallAndToArray(MemberShape member) { - return CodeBlock.of("$L.$L($L($L.$L).toArray($L_$L))", - VAR_OUTPUT, - setMemberField(member), - conversionMethodReference(subject.model.expectShape(member.getTarget())) - .asNormalReference(), - VAR_INPUT, - Dafny.getMemberFieldValue(member), - uncapitalize(member.getMemberName()), VAR_TEMP); - } + @Override + protected CodeBlock setWithConversionCall( + MemberShape member, + CodeBlock getMember + ) { + return CodeBlock.of( + "$L.$L($L($L.$L))", + VAR_OUTPUT, + setMemberField(member), + conversionMethodReference(subject.model.expectShape(member.getTarget())) + .asNormalReference(), + VAR_INPUT, + Dafny.getMemberFieldValue(member) + ); + } - /** @return CodeBlock of Method to set a member field. */ - @Override - protected CodeBlock setMemberField(MemberShape shape) { - // In AWS SDK Java v1, using `with` allows for enums or strings - // while `set` only allows for strings. - return CodeBlock.of("with$L", capitalize(shape.getMemberName())); - } + CodeBlock setWithConversionCallAndToArray(MemberShape member) { + return CodeBlock.of( + "$L.$L($L($L.$L).toArray($L_$L))", + VAR_OUTPUT, + setMemberField(member), + conversionMethodReference(subject.model.expectShape(member.getTarget())) + .asNormalReference(), + VAR_INPUT, + Dafny.getMemberFieldValue(member), + uncapitalize(member.getMemberName()), + VAR_TEMP + ); + } - MethodSpec generateConvertString(ShapeId shapeId) { - final StringShape shape = subject.model.expectShape(shapeId, StringShape.class); - if (shape.hasTrait(EnumTrait.class)) { - return generateConvertEnum(shapeId); - } - return null; - } + /** @return CodeBlock of Method to set a member field. */ + @Override + protected CodeBlock setMemberField(MemberShape shape) { + // In AWS SDK Java v1, using `with` allows for enums or strings + // while `set` only allows for strings. + return CodeBlock.of("with$L", capitalize(shape.getMemberName())); + } - MethodSpec generateConvertEnum(ShapeId shapeId) { - final StringShape shape = subject.model.expectShape(shapeId, StringShape.class); - final ClassName returnType = subject.nativeNameResolver.classForEnum(shape); - MethodSpec.Builder method = modeledEnumCommon(shape, returnType); - // fromValue is an AWS SDK specific feature - method.addStatement("return $T.fromValue($L.toString())", returnType, VAR_INPUT); - return method.build(); + MethodSpec generateConvertString(ShapeId shapeId) { + final StringShape shape = subject.model.expectShape( + shapeId, + StringShape.class + ); + if (shape.hasTrait(EnumTrait.class)) { + return generateConvertEnum(shapeId); } + return null; + } - MethodSpec generateConvertResponseV1(final ShapeId shapeId) { - MethodSpec structure = generateConvertStructure(shapeId); - MethodSpec.Builder builder = structure.toBuilder(); - builder.parameters.clear(); - builder.addParameter(subject.nativeNameResolver.typeForOperationOutput(shapeId), "nativeValue"); - return builder.build(); - } + MethodSpec generateConvertEnum(ShapeId shapeId) { + final StringShape shape = subject.model.expectShape( + shapeId, + StringShape.class + ); + final ClassName returnType = subject.nativeNameResolver.classForEnum(shape); + MethodSpec.Builder method = modeledEnumCommon(shape, returnType); + // fromValue is an AWS SDK specific feature + method.addStatement( + "return $T.fromValue($L.toString())", + returnType, + VAR_INPUT + ); + return method.build(); + } - MethodSpec generateConvertStructure(final ShapeId shapeId) { - final StructureShape structureShape = subject.model.expectShape(shapeId, StructureShape.class); - return super.modeledStructure(structureShape); - } + MethodSpec generateConvertResponseV1(final ShapeId shapeId) { + MethodSpec structure = generateConvertStructure(shapeId); + MethodSpec.Builder builder = structure.toBuilder(); + builder.parameters.clear(); + builder.addParameter( + subject.nativeNameResolver.typeForOperationOutput(shapeId), + "nativeValue" + ); + return builder.build(); + } + + MethodSpec generateConvertStructure(final ShapeId shapeId) { + final StructureShape structureShape = subject.model.expectShape( + shapeId, + StructureShape.class + ); + return super.modeledStructure(structureShape); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/JavaAwsSdkV2.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/JavaAwsSdkV2.java index 99308f8142..6b9fc9b67e 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/JavaAwsSdkV2.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/JavaAwsSdkV2.java @@ -3,17 +3,15 @@ package software.amazon.polymorph.smithyjava.generator.awssdk.v2; import com.squareup.javapoet.ClassName; - import java.nio.file.Path; import java.util.HashMap; import java.util.Map; - import software.amazon.polymorph.smithydafny.DafnyVersion; import software.amazon.polymorph.smithyjava.MethodReference; import software.amazon.polymorph.smithyjava.generator.CodegenSubject; -import software.amazon.polymorph.utils.TokenTree; import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkDafnyV2; import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkNativeV2; +import software.amazon.polymorph.utils.TokenTree; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.ServiceShape; @@ -23,45 +21,73 @@ * the AWS SDK for Java V2. */ public class JavaAwsSdkV2 extends CodegenSubject { - public static final ClassName BLOB_TO_NATIVE_SDK_BYTES = - ClassName.get("software.amazon.awssdk.core", "SdkBytes"); - public final static ClassName SDK_BYTES_WRAPPER = - ClassName.get("software.amazon.awssdk.core", "BytesWrapper"); - public final static MethodReference SDK_BYTES_AS_BYTE_BUFFER = - new MethodReference(SDK_BYTES_WRAPPER, "asByteBuffer"); - // Hack to override Name Resolvers to Aws Sdk V2 specific ones - // See code comment on ../library/ModelCodegen for details. - final AwsSdkDafnyV2 dafnyNameResolver; - final AwsSdkNativeV2 nativeNameResolver; - /** Public Java Interfaces will go here. */ - public final String packageName; + public static final ClassName BLOB_TO_NATIVE_SDK_BYTES = ClassName.get( + "software.amazon.awssdk.core", + "SdkBytes" + ); + public static final ClassName SDK_BYTES_WRAPPER = ClassName.get( + "software.amazon.awssdk.core", + "BytesWrapper" + ); + public static final MethodReference SDK_BYTES_AS_BYTE_BUFFER = + new MethodReference(SDK_BYTES_WRAPPER, "asByteBuffer"); + // Hack to override Name Resolvers to Aws Sdk V2 specific ones + // See code comment on ../library/ModelCodegen for details. + final AwsSdkDafnyV2 dafnyNameResolver; + final AwsSdkNativeV2 nativeNameResolver; + + /** Public Java Interfaces will go here. */ + public final String packageName; - private JavaAwsSdkV2( - ServiceShape serviceShape, - Model model, - AwsSdkDafnyV2 dafnyNameResolver, - AwsSdkNativeV2 nativeNameResolver) { - super(model, serviceShape, dafnyNameResolver, nativeNameResolver, AwsSdkVersion.V2); - this.dafnyNameResolver = dafnyNameResolver; - this.nativeNameResolver = nativeNameResolver; - this.packageName = dafnyNameResolver.packageName(); - } + private JavaAwsSdkV2( + ServiceShape serviceShape, + Model model, + AwsSdkDafnyV2 dafnyNameResolver, + AwsSdkNativeV2 nativeNameResolver + ) { + super( + model, + serviceShape, + dafnyNameResolver, + nativeNameResolver, + AwsSdkVersion.V2 + ); + this.dafnyNameResolver = dafnyNameResolver; + this.nativeNameResolver = nativeNameResolver; + this.packageName = dafnyNameResolver.packageName(); + } - public static JavaAwsSdkV2 createJavaAwsSdkV2(ServiceShape serviceShape, Model model, DafnyVersion dafnyVersion) { - final AwsSdkDafnyV2 dafnyNameResolver = new AwsSdkDafnyV2(serviceShape, model, dafnyVersion); - final AwsSdkNativeV2 nativeNameResolver = new AwsSdkNativeV2(serviceShape, model); - return new JavaAwsSdkV2(serviceShape, model, dafnyNameResolver, nativeNameResolver); - } + public static JavaAwsSdkV2 createJavaAwsSdkV2( + ServiceShape serviceShape, + Model model, + DafnyVersion dafnyVersion + ) { + final AwsSdkDafnyV2 dafnyNameResolver = new AwsSdkDafnyV2( + serviceShape, + model, + dafnyVersion + ); + final AwsSdkNativeV2 nativeNameResolver = new AwsSdkNativeV2( + serviceShape, + model + ); + return new JavaAwsSdkV2( + serviceShape, + model, + dafnyNameResolver, + nativeNameResolver + ); + } - public Map generate() { - Map rtn = new HashMap<>(); - ShimV2 shimGenerator = new ShimV2(this); - ToDafnyAwsV2 toDafnyGenerator = new ToDafnyAwsV2(this); - ToNativeAwsV2 toNativeGenerator = new ToNativeAwsV2(this); - rtn.putAll(shimGenerator.generate()); - rtn.putAll(toDafnyGenerator.generate()); - rtn.putAll(toNativeGenerator.generate()); - return rtn; - } + public Map generate() { + Map rtn = new HashMap<>(); + ShimV2 shimGenerator = new ShimV2(this); + ToDafnyAwsV2 toDafnyGenerator = new ToDafnyAwsV2(this); + ToNativeAwsV2 toNativeGenerator = new ToNativeAwsV2(this); + rtn.putAll(shimGenerator.generate()); + rtn.putAll(toDafnyGenerator.generate()); + rtn.putAll(toNativeGenerator.generate()); + return rtn; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ShimV2.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ShimV2.java index bda1e9dd59..5cc3b64063 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ShimV2.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ShimV2.java @@ -2,194 +2,257 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v2; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_TUPLE0_CLASS_NAME; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SMITHY_API_UNIT; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Collections; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; - import javax.lang.model.element.Modifier; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import software.amazon.polymorph.smithyjava.generator.Generator; -import software.amazon.polymorph.utils.DafnyNameResolverHelpers; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; +import software.amazon.polymorph.utils.DafnyNameResolverHelpers; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.utils.StringUtils; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_TUPLE0_CLASS_NAME; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SMITHY_API_UNIT; - //TODO: Create abstract class for V1 & V2 to extend /** * Generates an AWS SDK Shim for the AWS SDK for Java V2 * exposing an AWS Service's operations to Dafny Generated Java. */ public class ShimV2 extends Generator { - public static final String SHIM = "Shim"; - // Hack to override CodegenSubject - // See code comment on ../library/ModelCodegen for details. - private final JavaAwsSdkV2 subject; - private static final Logger LOGGER = LoggerFactory.getLogger(ShimV2.class); - public ShimV2(JavaAwsSdkV2 awsSdk) { - super(awsSdk); - this.subject = awsSdk; - } - public static ClassName className(ServiceShape shape) { - return ClassName.get( - DafnyNameResolverHelpers.packageNameForNamespace( - shape.toShapeId().getNamespace()), SHIM); - } + public static final String SHIM = "Shim"; + // Hack to override CodegenSubject + // See code comment on ../library/ModelCodegen for details. + private final JavaAwsSdkV2 subject; + private static final Logger LOGGER = LoggerFactory.getLogger(ShimV2.class); - @Override - public Set javaFiles() { - JavaFile.Builder builder = JavaFile - .builder(subject.dafnyNameResolver.packageName(), shim()); - return Collections.singleton(builder.build()); - } + public ShimV2(JavaAwsSdkV2 awsSdk) { + super(awsSdk); + this.subject = awsSdk; + } - TypeSpec shim() { - return TypeSpec - .classBuilder( - ClassName.get(subject.dafnyNameResolver.packageName(), "Shim")) - .addModifiers(Modifier.PUBLIC) - .addSuperinterface(subject.dafnyNameResolver.typeForShape(subject.serviceShape.getId())) - .addField( - subject.nativeNameResolver.classNameForService(subject.serviceShape), - "_impl", Modifier.PRIVATE, Modifier.FINAL) - .addField( - ClassName.get(String.class), - "region", Modifier.PRIVATE, Modifier.FINAL) - .addMethod(constructor()) - .addMethod(impl()) - .addMethod(region()) - .addMethods( - subject.serviceShape.getAllOperations() - .stream().sorted() - .map(this::operation) - .filter(Optional::isPresent) - .map(Optional::get) - .collect(Collectors.toList())) - .build(); - } + public static ClassName className(ServiceShape shape) { + return ClassName.get( + DafnyNameResolverHelpers.packageNameForNamespace( + shape.toShapeId().getNamespace() + ), + SHIM + ); + } - protected MethodSpec impl() { - return MethodSpec.methodBuilder("impl") - .addModifiers(Modifier.PUBLIC) - .addStatement("return this._impl") - .returns(subject.nativeNameResolver.classNameForService(subject.serviceShape)) - .build(); - } + @Override + public Set javaFiles() { + JavaFile.Builder builder = JavaFile.builder( + subject.dafnyNameResolver.packageName(), + shim() + ); + return Collections.singleton(builder.build()); + } - MethodSpec constructor() { - return MethodSpec - .constructorBuilder() - .addModifiers(Modifier.PUBLIC) - .addParameter( - subject.nativeNameResolver.classNameForService(subject.serviceShape), - "impl", - Modifier.FINAL) - .addParameter( - ClassName.get(String.class), - "region", - Modifier.FINAL) - .addStatement("this._impl = impl") - .addStatement("this.region = region") - .build(); - } + TypeSpec shim() { + return TypeSpec + .classBuilder( + ClassName.get(subject.dafnyNameResolver.packageName(), "Shim") + ) + .addModifiers(Modifier.PUBLIC) + .addSuperinterface( + subject.dafnyNameResolver.typeForShape(subject.serviceShape.getId()) + ) + .addField( + subject.nativeNameResolver.classNameForService(subject.serviceShape), + "_impl", + Modifier.PRIVATE, + Modifier.FINAL + ) + .addField( + ClassName.get(String.class), + "region", + Modifier.PRIVATE, + Modifier.FINAL + ) + .addMethod(constructor()) + .addMethod(impl()) + .addMethod(region()) + .addMethods( + subject.serviceShape + .getAllOperations() + .stream() + .sorted() + .map(this::operation) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.toList()) + ) + .build(); + } - MethodSpec region() { - return MethodSpec - .methodBuilder("region") - .addModifiers(Modifier.PUBLIC) - .returns(ClassName.get(String.class)) - .addStatement("return this.region") - .build(); - } + protected MethodSpec impl() { + return MethodSpec + .methodBuilder("impl") + .addModifiers(Modifier.PUBLIC) + .addStatement("return this._impl") + .returns( + subject.nativeNameResolver.classNameForService(subject.serviceShape) + ) + .build(); + } - Optional operation(final ShapeId operationShapeId) { - final OperationShape operationShape = subject.model.expectShape(operationShapeId, OperationShape.class); - ShapeId inputShapeId = operationShape.getInputShape(); - ShapeId outputShapeId = operationShape.getOutputShape(); - TypeName dafnyOutput = subject.dafnyNameResolver.typeForShape(outputShapeId); - String operationName = operationShape.toShapeId().getName(); - MethodSpec.Builder builder = MethodSpec - .methodBuilder(StringUtils.capitalize(operationName)) - .addAnnotation(Override.class) - .addModifiers(Modifier.PUBLIC) - .returns( - Dafny.asDafnyResult( - dafnyOutput, - subject.dafnyNameResolver.abstractClassForError() - )) - .addParameter(subject.dafnyNameResolver.typeForShape(inputShapeId), "input") - .addStatement("$T converted = ToNative.$L(input)", - subject.nativeNameResolver.typeForShape(inputShapeId), - StringUtils.capitalize(inputShapeId.getName())) - .beginControlFlow("try"); - CodeBlock successTypeDescriptor; - if (outputShapeId.equals(SMITHY_API_UNIT)) { - successTypeDescriptor = CodeBlock.of(DAFNY_TUPLE0_CLASS_NAME + "._typeDescriptor()"); - builder.addStatement("_impl.$L(converted)", - StringUtils.uncapitalize(operationName)) - .addStatement("return $L", - subject.dafnyNameResolver.createSuccess( - successTypeDescriptor, - CodeBlock.of("$T.create()", DAFNY_TUPLE0_CLASS_NAME))); - } else { - successTypeDescriptor = subject.dafnyNameResolver.typeDescriptor(outputShapeId); - builder.addStatement("$T result = _impl.$L(converted)", - subject.nativeNameResolver.typeForOperationOutput(outputShapeId), - StringUtils.uncapitalize(operationName)) - .addStatement("$T dafnyResponse = ToDafny.$L(result)", - dafnyOutput, - StringUtils.capitalize(outputShapeId.getName())) - .addStatement("return $L", - subject.dafnyNameResolver.createSuccess( - successTypeDescriptor, - CodeBlock.of("dafnyResponse"))); - } + MethodSpec constructor() { + return MethodSpec + .constructorBuilder() + .addModifiers(Modifier.PUBLIC) + .addParameter( + subject.nativeNameResolver.classNameForService(subject.serviceShape), + "impl", + Modifier.FINAL + ) + .addParameter(ClassName.get(String.class), "region", Modifier.FINAL) + .addStatement("this._impl = impl") + .addStatement("this.region = region") + .build(); + } + + MethodSpec region() { + return MethodSpec + .methodBuilder("region") + .addModifiers(Modifier.PUBLIC) + .returns(ClassName.get(String.class)) + .addStatement("return this.region") + .build(); + } - operationShape.getErrors().stream().sorted().forEach(shapeId -> { - TypeName typeForShape = subject.nativeNameResolver.typeForShape(shapeId); + Optional operation(final ShapeId operationShapeId) { + final OperationShape operationShape = subject.model.expectShape( + operationShapeId, + OperationShape.class + ); + ShapeId inputShapeId = operationShape.getInputShape(); + ShapeId outputShapeId = operationShape.getOutputShape(); + TypeName dafnyOutput = subject.dafnyNameResolver.typeForShape( + outputShapeId + ); + String operationName = operationShape.toShapeId().getName(); + MethodSpec.Builder builder = MethodSpec + .methodBuilder(StringUtils.capitalize(operationName)) + .addAnnotation(Override.class) + .addModifiers(Modifier.PUBLIC) + .returns( + Dafny.asDafnyResult( + dafnyOutput, + subject.dafnyNameResolver.abstractClassForError() + ) + ) + .addParameter( + subject.dafnyNameResolver.typeForShape(inputShapeId), + "input" + ) + .addStatement( + "$T converted = ToNative.$L(input)", + subject.nativeNameResolver.typeForShape(inputShapeId), + StringUtils.capitalize(inputShapeId.getName()) + ) + .beginControlFlow("try"); + CodeBlock successTypeDescriptor; + if (outputShapeId.equals(SMITHY_API_UNIT)) { + successTypeDescriptor = + CodeBlock.of(DAFNY_TUPLE0_CLASS_NAME + "._typeDescriptor()"); + builder + .addStatement( + "_impl.$L(converted)", + StringUtils.uncapitalize(operationName) + ) + .addStatement( + "return $L", + subject.dafnyNameResolver.createSuccess( + successTypeDescriptor, + CodeBlock.of("$T.create()", DAFNY_TUPLE0_CLASS_NAME) + ) + ); + } else { + successTypeDescriptor = + subject.dafnyNameResolver.typeDescriptor(outputShapeId); + builder + .addStatement( + "$T result = _impl.$L(converted)", + subject.nativeNameResolver.typeForOperationOutput(outputShapeId), + StringUtils.uncapitalize(operationName) + ) + .addStatement( + "$T dafnyResponse = ToDafny.$L(result)", + dafnyOutput, + StringUtils.capitalize(outputShapeId.getName()) + ) + .addStatement( + "return $L", + subject.dafnyNameResolver.createSuccess( + successTypeDescriptor, + CodeBlock.of("dafnyResponse") + ) + ); + } - // InvalidEndpointException was removed in SDK V2 - if (typeForShape.toString().endsWith("InvalidEndpointException")) { - return; // Skips only this shape - } + operationShape + .getErrors() + .stream() + .sorted() + .forEach(shapeId -> { + TypeName typeForShape = subject.nativeNameResolver.typeForShape( + shapeId + ); + + // InvalidEndpointException was removed in SDK V2 + if (typeForShape.toString().endsWith("InvalidEndpointException")) { + return; // Skips only this shape + } - builder - .nextControlFlow("catch ($T ex)", subject.nativeNameResolver.typeForShape(shapeId)) - .addStatement("return $L", - subject.dafnyNameResolver.createFailure( - successTypeDescriptor, - CodeBlock.of("ToDafny.Error(ex)"))); - }); - TypeName dafnyError = subject.dafnyNameResolver.abstractClassForError(); - builder - .nextControlFlow("catch ($T ex)", subject.nativeNameResolver.baseErrorForService()) - .addStatement("return $L", - subject.dafnyNameResolver.createFailure( - successTypeDescriptor, - CodeBlock.of("ToDafny.Error(ex)"))); builder - .nextControlFlow("catch (Exception ex)") - .addStatement("return $L", + .nextControlFlow( + "catch ($T ex)", + subject.nativeNameResolver.typeForShape(shapeId) + ) + .addStatement( + "return $L", subject.dafnyNameResolver.createFailure( successTypeDescriptor, - CodeBlock.of("$T.create_Opaque(ex.toString())", dafnyError))); - return Optional.of(builder.endControlFlow().build()); - } - + CodeBlock.of("ToDafny.Error(ex)") + ) + ); + }); + TypeName dafnyError = subject.dafnyNameResolver.abstractClassForError(); + builder + .nextControlFlow( + "catch ($T ex)", + subject.nativeNameResolver.baseErrorForService() + ) + .addStatement( + "return $L", + subject.dafnyNameResolver.createFailure( + successTypeDescriptor, + CodeBlock.of("ToDafny.Error(ex)") + ) + ); + builder + .nextControlFlow("catch (Exception ex)") + .addStatement( + "return $L", + subject.dafnyNameResolver.createFailure( + successTypeDescriptor, + CodeBlock.of("$T.create_Opaque(ex.toString())", dafnyError) + ) + ); + return Optional.of(builder.endControlFlow().build()); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2.java index 1d830b5d4e..ef18fc6afb 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2.java @@ -2,6 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v2; +import static software.amazon.polymorph.smithyjava.generator.awssdk.v2.JavaAwsSdkV2.SDK_BYTES_AS_BYTE_BUFFER; +import static software.amazon.smithy.utils.StringUtils.capitalize; + import com.squareup.javapoet.AnnotationSpec; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; @@ -12,10 +15,6 @@ import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import com.squareup.javapoet.WildcardTypeName; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; @@ -23,17 +22,16 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; - import javax.lang.model.element.Modifier; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import software.amazon.polymorph.smithyjava.generator.ToDafny; -import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; -import software.amazon.polymorph.utils.DafnyNameResolverHelpers; -import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkDafnyV2; import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkNativeV2; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; - +import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; +import software.amazon.polymorph.utils.DafnyNameResolverHelpers; +import software.amazon.polymorph.utils.ModelUtils; import software.amazon.smithy.model.shapes.ListShape; import software.amazon.smithy.model.shapes.MapShape; import software.amazon.smithy.model.shapes.MemberShape; @@ -49,9 +47,6 @@ import software.amazon.smithy.model.traits.EnumDefinition; import software.amazon.smithy.model.traits.EnumTrait; -import static software.amazon.polymorph.smithyjava.generator.awssdk.v2.JavaAwsSdkV2.SDK_BYTES_AS_BYTE_BUFFER; -import static software.amazon.smithy.utils.StringUtils.capitalize; - //TODO: Create abstract class for V1 & V2 to extend /** * ToDafnyAwsV2 generates ToDafny. @@ -75,471 +70,669 @@ * */ public class ToDafnyAwsV2 extends ToDafny { - private static final Logger LOGGER = LoggerFactory.getLogger(ToDafnyAwsV2.class); - // Hack to override subject to JavaAwsSdkV2 - // See code comment on ../library/ModelCodegen for details. - final JavaAwsSdkV2 subject; - - public static ClassName className(ShapeId shapeId) { - if (!AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { - throw new IllegalArgumentException("ShapeId MUST BE in an AWS SDK Namespace"); - } - return ClassName.get( - DafnyNameResolverHelpers.packageNameForNamespace(shapeId.getNamespace()), - TO_DAFNY); - } - - public ToDafnyAwsV2(JavaAwsSdkV2 awsSdk) { - super(awsSdk, className(awsSdk.serviceShape.toShapeId())); - this.subject = awsSdk; - } - - @Override - public Set javaFiles() { - JavaFile.Builder builder = JavaFile - .builder(subject.dafnyNameResolver.packageName(), toDafny()); - return Collections.singleton(builder.build()); - } - - TypeSpec toDafny() { - List operations = subject.serviceShape - .getOperations().stream().sorted() - .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) - .toList(); - LinkedHashSet operationStructures = operations.stream() - .map(OperationShape::getInputShape).sorted() - .collect(Collectors.toCollection(LinkedHashSet::new)); - operations.stream().map(OperationShape::getOutputShape).sorted() - .forEachOrdered(operationStructures::add); - LinkedHashSet serviceErrors = ModelUtils.streamServiceErrors(subject.model, subject.serviceShape) - .map(Shape::toShapeId).sorted() - // InvalidEndpointException does not exist in SDK V2 - .filter(structureShapeId -> !structureShapeId.toString().contains("com.amazonaws.dynamodb#InvalidEndpointException")) - .collect(Collectors.toCollection(LinkedHashSet::new)); - - operationStructures.addAll(serviceErrors); - Set allRelevantShapeIds = ModelUtils.findAllDependentShapes(operationStructures, subject.model); - allRelevantShapeIds.removeAll(serviceErrors); - allRelevantShapeIds.remove(ShapeId.fromParts("smithy.api", "Unit")); - // Enums are also a special case - LinkedHashSet enumShapeIds = new LinkedHashSet<>(); - allRelevantShapeIds.forEach(shapeId -> { - Shape shape = subject.model.expectShape(shapeId); - if (shape.hasTrait(EnumTrait.class)) { - enumShapeIds.add(shapeId); - } - }); - allRelevantShapeIds.removeAll(enumShapeIds); - - final List convertAllRelevant = allRelevantShapeIds.stream().sorted() - .map(this::generateConvert).filter(Objects::nonNull).toList(); - final List convertServiceErrors = serviceErrors.stream().sorted() - .map(this::modeledError).toList(); - // For enums, we generate overloaded methods, - // one to convert instances of the Enum - final List convertEnumEnum = enumShapeIds - .stream().sorted().map(this::generateConvertEnumEnum).toList(); - // The other to convert String representatives of the enum - final List convertEnumString = enumShapeIds - .stream().sorted().map(this::generateConvertEnumString).toList(); - - return TypeSpec - .classBuilder( - ClassName.get(subject.dafnyNameResolver.packageName(), "ToDafny")) - .addModifiers(Modifier.PUBLIC) - .addMethods(convertAllRelevant) - .addMethods(convertServiceErrors) - .addMethods(convertEnumEnum) - .addMethods(convertEnumString) - .addMethod(generateConvertOpaqueError()) - .addMethod(modeledService(subject.serviceShape)) - .build(); - } - - /** - * The Dafny representation of an AWS SDK Service is a - * Polymorph generated Shim wrapping that Service Client.

- * i.e.: For KMS, this method generates:

- *
-     * public static IKeyManagementServiceClient KeyManagementService(KmsClient nativeValue) {
-     *   return new Shim(nativeValue, null);
-     * }
-     * 
- */ - MethodSpec modeledService(ServiceShape shape) { - String methodName = capitalize(shape.toShapeId().getName()); - ClassName nativeClass = AwsSdkNativeV2.classNameForServiceClient(shape); - ClassName dafnyClass = AwsSdkDafnyV2.classNameForAwsService(shape); - ClassName shim = ShimV2.className(shape); - return MethodSpec.methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .addParameter(nativeClass, VAR_INPUT) - .returns(dafnyClass) - .addStatement("return new $T($L, null)", shim, VAR_INPUT) - .build(); - } - - /** This method: - * 1. Determines the Shape Type - * 2. invokes the correct generate for that shape type - */ - @SuppressWarnings({"OptionalGetWithoutIsPresent", "DuplicatedCode"}) - MethodSpec generateConvert(final ShapeId shapeId) { - final Shape shape = subject.model.getShape(shapeId) - .orElseThrow(() -> new IllegalStateException("Cannot find shape " + shapeId)); - return switch (shape.getType()) { - // For the AWS SDK for Java, we do not generate converters for simple shapes - case BLOB, BOOLEAN, STRING, TIMESTAMP, BYTE, SHORT, DOUBLE, - INTEGER, LONG, BIG_DECIMAL, BIG_INTEGER, MEMBER -> null; - case LIST -> modeledList(shape.asListShape().get()); - case MAP -> modeledMap(shape.asMapShape().get()); - case SET -> modeledSet(shape.asSetShape().get()); - case STRUCTURE -> generateConvertStructure(shapeId); - case UNION -> generateConvertUnion(shapeId); - default -> throw new UnsupportedOperationException( - "ShapeId %s is of Type %s, which is not yet supported for ToDafny" - .formatted(shapeId, shape.getType())); - }; - } - MethodSpec generateConvertUnion(final ShapeId shapeId) { - final UnionShape unionShape = subject.model.expectShape(shapeId, UnionShape.class); - if (shapeId.toString().equals("com.amazonaws.dynamodb#AttributeValue")) { - return ddbAttributeValueConversion(shapeId, unionShape); - } - LOGGER.warn("Encountered an AWS SDK Union Shape!" + - "Historically, we have not been good at generating these!\n" + - "Union ShapeID: %s".formatted(shapeId)); - return super.modeledUnion(unionShape); + private static final Logger LOGGER = LoggerFactory.getLogger( + ToDafnyAwsV2.class + ); + // Hack to override subject to JavaAwsSdkV2 + // See code comment on ../library/ModelCodegen for details. + final JavaAwsSdkV2 subject; + + public static ClassName className(ShapeId shapeId) { + if (!AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { + throw new IllegalArgumentException( + "ShapeId MUST BE in an AWS SDK Namespace" + ); } - - /** */ - private MethodSpec ddbAttributeValueConversion(final ShapeId shapeId, final UnionShape shape) { - String methodName = capitalize(shapeId.getName()); - TypeName returnType = subject.dafnyNameResolver.typeForShape(shapeId); - MethodSpec.Builder method = MethodSpec - .methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .returns(returnType) - .addParameter(subject.nativeNameResolver.classNameForStructure(shape), VAR_INPUT); - method.beginControlFlow("switch ($L.type())", VAR_INPUT); - shape.members().forEach(member -> { - CodeBlock getField = getMember(CodeBlock.builder().add(VAR_INPUT).build(), member); - CodeBlock memberConversion = memberConversion(member, getField); - String datatypeConstructorCreate = Dafny.datatypeConstructorCreate(member.getMemberName(), false); - // The DDB Model uses NULL, but AWS SDK V2 uses NUL - String memberName = member.getMemberName().equals("NULL")? "NUL" : member.getMemberName(); - method.beginControlFlow("case $L:", memberName) - .addStatement("return $T.$L($L)", returnType, datatypeConstructorCreate, memberConversion) - .endControlFlow(); - }); - method.beginControlFlow("default:") - .addStatement( - "throw new $T($S + $L + $S)", - IllegalArgumentException.class, - "Cannot convert ", - VAR_INPUT, - " to %s.".formatted(returnType)) - .endControlFlow(); - method.endControlFlow(); - return method.build(); + return ClassName.get( + DafnyNameResolverHelpers.packageNameForNamespace(shapeId.getNamespace()), + TO_DAFNY + ); + } + + public ToDafnyAwsV2(JavaAwsSdkV2 awsSdk) { + super(awsSdk, className(awsSdk.serviceShape.toShapeId())); + this.subject = awsSdk; + } + + @Override + public Set javaFiles() { + JavaFile.Builder builder = JavaFile.builder( + subject.dafnyNameResolver.packageName(), + toDafny() + ); + return Collections.singleton(builder.build()); + } + + TypeSpec toDafny() { + List operations = subject.serviceShape + .getOperations() + .stream() + .sorted() + .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) + .toList(); + LinkedHashSet operationStructures = operations + .stream() + .map(OperationShape::getInputShape) + .sorted() + .collect(Collectors.toCollection(LinkedHashSet::new)); + operations + .stream() + .map(OperationShape::getOutputShape) + .sorted() + .forEachOrdered(operationStructures::add); + LinkedHashSet serviceErrors = ModelUtils + .streamServiceErrors(subject.model, subject.serviceShape) + .map(Shape::toShapeId) + .sorted() + // InvalidEndpointException does not exist in SDK V2 + .filter(structureShapeId -> + !structureShapeId + .toString() + .contains("com.amazonaws.dynamodb#InvalidEndpointException") + ) + .collect(Collectors.toCollection(LinkedHashSet::new)); + + operationStructures.addAll(serviceErrors); + Set allRelevantShapeIds = ModelUtils.findAllDependentShapes( + operationStructures, + subject.model + ); + allRelevantShapeIds.removeAll(serviceErrors); + allRelevantShapeIds.remove(ShapeId.fromParts("smithy.api", "Unit")); + // Enums are also a special case + LinkedHashSet enumShapeIds = new LinkedHashSet<>(); + allRelevantShapeIds.forEach(shapeId -> { + Shape shape = subject.model.expectShape(shapeId); + if (shape.hasTrait(EnumTrait.class)) { + enumShapeIds.add(shapeId); + } + }); + allRelevantShapeIds.removeAll(enumShapeIds); + + final List convertAllRelevant = allRelevantShapeIds + .stream() + .sorted() + .map(this::generateConvert) + .filter(Objects::nonNull) + .toList(); + final List convertServiceErrors = serviceErrors + .stream() + .sorted() + .map(this::modeledError) + .toList(); + // For enums, we generate overloaded methods, + // one to convert instances of the Enum + final List convertEnumEnum = enumShapeIds + .stream() + .sorted() + .map(this::generateConvertEnumEnum) + .toList(); + // The other to convert String representatives of the enum + final List convertEnumString = enumShapeIds + .stream() + .sorted() + .map(this::generateConvertEnumString) + .toList(); + + return TypeSpec + .classBuilder( + ClassName.get(subject.dafnyNameResolver.packageName(), "ToDafny") + ) + .addModifiers(Modifier.PUBLIC) + .addMethods(convertAllRelevant) + .addMethods(convertServiceErrors) + .addMethods(convertEnumEnum) + .addMethods(convertEnumString) + .addMethod(generateConvertOpaqueError()) + .addMethod(modeledService(subject.serviceShape)) + .build(); + } + + /** + * The Dafny representation of an AWS SDK Service is a + * Polymorph generated Shim wrapping that Service Client.

+ * i.e.: For KMS, this method generates:

+ *
+   * public static IKeyManagementServiceClient KeyManagementService(KmsClient nativeValue) {
+   *   return new Shim(nativeValue, null);
+   * }
+   * 
+ */ + MethodSpec modeledService(ServiceShape shape) { + String methodName = capitalize(shape.toShapeId().getName()); + ClassName nativeClass = AwsSdkNativeV2.classNameForServiceClient(shape); + ClassName dafnyClass = AwsSdkDafnyV2.classNameForAwsService(shape); + ClassName shim = ShimV2.className(shape); + return MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .addParameter(nativeClass, VAR_INPUT) + .returns(dafnyClass) + .addStatement("return new $T($L, null)", shim, VAR_INPUT) + .build(); + } + + /** This method: + * 1. Determines the Shape Type + * 2. invokes the correct generate for that shape type + */ + @SuppressWarnings({ "OptionalGetWithoutIsPresent", "DuplicatedCode" }) + MethodSpec generateConvert(final ShapeId shapeId) { + final Shape shape = subject.model + .getShape(shapeId) + .orElseThrow(() -> + new IllegalStateException("Cannot find shape " + shapeId) + ); + return switch (shape.getType()) { + // For the AWS SDK for Java, we do not generate converters for simple shapes + case BLOB, + BOOLEAN, + STRING, + TIMESTAMP, + BYTE, + SHORT, + DOUBLE, + INTEGER, + LONG, + BIG_DECIMAL, + BIG_INTEGER, + MEMBER -> null; + case LIST -> modeledList(shape.asListShape().get()); + case MAP -> modeledMap(shape.asMapShape().get()); + case SET -> modeledSet(shape.asSetShape().get()); + case STRUCTURE -> generateConvertStructure(shapeId); + case UNION -> generateConvertUnion(shapeId); + default -> throw new UnsupportedOperationException( + "ShapeId %s is of Type %s, which is not yet supported for ToDafny".formatted( + shapeId, + shape.getType() + ) + ); + }; + } + + MethodSpec generateConvertUnion(final ShapeId shapeId) { + final UnionShape unionShape = subject.model.expectShape( + shapeId, + UnionShape.class + ); + if (shapeId.toString().equals("com.amazonaws.dynamodb#AttributeValue")) { + return ddbAttributeValueConversion(shapeId, unionShape); } - - @Override - protected CodeBlock memberConversion(MemberShape memberShape, CodeBlock inputVar) { - CodeBlock methodBlock = conversionMethodReference(subject.model.expectShape(memberShape.getTarget())).asNormalReference(); - - return CodeBlock.of("$L($L)", - methodBlock, - formatInputVarForMemberConversion(memberShape, inputVar) - ); - } - - /** - * Formats inputVar if it requires reformatting for SDK V2. - * @param memberShape shape defined in Smithy model - * @param inputVar CodeBlock to be formatted. This SHOULD be used to build a formatted - * CodeBlock, but SHOULD NOT be used in logic that decides HOW to build a - * formatted CodeBlock. - * Prefer to use MemberShape in decision logic as MemberShape is the source of - * truth from the Smithy model. - * @return inputVar formatted for SDK V2 - */ - public CodeBlock formatInputVarForMemberConversion(MemberShape memberShape, CodeBlock inputVar) { - CodeBlock.Builder returnCodeBlockBuilder = CodeBlock.builder().add(inputVar); - - // If methodBlock is transforming to Dafny ByteSequence, it is expecting either a byte[] - // or ByteBuffer. - // In this case, inputVar is of type SdkBytes. - // dafny-java-conversion should not have a ByteSequence constructor that directly takes in - // SdkBytes. If it did, Polymorph would need to depend on AWS SDK for Java V2. - // The conversion from inputVar as SdkBytes to a Dafny ByteSequence looks like - // ByteSequence(inputVar.asByteArray()) - Shape targetShape = subject.model.expectShape(memberShape.getTarget()); - if (targetShape.getType() == ShapeType.BLOB) { - return returnCodeBlockBuilder - .add(".asByteArray()") - .build(); - } - - // BinarySetAttributeValue conversion is special. - // The input Dafny type is DafnySequence>. - // The output native type is List. - // dafny-java-conversion can convert most input types directly to the output types; - // however, SdkBytes is an exception. SdkBytes is defined in the AWS SDK. It is not a - // native Java nor Dafny type. - // We do not want to write a conversion to SdkBytes inside dafny-java-conversion, else - // Polymorph would need to take a dependency on the AWS SDK. Instead, smithy-dafny-codegen-cli= - // will generate the required conversion code. - // This is the only time when Polymorph needs to convert a list of a Dafny type to a list - // of a type that Polymorph does not know about. So this is a special case and warrants - // its own generation logic. - if (targetShape.getId().toString().equals("com.amazonaws.dynamodb#BinarySetAttributeValue")) { - return returnCodeBlockBuilder - .add(".stream()\n.map($L)\n.collect($L.toList())", - SDK_BYTES_AS_BYTE_BUFFER.asFunctionalReference(), - Constants.JAVA_UTIL_STREAM_COLLECTORS) - .build(); - } - return inputVar; - } - - MethodSpec generateConvertEnumString(ShapeId shapeId) { - final StringShape shape = subject.model.expectShape(shapeId, StringShape.class); - String methodName = capitalize(shapeId.getName()); - TypeName dafnyEnumClass = subject.dafnyNameResolver.typeForShape(shapeId); - - MethodSpec.Builder builder = MethodSpec - .methodBuilder(methodName) - .addModifiers(Modifier.STATIC, Modifier.PUBLIC) - .returns(dafnyEnumClass) - .addParameter(subject.nativeNameResolver.classForString(), "nativeValue"); - builder.addStatement( - "return $L($T.fromValue(nativeValue))", - methodName, - subject.nativeNameResolver.classForEnum(shape) + LOGGER.warn( + "Encountered an AWS SDK Union Shape!" + + "Historically, we have not been good at generating these!\n" + + "Union ShapeID: %s".formatted(shapeId) + ); + return super.modeledUnion(unionShape); + } + + /** */ + private MethodSpec ddbAttributeValueConversion( + final ShapeId shapeId, + final UnionShape shape + ) { + String methodName = capitalize(shapeId.getName()); + TypeName returnType = subject.dafnyNameResolver.typeForShape(shapeId); + MethodSpec.Builder method = MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .returns(returnType) + .addParameter( + subject.nativeNameResolver.classNameForStructure(shape), + VAR_INPUT + ); + method.beginControlFlow("switch ($L.type())", VAR_INPUT); + shape + .members() + .forEach(member -> { + CodeBlock getField = getMember( + CodeBlock.builder().add(VAR_INPUT).build(), + member ); - return builder.build(); - } - - protected MethodSpec generateConvertEnumEnum(ShapeId shapeId) { - final StringShape shape = subject.model.expectShape(shapeId, StringShape.class); - return modeledEnum(shape); - } - - // TODO: We should make all name resolvers support `formatEnumCaseName`, - // rather than entirely ignoring the abstract implementation. - /** - * This logic is the same as ToDafny's logic, - * except it calls an only-defined-in-V2 formatEnumCaseName function. - */ - @Override - @SuppressWarnings("OptionalGetWithoutIsPresent") - protected MethodSpec modeledEnum(StringShape shape) { - final ShapeId shapeId = shape.getId(); - String methodName = capitalize(shapeId.getName()); - final EnumTrait enumTrait = shape.getTrait(EnumTrait.class).orElseThrow( - () -> new IllegalArgumentException( - "Shape must have the enum trait. ShapeId: %s".formatted(shapeId)) + CodeBlock memberConversion = memberConversion(member, getField); + String datatypeConstructorCreate = Dafny.datatypeConstructorCreate( + member.getMemberName(), + false ); - if (!enumTrait.hasNames()) { - throw new UnsupportedOperationException( - "Unnamed enums not supported. ShapeId: %s".formatted(shapeId)); - } - TypeName dafnyEnumClass = subject.dafnyNameResolver.typeForShape(shapeId); - - MethodSpec.Builder builder = MethodSpec - .methodBuilder(methodName) - .addModifiers(Modifier.STATIC, Modifier.PUBLIC) - .returns(dafnyEnumClass) - .addParameter(subject.nativeNameResolver.classForEnum(shape), VAR_INPUT) - .beginControlFlow("switch ($L)", VAR_INPUT); - - final boolean isRecordType = enumTrait.getValues().size() == 1; - - enumTrait.getValues().stream() - .map(EnumDefinition::getName) - .map(Optional::get) - .peek(name -> { - if (!ModelUtils.isValidEnumDefinitionName(name)) { - throw new UnsupportedOperationException( - "Invalid enum definition name: %s".formatted(name)); - } - }) - .forEach(name -> builder - .beginControlFlow("case $L:", - subject.dafnyNameResolver.formatEnumCaseName(dafnyEnumClass, name)) - .addStatement( - "return $T.$L()", - dafnyEnumClass, - Dafny.datatypeConstructorCreate(name, isRecordType)) - .endControlFlow() - ); - - builder.beginControlFlow("default:") - .addStatement( - "throw new $T($S + $L + $S)", - RuntimeException.class, - "Cannot convert ", - VAR_INPUT, - " to %s.".formatted(dafnyEnumClass)) - .endControlFlow(); - builder.endControlFlow(); - return builder.build(); + // The DDB Model uses NULL, but AWS SDK V2 uses NUL + String memberName = member.getMemberName().equals("NULL") + ? "NUL" + : member.getMemberName(); + method + .beginControlFlow("case $L:", memberName) + .addStatement( + "return $T.$L($L)", + returnType, + datatypeConstructorCreate, + memberConversion + ) + .endControlFlow(); + }); + method + .beginControlFlow("default:") + .addStatement( + "throw new $T($S + $L + $S)", + IllegalArgumentException.class, + "Cannot convert ", + VAR_INPUT, + " to %s.".formatted(returnType) + ) + .endControlFlow(); + method.endControlFlow(); + return method.build(); + } + + @Override + protected CodeBlock memberConversion( + MemberShape memberShape, + CodeBlock inputVar + ) { + CodeBlock methodBlock = conversionMethodReference( + subject.model.expectShape(memberShape.getTarget()) + ) + .asNormalReference(); + + return CodeBlock.of( + "$L($L)", + methodBlock, + formatInputVarForMemberConversion(memberShape, inputVar) + ); + } + + /** + * Formats inputVar if it requires reformatting for SDK V2. + * @param memberShape shape defined in Smithy model + * @param inputVar CodeBlock to be formatted. This SHOULD be used to build a formatted + * CodeBlock, but SHOULD NOT be used in logic that decides HOW to build a + * formatted CodeBlock. + * Prefer to use MemberShape in decision logic as MemberShape is the source of + * truth from the Smithy model. + * @return inputVar formatted for SDK V2 + */ + public CodeBlock formatInputVarForMemberConversion( + MemberShape memberShape, + CodeBlock inputVar + ) { + CodeBlock.Builder returnCodeBlockBuilder = CodeBlock + .builder() + .add(inputVar); + + // If methodBlock is transforming to Dafny ByteSequence, it is expecting either a byte[] + // or ByteBuffer. + // In this case, inputVar is of type SdkBytes. + // dafny-java-conversion should not have a ByteSequence constructor that directly takes in + // SdkBytes. If it did, Polymorph would need to depend on AWS SDK for Java V2. + // The conversion from inputVar as SdkBytes to a Dafny ByteSequence looks like + // ByteSequence(inputVar.asByteArray()) + Shape targetShape = subject.model.expectShape(memberShape.getTarget()); + if (targetShape.getType() == ShapeType.BLOB) { + return returnCodeBlockBuilder.add(".asByteArray()").build(); } - MethodSpec generateConvertStructure(final ShapeId shapeId) { - final StructureShape structureShape = subject.model.expectShape(shapeId, StructureShape.class); - return super.modeledStructure(structureShape); + // BinarySetAttributeValue conversion is special. + // The input Dafny type is DafnySequence>. + // The output native type is List. + // dafny-java-conversion can convert most input types directly to the output types; + // however, SdkBytes is an exception. SdkBytes is defined in the AWS SDK. It is not a + // native Java nor Dafny type. + // We do not want to write a conversion to SdkBytes inside dafny-java-conversion, else + // Polymorph would need to take a dependency on the AWS SDK. Instead, smithy-dafny-codegen-cli= + // will generate the required conversion code. + // This is the only time when Polymorph needs to convert a list of a Dafny type to a list + // of a type that Polymorph does not know about. So this is a special case and warrants + // its own generation logic. + if ( + targetShape + .getId() + .toString() + .equals("com.amazonaws.dynamodb#BinarySetAttributeValue") + ) { + return returnCodeBlockBuilder + .add( + ".stream()\n.map($L)\n.collect($L.toList())", + SDK_BYTES_AS_BYTE_BUFFER.asFunctionalReference(), + Constants.JAVA_UTIL_STREAM_COLLECTORS + ) + .build(); } - - @Override - protected CodeBlock getMember(CodeBlock variableName, MemberShape memberShape) { - return subject.dafnyNameResolver.methodForGetMember(variableName, memberShape); + return inputVar; + } + + MethodSpec generateConvertEnumString(ShapeId shapeId) { + final StringShape shape = subject.model.expectShape( + shapeId, + StringShape.class + ); + String methodName = capitalize(shapeId.getName()); + TypeName dafnyEnumClass = subject.dafnyNameResolver.typeForShape(shapeId); + + MethodSpec.Builder builder = MethodSpec + .methodBuilder(methodName) + .addModifiers(Modifier.STATIC, Modifier.PUBLIC) + .returns(dafnyEnumClass) + .addParameter(subject.nativeNameResolver.classForString(), "nativeValue"); + builder.addStatement( + "return $L($T.fromValue(nativeValue))", + methodName, + subject.nativeNameResolver.classForEnum(shape) + ); + return builder.build(); + } + + protected MethodSpec generateConvertEnumEnum(ShapeId shapeId) { + final StringShape shape = subject.model.expectShape( + shapeId, + StringShape.class + ); + return modeledEnum(shape); + } + + // TODO: We should make all name resolvers support `formatEnumCaseName`, + // rather than entirely ignoring the abstract implementation. + /** + * This logic is the same as ToDafny's logic, + * except it calls an only-defined-in-V2 formatEnumCaseName function. + */ + @Override + @SuppressWarnings("OptionalGetWithoutIsPresent") + protected MethodSpec modeledEnum(StringShape shape) { + final ShapeId shapeId = shape.getId(); + String methodName = capitalize(shapeId.getName()); + final EnumTrait enumTrait = shape + .getTrait(EnumTrait.class) + .orElseThrow(() -> + new IllegalArgumentException( + "Shape must have the enum trait. ShapeId: %s".formatted(shapeId) + ) + ); + if (!enumTrait.hasNames()) { + throw new UnsupportedOperationException( + "Unnamed enums not supported. ShapeId: %s".formatted(shapeId) + ); } - - /** - * We have to customize - * List conversion for the AWS SDK for Java V2 because - * AWS SDK Java V2 treats Enums in a special way. - * See the comment on - * {@link AwsSdkNativeV2#typeForShapeNoEnum} - **/ - @Override - protected MethodSpec modeledList(ListShape shape) { - MemberShape memberShape = shape.getMember(); - CodeBlock memberConverter = conversionMethodReference(subject.model.expectShape(memberShape.getTarget())).asFunctionalReference(); - CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()).asNormalReference(); - CodeBlock getTypeDescriptor = subject.dafnyNameResolver.typeDescriptor(memberShape.getTarget()); - - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), "nativeValue") - .build(); - - MethodSpec.Builder methodSpecBuilder = MethodSpec - .methodBuilder(capitalize(shape.getId().getName())) - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - - .returns(subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId())) - .addParameter(parameterSpec); - - // A static call to TypeDescriptor class requires an explicit typecast. - // This generates an "unchecked cast" warning, which needs to be suppressed. - // (Dafny automatically generates this warning suppression annotation for classes that - // generate their own _typeDescriptor() method.) - if (subject.dafnyNameResolver.shapeIdRequiresStaticTypeDescriptor(memberShape.getTarget())) { - return methodSpecBuilder - // Suppress "unchecked cast" warning; this is expected - .addAnnotation( - AnnotationSpec.builder(SuppressWarnings.class) - .addMember("value", "$S", "unchecked") - .build() - ) - .addStatement("return \n($L) \n$L(\n$L, \n$L, \n$L)", - // This is the explicit typecast in the return statement - subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId()), - genericCall, - "nativeValue", - memberConverter, - getTypeDescriptor) - .build(); + TypeName dafnyEnumClass = subject.dafnyNameResolver.typeForShape(shapeId); + + MethodSpec.Builder builder = MethodSpec + .methodBuilder(methodName) + .addModifiers(Modifier.STATIC, Modifier.PUBLIC) + .returns(dafnyEnumClass) + .addParameter(subject.nativeNameResolver.classForEnum(shape), VAR_INPUT) + .beginControlFlow("switch ($L)", VAR_INPUT); + + final boolean isRecordType = enumTrait.getValues().size() == 1; + + enumTrait + .getValues() + .stream() + .map(EnumDefinition::getName) + .map(Optional::get) + .peek(name -> { + if (!ModelUtils.isValidEnumDefinitionName(name)) { + throw new UnsupportedOperationException( + "Invalid enum definition name: %s".formatted(name) + ); } - - return methodSpecBuilder - .addStatement("return $L(\n$L, \n$L, \n$L)", - genericCall, "nativeValue", memberConverter, getTypeDescriptor) - .build(); + }) + .forEach(name -> + builder + .beginControlFlow( + "case $L:", + subject.dafnyNameResolver.formatEnumCaseName(dafnyEnumClass, name) + ) + .addStatement( + "return $T.$L()", + dafnyEnumClass, + Dafny.datatypeConstructorCreate(name, isRecordType) + ) + .endControlFlow() + ); + + builder + .beginControlFlow("default:") + .addStatement( + "throw new $T($S + $L + $S)", + RuntimeException.class, + "Cannot convert ", + VAR_INPUT, + " to %s.".formatted(dafnyEnumClass) + ) + .endControlFlow(); + builder.endControlFlow(); + return builder.build(); + } + + MethodSpec generateConvertStructure(final ShapeId shapeId) { + final StructureShape structureShape = subject.model.expectShape( + shapeId, + StructureShape.class + ); + return super.modeledStructure(structureShape); + } + + @Override + protected CodeBlock getMember( + CodeBlock variableName, + MemberShape memberShape + ) { + return subject.dafnyNameResolver.methodForGetMember( + variableName, + memberShape + ); + } + + /** + * We have to customize + * List conversion for the AWS SDK for Java V2 because + * AWS SDK Java V2 treats Enums in a special way. + * See the comment on + * {@link AwsSdkNativeV2#typeForShapeNoEnum} + **/ + @Override + protected MethodSpec modeledList(ListShape shape) { + MemberShape memberShape = shape.getMember(); + CodeBlock memberConverter = conversionMethodReference( + subject.model.expectShape(memberShape.getTarget()) + ) + .asFunctionalReference(); + CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(shape.getType()) + .asNormalReference(); + CodeBlock getTypeDescriptor = subject.dafnyNameResolver.typeDescriptor( + memberShape.getTarget() + ); + + ParameterSpec parameterSpec = ParameterSpec + .builder( + subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), + "nativeValue" + ) + .build(); + + MethodSpec.Builder methodSpecBuilder = MethodSpec + .methodBuilder(capitalize(shape.getId().getName())) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns( + subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId()) + ) + .addParameter(parameterSpec); + + // A static call to TypeDescriptor class requires an explicit typecast. + // This generates an "unchecked cast" warning, which needs to be suppressed. + // (Dafny automatically generates this warning suppression annotation for classes that + // generate their own _typeDescriptor() method.) + if ( + subject.dafnyNameResolver.shapeIdRequiresStaticTypeDescriptor( + memberShape.getTarget() + ) + ) { + return methodSpecBuilder + // Suppress "unchecked cast" warning; this is expected + .addAnnotation( + AnnotationSpec + .builder(SuppressWarnings.class) + .addMember("value", "$S", "unchecked") + .build() + ) + .addStatement( + "return \n($L) \n$L(\n$L, \n$L, \n$L)", + // This is the explicit typecast in the return statement + subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId()), + genericCall, + "nativeValue", + memberConverter, + getTypeDescriptor + ) + .build(); } - /** - * We have to customize - * Set conversion for the AWS SDK for Java V2 because - * AWS SDK Java V2 treats Enums in a special way. - * See the comment on - * {@link AwsSdkNativeV2#typeForShapeNoEnum} - **/ - @Override - protected MethodSpec modeledSet(SetShape shape) { - MemberShape memberShape = shape.getMember(); - CodeBlock memberConverter = conversionMethodReference(subject.model.expectShape(memberShape.getTarget())).asFunctionalReference(); - CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()).asNormalReference(); - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), "nativeValue") - .build(); - return MethodSpec - .methodBuilder(capitalize(shape.getId().getName())) - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - .returns(subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId())) - .addParameter(parameterSpec) - .addStatement("return $L(\nnativeValue, \n$L)", - genericCall, memberConverter) - .build(); - } - - /** - * We have to customize - * Map conversion for the AWS SDK for Java V2 because - * AWS SDK Java V2 treats Enums in a special way. - * See the comment on - * {@link AwsSdkNativeV2#typeForShapeNoEnum} - **/ - @Override - @SuppressWarnings("OptionalGetWithoutIsPresent") - protected MethodSpec modeledMap(MapShape shape) { - MemberShape keyShape = shape.getKey().asMemberShape().get(); - CodeBlock keyConverter = conversionMethodReference(subject.model.expectShape(keyShape.getTarget())).asFunctionalReference(); - MemberShape valueShape = shape.getValue().asMemberShape().get(); - CodeBlock valueConverter = conversionMethodReference(subject.model.expectShape(valueShape.getTarget())).asFunctionalReference(); - CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(shape.getType()).asNormalReference(); - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), "nativeValue") - .build(); - return MethodSpec - .methodBuilder(capitalize(shape.getId().getName())) - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - .returns(subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId())) - .addParameter(parameterSpec) - .addStatement("return $L(\nnativeValue, \n$L, \n$L)", - genericCall, keyConverter, valueConverter) - .build(); - } - - MethodSpec generateConvertOpaqueError() { - // Opaque Errors are not in the model, - // so we cannot use any of our helper methods for this method. - - CodeBlock memberDeclaration = CodeBlock.of( - "$T $L", - ParameterizedTypeName.get( - ClassName.get("Wrappers_Compile", "Option"), - ParameterizedTypeName.get( - software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_SEQUENCE_CLASS_NAME, - WildcardTypeName.subtypeOf(Character.class)) - ), - "message" - ); - // This is memberAssignment from above, - // but with calls to dafnyNameResolver replaced with their expected response. - CodeBlock stringTypeDescriptor = Dafny.TYPE_DESCRIPTOR_BY_SHAPE_TYPE.get(ShapeType.STRING); - CodeBlock memberAssignment = CodeBlock.of( - "$L = $T.nonNull($L) ?\n$L\n: $L", - "message", - ClassName.get(Objects.class), - "nativeValue.getMessage()", - subject.dafnyNameResolver.createSome(stringTypeDescriptor, - CodeBlock.of("$T.$L($L)", - COMMON_TO_DAFNY_SIMPLE, - SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(ShapeType.STRING).methodName(), - "nativeValue.getMessage()")), - subject.dafnyNameResolver.createNone(stringTypeDescriptor) - ); - return MethodSpec.methodBuilder("Error") - .addModifiers(Modifier.PUBLIC, Modifier.STATIC) - .returns(subject.dafnyNameResolver.abstractClassForError()) - .addParameter(subject.nativeNameResolver.baseErrorForService(), "nativeValue") - .addStatement(memberDeclaration) - .addStatement(memberAssignment) - .addStatement("return new $T(message)", subject.dafnyNameResolver.classForOpaqueError()) - .build(); - } + return methodSpecBuilder + .addStatement( + "return $L(\n$L, \n$L, \n$L)", + genericCall, + "nativeValue", + memberConverter, + getTypeDescriptor + ) + .build(); + } + + /** + * We have to customize + * Set conversion for the AWS SDK for Java V2 because + * AWS SDK Java V2 treats Enums in a special way. + * See the comment on + * {@link AwsSdkNativeV2#typeForShapeNoEnum} + **/ + @Override + protected MethodSpec modeledSet(SetShape shape) { + MemberShape memberShape = shape.getMember(); + CodeBlock memberConverter = conversionMethodReference( + subject.model.expectShape(memberShape.getTarget()) + ) + .asFunctionalReference(); + CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(shape.getType()) + .asNormalReference(); + ParameterSpec parameterSpec = ParameterSpec + .builder( + subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), + "nativeValue" + ) + .build(); + return MethodSpec + .methodBuilder(capitalize(shape.getId().getName())) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns( + subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId()) + ) + .addParameter(parameterSpec) + .addStatement( + "return $L(\nnativeValue, \n$L)", + genericCall, + memberConverter + ) + .build(); + } + + /** + * We have to customize + * Map conversion for the AWS SDK for Java V2 because + * AWS SDK Java V2 treats Enums in a special way. + * See the comment on + * {@link AwsSdkNativeV2#typeForShapeNoEnum} + **/ + @Override + @SuppressWarnings("OptionalGetWithoutIsPresent") + protected MethodSpec modeledMap(MapShape shape) { + MemberShape keyShape = shape.getKey().asMemberShape().get(); + CodeBlock keyConverter = conversionMethodReference( + subject.model.expectShape(keyShape.getTarget()) + ) + .asFunctionalReference(); + MemberShape valueShape = shape.getValue().asMemberShape().get(); + CodeBlock valueConverter = conversionMethodReference( + subject.model.expectShape(valueShape.getTarget()) + ) + .asFunctionalReference(); + CodeBlock genericCall = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(shape.getType()) + .asNormalReference(); + ParameterSpec parameterSpec = ParameterSpec + .builder( + subject.nativeNameResolver.typeForListSetOrMapNoEnum(shape.getId()), + "nativeValue" + ) + .build(); + return MethodSpec + .methodBuilder(capitalize(shape.getId().getName())) + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns( + subject.dafnyNameResolver.typeForAggregateWithWildcard(shape.getId()) + ) + .addParameter(parameterSpec) + .addStatement( + "return $L(\nnativeValue, \n$L, \n$L)", + genericCall, + keyConverter, + valueConverter + ) + .build(); + } + + MethodSpec generateConvertOpaqueError() { + // Opaque Errors are not in the model, + // so we cannot use any of our helper methods for this method. + + CodeBlock memberDeclaration = CodeBlock.of( + "$T $L", + ParameterizedTypeName.get( + ClassName.get("Wrappers_Compile", "Option"), + ParameterizedTypeName.get( + software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_SEQUENCE_CLASS_NAME, + WildcardTypeName.subtypeOf(Character.class) + ) + ), + "message" + ); + // This is memberAssignment from above, + // but with calls to dafnyNameResolver replaced with their expected response. + CodeBlock stringTypeDescriptor = Dafny.TYPE_DESCRIPTOR_BY_SHAPE_TYPE.get( + ShapeType.STRING + ); + CodeBlock memberAssignment = CodeBlock.of( + "$L = $T.nonNull($L) ?\n$L\n: $L", + "message", + ClassName.get(Objects.class), + "nativeValue.getMessage()", + subject.dafnyNameResolver.createSome( + stringTypeDescriptor, + CodeBlock.of( + "$T.$L($L)", + COMMON_TO_DAFNY_SIMPLE, + SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(ShapeType.STRING) + .methodName(), + "nativeValue.getMessage()" + ) + ), + subject.dafnyNameResolver.createNone(stringTypeDescriptor) + ); + return MethodSpec + .methodBuilder("Error") + .addModifiers(Modifier.PUBLIC, Modifier.STATIC) + .returns(subject.dafnyNameResolver.abstractClassForError()) + .addParameter( + subject.nativeNameResolver.baseErrorForService(), + "nativeValue" + ) + .addStatement(memberDeclaration) + .addStatement(memberAssignment) + .addStatement( + "return new $T(message)", + subject.dafnyNameResolver.classForOpaqueError() + ) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeAwsV2.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeAwsV2.java index 708f2dfc08..015d41d523 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeAwsV2.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeAwsV2.java @@ -2,6 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v2; +import static software.amazon.smithy.utils.StringUtils.capitalize; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; @@ -9,7 +11,6 @@ import com.squareup.javapoet.ParameterSpec; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; - import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; @@ -17,18 +18,15 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; - import javax.lang.model.element.Modifier; - import software.amazon.polymorph.smithyjava.MethodReference; import software.amazon.polymorph.smithyjava.generator.ToNative; -import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; -import software.amazon.polymorph.utils.DafnyNameResolverHelpers; -import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkDafnyV2; import software.amazon.polymorph.smithyjava.nameresolver.AwsSdkNativeV2; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; - +import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; +import software.amazon.polymorph.utils.DafnyNameResolverHelpers; +import software.amazon.polymorph.utils.ModelUtils; import software.amazon.smithy.model.shapes.MemberShape; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ServiceShape; @@ -41,8 +39,6 @@ import software.amazon.smithy.model.traits.EnumDefinition; import software.amazon.smithy.model.traits.EnumTrait; -import static software.amazon.smithy.utils.StringUtils.capitalize; - //TODO: Create abstract class for V1 & V2 to extend /** * ToNativeAwsV2 generates ToNative. @@ -67,315 +63,452 @@ * */ public class ToNativeAwsV2 extends ToNative { - protected final static String VAR_BUILDER = "builder"; - protected final static String VAR_TEMP = "temp"; - - // TODO: for V2 support, use abstract AwsSdk name resolvers and sub class for V1 or V2. - // Hack to override CodegenSubject - // See code comment on ../library/ModelCodegen for details. - private final JavaAwsSdkV2 subject; + protected static final String VAR_BUILDER = "builder"; + protected static final String VAR_TEMP = "temp"; - public static ClassName className(ShapeId shapeId) { - if (!AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { - throw new IllegalArgumentException("ShapeId MUST BE in an AWS SDK Namespace"); - } - return ClassName.get( - DafnyNameResolverHelpers.packageNameForNamespace(shapeId.getNamespace()), - TO_NATIVE); - } + // TODO: for V2 support, use abstract AwsSdk name resolvers and sub class for V1 or V2. - protected static Map V2_CONVERSION_METHOD_FROM_SHAPE_TYPE; + // Hack to override CodegenSubject + // See code comment on ../library/ModelCodegen for details. + private final JavaAwsSdkV2 subject; - static { - V2_CONVERSION_METHOD_FROM_SHAPE_TYPE = Map.ofEntries( - Map.entry(ShapeType.BLOB, - new MethodReference(JavaAwsSdkV2.BLOB_TO_NATIVE_SDK_BYTES, "fromByteArray")), - Map.entry(ShapeType.TIMESTAMP, - new MethodReference(COMMON_TO_NATIVE_SIMPLE, "Instant")) - ); - } - - public ToNativeAwsV2(JavaAwsSdkV2 awsSdk) { - super(awsSdk, className(awsSdk.serviceShape.toShapeId())); - this.subject = awsSdk; - } - - @Override - public Set javaFiles() { - JavaFile.Builder builder = JavaFile.builder(subject.packageName, toNative()); - return Collections.singleton(builder.build()); - } - - TypeSpec toNative() { - List operations = subject.serviceShape - .getOperations().stream().sorted() - .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) - .toList(); - LinkedHashSet operationStructures = operations.stream() - .map(OperationShape::getInputShape).sorted() - .collect(Collectors.toCollection(LinkedHashSet::new)); - operations.stream().map(OperationShape::getOutputShape).sorted() - .forEachOrdered(operationStructures::add); - LinkedHashSet serviceErrors = ModelUtils.streamServiceErrors(subject.model, subject.serviceShape) - .map(Shape::toShapeId).sorted() - // InvalidEndpointException does not exist in SDK V2 - .filter(structureShapeId -> !structureShapeId.toString().contains("com.amazonaws.dynamodb#InvalidEndpointException")) - .collect(Collectors.toCollection(LinkedHashSet::new)); - - operationStructures.addAll(serviceErrors); - Set allRelevantShapeIds = ModelUtils.findAllDependentShapes(operationStructures, subject.model); - allRelevantShapeIds.removeAll(serviceErrors); - allRelevantShapeIds.remove(ShapeId.fromParts("smithy.api", "Unit")); - - List convertRelevant = allRelevantShapeIds.stream().sorted() - .map(this::generateConvert).filter(Objects::nonNull).toList(); - final List convertServiceErrors = serviceErrors.stream().sorted() - .map(this::modeledError).toList(); - return TypeSpec - .classBuilder( - ClassName.get(subject.packageName, TO_NATIVE)) - .addModifiers(Modifier.PUBLIC) - .addMethods(convertRelevant) - .addMethods(convertServiceErrors) - .addMethod(modeledService(subject.serviceShape)) - .build(); - } - - /** - * The Dafny representation of an AWS SDK Service is a - * Polymorph generated Shim wrapping that Service Client.

- * Thus, the Native equivalent is the wrapped Service Client.

- * i.e.: For KMS, this method generates:

- *
-     * public static KmsClient KeyManagementService(IKeyManagementServiceClient dafnyValue) {
-     *   return ((Shim) dafnyValue).impl();
-     * }
-     * 
- */ - MethodSpec modeledService(ServiceShape shape) { - String methodName = capitalize(shape.toShapeId().getName()); - ClassName nativeClass = AwsSdkNativeV2.classNameForServiceClient(shape); - ClassName dafnyClass = AwsSdkDafnyV2.classNameForAwsService(shape); - ClassName shim = ShimV2.className(shape); - return MethodSpec.methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .addParameter(dafnyClass, VAR_INPUT) - .returns(nativeClass) - .addStatement("return (($T) $L).impl()", shim, VAR_INPUT) - .build(); + public static ClassName className(ShapeId shapeId) { + if (!AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shapeId)) { + throw new IllegalArgumentException( + "ShapeId MUST BE in an AWS SDK Namespace" + ); } + return ClassName.get( + DafnyNameResolverHelpers.packageNameForNamespace(shapeId.getNamespace()), + TO_NATIVE + ); + } + + protected static Map< + ShapeType, + MethodReference + > V2_CONVERSION_METHOD_FROM_SHAPE_TYPE; + + static { + V2_CONVERSION_METHOD_FROM_SHAPE_TYPE = + Map.ofEntries( + Map.entry( + ShapeType.BLOB, + new MethodReference( + JavaAwsSdkV2.BLOB_TO_NATIVE_SDK_BYTES, + "fromByteArray" + ) + ), + Map.entry( + ShapeType.TIMESTAMP, + new MethodReference(COMMON_TO_NATIVE_SIMPLE, "Instant") + ) + ); + } + + public ToNativeAwsV2(JavaAwsSdkV2 awsSdk) { + super(awsSdk, className(awsSdk.serviceShape.toShapeId())); + this.subject = awsSdk; + } + + @Override + public Set javaFiles() { + JavaFile.Builder builder = JavaFile.builder( + subject.packageName, + toNative() + ); + return Collections.singleton(builder.build()); + } + + TypeSpec toNative() { + List operations = subject.serviceShape + .getOperations() + .stream() + .sorted() + .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) + .toList(); + LinkedHashSet operationStructures = operations + .stream() + .map(OperationShape::getInputShape) + .sorted() + .collect(Collectors.toCollection(LinkedHashSet::new)); + operations + .stream() + .map(OperationShape::getOutputShape) + .sorted() + .forEachOrdered(operationStructures::add); + LinkedHashSet serviceErrors = ModelUtils + .streamServiceErrors(subject.model, subject.serviceShape) + .map(Shape::toShapeId) + .sorted() + // InvalidEndpointException does not exist in SDK V2 + .filter(structureShapeId -> + !structureShapeId + .toString() + .contains("com.amazonaws.dynamodb#InvalidEndpointException") + ) + .collect(Collectors.toCollection(LinkedHashSet::new)); + + operationStructures.addAll(serviceErrors); + Set allRelevantShapeIds = ModelUtils.findAllDependentShapes( + operationStructures, + subject.model + ); + allRelevantShapeIds.removeAll(serviceErrors); + allRelevantShapeIds.remove(ShapeId.fromParts("smithy.api", "Unit")); + + List convertRelevant = allRelevantShapeIds + .stream() + .sorted() + .map(this::generateConvert) + .filter(Objects::nonNull) + .toList(); + final List convertServiceErrors = serviceErrors + .stream() + .sorted() + .map(this::modeledError) + .toList(); + return TypeSpec + .classBuilder(ClassName.get(subject.packageName, TO_NATIVE)) + .addModifiers(Modifier.PUBLIC) + .addMethods(convertRelevant) + .addMethods(convertServiceErrors) + .addMethod(modeledService(subject.serviceShape)) + .build(); + } + + /** + * The Dafny representation of an AWS SDK Service is a + * Polymorph generated Shim wrapping that Service Client.

+ * Thus, the Native equivalent is the wrapped Service Client.

+ * i.e.: For KMS, this method generates:

+ *
+   * public static KmsClient KeyManagementService(IKeyManagementServiceClient dafnyValue) {
+   *   return ((Shim) dafnyValue).impl();
+   * }
+   * 
+ */ + MethodSpec modeledService(ServiceShape shape) { + String methodName = capitalize(shape.toShapeId().getName()); + ClassName nativeClass = AwsSdkNativeV2.classNameForServiceClient(shape); + ClassName dafnyClass = AwsSdkDafnyV2.classNameForAwsService(shape); + ClassName shim = ShimV2.className(shape); + return MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .addParameter(dafnyClass, VAR_INPUT) + .returns(nativeClass) + .addStatement("return (($T) $L).impl()", shim, VAR_INPUT) + .build(); + } + + @SuppressWarnings({ "OptionalGetWithoutIsPresent" }) + MethodSpec generateConvert(ShapeId shapeId) { + final Shape shape = subject.model + .getShape(shapeId) + .orElseThrow(() -> + new IllegalStateException("Cannot find shape " + shapeId) + ); + return switch (shape.getType()) { + // For the AWS SDK for Java V2, we do not generate converters for simple shapes + case BLOB, + BOOLEAN, + TIMESTAMP, + BYTE, + SHORT, + DOUBLE, + INTEGER, + LONG, + BIG_DECIMAL, + BIG_INTEGER, + MEMBER -> null; + case STRING -> generateConvertString(shapeId); // STRING handles enums + case LIST -> modeledList(shape.asListShape().get()); + case SET -> modeledSet(shape.asSetShape().get()); + case MAP -> modeledMap(shape.asMapShape().get()); + case STRUCTURE -> modeledStructure(shape.asStructureShape().get()); + case UNION -> modeledUnion(shape.asUnionShape().get()); + default -> throw new UnsupportedOperationException( + "ShapeId %s is of Type %s, which is not yet supported for ToNative".formatted( + shapeId, + shape.getType() + ) + ); + }; + } + + @Override + protected MethodSpec modeledListOrSet( + MemberShape memberShape, + ShapeId shapeId, + ShapeType shapeType + ) { + // BinarySetAttributeValue conversion is special. + // The input Dafny type is DafnySequence>. + // The output native type is List. + // dafny-java-conversion can convert most input types directly to the output types; + // however, SdkBytes is an exception. SdkBytes is defined in the AWS SDK. It is not a + // native Java nor Dafny type. + // We do not want to write a conversion to SdkBytes inside dafny-java-conversion, else + // Polymorph would need to take a dependency on the AWS SDK. Instead, smithy-dafny + // will generate the required conversion code. + // This is the only time when Polymorph needs to convert a list of a Dafny type to a list + // of a type that Polymorph does not know about. So this is a special case and warrants + // its own generation logic. + if (shapeId.getName().contains("BinarySetAttributeValue")) { + ParameterSpec parameterSpec = ParameterSpec + .builder(subject.dafnyNameResolver.typeForShape(shapeId), VAR_INPUT) + .build(); + + MethodSpec.Builder methodSpecBuilder = MethodSpec + .methodBuilder(capitalize(shapeId.getName())) + .addModifiers(PUBLIC_STATIC) + .returns(subject.nativeNameResolver.typeForShape(shapeId)) + .addParameter(parameterSpec); + + // Since this special case only applies to one class right now, explicitly assigning a + // string isn't unreasonable. We should extend this logic if this case applies to + // more classes as we add new libraries. + CodeBlock.Builder codeBlockBuilder = CodeBlock.builder(); + codeBlockBuilder.add( + """ + List returnList = new $L(); + + dafnyValue.forEach((value) -> { + returnList.add(software.amazon.awssdk.core.SdkBytes.fromByteArray((byte[]) value.toRawArray())); + }); - @SuppressWarnings({"OptionalGetWithoutIsPresent"}) - MethodSpec generateConvert(ShapeId shapeId) { - final Shape shape = subject.model.getShape(shapeId) - .orElseThrow(() -> new IllegalStateException("Cannot find shape " + shapeId)); - return switch (shape.getType()) { - // For the AWS SDK for Java V2, we do not generate converters for simple shapes - case BLOB, BOOLEAN, TIMESTAMP, BYTE, SHORT, DOUBLE, - INTEGER, LONG, BIG_DECIMAL, BIG_INTEGER, MEMBER -> null; - case STRING -> generateConvertString(shapeId); // STRING handles enums - case LIST -> modeledList(shape.asListShape().get()); - case SET -> modeledSet(shape.asSetShape().get()); - case MAP -> modeledMap(shape.asMapShape().get()); - case STRUCTURE -> modeledStructure(shape.asStructureShape().get()); - case UNION -> modeledUnion(shape.asUnionShape().get()); - default -> throw new UnsupportedOperationException( - "ShapeId %s is of Type %s, which is not yet supported for ToNative" - .formatted(shapeId, shape.getType())); - }; - } + return returnList; + """, + Constants.JAVA_UTIL_ARRAYLIST + ); - @Override - protected MethodSpec modeledListOrSet(MemberShape memberShape, ShapeId shapeId, ShapeType shapeType) { - // BinarySetAttributeValue conversion is special. - // The input Dafny type is DafnySequence>. - // The output native type is List. - // dafny-java-conversion can convert most input types directly to the output types; - // however, SdkBytes is an exception. SdkBytes is defined in the AWS SDK. It is not a - // native Java nor Dafny type. - // We do not want to write a conversion to SdkBytes inside dafny-java-conversion, else - // Polymorph would need to take a dependency on the AWS SDK. Instead, smithy-dafny - // will generate the required conversion code. - // This is the only time when Polymorph needs to convert a list of a Dafny type to a list - // of a type that Polymorph does not know about. So this is a special case and warrants - // its own generation logic. - if (shapeId.getName().contains("BinarySetAttributeValue")) { - ParameterSpec parameterSpec = ParameterSpec - .builder(subject.dafnyNameResolver.typeForShape(shapeId), VAR_INPUT) - .build(); - - MethodSpec.Builder methodSpecBuilder = MethodSpec - .methodBuilder(capitalize(shapeId.getName())) - .addModifiers(PUBLIC_STATIC) - .returns(subject.nativeNameResolver.typeForShape(shapeId)) - .addParameter(parameterSpec); - - // Since this special case only applies to one class right now, explicitly assigning a - // string isn't unreasonable. We should extend this logic if this case applies to - // more classes as we add new libraries. - CodeBlock.Builder codeBlockBuilder = CodeBlock.builder(); - codeBlockBuilder.add(""" - List returnList = new $L(); - - dafnyValue.forEach((value) -> { - returnList.add(software.amazon.awssdk.core.SdkBytes.fromByteArray((byte[]) value.toRawArray())); - }); - - return returnList; - """, Constants.JAVA_UTIL_ARRAYLIST); - - methodSpecBuilder.addCode(codeBlockBuilder.build()); - - return methodSpecBuilder.build(); - } + methodSpecBuilder.addCode(codeBlockBuilder.build()); - return super.modeledListOrSet(memberShape, shapeId, shapeType); + return methodSpecBuilder.build(); } - @Override - protected MethodSpec modeledStructure(StructureShape structureShape) { - String methodName = capitalize(structureShape.getId().getName()); - ClassName nativeClassName = subject.nativeNameResolver.classNameForStructure(structureShape); - MethodSpec.Builder builder = MethodSpec - .methodBuilder(methodName) - .addModifiers(Modifier.STATIC, Modifier.PUBLIC) - .returns(nativeClassName) - .addParameter(subject.dafnyNameResolver.typeForShape(structureShape.getId()), VAR_INPUT); - - if (structureShape.members().size() == 0) { - builder.addStatement("return $T.builder().build()", nativeClassName); - return builder.build(); - } - builder.addStatement("$T.Builder $L = $T.builder()", nativeClassName, VAR_BUILDER, nativeClassName); - - // For each member - structureShape.members().stream().sorted() - .forEach(member -> { - // if optional, check if present - if (member.isOptional()) { - builder.beginControlFlow("if ($L.$L.is_Some())", VAR_INPUT, Dafny.getMemberField(member)); - } - // set with conversion call - builder.addStatement(setWithConversionCall(member, Dafny.getMemberFieldValue(member))); - if (member.isOptional()) builder.endControlFlow(); - }); - return builder.addStatement("return $L.build()", VAR_BUILDER).build(); - } - - @Override - protected CodeBlock setWithConversionCall(MemberShape member, CodeBlock getMember) { - Shape targetShape = subject.model.expectShape(member.getTarget()); - // SDK V2 reads in Blob shapes as SdkBytes. - // SdkBytes are a Java SDK V2-specific datatype defined in the SDK V2 package. As a result, - // dafny-java-version should not define a byte-array-to-SdkBytes conversion. Otherwise, - // Polymorph would need to depend on AWS SDK for Java V2. - // SDK V1 uses ByteBuffers, which are a common Java type defined externally from SDK V1, so - // dafny-java-conversion may define a conversion without declaring a dependency on SDK V1. - // This block converts the Dafny array to a byte array, which is converted to SdkBytes via - // SdkBytes.fromByteArray(). - if (targetShape.getType() == ShapeType.BLOB) { - return CodeBlock.of("$L.$L($L((byte[]) ($L.$L.toRawArray())))", - VAR_BUILDER, - setMemberField(member), - conversionMethodReference(member).asNormalReference(), - VAR_INPUT, - AwsSdkDafnyV2.getV2MemberFieldValue(member)); - } - - return CodeBlock.of("$L.$L($L($L.$L))", - VAR_BUILDER, - setMemberField(member), - conversionMethodReference(member).asNormalReference(), - VAR_INPUT, - AwsSdkDafnyV2.getV2MemberFieldValue(member)); + return super.modeledListOrSet(memberShape, shapeId, shapeType); + } + + @Override + protected MethodSpec modeledStructure(StructureShape structureShape) { + String methodName = capitalize(structureShape.getId().getName()); + ClassName nativeClassName = + subject.nativeNameResolver.classNameForStructure(structureShape); + MethodSpec.Builder builder = MethodSpec + .methodBuilder(methodName) + .addModifiers(Modifier.STATIC, Modifier.PUBLIC) + .returns(nativeClassName) + .addParameter( + subject.dafnyNameResolver.typeForShape(structureShape.getId()), + VAR_INPUT + ); + + if (structureShape.members().size() == 0) { + builder.addStatement("return $T.builder().build()", nativeClassName); + return builder.build(); } - - protected MethodReference conversionMethodReference(MemberShape memberShape) { - Shape targetShape = subject.model.expectShape(memberShape.getTarget()); - if (V2_CONVERSION_METHOD_FROM_SHAPE_TYPE.containsKey(targetShape.getType())) { - return V2_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(targetShape.getType()); + builder.addStatement( + "$T.Builder $L = $T.builder()", + nativeClassName, + VAR_BUILDER, + nativeClassName + ); + + // For each member + structureShape + .members() + .stream() + .sorted() + .forEach(member -> { + // if optional, check if present + if (member.isOptional()) { + builder.beginControlFlow( + "if ($L.$L.is_Some())", + VAR_INPUT, + Dafny.getMemberField(member) + ); } - return super.conversionMethodReference(targetShape); + // set with conversion call + builder.addStatement( + setWithConversionCall(member, Dafny.getMemberFieldValue(member)) + ); + if (member.isOptional()) builder.endControlFlow(); + }); + return builder.addStatement("return $L.build()", VAR_BUILDER).build(); + } + + @Override + protected CodeBlock setWithConversionCall( + MemberShape member, + CodeBlock getMember + ) { + Shape targetShape = subject.model.expectShape(member.getTarget()); + // SDK V2 reads in Blob shapes as SdkBytes. + // SdkBytes are a Java SDK V2-specific datatype defined in the SDK V2 package. As a result, + // dafny-java-version should not define a byte-array-to-SdkBytes conversion. Otherwise, + // Polymorph would need to depend on AWS SDK for Java V2. + // SDK V1 uses ByteBuffers, which are a common Java type defined externally from SDK V1, so + // dafny-java-conversion may define a conversion without declaring a dependency on SDK V1. + // This block converts the Dafny array to a byte array, which is converted to SdkBytes via + // SdkBytes.fromByteArray(). + if (targetShape.getType() == ShapeType.BLOB) { + return CodeBlock.of( + "$L.$L($L((byte[]) ($L.$L.toRawArray())))", + VAR_BUILDER, + setMemberField(member), + conversionMethodReference(member).asNormalReference(), + VAR_INPUT, + AwsSdkDafnyV2.getV2MemberFieldValue(member) + ); } - /** @return CodeBlock of Method to set a member field. */ - @Override - protected CodeBlock setMemberField(MemberShape shape) { - return subject.nativeNameResolver.fieldForSetMember(shape); - + return CodeBlock.of( + "$L.$L($L($L.$L))", + VAR_BUILDER, + setMemberField(member), + conversionMethodReference(member).asNormalReference(), + VAR_INPUT, + AwsSdkDafnyV2.getV2MemberFieldValue(member) + ); + } + + protected MethodReference conversionMethodReference(MemberShape memberShape) { + Shape targetShape = subject.model.expectShape(memberShape.getTarget()); + if ( + V2_CONVERSION_METHOD_FROM_SHAPE_TYPE.containsKey(targetShape.getType()) + ) { + return V2_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(targetShape.getType()); } - - MethodSpec generateConvertString(ShapeId shapeId) { - final StringShape shape = subject.model.expectShape(shapeId, StringShape.class); - if (shape.hasTrait(EnumTrait.class)) { - return generateConvertEnum(shapeId); - } - return null; + return super.conversionMethodReference(targetShape); + } + + /** @return CodeBlock of Method to set a member field. */ + @Override + protected CodeBlock setMemberField(MemberShape shape) { + return subject.nativeNameResolver.fieldForSetMember(shape); + } + + MethodSpec generateConvertString(ShapeId shapeId) { + final StringShape shape = subject.model.expectShape( + shapeId, + StringShape.class + ); + if (shape.hasTrait(EnumTrait.class)) { + return generateConvertEnum(shapeId); } - - MethodSpec generateConvertEnum(ShapeId shapeId) { - final StringShape shape = subject.model.expectShape(shapeId, StringShape.class); - final ClassName returnType = subject.nativeNameResolver.classForEnum(shape); - MethodSpec method = modeledEnum(shape); - return method; + return null; + } + + MethodSpec generateConvertEnum(ShapeId shapeId) { + final StringShape shape = subject.model.expectShape( + shapeId, + StringShape.class + ); + final ClassName returnType = subject.nativeNameResolver.classForEnum(shape); + MethodSpec method = modeledEnum(shape); + return method; + } + + protected final MethodSpec modeledEnum(StringShape shape) { + final ShapeId shapeId = shape.getId(); + final String methodName = capitalize(shapeId.getName()); + final TypeName inputType = subject.dafnyNameResolver.typeForShape(shapeId); + final ClassName returnType = subject.nativeNameResolver.classForEnum(shape); + MethodSpec.Builder method = initializeMethodSpec( + methodName, + inputType, + returnType + ); + final EnumTrait enumTrait = shape.getTrait(EnumTrait.class).orElseThrow(); + if (!enumTrait.hasNames()) { + throw new UnsupportedOperationException( + "Unnamed enums not supported. ShapeId: %s".formatted(shapeId) + ); } - protected final MethodSpec modeledEnum(StringShape shape) { - final ShapeId shapeId = shape.getId(); - final String methodName = capitalize(shapeId.getName()); - final TypeName inputType = subject.dafnyNameResolver.typeForShape(shapeId); - final ClassName returnType = subject.nativeNameResolver.classForEnum(shape); - MethodSpec.Builder method = initializeMethodSpec(methodName, inputType, returnType); - final EnumTrait enumTrait = shape.getTrait(EnumTrait.class).orElseThrow(); - if (!enumTrait.hasNames()) { - throw new UnsupportedOperationException( - "Unnamed enums not supported. ShapeId: %s".formatted(shapeId)); + enumTrait + .getValues() + .stream() + .map(EnumDefinition::getName) + .map(maybeName -> + maybeName.orElseThrow(() -> + new IllegalArgumentException( + "Unnamed enums not supported. ShapeId: %s".formatted(shapeId) + ) + ) + ) + .peek(name -> { + if (!ModelUtils.isValidEnumDefinitionName(name)) { + throw new UnsupportedOperationException( + "Invalid enum definition name: %s".formatted(name) + ); } - - enumTrait.getValues().stream() - .map(EnumDefinition::getName) - .map(maybeName -> maybeName.orElseThrow( - () -> new IllegalArgumentException( - "Unnamed enums not supported. ShapeId: %s".formatted(shapeId)) - )) - .peek(name -> { - if (!ModelUtils.isValidEnumDefinitionName(name)) { - throw new UnsupportedOperationException( - "Invalid enum definition name: %s".formatted(name)); - } - }) - .forEachOrdered(name -> method - .beginControlFlow("if ($L.$L())", VAR_INPUT, Dafny.datatypeConstructorIs(name)) - .addStatement("return $T.$L", returnType, subject.nativeNameResolver.v2FormattedEnumValue(shapeId, name)) - .endControlFlow() - ); - - method.addStatement("return $T.fromValue($L.toString())", returnType, VAR_INPUT); - return method.build(); - } - - // TODO: Refactor with ToNative. - // This is only duplicated because ToNative uses "nativeBuilder" as the name for its builders, - // but this file uses "builder". This seems able to be refactored. - protected MethodSpec modeledUnion(final UnionShape shape) { - final ShapeId shapeId = shape.getId(); - final String methodName = capitalize(shapeId.getName()); - final TypeName inputType = subject.dafnyNameResolver.typeForShape(shapeId); - final ClassName returnType = subject.nativeNameResolver.classNameForStructure(shape); - MethodSpec.Builder method = initializeMethodSpec(methodName, inputType, returnType); - ClassName nativeClassName = subject.nativeNameResolver.classNameForStructure( - shape.asUnionShape().get()); - method.addStatement("$T.Builder $L = $T.builder()", nativeClassName, VAR_BUILDER, - nativeClassName); - shape.members() - .forEach(member -> { - method.beginControlFlow("if ($L.$L())", VAR_INPUT, - Dafny.datatypeConstructorIs(member.getMemberName())) - .addStatement(setWithConversionCall(member, Dafny.getMemberField(member))) - .endControlFlow(); - }); - method.addStatement("return $L.build()", VAR_BUILDER); - return method.build(); - } + }) + .forEachOrdered(name -> + method + .beginControlFlow( + "if ($L.$L())", + VAR_INPUT, + Dafny.datatypeConstructorIs(name) + ) + .addStatement( + "return $T.$L", + returnType, + subject.nativeNameResolver.v2FormattedEnumValue(shapeId, name) + ) + .endControlFlow() + ); + + method.addStatement( + "return $T.fromValue($L.toString())", + returnType, + VAR_INPUT + ); + return method.build(); + } + + // TODO: Refactor with ToNative. + // This is only duplicated because ToNative uses "nativeBuilder" as the name for its builders, + // but this file uses "builder". This seems able to be refactored. + protected MethodSpec modeledUnion(final UnionShape shape) { + final ShapeId shapeId = shape.getId(); + final String methodName = capitalize(shapeId.getName()); + final TypeName inputType = subject.dafnyNameResolver.typeForShape(shapeId); + final ClassName returnType = + subject.nativeNameResolver.classNameForStructure(shape); + MethodSpec.Builder method = initializeMethodSpec( + methodName, + inputType, + returnType + ); + ClassName nativeClassName = + subject.nativeNameResolver.classNameForStructure( + shape.asUnionShape().get() + ); + method.addStatement( + "$T.Builder $L = $T.builder()", + nativeClassName, + VAR_BUILDER, + nativeClassName + ); + shape + .members() + .forEach(member -> { + method + .beginControlFlow( + "if ($L.$L())", + VAR_INPUT, + Dafny.datatypeConstructorIs(member.getMemberName()) + ) + .addStatement( + setWithConversionCall(member, Dafny.getMemberField(member)) + ) + .endControlFlow(); + }); + method.addStatement("return $L.build()", VAR_BUILDER); + return method.build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/JavaLibrary.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/JavaLibrary.java index b3ac9a26ef..0d31380351 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/JavaLibrary.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/JavaLibrary.java @@ -2,19 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.library; +import static software.amazon.polymorph.smithyjava.generator.library.shims.ResourceShim.WRAP_METHOD_NAME; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; - import java.nio.file.Path; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import software.amazon.polymorph.smithydafny.DafnyVersion; import software.amazon.polymorph.smithyjava.NamespaceHelper; import software.amazon.polymorph.smithyjava.generator.CodegenSubject; @@ -31,7 +30,6 @@ import software.amazon.polymorph.utils.DafnyNameResolverHelpers; import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.utils.TokenTree; - import software.amazon.smithy.model.Model; import software.amazon.smithy.model.node.ExpectationNotMetException; import software.amazon.smithy.model.shapes.ListShape; @@ -49,178 +47,267 @@ import software.amazon.smithy.model.traits.ErrorTrait; import software.amazon.smithy.model.traits.TraitDefinition; -import static software.amazon.polymorph.smithyjava.generator.library.shims.ResourceShim.WRAP_METHOD_NAME; - public class JavaLibrary extends CodegenSubject { - @SuppressWarnings("unused") - private static final Logger LOGGER = LoggerFactory.getLogger(JavaLibrary.class); - - /** Public Java Interfaces will go here. */ - public final String packageName; - /** Public POJOs will go here. */ - public final String modelPackageName; - public final ToDafnyLibrary toDafnyLibrary; - public final ToNativeLibrary toNativeLibrary; - - public JavaLibrary(Model model, ServiceShape serviceShape, AwsSdkVersion sdkVersion, DafnyVersion dafnyVersion) { - super(model, serviceShape, initDafny(model, serviceShape, sdkVersion, dafnyVersion), initNative(model, serviceShape, sdkVersion), sdkVersion); - packageName = NamespaceHelper.standardize(serviceShape.getId().getNamespace()); - modelPackageName = packageName + ".model"; - try { - serviceShape.expectTrait(LocalServiceTrait.class); - } catch (ExpectationNotMetException ex) { - throw new IllegalArgumentException( - "JavaLibrary's MUST have a localService trait. ShapeId: %s".formatted(serviceShape.getId()), - ex - ); - } - toDafnyLibrary = new ToDafnyLibrary(this); - toNativeLibrary = new ToNativeLibrary(this); - } - static Dafny initDafny(Model model, ServiceShape serviceShape, AwsSdkVersion awsSdkVersion, DafnyVersion dafnyVersion) { - String packageName = DafnyNameResolverHelpers.packageNameForNamespace(serviceShape.getId().getNamespace()); - return new Dafny(packageName, model, serviceShape, awsSdkVersion, dafnyVersion); - } + @SuppressWarnings("unused") + private static final Logger LOGGER = LoggerFactory.getLogger( + JavaLibrary.class + ); - static Native initNative(Model model, ServiceShape serviceShape, AwsSdkVersion awsSdkVersion) { - String packageName = NamespaceHelper.standardize(serviceShape.getId().getNamespace()); - return new Native(packageName, serviceShape, model, packageName + ".model", awsSdkVersion); - } + /** Public Java Interfaces will go here. */ + public final String packageName; + /** Public POJOs will go here. */ + public final String modelPackageName; + public final ToDafnyLibrary toDafnyLibrary; + public final ToNativeLibrary toNativeLibrary; - public static CodeBlock wrapAwsService( - Shape shape, CodeBlock nativeValue, CodeBlock regionVar, - AwsSdkVersion sdkVersion) { - Optional serviceShape = shape.asServiceShape(); - if (serviceShape.isEmpty()) { - throw new IllegalArgumentException("Shape must be Service"); - } - return switch (sdkVersion) { - case V1 -> CodeBlock.of("new $T($L, $L)", - ShimV1.className(serviceShape.get()), - nativeValue, - regionVar); - case V2 -> CodeBlock.of("new $T($L, $L)", - ShimV2.className(serviceShape.get()), - nativeValue, - regionVar); - }; + public JavaLibrary( + Model model, + ServiceShape serviceShape, + AwsSdkVersion sdkVersion, + DafnyVersion dafnyVersion + ) { + super( + model, + serviceShape, + initDafny(model, serviceShape, sdkVersion, dafnyVersion), + initNative(model, serviceShape, sdkVersion), + sdkVersion + ); + packageName = + NamespaceHelper.standardize(serviceShape.getId().getNamespace()); + modelPackageName = packageName + ".model"; + try { + serviceShape.expectTrait(LocalServiceTrait.class); + } catch (ExpectationNotMetException ex) { + throw new IllegalArgumentException( + "JavaLibrary's MUST have a localService trait. ShapeId: %s".formatted( + serviceShape.getId() + ), + ex + ); } + toDafnyLibrary = new ToDafnyLibrary(this); + toNativeLibrary = new ToNativeLibrary(this); + } - @SuppressWarnings("unused") // We do not use this yet (2023-03-05), but we might soon-ish. Remove by 2023-06 if still not used. - protected static CodeBlock castAndUnwrapAwsService( - Shape shape, CodeBlock dafnyValue, - AwsSdkVersion sdkVersion) { - Optional serviceShape = shape.asServiceShape(); - if (serviceShape.isEmpty()) { - throw new IllegalArgumentException("Shape must be Service"); - } - return switch (sdkVersion) { - case V1 -> CodeBlock.of("(($T) $L).impl()", - ShimV1.className(serviceShape.get()), - dafnyValue); - case V2 -> CodeBlock.of("(($T) $L).impl()", - ShimV2.className(serviceShape.get()), - dafnyValue); - }; - } + static Dafny initDafny( + Model model, + ServiceShape serviceShape, + AwsSdkVersion awsSdkVersion, + DafnyVersion dafnyVersion + ) { + String packageName = DafnyNameResolverHelpers.packageNameForNamespace( + serviceShape.getId().getNamespace() + ); + return new Dafny( + packageName, + model, + serviceShape, + awsSdkVersion, + dafnyVersion + ); + } - @Override - public Map generate() { - Map rtn = new LinkedHashMap<>(); - ModelCodegen serviceCodegen = new ModelCodegen(this); - rtn.putAll(serviceCodegen.generate()); - rtn.putAll(toDafnyLibrary.generate()); - rtn.putAll(toNativeLibrary.generate()); - ShimLibrary shim = new ServiceShim(this, this.serviceShape); - rtn.putAll(shim.generate()); - getResourcesInServiceNamespace().stream() - .map(shape -> new ResourceShim(this, shape)) - .map(Generator::generate) - .forEachOrdered(rtn::putAll); - return rtn; - } + static Native initNative( + Model model, + ServiceShape serviceShape, + AwsSdkVersion awsSdkVersion + ) { + String packageName = NamespaceHelper.standardize( + serviceShape.getId().getNamespace() + ); + return new Native( + packageName, + serviceShape, + model, + packageName + ".model", + awsSdkVersion + ); + } - public List getErrorsInServiceNamespace() { - return this.model.getStructureShapes().stream() - .filter(shape -> shape.hasTrait(ErrorTrait.class)) - .filter(shape -> ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape)) - .sorted().toList(); + public static CodeBlock wrapAwsService( + Shape shape, + CodeBlock nativeValue, + CodeBlock regionVar, + AwsSdkVersion sdkVersion + ) { + Optional serviceShape = shape.asServiceShape(); + if (serviceShape.isEmpty()) { + throw new IllegalArgumentException("Shape must be Service"); } + return switch (sdkVersion) { + case V1 -> CodeBlock.of( + "new $T($L, $L)", + ShimV1.className(serviceShape.get()), + nativeValue, + regionVar + ); + case V2 -> CodeBlock.of( + "new $T($L, $L)", + ShimV2.className(serviceShape.get()), + nativeValue, + regionVar + ); + }; + } - public List getStructuresInServiceNamespace() { - return this.model.getStructureShapes().stream() - .filter(shape -> !shape.hasTrait(ErrorTrait.class)) - .filter(shape -> !shape.hasTrait(TraitDefinition.class)) - .filter(shape -> !shape.hasTrait(EnumTrait.class)) - // We do not generate POJOs or To(Dafny,Native) for reference shapes - .filter(shape -> !shape.hasTrait(ReferenceTrait.class)) - // We do not generate POJOs or To(Dafny,Native) for indirect reference shapes - .filter(shape -> { - if (!shape.hasTrait(PositionalTrait.class)) { - return true; - } - final MemberShape onlyMember = PositionalTrait.onlyMember(shape); - final Shape targetShape = model.expectShape(onlyMember.getTarget()); - return !targetShape.hasTrait(ReferenceTrait.class); - }) - .filter(shape -> ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape)) - .sorted().toList(); + @SuppressWarnings("unused") // We do not use this yet (2023-03-05), but we might soon-ish. Remove by 2023-06 if still not used. + protected static CodeBlock castAndUnwrapAwsService( + Shape shape, + CodeBlock dafnyValue, + AwsSdkVersion sdkVersion + ) { + Optional serviceShape = shape.asServiceShape(); + if (serviceShape.isEmpty()) { + throw new IllegalArgumentException("Shape must be Service"); } + return switch (sdkVersion) { + case V1 -> CodeBlock.of( + "(($T) $L).impl()", + ShimV1.className(serviceShape.get()), + dafnyValue + ); + case V2 -> CodeBlock.of( + "(($T) $L).impl()", + ShimV2.className(serviceShape.get()), + dafnyValue + ); + }; + } - public List getResourcesInServiceNamespace() { - return this.model.getResourceShapes().stream() - .filter(shape -> ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape)) - .sorted().toList(); - } + @Override + public Map generate() { + Map rtn = new LinkedHashMap<>(); + ModelCodegen serviceCodegen = new ModelCodegen(this); + rtn.putAll(serviceCodegen.generate()); + rtn.putAll(toDafnyLibrary.generate()); + rtn.putAll(toNativeLibrary.generate()); + ShimLibrary shim = new ServiceShim(this, this.serviceShape); + rtn.putAll(shim.generate()); + getResourcesInServiceNamespace() + .stream() + .map(shape -> new ResourceShim(this, shape)) + .map(Generator::generate) + .forEachOrdered(rtn::putAll); + return rtn; + } - public List getEnumsInServiceNamespace() { - return this.model.getStringShapesWithTrait(EnumTrait.class).stream() - .filter(shape -> ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape)) - .sorted().toList(); - } + public List getErrorsInServiceNamespace() { + return this.model.getStructureShapes() + .stream() + .filter(shape -> shape.hasTrait(ErrorTrait.class)) + .filter(shape -> + ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape) + ) + .sorted() + .toList(); + } - public List getUnionsInServiceNamespace() { - return this.model.getUnionShapes().stream() - .filter(shape -> ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape)) - .sorted().toList(); - } + public List getStructuresInServiceNamespace() { + return this.model.getStructureShapes() + .stream() + .filter(shape -> !shape.hasTrait(ErrorTrait.class)) + .filter(shape -> !shape.hasTrait(TraitDefinition.class)) + .filter(shape -> !shape.hasTrait(EnumTrait.class)) + // We do not generate POJOs or To(Dafny,Native) for reference shapes + .filter(shape -> !shape.hasTrait(ReferenceTrait.class)) + // We do not generate POJOs or To(Dafny,Native) for indirect reference shapes + .filter(shape -> { + if (!shape.hasTrait(PositionalTrait.class)) { + return true; + } + final MemberShape onlyMember = PositionalTrait.onlyMember(shape); + final Shape targetShape = model.expectShape(onlyMember.getTarget()); + return !targetShape.hasTrait(ReferenceTrait.class); + }) + .filter(shape -> + ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape) + ) + .sorted() + .toList(); + } - public List getListsInServiceNamespace() { - return this.model.getListShapes().stream() - .filter(shape -> ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape)) - .sorted().toList(); - } + public List getResourcesInServiceNamespace() { + return this.model.getResourceShapes() + .stream() + .filter(shape -> + ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape) + ) + .sorted() + .toList(); + } - public List getSetsInServiceNamespace() { - return this.model.getSetShapes().stream() - .filter(shape -> ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape)) - .sorted().toList(); - } + public List getEnumsInServiceNamespace() { + return this.model.getStringShapesWithTrait(EnumTrait.class) + .stream() + .filter(shape -> + ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape) + ) + .sorted() + .toList(); + } - public List getMapsInServiceNamespace() { - return this.model.getMapShapes().stream() - .filter(shape -> ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape)) - .sorted().toList(); - } + public List getUnionsInServiceNamespace() { + return this.model.getUnionShapes() + .stream() + .filter(shape -> + ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape) + ) + .sorted() + .toList(); + } - public CodeBlock wrapWithShim(ShapeId referentId, CodeBlock referentVariable) throws ExpectationNotMetException { - final Shape targetShape = model.expectShape(referentId); - final ClassName rtnClassName; - if (targetShape.isResourceShape()) { - //noinspection OptionalGetWithoutIsPresent - ResourceShape rShape = targetShape.asResourceShape().get(); - rtnClassName = nativeNameResolver.classNameForResource(rShape); - return CodeBlock.of("$T.$L($L)", - rtnClassName, WRAP_METHOD_NAME, referentVariable); - } else { - // It MUST be a service, as reference traits ONLY reference Resources & Services - //noinspection OptionalGetWithoutIsPresent - ServiceShape sShape = targetShape.asServiceShape().get(); - rtnClassName = nativeNameResolver.classNameForService(sShape); - } - return CodeBlock.of("new $T($L)", - rtnClassName, - referentVariable); + public List getListsInServiceNamespace() { + return this.model.getListShapes() + .stream() + .filter(shape -> + ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape) + ) + .sorted() + .toList(); + } + + public List getSetsInServiceNamespace() { + return this.model.getSetShapes() + .stream() + .filter(shape -> + ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape) + ) + .sorted() + .toList(); + } + + public List getMapsInServiceNamespace() { + return this.model.getMapShapes() + .stream() + .filter(shape -> + ModelUtils.isInServiceNamespace(shape.getId(), this.serviceShape) + ) + .sorted() + .toList(); + } + + public CodeBlock wrapWithShim(ShapeId referentId, CodeBlock referentVariable) + throws ExpectationNotMetException { + final Shape targetShape = model.expectShape(referentId); + final ClassName rtnClassName; + if (targetShape.isResourceShape()) { + //noinspection OptionalGetWithoutIsPresent + ResourceShape rShape = targetShape.asResourceShape().get(); + rtnClassName = nativeNameResolver.classNameForResource(rShape); + return CodeBlock.of( + "$T.$L($L)", + rtnClassName, + WRAP_METHOD_NAME, + referentVariable + ); + } else { + // It MUST be a service, as reference traits ONLY reference Resources & Services + //noinspection OptionalGetWithoutIsPresent + ServiceShape sShape = targetShape.asServiceShape().get(); + rtnClassName = nativeNameResolver.classNameForService(sShape); } + return CodeBlock.of("new $T($L)", rtnClassName, referentVariable); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ModelCodegen.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ModelCodegen.java index 3db3b84bce..1d87a97e28 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ModelCodegen.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ModelCodegen.java @@ -3,6 +3,7 @@ package software.amazon.polymorph.smithyjava.generator.library; import com.squareup.javapoet.JavaFile; +import java.util.LinkedHashSet; import software.amazon.polymorph.smithyjava.generator.Generator; import software.amazon.polymorph.smithyjava.modeled.ModeledEnum; import software.amazon.polymorph.smithyjava.modeled.ModeledError; @@ -14,9 +15,6 @@ import software.amazon.smithy.model.shapes.StructureShape; import software.amazon.smithy.model.shapes.UnionShape; -import java.util.LinkedHashSet; - - /** * ModelCodegen generates the content of the Subject's Model package. * i.e.: Any POJOs, Enums, Exceptions, or Interfaces that are needed by the Subject. @@ -26,61 +24,74 @@ * as the SDK Library already has all of this defined.

*/ class ModelCodegen extends Generator { - // Hack to override CodegenSubject - // Why override? Generator takes any CodegenSubject, - // but we want the particular subclass JavaLibrary. - // If we did not hack this, - // Java would down cast `subject` to CodegenSubject, - // and we would lose access to any subclass specific APIs or Fields. - final JavaLibrary subject; - /** Public Java Interfaces will go here. */ - public final String packageName; - /** Public POJOs will go here. */ - public final String modelPackageName; - public ModelCodegen(JavaLibrary subject) { - super(subject); - // Hack to override CodegenSubject - this.subject = subject; - packageName = subject.packageName; - modelPackageName = subject.modelPackageName; - } + // Hack to override CodegenSubject + // Why override? Generator takes any CodegenSubject, + // but we want the particular subclass JavaLibrary. + // If we did not hack this, + // Java would down cast `subject` to CodegenSubject, + // and we would lose access to any subclass specific APIs or Fields. + final JavaLibrary subject; + /** Public Java Interfaces will go here. */ + public final String packageName; + /** Public POJOs will go here. */ + public final String modelPackageName; + + public ModelCodegen(JavaLibrary subject) { + super(subject); + // Hack to override CodegenSubject + this.subject = subject; + packageName = subject.packageName; + modelPackageName = subject.modelPackageName; + } - @Override - public LinkedHashSet javaFiles() { - LinkedHashSet rtn = new LinkedHashSet<>(); - // Opaque Exception Class - rtn.add(OpaqueError.javaFile(modelPackageName)); - // Collection of Errors class - rtn.add(CollectionOfErrors.javaFile(modelPackageName)); - // Modeled exception classes - subject.getErrorsInServiceNamespace().stream() - .map(this::modeledError).forEachOrdered(rtn::add); - // Structures - subject.getStructuresInServiceNamespace().stream() - .map(this::modeledStructure).forEachOrdered(rtn::add); - // Enums - subject.getEnumsInServiceNamespace().stream() - .map(this::modeledEnum).forEachOrdered(rtn::add); - // Unions - subject.getUnionsInServiceNamespace().stream() - .map(this::modeledUnion).forEachOrdered(rtn::add); - return rtn; - } + @Override + public LinkedHashSet javaFiles() { + LinkedHashSet rtn = new LinkedHashSet<>(); + // Opaque Exception Class + rtn.add(OpaqueError.javaFile(modelPackageName)); + // Collection of Errors class + rtn.add(CollectionOfErrors.javaFile(modelPackageName)); + // Modeled exception classes + subject + .getErrorsInServiceNamespace() + .stream() + .map(this::modeledError) + .forEachOrdered(rtn::add); + // Structures + subject + .getStructuresInServiceNamespace() + .stream() + .map(this::modeledStructure) + .forEachOrdered(rtn::add); + // Enums + subject + .getEnumsInServiceNamespace() + .stream() + .map(this::modeledEnum) + .forEachOrdered(rtn::add); + // Unions + subject + .getUnionsInServiceNamespace() + .stream() + .map(this::modeledUnion) + .forEachOrdered(rtn::add); + return rtn; + } - JavaFile modeledError(StructureShape shape) { - return ModeledError.javaFile(modelPackageName, shape, subject); - } + JavaFile modeledError(StructureShape shape) { + return ModeledError.javaFile(modelPackageName, shape, subject); + } - JavaFile modeledStructure(StructureShape shape) { - return ModeledStructure.javaFile(modelPackageName, shape, subject); - } + JavaFile modeledStructure(StructureShape shape) { + return ModeledStructure.javaFile(modelPackageName, shape, subject); + } - JavaFile modeledEnum(StringShape stringShape) { - return ModeledEnum.javaFile(modelPackageName, stringShape); - } + JavaFile modeledEnum(StringShape stringShape) { + return ModeledEnum.javaFile(modelPackageName, stringShape); + } - JavaFile modeledUnion(UnionShape shape) { - return ModeledUnion.javaFile(modelPackageName, shape, subject); - } + JavaFile modeledUnion(UnionShape shape) { + return ModeledUnion.javaFile(modelPackageName, shape, subject); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ShimLibrary.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ShimLibrary.java index 2b860e35ba..b1228943e8 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ShimLibrary.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ShimLibrary.java @@ -2,196 +2,232 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.library; +import static javax.lang.model.element.Modifier.PUBLIC; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_TUPLE0_CLASS_NAME; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SMITHY_API_UNIT; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeName; - import java.util.Optional; - import software.amazon.awssdk.utils.StringUtils; import software.amazon.polymorph.smithyjava.MethodReference; +import software.amazon.polymorph.smithyjava.MethodSignature; import software.amazon.polymorph.smithyjava.OperationJavaDoc; import software.amazon.polymorph.smithyjava.generator.Generator; import software.amazon.polymorph.smithyjava.modeled.Operation; +import software.amazon.polymorph.smithyjava.nameresolver.Dafny; import software.amazon.polymorph.traits.JavaDocTrait; import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; import software.amazon.polymorph.utils.ModelUtils; -import software.amazon.polymorph.smithyjava.MethodSignature; import software.amazon.polymorph.utils.ModelUtils.ResolvedShapeId; -import software.amazon.polymorph.smithyjava.nameresolver.Dafny; - import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.shapes.ShapeId; -import static javax.lang.model.element.Modifier.PUBLIC; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_TUPLE0_CLASS_NAME; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SMITHY_API_UNIT; - /** * A Java Library's Shim is the public class * that consumers interact with in Native Java.

* ShimLibrary holds the logic required to generate the Shim. */ public abstract class ShimLibrary extends Generator { - // Hack to override CodegenSubject - // See ModelCodegen for explanation - protected final JavaLibrary subject; - /** The class name of the Subject's ToDafny class. */ - public final ClassName toDafnyClassName; - /** The class name of the Subject's ToNative class. */ - public final ClassName toNativeClassName; - public ShimLibrary(JavaLibrary javaLibrary) { - super(javaLibrary); - this.subject = javaLibrary; - this.toDafnyClassName = ToDafnyLibrary.className(javaLibrary); - this.toNativeClassName = ToNativeLibrary.className(javaLibrary); + // Hack to override CodegenSubject + // See ModelCodegen for explanation + protected final JavaLibrary subject; + /** The class name of the Subject's ToDafny class. */ + public final ClassName toDafnyClassName; + /** The class name of the Subject's ToNative class. */ + public final ClassName toNativeClassName; + + public ShimLibrary(JavaLibrary javaLibrary) { + super(javaLibrary); + this.subject = javaLibrary; + this.toDafnyClassName = ToDafnyLibrary.className(javaLibrary); + this.toNativeClassName = ToNativeLibrary.className(javaLibrary); + } + + // TODO: The methods in this class SHOULD all be moved to + // software.amazon.polymorph.smithyjava.modeled.Operation.AsNative, + // which, ideally, would become a Shape Visitor? + protected MethodSignature operationMethodSignature(OperationShape shape) { + final ResolvedShapeId inputResolved = ModelUtils.resolveShape( + shape.getInputShape(), + subject.model + ); + final ResolvedShapeId outputResolved = ModelUtils.resolveShape( + shape.getOutputShape(), + subject.model + ); + final String operationName = shape.toShapeId().getName(); + final MethodSpec.Builder method = MethodSpec + .methodBuilder(operationName) + .addModifiers(PUBLIC); + // if operation takes an argument + if (!inputResolved.resolvedId().equals(SMITHY_API_UNIT)) { + TypeName inputType = methodSignatureTypeName(inputResolved); + method.addParameter(inputType, NATIVE_VAR); } - - // TODO: The methods in this class SHOULD all be moved to - // software.amazon.polymorph.smithyjava.modeled.Operation.AsNative, - // which, ideally, would become a Shape Visitor? - protected MethodSignature operationMethodSignature(OperationShape shape) { - final ResolvedShapeId inputResolved = ModelUtils.resolveShape( - shape.getInputShape(), subject.model); - final ResolvedShapeId outputResolved = ModelUtils.resolveShape( - shape.getOutputShape(), subject.model); - final String operationName = shape.toShapeId().getName(); - final MethodSpec.Builder method = MethodSpec - .methodBuilder(operationName) - .addModifiers(PUBLIC); - // if operation takes an argument - if (!inputResolved.resolvedId().equals(SMITHY_API_UNIT)) { - TypeName inputType = methodSignatureTypeName(inputResolved); - method.addParameter(inputType, NATIVE_VAR); - } - // if operation is not void - if (!outputResolved.resolvedId().equals(SMITHY_API_UNIT)) { - TypeName outputType = methodSignatureTypeName(outputResolved); - method.returns(outputType); - } - String maybeJavaDoc = OperationJavaDoc.fromOperationShape(subject.model, shape).getDoc(); - if (StringUtils.isNotBlank(maybeJavaDoc)) { - method.addJavadoc(maybeJavaDoc); - } - return new MethodSignature(method, inputResolved, outputResolved); - } - - /** @return TypeName for a method's signature. */ - protected TypeName methodSignatureTypeName(ResolvedShapeId resolvedShape) { - return Operation.preferNativeInterface(resolvedShape, subject); + // if operation is not void + if (!outputResolved.resolvedId().equals(SMITHY_API_UNIT)) { + TypeName outputType = methodSignatureTypeName(outputResolved); + method.returns(outputType); } - - protected MethodSpec operation(OperationShape operationShape) { - final MethodSignature signature = operationMethodSignature(operationShape); - final ResolvedShapeId inputResolved = signature.resolvedInput(); - final ResolvedShapeId outputResolved = signature.resolvedOutput(); - MethodSpec.Builder method = signature.method(); - final String operationName = operationShape.toShapeId().getName(); - // if operation takes an argument - if (!inputResolved.resolvedId().equals(SMITHY_API_UNIT)) { - Shape shape = subject.model.expectShape(inputResolved.resolvedId()); - // If input is a Service or Resource, and Not in AWS Namespace - if ( - (shape.isServiceShape() || shape.isResourceShape()) - && !AwsSdkNameResolverHelpers.isInAwsSdkNamespace(inputResolved.resolvedId()) - ) { - // if operation takes a non-AWS Service/Resource, get impl() - method.addStatement(dafnyDeclareGetImpl(inputResolved.resolvedId())); - } else { - // Convert from nativeValue to dafnyValue - method.addStatement(dafnyDeclareAndConvert(inputResolved)); - } - } - // A void result in Dafny Java is Tuple0 - TypeName success = DAFNY_TUPLE0_CLASS_NAME; - // if operation is not void - if (!outputResolved.resolvedId().equals(SMITHY_API_UNIT)) { - // Replace Tuple0 with real type - success = subject.dafnyNameResolver.typeForShape(outputResolved.resolvedId()); - } - TypeName failure = subject.dafnyNameResolver.abstractClassForError(); - //TODO: handle operation specific errors? - TypeName result = Dafny.asDafnyResult(success, failure); - // if operation takes an argument - if (!inputResolved.resolvedId().equals(SMITHY_API_UNIT)) { - // call with that argument in dafny - method.addStatement("$T $L = this.$L.$L($L)", - result, RESULT_VAR, - INTERFACE_FIELD, operationName, DAFNY_VAR); - } else { - // call with no args - method.addStatement("$T $L = this.$L.$L()", - result, RESULT_VAR, - INTERFACE_FIELD, operationName); - } - // Handle Failure - method.addCode(ifFailure()); - - // if operation is void - if (outputResolved.resolvedId().equals(SMITHY_API_UNIT)) { - return method.build(); - } - Shape outputShape = subject.model.expectShape(outputResolved.resolvedId()); - // if resolvedOutput is a Service or Resource not in AWS SDK Namespace - if ( - (outputShape.isServiceShape() || outputShape.isResourceShape()) - && !AwsSdkNameResolverHelpers.isInAwsSdkNamespace(outputResolved.resolvedId()) - ) { - // if operation outputs a non-AWS Service/Resource, wrap result with Shim - method.addStatement("return $L", - subject.wrapWithShim(outputResolved.resolvedId(), - CodeBlock.of("$L.dtor_value()", RESULT_VAR))); - return method.build(); - } - final Shape naiveShape = subject.model.expectShape(outputResolved.naiveId()); - final MethodReference toNativeMethod = subject.toNativeLibrary.conversionMethodReference(naiveShape); - // else convert success to native and return - method.addStatement("return $L($L.dtor_value())", - toNativeMethod.asNormalReference(), - RESULT_VAR); - return method.build(); + String maybeJavaDoc = OperationJavaDoc + .fromOperationShape(subject.model, shape) + .getDoc(); + if (StringUtils.isNotBlank(maybeJavaDoc)) { + method.addJavadoc(maybeJavaDoc); } - - // If it is known the Shape cannot have a positional trait, - // then the "targetId" and the "shapeId" are the same. - protected CodeBlock dafnyDeclareAndConvert(ShapeId shapeId) { - return dafnyDeclareAndConvert(new ResolvedShapeId(shapeId, shapeId)); + return new MethodSignature(method, inputResolved, outputResolved); + } + + /** @return TypeName for a method's signature. */ + protected TypeName methodSignatureTypeName(ResolvedShapeId resolvedShape) { + return Operation.preferNativeInterface(resolvedShape, subject); + } + + protected MethodSpec operation(OperationShape operationShape) { + final MethodSignature signature = operationMethodSignature(operationShape); + final ResolvedShapeId inputResolved = signature.resolvedInput(); + final ResolvedShapeId outputResolved = signature.resolvedOutput(); + MethodSpec.Builder method = signature.method(); + final String operationName = operationShape.toShapeId().getName(); + // if operation takes an argument + if (!inputResolved.resolvedId().equals(SMITHY_API_UNIT)) { + Shape shape = subject.model.expectShape(inputResolved.resolvedId()); + // If input is a Service or Resource, and Not in AWS Namespace + if ( + (shape.isServiceShape() || shape.isResourceShape()) && + !AwsSdkNameResolverHelpers.isInAwsSdkNamespace( + inputResolved.resolvedId() + ) + ) { + // if operation takes a non-AWS Service/Resource, get impl() + method.addStatement(dafnyDeclareGetImpl(inputResolved.resolvedId())); + } else { + // Convert from nativeValue to dafnyValue + method.addStatement(dafnyDeclareAndConvert(inputResolved)); + } } - - // Positional complicates everything. - // The types need to be looked up by targetId. - // But The converters are named after the shapeId. - protected CodeBlock dafnyDeclareAndConvert(ResolvedShapeId resolvedShape) { - final ShapeId targetId = resolvedShape.resolvedId(); - final Shape naiveShape = subject.model.expectShape(resolvedShape.naiveId()); - final MethodReference toDafnyMethod = subject.toDafnyLibrary.conversionMethodReference(naiveShape); - return CodeBlock.of("$T $L = $L($L)", - subject.dafnyNameResolver.typeForShape(targetId), - DAFNY_VAR, - toDafnyMethod.asNormalReference(), - NATIVE_VAR); + // A void result in Dafny Java is Tuple0 + TypeName success = DAFNY_TUPLE0_CLASS_NAME; + // if operation is not void + if (!outputResolved.resolvedId().equals(SMITHY_API_UNIT)) { + // Replace Tuple0 with real type + success = + subject.dafnyNameResolver.typeForShape(outputResolved.resolvedId()); } - - protected CodeBlock dafnyDeclare(ShapeId targetId) { - return CodeBlock.of("$T $L = $L", - subject.dafnyNameResolver.typeForShape(targetId), - DAFNY_VAR, - NATIVE_VAR); + TypeName failure = subject.dafnyNameResolver.abstractClassForError(); + //TODO: handle operation specific errors? + TypeName result = Dafny.asDafnyResult(success, failure); + // if operation takes an argument + if (!inputResolved.resolvedId().equals(SMITHY_API_UNIT)) { + // call with that argument in dafny + method.addStatement( + "$T $L = this.$L.$L($L)", + result, + RESULT_VAR, + INTERFACE_FIELD, + operationName, + DAFNY_VAR + ); + } else { + // call with no args + method.addStatement( + "$T $L = this.$L.$L()", + result, + RESULT_VAR, + INTERFACE_FIELD, + operationName + ); } + // Handle Failure + method.addCode(ifFailure()); - protected CodeBlock dafnyDeclareGetImpl(ShapeId targetId) { - return CodeBlock.of("$L.impl()", dafnyDeclare(targetId)); + // if operation is void + if (outputResolved.resolvedId().equals(SMITHY_API_UNIT)) { + return method.build(); } - - protected CodeBlock ifFailure() { - return CodeBlock.builder() - .beginControlFlow("if ($L.is_Failure())", RESULT_VAR) - .addStatement("throw $T.Error($L.dtor_error())", - toNativeClassName, RESULT_VAR) - .endControlFlow() - .build(); + Shape outputShape = subject.model.expectShape(outputResolved.resolvedId()); + // if resolvedOutput is a Service or Resource not in AWS SDK Namespace + if ( + (outputShape.isServiceShape() || outputShape.isResourceShape()) && + !AwsSdkNameResolverHelpers.isInAwsSdkNamespace( + outputResolved.resolvedId() + ) + ) { + // if operation outputs a non-AWS Service/Resource, wrap result with Shim + method.addStatement( + "return $L", + subject.wrapWithShim( + outputResolved.resolvedId(), + CodeBlock.of("$L.dtor_value()", RESULT_VAR) + ) + ); + return method.build(); } + final Shape naiveShape = subject.model.expectShape( + outputResolved.naiveId() + ); + final MethodReference toNativeMethod = + subject.toNativeLibrary.conversionMethodReference(naiveShape); + // else convert success to native and return + method.addStatement( + "return $L($L.dtor_value())", + toNativeMethod.asNormalReference(), + RESULT_VAR + ); + return method.build(); + } + + // If it is known the Shape cannot have a positional trait, + // then the "targetId" and the "shapeId" are the same. + protected CodeBlock dafnyDeclareAndConvert(ShapeId shapeId) { + return dafnyDeclareAndConvert(new ResolvedShapeId(shapeId, shapeId)); + } + + // Positional complicates everything. + // The types need to be looked up by targetId. + // But The converters are named after the shapeId. + protected CodeBlock dafnyDeclareAndConvert(ResolvedShapeId resolvedShape) { + final ShapeId targetId = resolvedShape.resolvedId(); + final Shape naiveShape = subject.model.expectShape(resolvedShape.naiveId()); + final MethodReference toDafnyMethod = + subject.toDafnyLibrary.conversionMethodReference(naiveShape); + return CodeBlock.of( + "$T $L = $L($L)", + subject.dafnyNameResolver.typeForShape(targetId), + DAFNY_VAR, + toDafnyMethod.asNormalReference(), + NATIVE_VAR + ); + } + + protected CodeBlock dafnyDeclare(ShapeId targetId) { + return CodeBlock.of( + "$T $L = $L", + subject.dafnyNameResolver.typeForShape(targetId), + DAFNY_VAR, + NATIVE_VAR + ); + } + + protected CodeBlock dafnyDeclareGetImpl(ShapeId targetId) { + return CodeBlock.of("$L.impl()", dafnyDeclare(targetId)); + } + + protected CodeBlock ifFailure() { + return CodeBlock + .builder() + .beginControlFlow("if ($L.is_Failure())", RESULT_VAR) + .addStatement( + "throw $T.Error($L.dtor_error())", + toNativeClassName, + RESULT_VAR + ) + .endControlFlow() + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/TestJavaLibrary.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/TestJavaLibrary.java index afe33cd259..4c34b7b725 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/TestJavaLibrary.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/TestJavaLibrary.java @@ -5,28 +5,33 @@ import java.nio.file.Path; import java.util.LinkedHashMap; import java.util.Map; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import software.amazon.polymorph.smithydafny.DafnyVersion; import software.amazon.polymorph.smithyjava.generator.library.shims.TestServiceShim; import software.amazon.polymorph.utils.TokenTree; - import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.ServiceShape; public class TestJavaLibrary extends JavaLibrary { - @SuppressWarnings("unused") - private static final Logger LOGGER = LoggerFactory.getLogger(TestJavaLibrary.class); - public TestJavaLibrary(Model model, ServiceShape serviceShape, AwsSdkVersion sdkVersion, DafnyVersion dafnyVersion) { - super(model, serviceShape, sdkVersion, dafnyVersion); - } + @SuppressWarnings("unused") + private static final Logger LOGGER = LoggerFactory.getLogger( + TestJavaLibrary.class + ); + + public TestJavaLibrary( + Model model, + ServiceShape serviceShape, + AwsSdkVersion sdkVersion, + DafnyVersion dafnyVersion + ) { + super(model, serviceShape, sdkVersion, dafnyVersion); + } - @Override - public Map generate() { - TestServiceShim shim = new TestServiceShim(this, this.serviceShape); - return new LinkedHashMap<>(shim.generate()); - } + @Override + public Map generate() { + TestServiceShim shim = new TestServiceShim(this, this.serviceShape); + return new LinkedHashMap<>(shim.generate()); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ToDafnyLibrary.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ToDafnyLibrary.java index b29da4c50b..cbc0a47cf7 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ToDafnyLibrary.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ToDafnyLibrary.java @@ -2,6 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.library; +import static software.amazon.smithy.utils.StringUtils.capitalize; +import static software.amazon.smithy.utils.StringUtils.uncapitalize; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; @@ -10,25 +13,21 @@ import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import com.squareup.javapoet.WildcardTypeName; - import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.stream.Collectors; - import javax.lang.model.element.Modifier; - import software.amazon.polymorph.smithyjava.MethodReference; import software.amazon.polymorph.smithyjava.generator.ToDafny; -import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; -import software.amazon.polymorph.traits.PositionalTrait; -import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; import software.amazon.polymorph.smithyjava.nameresolver.Native; import software.amazon.polymorph.smithyjava.unmodeled.CollectionOfErrors; import software.amazon.polymorph.smithyjava.unmodeled.OpaqueError; - +import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; +import software.amazon.polymorph.traits.PositionalTrait; +import software.amazon.polymorph.utils.ModelUtils; import software.amazon.smithy.model.shapes.MemberShape; import software.amazon.smithy.model.shapes.ResourceShape; import software.amazon.smithy.model.shapes.ServiceShape; @@ -37,9 +36,6 @@ import software.amazon.smithy.model.shapes.ShapeType; import software.amazon.smithy.model.shapes.StructureShape; -import static software.amazon.smithy.utils.StringUtils.capitalize; -import static software.amazon.smithy.utils.StringUtils.uncapitalize; - /** * ToDafnyLibrary generates ToDafny, * a helper class for the Java Library's Shim.

@@ -54,199 +50,295 @@ * */ public class ToDafnyLibrary extends ToDafny { - static final MethodReference DAFNY_UTF8_BYTES = new MethodReference(COMMON_TO_DAFNY_SIMPLE, "DafnyUtf8Bytes"); - // Hack to override CodegenSubject - // See code comment on ModelCodegen for details. - final JavaLibrary subject; - public static ClassName className(JavaLibrary javaLibrary) { - return ClassName.get(javaLibrary.packageName, TO_DAFNY); - } + static final MethodReference DAFNY_UTF8_BYTES = new MethodReference( + COMMON_TO_DAFNY_SIMPLE, + "DafnyUtf8Bytes" + ); + // Hack to override CodegenSubject + // See code comment on ModelCodegen for details. + final JavaLibrary subject; - public ToDafnyLibrary(JavaLibrary javaLibrary) { - super(javaLibrary, className(javaLibrary)); - this.subject = javaLibrary; - } + public static ClassName className(JavaLibrary javaLibrary) { + return ClassName.get(javaLibrary.packageName, TO_DAFNY); + } - @Override - public Set javaFiles() { - JavaFile.Builder builder = JavaFile - .builder(thisClassName.packageName(), toDafny()); - return Collections.singleton(builder.build()); - } + public ToDafnyLibrary(JavaLibrary javaLibrary) { + super(javaLibrary, className(javaLibrary)); + this.subject = javaLibrary; + } - TypeSpec toDafny() { - ArrayList toDafnyMethods = new ArrayList<>(); - // NativeError (really, any Error in the service) - toDafnyMethods.add(runtimeException()); - // OpaqueError - toDafnyMethods.add(opaqueError()); - // CollectionError - toDafnyMethods.add(collectionError()); - // Structures - subject.getStructuresInServiceNamespace().stream() - .map(this::modeledStructure).forEachOrdered(toDafnyMethods::add); - // Modeled exception classes - subject.getErrorsInServiceNamespace().stream() - .map(this::modeledError).forEachOrdered(toDafnyMethods::add); - // Enums - subject.getEnumsInServiceNamespace().stream() - .map(this::modeledEnum).forEachOrdered(toDafnyMethods::add); - // Unions - subject.getUnionsInServiceNamespace().stream() - .map(this::modeledUnion).forEachOrdered(toDafnyMethods::add); - // Lists - subject.getListsInServiceNamespace().stream() - .map(this::modeledList).forEachOrdered(toDafnyMethods::add); - // Sets - subject.getSetsInServiceNamespace().stream() - .map(this::modeledSet).forEachOrdered(toDafnyMethods::add); - // Maps - subject.getMapsInServiceNamespace().stream() - .map(this::modeledMap).forEachOrdered(toDafnyMethods::add); - // Resources - subject.getResourcesInServiceNamespace().stream() - .map(this::modeledResource).forEachOrdered(toDafnyMethods::add); - // The Service, it's self - toDafnyMethods.add(modeledService(subject.serviceShape)); - return TypeSpec.classBuilder(thisClassName) - .addModifiers(Modifier.PUBLIC) - .addMethods(toDafnyMethods) - .build(); - } + @Override + public Set javaFiles() { + JavaFile.Builder builder = JavaFile.builder( + thisClassName.packageName(), + toDafny() + ); + return Collections.singleton(builder.build()); + } - // Converts any subclass of RuntimeException to the correct Dafny Error, - // or casts it as an OpaqueError. - MethodSpec runtimeException() { - TypeName dafnyError = subject.dafnyNameResolver.abstractClassForError(); - ClassName runtimeException = ClassName.get(RuntimeException.class); - MethodSpec.Builder method = MethodSpec.methodBuilder("Error") - .returns(dafnyError) - .addModifiers(PUBLIC_STATIC) - .addParameter(runtimeException, VAR_INPUT); - List allNativeErrors = subject.getErrorsInServiceNamespace().stream() - .map(subject.nativeNameResolver::classNameForStructure) - .collect(Collectors.toCollection(ArrayList::new)); - allNativeErrors.add(OpaqueError.nativeClassName(subject.nativeNameResolver.modelPackage)); - allNativeErrors.add(CollectionOfErrors.nativeClassName(subject.nativeNameResolver.modelPackage)); - allNativeErrors.forEach(errorClassName -> - method.beginControlFlow("if ($L instanceof $T)", VAR_INPUT, errorClassName) - .addStatement("return $T.Error(($T) $L)", thisClassName, errorClassName, VAR_INPUT) - .endControlFlow() - ); - return method - .addStatement("return $T.create_Opaque($L)", dafnyError, VAR_INPUT) - .build(); - } + TypeSpec toDafny() { + ArrayList toDafnyMethods = new ArrayList<>(); + // NativeError (really, any Error in the service) + toDafnyMethods.add(runtimeException()); + // OpaqueError + toDafnyMethods.add(opaqueError()); + // CollectionError + toDafnyMethods.add(collectionError()); + // Structures + subject + .getStructuresInServiceNamespace() + .stream() + .map(this::modeledStructure) + .forEachOrdered(toDafnyMethods::add); + // Modeled exception classes + subject + .getErrorsInServiceNamespace() + .stream() + .map(this::modeledError) + .forEachOrdered(toDafnyMethods::add); + // Enums + subject + .getEnumsInServiceNamespace() + .stream() + .map(this::modeledEnum) + .forEachOrdered(toDafnyMethods::add); + // Unions + subject + .getUnionsInServiceNamespace() + .stream() + .map(this::modeledUnion) + .forEachOrdered(toDafnyMethods::add); + // Lists + subject + .getListsInServiceNamespace() + .stream() + .map(this::modeledList) + .forEachOrdered(toDafnyMethods::add); + // Sets + subject + .getSetsInServiceNamespace() + .stream() + .map(this::modeledSet) + .forEachOrdered(toDafnyMethods::add); + // Maps + subject + .getMapsInServiceNamespace() + .stream() + .map(this::modeledMap) + .forEachOrdered(toDafnyMethods::add); + // Resources + subject + .getResourcesInServiceNamespace() + .stream() + .map(this::modeledResource) + .forEachOrdered(toDafnyMethods::add); + // The Service, it's self + toDafnyMethods.add(modeledService(subject.serviceShape)); + return TypeSpec + .classBuilder(thisClassName) + .addModifiers(Modifier.PUBLIC) + .addMethods(toDafnyMethods) + .build(); + } - MethodSpec opaqueError() { - TypeName dafnyError = subject.dafnyNameResolver.abstractClassForError(); - ClassName opaqueError = OpaqueError.nativeClassName(subject.nativeNameResolver.modelPackage); - return MethodSpec.methodBuilder("Error") - .returns(dafnyError) - .addModifiers(PUBLIC_STATIC) - .addParameter(opaqueError, VAR_INPUT) - .addStatement("return $T.create_Opaque($L.obj())", dafnyError, VAR_INPUT) - .build(); - } + // Converts any subclass of RuntimeException to the correct Dafny Error, + // or casts it as an OpaqueError. + MethodSpec runtimeException() { + TypeName dafnyError = subject.dafnyNameResolver.abstractClassForError(); + ClassName runtimeException = ClassName.get(RuntimeException.class); + MethodSpec.Builder method = MethodSpec + .methodBuilder("Error") + .returns(dafnyError) + .addModifiers(PUBLIC_STATIC) + .addParameter(runtimeException, VAR_INPUT); + List allNativeErrors = subject + .getErrorsInServiceNamespace() + .stream() + .map(subject.nativeNameResolver::classNameForStructure) + .collect(Collectors.toCollection(ArrayList::new)); + allNativeErrors.add( + OpaqueError.nativeClassName(subject.nativeNameResolver.modelPackage) + ); + allNativeErrors.add( + CollectionOfErrors.nativeClassName( + subject.nativeNameResolver.modelPackage + ) + ); + allNativeErrors.forEach(errorClassName -> + method + .beginControlFlow("if ($L instanceof $T)", VAR_INPUT, errorClassName) + .addStatement( + "return $T.Error(($T) $L)", + thisClassName, + errorClassName, + VAR_INPUT + ) + .endControlFlow() + ); + return method + .addStatement("return $T.create_Opaque($L)", dafnyError, VAR_INPUT) + .build(); + } - MethodSpec collectionError() { - ClassName dafnyError = subject.dafnyNameResolver.abstractClassForError(); - ClassName nativeError = CollectionOfErrors.nativeClassName(subject.nativeNameResolver.modelPackage); - ParameterizedTypeName listType = ParameterizedTypeName.get( - software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_SEQUENCE_CLASS_NAME, - WildcardTypeName.subtypeOf(dafnyError) - ); - CodeBlock listConverter = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(ShapeType.LIST).asNormalReference(); - MethodReference errorTypeDescriptor = new MethodReference( - dafnyError, - "_typeDescriptor"); - TypeName messageType = subject.dafnyNameResolver.typeForShape(ShapeId.fromParts("smithy.api", "String")); - CodeBlock messageConverter = SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(ShapeType.STRING).asNormalReference(); - return MethodSpec.methodBuilder("Error") - .returns(dafnyError) - .addModifiers(PUBLIC_STATIC) - .addParameter(nativeError, VAR_INPUT) - .addStatement( - "$T list = $L(\n$L.list(), \n$T::Error, \n$L())", - listType, listConverter, VAR_INPUT, thisClassName, errorTypeDescriptor.asNormalReference() - ) - .addStatement("$T message = $L($L.getMessage())", messageType, messageConverter, VAR_INPUT) - .addStatement("return $T.create_CollectionOfErrors(list, message)", dafnyError) - .build(); - } + MethodSpec opaqueError() { + TypeName dafnyError = subject.dafnyNameResolver.abstractClassForError(); + ClassName opaqueError = OpaqueError.nativeClassName( + subject.nativeNameResolver.modelPackage + ); + return MethodSpec + .methodBuilder("Error") + .returns(dafnyError) + .addModifiers(PUBLIC_STATIC) + .addParameter(opaqueError, VAR_INPUT) + .addStatement("return $T.create_Opaque($L.obj())", dafnyError, VAR_INPUT) + .build(); + } - @Override - protected MethodSpec modeledStructure( - final StructureShape structureShape - ) { - if (structureShape.hasTrait(PositionalTrait.class)) { - return positionalStructure(structureShape); - } - return super.modeledStructure(structureShape); - } + MethodSpec collectionError() { + ClassName dafnyError = subject.dafnyNameResolver.abstractClassForError(); + ClassName nativeError = CollectionOfErrors.nativeClassName( + subject.nativeNameResolver.modelPackage + ); + ParameterizedTypeName listType = ParameterizedTypeName.get( + software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_SEQUENCE_CLASS_NAME, + WildcardTypeName.subtypeOf(dafnyError) + ); + CodeBlock listConverter = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(ShapeType.LIST) + .asNormalReference(); + MethodReference errorTypeDescriptor = new MethodReference( + dafnyError, + "_typeDescriptor" + ); + TypeName messageType = subject.dafnyNameResolver.typeForShape( + ShapeId.fromParts("smithy.api", "String") + ); + CodeBlock messageConverter = SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(ShapeType.STRING) + .asNormalReference(); + return MethodSpec + .methodBuilder("Error") + .returns(dafnyError) + .addModifiers(PUBLIC_STATIC) + .addParameter(nativeError, VAR_INPUT) + .addStatement( + "$T list = $L(\n$L.list(), \n$T::Error, \n$L())", + listType, + listConverter, + VAR_INPUT, + thisClassName, + errorTypeDescriptor.asNormalReference() + ) + .addStatement( + "$T message = $L($L.getMessage())", + messageType, + messageConverter, + VAR_INPUT + ) + .addStatement( + "return $T.create_CollectionOfErrors(list, message)", + dafnyError + ) + .build(); + } - protected MethodSpec positionalStructure(StructureShape shape) { - final MemberShape onlyMember = PositionalTrait.onlyMember(shape); - final ShapeId onlyMemberId = onlyMember.toShapeId(); - final String methodName = capitalize(shape.getId().getName()); - final TypeName inputType = subject.nativeNameResolver.typeForShape(onlyMemberId); - final TypeName outputType = subject.dafnyNameResolver.typeForShape(onlyMemberId); - MethodSpec.Builder builder = MethodSpec - .methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .returns(outputType) - .addParameter(inputType, VAR_INPUT); - CodeBlock variable = CodeBlock.of("$L", uncapitalize(onlyMember.getMemberName())); - builder.addStatement(memberDeclaration(onlyMember, variable)); - builder.addStatement(memberConvertAndAssign(onlyMember, variable, CodeBlock.of("$L", VAR_INPUT))); - builder.addStatement("return $L", variable); - return builder.build(); + @Override + protected MethodSpec modeledStructure(final StructureShape structureShape) { + if (structureShape.hasTrait(PositionalTrait.class)) { + return positionalStructure(structureShape); } + return super.modeledStructure(structureShape); + } - protected MethodSpec modeledResource(ResourceShape shape) { - final String methodName = capitalize(shape.getId().getName()); - return MethodSpec - .methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .returns(Dafny.interfaceForResource(shape)) - .addParameter(Native.classNameForResourceInterface(shape), VAR_INPUT) - .addStatement("return $L.impl()", subject.wrapWithShim(shape.getId(), CodeBlock.of(VAR_INPUT))) - .build(); - } + protected MethodSpec positionalStructure(StructureShape shape) { + final MemberShape onlyMember = PositionalTrait.onlyMember(shape); + final ShapeId onlyMemberId = onlyMember.toShapeId(); + final String methodName = capitalize(shape.getId().getName()); + final TypeName inputType = subject.nativeNameResolver.typeForShape( + onlyMemberId + ); + final TypeName outputType = subject.dafnyNameResolver.typeForShape( + onlyMemberId + ); + MethodSpec.Builder builder = MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .returns(outputType) + .addParameter(inputType, VAR_INPUT); + CodeBlock variable = CodeBlock.of( + "$L", + uncapitalize(onlyMember.getMemberName()) + ); + builder.addStatement(memberDeclaration(onlyMember, variable)); + builder.addStatement( + memberConvertAndAssign( + onlyMember, + variable, + CodeBlock.of("$L", VAR_INPUT) + ) + ); + builder.addStatement("return $L", variable); + return builder.build(); + } - protected MethodSpec modeledService(ServiceShape shape) { - final String methodName = capitalize(shape.getId().getName()); - return MethodSpec - .methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .returns(Dafny.interfaceForService(shape)) - .addParameter(Native.classNameForInterfaceOrLocalService(shape, subject.sdkVersion), VAR_INPUT) - .addStatement("return $L.impl()", CodeBlock.of(VAR_INPUT)) - .build(); - } + protected MethodSpec modeledResource(ResourceShape shape) { + final String methodName = capitalize(shape.getId().getName()); + return MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .returns(Dafny.interfaceForResource(shape)) + .addParameter(Native.classNameForResourceInterface(shape), VAR_INPUT) + .addStatement( + "return $L.impl()", + subject.wrapWithShim(shape.getId(), CodeBlock.of(VAR_INPUT)) + ) + .build(); + } - /** For Library structure members, the getter is `un-capitalized member name`. */ - @Override - protected CodeBlock getMember(CodeBlock variableName, MemberShape memberShape) { - return CodeBlock.of("$L.$L()", variableName, memberShape.getMemberName()); - } + protected MethodSpec modeledService(ServiceShape shape) { + final String methodName = capitalize(shape.getId().getName()); + return MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .returns(Dafny.interfaceForService(shape)) + .addParameter( + Native.classNameForInterfaceOrLocalService(shape, subject.sdkVersion), + VAR_INPUT + ) + .addStatement("return $L.impl()", CodeBlock.of(VAR_INPUT)) + .build(); + } + + /** For Library structure members, the getter is `un-capitalized member name`. */ + @Override + protected CodeBlock getMember( + CodeBlock variableName, + MemberShape memberShape + ) { + return CodeBlock.of("$L.$L()", variableName, memberShape.getMemberName()); + } - // Reference & Positional often mask Service or Resource shapes - // that can be in other namespaces. - // This override simplifies their lookup. - @Override - public MethodReference conversionMethodReference(Shape shape) { - ModelUtils.ResolvedShapeId resolvedShapeId = ModelUtils.resolveShape(shape.getId(),subject.model ); - Shape resolvedShape = subject.model.expectShape(resolvedShapeId.resolvedId()); - if (resolvedShape.isServiceShape() || resolvedShape.isResourceShape()) { - return super.nonSimpleConversionMethodReference(resolvedShape); - } - // If the target has the dafnyUtf8Bytes trait, - // going to Dafny, the Strings need to be converted to Bytes - if (resolvedShape.hasTrait(DafnyUtf8BytesTrait.class)) { - return DAFNY_UTF8_BYTES; - } - return super.conversionMethodReference(shape); + // Reference & Positional often mask Service or Resource shapes + // that can be in other namespaces. + // This override simplifies their lookup. + @Override + public MethodReference conversionMethodReference(Shape shape) { + ModelUtils.ResolvedShapeId resolvedShapeId = ModelUtils.resolveShape( + shape.getId(), + subject.model + ); + Shape resolvedShape = subject.model.expectShape( + resolvedShapeId.resolvedId() + ); + if (resolvedShape.isServiceShape() || resolvedShape.isResourceShape()) { + return super.nonSimpleConversionMethodReference(resolvedShape); + } + // If the target has the dafnyUtf8Bytes trait, + // going to Dafny, the Strings need to be converted to Bytes + if (resolvedShape.hasTrait(DafnyUtf8BytesTrait.class)) { + return DAFNY_UTF8_BYTES; } + return super.conversionMethodReference(shape); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ToNativeLibrary.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ToNativeLibrary.java index d66b6b4541..2cec40d77c 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ToNativeLibrary.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/ToNativeLibrary.java @@ -2,35 +2,35 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.library; +import static software.amazon.polymorph.smithyjava.nameresolver.Dafny.datatypeConstructorIs; +import static software.amazon.polymorph.smithyjava.nameresolver.Dafny.datatypeDeconstructor; +import static software.amazon.smithy.utils.StringUtils.capitalize; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; - import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; - import javax.lang.model.element.Modifier; - import software.amazon.polymorph.smithydafny.DafnyNameResolver; import software.amazon.polymorph.smithyjava.MethodReference; import software.amazon.polymorph.smithyjava.generator.ToNative; -import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; -import software.amazon.polymorph.traits.LocalServiceTrait; -import software.amazon.polymorph.traits.PositionalTrait; -import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; import software.amazon.polymorph.smithyjava.nameresolver.Native; import software.amazon.polymorph.smithyjava.unmodeled.CollectionOfErrors; import software.amazon.polymorph.smithyjava.unmodeled.OpaqueError; +import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; import software.amazon.polymorph.traits.ExtendableTrait; - +import software.amazon.polymorph.traits.LocalServiceTrait; +import software.amazon.polymorph.traits.PositionalTrait; +import software.amazon.polymorph.utils.ModelUtils; import software.amazon.smithy.model.shapes.MemberShape; import software.amazon.smithy.model.shapes.ResourceShape; import software.amazon.smithy.model.shapes.ServiceShape; @@ -39,10 +39,6 @@ import software.amazon.smithy.model.shapes.ShapeType; import software.amazon.smithy.model.shapes.StructureShape; -import static software.amazon.polymorph.smithyjava.nameresolver.Dafny.datatypeConstructorIs; -import static software.amazon.polymorph.smithyjava.nameresolver.Dafny.datatypeDeconstructor; -import static software.amazon.smithy.utils.StringUtils.capitalize; - /** * ToNativeLibrary generates ToNative, * a helper class for the Java Library's Shim.

@@ -57,252 +53,367 @@ * */ public class ToNativeLibrary extends ToNative { - static final MethodReference DAFNY_UTF8_BYTES = new MethodReference(COMMON_TO_NATIVE_SIMPLE, "DafnyUtf8Bytes"); - // Hack to override CodegenSubject - // See code comment on ModelCodegen for details. - final JavaLibrary subject; - public static ClassName className(JavaLibrary javaLibrary) { - return ClassName.get(javaLibrary.packageName, TO_NATIVE); - } + static final MethodReference DAFNY_UTF8_BYTES = new MethodReference( + COMMON_TO_NATIVE_SIMPLE, + "DafnyUtf8Bytes" + ); + // Hack to override CodegenSubject + // See code comment on ModelCodegen for details. + final JavaLibrary subject; - public ToNativeLibrary(JavaLibrary javaLibrary) { - super(javaLibrary, className(javaLibrary)); - this.subject = javaLibrary; - } + public static ClassName className(JavaLibrary javaLibrary) { + return ClassName.get(javaLibrary.packageName, TO_NATIVE); + } - @Override - public Set javaFiles() { - JavaFile.Builder builder = JavaFile - .builder(thisClassName.packageName(), toNative()); - return Collections.singleton(builder.build()); - } + public ToNativeLibrary(JavaLibrary javaLibrary) { + super(javaLibrary, className(javaLibrary)); + this.subject = javaLibrary; + } - TypeSpec toNative() { - ArrayList toNativeMethods = new ArrayList<>(); - // OpaqueError - toNativeMethods.add(opaqueError()); - // CollectionError - toNativeMethods.add(collectionError()); - // Modeled exception classes - subject.getErrorsInServiceNamespace().stream() - .map(this::modeledError).forEachOrdered(toNativeMethods::add); - // Any Error - toNativeMethods.add(dafnyError()); - // Structures - subject.getStructuresInServiceNamespace().stream() - .map(this::modeledStructure).forEachOrdered(toNativeMethods::add); - // Enums - subject.getEnumsInServiceNamespace().stream() - .map(this::modeledEnum).forEachOrdered(toNativeMethods::add); - // Unions - subject.getUnionsInServiceNamespace().stream() - .map(this::modeledUnion).forEachOrdered(toNativeMethods::add); - // Lists - subject.getListsInServiceNamespace().stream() - .map(this::modeledList).forEachOrdered(toNativeMethods::add); - // Sets - subject.getSetsInServiceNamespace().stream() - .map(this::modeledSet).forEachOrdered(toNativeMethods::add); - // Maps - subject.getMapsInServiceNamespace().stream() - .map(this::modeledMap).forEachOrdered(toNativeMethods::add); - // Resources - subject.getResourcesInServiceNamespace().stream() - .map(this::modeledResource).forEachOrdered(toNativeMethods::add); - // The Service, it's self - toNativeMethods.add(modeledService(subject.serviceShape)); - return TypeSpec.classBuilder(thisClassName) - .addModifiers(Modifier.PUBLIC) - .addMethods(toNativeMethods) - .build(); - } + @Override + public Set javaFiles() { + JavaFile.Builder builder = JavaFile.builder( + thisClassName.packageName(), + toNative() + ); + return Collections.singleton(builder.build()); + } - MethodSpec opaqueError() { - ClassName inputType = subject.dafnyNameResolver.classForDatatypeConstructor("Error", "Opaque"); - ClassName returnType = OpaqueError.nativeClassName(subject.modelPackageName); - MethodSpec.Builder method = super.initializeErrorMethodSpec(inputType, returnType); - method = super.createNativeBuilder(method, returnType); - // Set Value - method.addStatement("$L.obj($L.$L)", NATIVE_BUILDER, VAR_INPUT, datatypeDeconstructor("obj")); - // Build and Return - return super.buildAndReturn(method); - } + TypeSpec toNative() { + ArrayList toNativeMethods = new ArrayList<>(); + // OpaqueError + toNativeMethods.add(opaqueError()); + // CollectionError + toNativeMethods.add(collectionError()); + // Modeled exception classes + subject + .getErrorsInServiceNamespace() + .stream() + .map(this::modeledError) + .forEachOrdered(toNativeMethods::add); + // Any Error + toNativeMethods.add(dafnyError()); + // Structures + subject + .getStructuresInServiceNamespace() + .stream() + .map(this::modeledStructure) + .forEachOrdered(toNativeMethods::add); + // Enums + subject + .getEnumsInServiceNamespace() + .stream() + .map(this::modeledEnum) + .forEachOrdered(toNativeMethods::add); + // Unions + subject + .getUnionsInServiceNamespace() + .stream() + .map(this::modeledUnion) + .forEachOrdered(toNativeMethods::add); + // Lists + subject + .getListsInServiceNamespace() + .stream() + .map(this::modeledList) + .forEachOrdered(toNativeMethods::add); + // Sets + subject + .getSetsInServiceNamespace() + .stream() + .map(this::modeledSet) + .forEachOrdered(toNativeMethods::add); + // Maps + subject + .getMapsInServiceNamespace() + .stream() + .map(this::modeledMap) + .forEachOrdered(toNativeMethods::add); + // Resources + subject + .getResourcesInServiceNamespace() + .stream() + .map(this::modeledResource) + .forEachOrdered(toNativeMethods::add); + // The Service, it's self + toNativeMethods.add(modeledService(subject.serviceShape)); + return TypeSpec + .classBuilder(thisClassName) + .addModifiers(Modifier.PUBLIC) + .addMethods(toNativeMethods) + .build(); + } - MethodSpec collectionError() { - ClassName inputType = subject.dafnyNameResolver.classForDatatypeConstructor("Error", "CollectionOfErrors"); - ClassName returnType = CollectionOfErrors.nativeClassName(subject.modelPackageName); - CodeBlock listConverter = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(ShapeType.LIST).asNormalReference(); - CodeBlock messageConverter = SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE.get(ShapeType.STRING).asNormalReference(); - MethodSpec.Builder method = super.initializeErrorMethodSpec(inputType, returnType); - super.createNativeBuilder(method, returnType); - // Set Values - method - .addStatement("$L.list(\n$L(\n$L.$L, \n$T::Error))", - NATIVE_BUILDER, listConverter, VAR_INPUT, datatypeDeconstructor("list"), thisClassName) - .addStatement("$L.message($L($L.$L))", - NATIVE_BUILDER, messageConverter, VAR_INPUT, datatypeDeconstructor("message")); - // Build and Return - return super.buildAndReturn(method); - } + MethodSpec opaqueError() { + ClassName inputType = subject.dafnyNameResolver.classForDatatypeConstructor( + "Error", + "Opaque" + ); + ClassName returnType = OpaqueError.nativeClassName( + subject.modelPackageName + ); + MethodSpec.Builder method = super.initializeErrorMethodSpec( + inputType, + returnType + ); + method = super.createNativeBuilder(method, returnType); + // Set Value + method.addStatement( + "$L.obj($L.$L)", + NATIVE_BUILDER, + VAR_INPUT, + datatypeDeconstructor("obj") + ); + // Build and Return + return super.buildAndReturn(method); + } - MethodSpec dafnyError() { - ClassName inputType = subject.dafnyNameResolver.abstractClassForError(); - ClassName returnType = ClassName.get(RuntimeException.class); - MethodSpec.Builder method = super.initializeErrorMethodSpec(inputType, returnType); - // We need a list of ``. - // We have the logic exposed to look up the ClassName, - // which, as a string, will be .Error_. - // We get the "simpleName" (i.e.: Error_), - // and, finally, replace "Error_" with nothing, thus getting just "". - List allDafnyErrorConstructors = subject.getErrorsInServiceNamespace().stream() - .map(subject.dafnyNameResolver::classForError) - .map(ClassName::simpleName) - .map(simpleName -> simpleName.replaceFirst("Error_", "")) - .collect(Collectors.toCollection(ArrayList::new)); // We need a mutable list, so we can't use stream().toList() - allDafnyErrorConstructors.add("Opaque"); - allDafnyErrorConstructors.add("CollectionOfErrors"); - allDafnyErrorConstructors.forEach(constructorName -> - method.beginControlFlow("if ($L.$L())", VAR_INPUT, datatypeConstructorIs(constructorName)) - .addStatement( - "return $T.Error(($T) $L)", - thisClassName, - subject.dafnyNameResolver.classForDatatypeConstructor("Error", constructorName), - VAR_INPUT) - .endControlFlow() - ); - // Handle Errors from another service: - LocalServiceTrait localServiceTrait = subject.serviceShape.expectTrait(LocalServiceTrait.class); - if (localServiceTrait.getDependencies() != null) { - localServiceTrait.getDependencies().stream() - .map(subject.model::expectShape) - .map(Shape::asServiceShape) - .filter(Optional::isPresent) - .map(Optional::get) - .forEach(serviceShape -> - { - String serviceName = DafnyNameResolver.moduleNamespace(serviceShape.toShapeId().getNamespace()); - method - .beginControlFlow( - "if ($L.$L())", VAR_INPUT, datatypeConstructorIs(serviceName)) - .addStatement( - "return $T.Error($L.$L)", - ToNative.ToNativeClassNameForShape(serviceShape, subject.sdkVersion), - VAR_INPUT, - datatypeDeconstructor(serviceName)) - .endControlFlow(); - } - ); - } - // If the Error cannot be placed into any of the above, call it opaque and move on - super.createNativeBuilder(method, OpaqueError.nativeClassName(subject.modelPackageName)); - method.addStatement("$L.obj($L)", NATIVE_BUILDER, VAR_INPUT); - return super.buildAndReturn(method); + MethodSpec collectionError() { + ClassName inputType = subject.dafnyNameResolver.classForDatatypeConstructor( + "Error", + "CollectionOfErrors" + ); + ClassName returnType = CollectionOfErrors.nativeClassName( + subject.modelPackageName + ); + CodeBlock listConverter = AGGREGATE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(ShapeType.LIST) + .asNormalReference(); + CodeBlock messageConverter = SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE + .get(ShapeType.STRING) + .asNormalReference(); + MethodSpec.Builder method = super.initializeErrorMethodSpec( + inputType, + returnType + ); + super.createNativeBuilder(method, returnType); + // Set Values + method + .addStatement( + "$L.list(\n$L(\n$L.$L, \n$T::Error))", + NATIVE_BUILDER, + listConverter, + VAR_INPUT, + datatypeDeconstructor("list"), + thisClassName + ) + .addStatement( + "$L.message($L($L.$L))", + NATIVE_BUILDER, + messageConverter, + VAR_INPUT, + datatypeDeconstructor("message") + ); + // Build and Return + return super.buildAndReturn(method); + } + + MethodSpec dafnyError() { + ClassName inputType = subject.dafnyNameResolver.abstractClassForError(); + ClassName returnType = ClassName.get(RuntimeException.class); + MethodSpec.Builder method = super.initializeErrorMethodSpec( + inputType, + returnType + ); + // We need a list of ``. + // We have the logic exposed to look up the ClassName, + // which, as a string, will be .Error_. + // We get the "simpleName" (i.e.: Error_), + // and, finally, replace "Error_" with nothing, thus getting just "". + List allDafnyErrorConstructors = subject + .getErrorsInServiceNamespace() + .stream() + .map(subject.dafnyNameResolver::classForError) + .map(ClassName::simpleName) + .map(simpleName -> simpleName.replaceFirst("Error_", "")) + .collect(Collectors.toCollection(ArrayList::new)); // We need a mutable list, so we can't use stream().toList() + allDafnyErrorConstructors.add("Opaque"); + allDafnyErrorConstructors.add("CollectionOfErrors"); + allDafnyErrorConstructors.forEach(constructorName -> + method + .beginControlFlow( + "if ($L.$L())", + VAR_INPUT, + datatypeConstructorIs(constructorName) + ) + .addStatement( + "return $T.Error(($T) $L)", + thisClassName, + subject.dafnyNameResolver.classForDatatypeConstructor( + "Error", + constructorName + ), + VAR_INPUT + ) + .endControlFlow() + ); + // Handle Errors from another service: + LocalServiceTrait localServiceTrait = subject.serviceShape.expectTrait( + LocalServiceTrait.class + ); + if (localServiceTrait.getDependencies() != null) { + localServiceTrait + .getDependencies() + .stream() + .map(subject.model::expectShape) + .map(Shape::asServiceShape) + .filter(Optional::isPresent) + .map(Optional::get) + .forEach(serviceShape -> { + String serviceName = DafnyNameResolver.moduleNamespace( + serviceShape.toShapeId().getNamespace() + ); + method + .beginControlFlow( + "if ($L.$L())", + VAR_INPUT, + datatypeConstructorIs(serviceName) + ) + .addStatement( + "return $T.Error($L.$L)", + ToNative.ToNativeClassNameForShape( + serviceShape, + subject.sdkVersion + ), + VAR_INPUT, + datatypeDeconstructor(serviceName) + ) + .endControlFlow(); + }); } + // If the Error cannot be placed into any of the above, call it opaque and move on + super.createNativeBuilder( + method, + OpaqueError.nativeClassName(subject.modelPackageName) + ); + method.addStatement("$L.obj($L)", NATIVE_BUILDER, VAR_INPUT); + return super.buildAndReturn(method); + } - @Override - protected MethodSpec modeledStructure(StructureShape structureShape) { - if (structureShape.hasTrait(PositionalTrait.class)) { - return positionalStructure(structureShape); - } - // if this structure does NOT have a positional trait, - // then we can use the abstract's modeledStructure. - return super.modeledStructure(structureShape); + @Override + protected MethodSpec modeledStructure(StructureShape structureShape) { + if (structureShape.hasTrait(PositionalTrait.class)) { + return positionalStructure(structureShape); } + // if this structure does NOT have a positional trait, + // then we can use the abstract's modeledStructure. + return super.modeledStructure(structureShape); + } - protected MethodSpec positionalStructure(StructureShape structureShape) { - final MemberShape onlyMember = PositionalTrait.onlyMember(structureShape); - final ShapeId onlyMemberId = onlyMember.toShapeId(); - final String methodName = capitalize(structureShape.getId().getName()); - final TypeName inputType = subject.dafnyNameResolver.typeForShape(onlyMemberId); - final TypeName returnType = subject.nativeNameResolver.typeForShape(onlyMemberId); - MethodSpec.Builder method = initializeMethodSpec(methodName, inputType, returnType); + protected MethodSpec positionalStructure(StructureShape structureShape) { + final MemberShape onlyMember = PositionalTrait.onlyMember(structureShape); + final ShapeId onlyMemberId = onlyMember.toShapeId(); + final String methodName = capitalize(structureShape.getId().getName()); + final TypeName inputType = subject.dafnyNameResolver.typeForShape( + onlyMemberId + ); + final TypeName returnType = subject.nativeNameResolver.typeForShape( + onlyMemberId + ); + MethodSpec.Builder method = initializeMethodSpec( + methodName, + inputType, + returnType + ); - // Optional and Positional are a weird combo, - // particularly in Java, - // for now, a non-set optional will return null + // Optional and Positional are a weird combo, + // particularly in Java, + // for now, a non-set optional will return null - if (onlyMember.isOptional()) { - // if optional, check if present - method.beginControlFlow("if ($L.is_Some())", VAR_INPUT); - } - // return result of conversion call of member - method.addStatement(returnWithConversionCall(onlyMember)); - if (onlyMember.isOptional()) { - method.endControlFlow(); - // else, optional is empty, return null - method.addStatement(returnNull()); - } - return method.build(); + if (onlyMember.isOptional()) { + // if optional, check if present + method.beginControlFlow("if ($L.is_Some())", VAR_INPUT); + } + // return result of conversion call of member + method.addStatement(returnWithConversionCall(onlyMember)); + if (onlyMember.isOptional()) { + method.endControlFlow(); + // else, optional is empty, return null + method.addStatement(returnNull()); } + return method.build(); + } - protected MethodSpec modeledResource(ResourceShape shape) { - final String methodName = capitalize(shape.getId().getName()); - MethodSpec.Builder method = MethodSpec - .methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .addParameter(Dafny.interfaceForResource(shape), VAR_INPUT) - .returns(Native.classNameForInterfaceOrLocalService(shape, subject.sdkVersion)); + protected MethodSpec modeledResource(ResourceShape shape) { + final String methodName = capitalize(shape.getId().getName()); + MethodSpec.Builder method = MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .addParameter(Dafny.interfaceForResource(shape), VAR_INPUT) + .returns( + Native.classNameForInterfaceOrLocalService(shape, subject.sdkVersion) + ); - if (shape.hasTrait(ExtendableTrait.class)) { - method - .beginControlFlow( - "if ($L instanceof $T.NativeWrapper)", - VAR_INPUT, subject.nativeNameResolver.classNameForResource(shape) - ) - .addStatement( - "return (($T.NativeWrapper) $L)._impl", - subject.nativeNameResolver.classNameForResource(shape), - VAR_INPUT - ) - .endControlFlow(); - } - return method - .addStatement( - "return $L", - subject.wrapWithShim(shape.getId(), CodeBlock.of(VAR_INPUT)) - ) - .build(); + if (shape.hasTrait(ExtendableTrait.class)) { + method + .beginControlFlow( + "if ($L instanceof $T.NativeWrapper)", + VAR_INPUT, + subject.nativeNameResolver.classNameForResource(shape) + ) + .addStatement( + "return (($T.NativeWrapper) $L)._impl", + subject.nativeNameResolver.classNameForResource(shape), + VAR_INPUT + ) + .endControlFlow(); } + return method + .addStatement( + "return $L", + subject.wrapWithShim(shape.getId(), CodeBlock.of(VAR_INPUT)) + ) + .build(); + } - protected MethodSpec modeledService(ServiceShape shape) { - final String methodName = capitalize(shape.getId().getName()); - final ClassName serviceClass = Native.classNameForInterfaceOrLocalService(shape, subject.sdkVersion); - return MethodSpec - .methodBuilder(methodName) - .addModifiers(PUBLIC_STATIC) - .returns(serviceClass) - .addParameter(Dafny.interfaceForService(shape), VAR_INPUT) - .addStatement("return new $T($L)", serviceClass, CodeBlock.of(VAR_INPUT)) - .build(); - } + protected MethodSpec modeledService(ServiceShape shape) { + final String methodName = capitalize(shape.getId().getName()); + final ClassName serviceClass = Native.classNameForInterfaceOrLocalService( + shape, + subject.sdkVersion + ); + return MethodSpec + .methodBuilder(methodName) + .addModifiers(PUBLIC_STATIC) + .returns(serviceClass) + .addParameter(Dafny.interfaceForService(shape), VAR_INPUT) + .addStatement("return new $T($L)", serviceClass, CodeBlock.of(VAR_INPUT)) + .build(); + } - protected CodeBlock returnWithConversionCall(final MemberShape shape) { - CodeBlock memberConversionMethod = conversionMethodReference( - subject.model.expectShape(shape.getTarget()) - ).asNormalReference(); - return CodeBlock.of("return $L($L)", memberConversionMethod, VAR_INPUT); - } + protected CodeBlock returnWithConversionCall(final MemberShape shape) { + CodeBlock memberConversionMethod = conversionMethodReference( + subject.model.expectShape(shape.getTarget()) + ) + .asNormalReference(); + return CodeBlock.of("return $L($L)", memberConversionMethod, VAR_INPUT); + } - protected static CodeBlock returnNull() { - return CodeBlock.of("return null"); - } + protected static CodeBlock returnNull() { + return CodeBlock.of("return null"); + } - // Reference & Positional often mask Service or Resource shapes - // that can be in other namespaces. - // This override simplifies their lookup. - @Override - public MethodReference conversionMethodReference(Shape shape) { - ModelUtils.ResolvedShapeId resolvedShapeId = ModelUtils.resolveShape(shape.toShapeId(), subject.model); - Shape resolvedShape = subject.model.expectShape(resolvedShapeId.resolvedId()); - if (resolvedShape.isServiceShape() || resolvedShape.isResourceShape()) { - return super.nonSimpleConversionMethodReference(resolvedShape); - } - // If the target has the dafnyUtf8Bytes trait, - // going to Dafny, the Strings need to be converted to Bytes - if (resolvedShape.hasTrait(DafnyUtf8BytesTrait.class)) { - return DAFNY_UTF8_BYTES; - } - return super.conversionMethodReference(resolvedShape); + // Reference & Positional often mask Service or Resource shapes + // that can be in other namespaces. + // This override simplifies their lookup. + @Override + public MethodReference conversionMethodReference(Shape shape) { + ModelUtils.ResolvedShapeId resolvedShapeId = ModelUtils.resolveShape( + shape.toShapeId(), + subject.model + ); + Shape resolvedShape = subject.model.expectShape( + resolvedShapeId.resolvedId() + ); + if (resolvedShape.isServiceShape() || resolvedShape.isResourceShape()) { + return super.nonSimpleConversionMethodReference(resolvedShape); + } + // If the target has the dafnyUtf8Bytes trait, + // going to Dafny, the Strings need to be converted to Bytes + if (resolvedShape.hasTrait(DafnyUtf8BytesTrait.class)) { + return DAFNY_UTF8_BYTES; } + return super.conversionMethodReference(resolvedShape); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/NativeWrapper.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/NativeWrapper.java index 863bfa0785..8c50261a14 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/NativeWrapper.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/NativeWrapper.java @@ -2,100 +2,109 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.library.shims; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PROTECTED; +import static javax.lang.model.element.Modifier.STATIC; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeSpec; - import java.util.Set; - -import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; import software.amazon.polymorph.smithyjava.MethodSignature; +import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; import software.amazon.polymorph.smithyjava.modeled.Operation; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ResourceShape; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PROTECTED; -import static javax.lang.model.element.Modifier.STATIC; - public class NativeWrapper extends ResourceShim { - public static ClassName className(ClassName resourceClass) { - return resourceClass.nestedClass("NativeWrapper"); - } + public static ClassName className(ClassName resourceClass) { + return resourceClass.nestedClass("NativeWrapper"); + } - public NativeWrapper(JavaLibrary javaLibrary, ResourceShape targetShape) { - super(javaLibrary, targetShape); - } + public NativeWrapper(JavaLibrary javaLibrary, ResourceShape targetShape) { + super(javaLibrary, targetShape); + } - @Override - public Set javaFiles() { - throw new RuntimeException("NativeWrapper is a nested static class."); - } + @Override + public Set javaFiles() { + throw new RuntimeException("NativeWrapper is a nested static class."); + } - TypeSpec nativeWrapper() { - ClassName className = className(); - TypeSpec.Builder spec =TypeSpec - .classBuilder(className) - // TODO: Verify that the nested class SHOULD BE `PROTECTED` instead of `PRIVATE` - // PR #215 or #196 - .addModifiers(PROTECTED, FINAL, STATIC) - .addSuperinterface(Dafny.interfaceForResource(targetShape)) - // TODO: It MAYBE best to keep the INTERFACE_FIELD PRIVATE, rather than PROTECTED, - // and add getter method. PR #215 or #196 - .addField(interfaceName, INTERFACE_FIELD, PROTECTED, FINAL) - .addMethod(nativeWrapperConstructor()); - getOperationsForTarget().forEach(oShape -> { - spec.addMethod(operation(oShape)); - spec.addMethod(operation_K(oShape)); - }); - return spec.build(); - } + TypeSpec nativeWrapper() { + ClassName className = className(); + TypeSpec.Builder spec = TypeSpec + .classBuilder(className) + // TODO: Verify that the nested class SHOULD BE `PROTECTED` instead of `PRIVATE` + // PR #215 or #196 + .addModifiers(PROTECTED, FINAL, STATIC) + .addSuperinterface(Dafny.interfaceForResource(targetShape)) + // TODO: It MAYBE best to keep the INTERFACE_FIELD PRIVATE, rather than PROTECTED, + // and add getter method. PR #215 or #196 + .addField(interfaceName, INTERFACE_FIELD, PROTECTED, FINAL) + .addMethod(nativeWrapperConstructor()); + getOperationsForTarget() + .forEach(oShape -> { + spec.addMethod(operation(oShape)); + spec.addMethod(operation_K(oShape)); + }); + return spec.build(); + } - private ClassName className() { - return className(thisClassName); - } + private ClassName className() { + return className(thisClassName); + } - MethodSpec nativeWrapperConstructor() { - String paramName = "nativeImpl"; - return MethodSpec - .constructorBuilder() - .addParameter(interfaceName, paramName) - .beginControlFlow("if ($L instanceof $T)", - paramName, subject.nativeNameResolver.typeForShape(targetShape.getId())) - .addStatement("throw new $T($S)", - IllegalArgumentException.class, - "Recursive wrapping is strictly forbidden.") - .endControlFlow() - .addStatement("this.$L = $L", INTERFACE_FIELD, paramName) - .build(); - } + MethodSpec nativeWrapperConstructor() { + String paramName = "nativeImpl"; + return MethodSpec + .constructorBuilder() + .addParameter(interfaceName, paramName) + .beginControlFlow( + "if ($L instanceof $T)", + paramName, + subject.nativeNameResolver.typeForShape(targetShape.getId()) + ) + .addStatement( + "throw new $T($S)", + IllegalArgumentException.class, + "Recursive wrapping is strictly forbidden." + ) + .endControlFlow() + .addStatement("this.$L = $L", INTERFACE_FIELD, paramName) + .build(); + } - @Override - protected MethodSpec operation(OperationShape operationShape) { - return Operation.AsDafny.operation(operationShape, this.subject, this); - } + @Override + protected MethodSpec operation(OperationShape operationShape) { + return Operation.AsDafny.operation(operationShape, this.subject, this); + } - /** - * Polymorph's Smithy-Dafny generates at least two methods for - * operations on Resources, - * one of which has an {@code `} appended to it.

- * When this {@code `} suffix is transpiled to Java, - * it becomes {@code _k}.

- * However, this {@code _k} method MUST NOT be implemented natively.

- * It can only be implemented in Dafny Source, - * and then be transpiled.

- * Hence, we MUST generate this "always throw" method.

- */ - protected MethodSpec operation_K(OperationShape operationShape) { - final MethodSignature signature = Operation.AsDafny.methodSignature(operationShape, true, subject); - MethodSpec.Builder method = signature.method(); - method.addStatement("throw new $T($S)", - ClassName.get(RuntimeException.class), - "Not supported at this time." - ); - return method.build(); - } + /** + * Polymorph's Smithy-Dafny generates at least two methods for + * operations on Resources, + * one of which has an {@code `} appended to it.

+ * When this {@code `} suffix is transpiled to Java, + * it becomes {@code _k}.

+ * However, this {@code _k} method MUST NOT be implemented natively.

+ * It can only be implemented in Dafny Source, + * and then be transpiled.

+ * Hence, we MUST generate this "always throw" method.

+ */ + protected MethodSpec operation_K(OperationShape operationShape) { + final MethodSignature signature = Operation.AsDafny.methodSignature( + operationShape, + true, + subject + ); + MethodSpec.Builder method = signature.method(); + method.addStatement( + "throw new $T($S)", + ClassName.get(RuntimeException.class), + "Not supported at this time." + ); + return method.build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/ResourceShim.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/ResourceShim.java index 33e84a9390..724dad3641 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/ResourceShim.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/ResourceShim.java @@ -2,6 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.library.shims; +import static javax.lang.model.element.Modifier.ABSTRACT; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PUBLIC; +import static software.amazon.smithy.utils.StringUtils.uncapitalize; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.FieldSpec; @@ -9,185 +15,202 @@ import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeSpec; import com.squareup.javapoet.TypeVariableName; - import java.util.LinkedHashSet; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; - +import software.amazon.polymorph.smithyjava.MethodSignature; import software.amazon.polymorph.smithyjava.generator.CodegenSubject; -import software.amazon.polymorph.smithyjava.generator.library.ShimLibrary; -import software.amazon.polymorph.traits.ExtendableTrait; import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; -import software.amazon.polymorph.smithyjava.MethodSignature; +import software.amazon.polymorph.smithyjava.generator.library.ShimLibrary; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; import software.amazon.polymorph.smithyjava.nameresolver.Native; - +import software.amazon.polymorph.traits.ExtendableTrait; import software.amazon.polymorph.traits.JavaDocTrait; import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.ResourceShape; -import static javax.lang.model.element.Modifier.ABSTRACT; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PUBLIC; -import static software.amazon.smithy.utils.StringUtils.uncapitalize; - - public class ResourceShim extends ShimLibrary { - private final static String TYPE_VAR = "I"; - /** Factory Method name. */ - public final static String WRAP_METHOD_NAME = "wrap"; - /** The Resource Shape the Shim wraps. */ - protected final ResourceShape targetShape; - protected final ClassName interfaceName; - /** The class name of the Subject's Shim class. */ - protected final ClassName thisClassName; - protected final boolean extendable; - private final ClassName dafnyType; - private final String argName; - - public ResourceShim(JavaLibrary javaLibrary, ResourceShape targetShape) { - super(javaLibrary); - this.targetShape = targetShape; - this.thisClassName = subject.nativeNameResolver.classNameForResource(targetShape); - this.interfaceName = interfaceName(targetShape, subject.sdkVersion); - this.extendable = targetShape.hasTrait(ExtendableTrait.class); - dafnyType = Dafny.interfaceForResource(this.targetShape); - argName = uncapitalize(dafnyType.simpleName()); - } - private static ClassName interfaceName(ResourceShape shape, CodegenSubject.AwsSdkVersion sdkVersion) { - return Native.classNameForInterfaceOrLocalService(shape, sdkVersion); + private static final String TYPE_VAR = "I"; + /** Factory Method name. */ + public static final String WRAP_METHOD_NAME = "wrap"; + /** The Resource Shape the Shim wraps. */ + protected final ResourceShape targetShape; + protected final ClassName interfaceName; + /** The class name of the Subject's Shim class. */ + protected final ClassName thisClassName; + protected final boolean extendable; + private final ClassName dafnyType; + private final String argName; + + public ResourceShim(JavaLibrary javaLibrary, ResourceShape targetShape) { + super(javaLibrary); + this.targetShape = targetShape; + this.thisClassName = + subject.nativeNameResolver.classNameForResource(targetShape); + this.interfaceName = interfaceName(targetShape, subject.sdkVersion); + this.extendable = targetShape.hasTrait(ExtendableTrait.class); + dafnyType = Dafny.interfaceForResource(this.targetShape); + argName = uncapitalize(dafnyType.simpleName()); + } + + private static ClassName interfaceName( + ResourceShape shape, + CodegenSubject.AwsSdkVersion sdkVersion + ) { + return Native.classNameForInterfaceOrLocalService(shape, sdkVersion); + } + + private TypeVariableName iExtendsInterface() { + return TypeVariableName.get(TYPE_VAR, interfaceName); + } + + @Override + public Set javaFiles() { + LinkedHashSet rtn = new LinkedHashSet<>(2); + rtn.add(JavaFile.builder(thisClassName.packageName(), shim()).build()); + rtn.add( + JavaFile + .builder(thisClassName.packageName(), publicResourceInterface()) + .build() + ); + return rtn; + } + + TypeSpec shim() { + TypeSpec.Builder spec = TypeSpec + .classBuilder(thisClassName) + .addModifiers(PUBLIC, FINAL) + .addField(getField()) + .addSuperinterface(interfaceName) + .addMethod(constructor()) + .addMethod(resourceAsDafny()) + .addMethod(resourceAsNativeInterface()) + .addMethod(impl()); + targetShape + .getTrait(JavaDocTrait.class) + .map(docTrait -> spec.addJavadoc(docTrait.getValue())); + spec.addMethods( + getOperationsForTarget() + .stream() + .map(this::operation) + .collect(Collectors.toList()) + ); + if (extendable) { + NativeWrapper wrapper = new NativeWrapper(subject, targetShape); + spec.addType(wrapper.nativeWrapper()); } - - private TypeVariableName iExtendsInterface() { - return TypeVariableName.get(TYPE_VAR, interfaceName); - } - - @Override - public Set javaFiles() { - LinkedHashSet rtn = new LinkedHashSet<>(2); - rtn.add(JavaFile.builder(thisClassName.packageName(), shim()).build()); - rtn.add(JavaFile.builder(thisClassName.packageName(), publicResourceInterface()).build()); - return rtn; - } - - TypeSpec shim() { - TypeSpec.Builder spec = TypeSpec - .classBuilder(thisClassName) - .addModifiers(PUBLIC, FINAL) - .addField(getField()) - .addSuperinterface(interfaceName) - .addMethod(constructor()) - .addMethod(resourceAsDafny()) - .addMethod(resourceAsNativeInterface()) - .addMethod(impl()); - targetShape.getTrait(JavaDocTrait.class) - .map(docTrait -> spec.addJavadoc(docTrait.getValue())); - spec.addMethods(getOperationsForTarget() - .stream().map(this::operation).collect(Collectors.toList())); - if (extendable) { - NativeWrapper wrapper = new NativeWrapper(subject, targetShape); - spec.addType(wrapper.nativeWrapper()); - } - return spec.build(); - } - - private CodeBlock nonNull() { - return CodeBlock.of("$T.requireNonNull($L, $S)", - Objects.class, - argName, - "Missing value for required argument `%s`" - .formatted(argName)); - } - - private MethodSpec constructor() { - return MethodSpec.constructorBuilder() - .addModifiers(PRIVATE) - .addParameter(dafnyType, argName) - .addStatement(nonNull()) - .addStatement("this.$L = $L", INTERFACE_FIELD, argName) - .build(); - } - - private MethodSpec resourceAsNativeInterface() { - MethodSpec.Builder method = MethodSpec - .methodBuilder(WRAP_METHOD_NAME) - .addModifiers(PUBLIC_STATIC) - .addTypeVariable(iExtendsInterface()) - .addParameter(iExtendsInterface(), argName) - .returns(thisClassName) - .addStatement(nonNull()) - .beginControlFlow( - "if ($L instanceof $L)", - argName, thisClassName) - .addStatement("return (($T) $L)", - thisClassName, argName) - .endControlFlow(); - if (extendable) { - return method - // return Resource.create(new NativeWrapper(iResource)); - .addStatement("return $T.$L(new $T($L))", - thisClassName, WRAP_METHOD_NAME, - NativeWrapper.className(thisClassName), argName) - .build(); - } - return method - .addStatement("throw new $T($S)", - IllegalArgumentException.class, - "Custom implementations of %s are NOT supported at this time." - .formatted(interfaceName)) - .build(); - } - - public MethodSpec resourceAsDafny() { - return MethodSpec - .methodBuilder(WRAP_METHOD_NAME) - .addModifiers(PUBLIC_STATIC) - .addParameter(dafnyType, argName) - .returns(thisClassName) - .addStatement("return new $T($L)", thisClassName, argName) - .build(); - } - - TypeSpec publicResourceInterface() { - TypeSpec.Builder spec = TypeSpec - .interfaceBuilder(interfaceName) - .addModifiers(PUBLIC); - spec.addMethods(getOperationsForTarget() - .stream().sequential().map(this::operationMethodSignature) - .map(MethodSignature::method) - .map(method -> method.addModifiers(PUBLIC, ABSTRACT)) - .map(MethodSpec.Builder::build) - .collect(Collectors.toList())); - return spec.build(); - } - - protected MethodSpec impl() { - return implMethodSignature() - .addModifiers(PUBLIC) - .addStatement("return this.$L", INTERFACE_FIELD) - .build(); - } - - protected MethodSpec.Builder implMethodSignature() { - return MethodSpec.methodBuilder("impl") - .returns(Dafny.interfaceForResource(targetShape)); - } - - - private FieldSpec getField() { - return FieldSpec - .builder(Dafny.interfaceForResource(targetShape), INTERFACE_FIELD) - .addModifiers(PRIVATE_FINAL) - .build(); - } - - protected List getOperationsForTarget() { - return targetShape.getOperations().stream().sorted() - .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) - .collect(Collectors.toList()); + return spec.build(); + } + + private CodeBlock nonNull() { + return CodeBlock.of( + "$T.requireNonNull($L, $S)", + Objects.class, + argName, + "Missing value for required argument `%s`".formatted(argName) + ); + } + + private MethodSpec constructor() { + return MethodSpec + .constructorBuilder() + .addModifiers(PRIVATE) + .addParameter(dafnyType, argName) + .addStatement(nonNull()) + .addStatement("this.$L = $L", INTERFACE_FIELD, argName) + .build(); + } + + private MethodSpec resourceAsNativeInterface() { + MethodSpec.Builder method = MethodSpec + .methodBuilder(WRAP_METHOD_NAME) + .addModifiers(PUBLIC_STATIC) + .addTypeVariable(iExtendsInterface()) + .addParameter(iExtendsInterface(), argName) + .returns(thisClassName) + .addStatement(nonNull()) + .beginControlFlow("if ($L instanceof $L)", argName, thisClassName) + .addStatement("return (($T) $L)", thisClassName, argName) + .endControlFlow(); + if (extendable) { + return method + // return Resource.create(new NativeWrapper(iResource)); + .addStatement( + "return $T.$L(new $T($L))", + thisClassName, + WRAP_METHOD_NAME, + NativeWrapper.className(thisClassName), + argName + ) + .build(); } + return method + .addStatement( + "throw new $T($S)", + IllegalArgumentException.class, + "Custom implementations of %s are NOT supported at this time.".formatted( + interfaceName + ) + ) + .build(); + } + + public MethodSpec resourceAsDafny() { + return MethodSpec + .methodBuilder(WRAP_METHOD_NAME) + .addModifiers(PUBLIC_STATIC) + .addParameter(dafnyType, argName) + .returns(thisClassName) + .addStatement("return new $T($L)", thisClassName, argName) + .build(); + } + + TypeSpec publicResourceInterface() { + TypeSpec.Builder spec = TypeSpec + .interfaceBuilder(interfaceName) + .addModifiers(PUBLIC); + spec.addMethods( + getOperationsForTarget() + .stream() + .sequential() + .map(this::operationMethodSignature) + .map(MethodSignature::method) + .map(method -> method.addModifiers(PUBLIC, ABSTRACT)) + .map(MethodSpec.Builder::build) + .collect(Collectors.toList()) + ); + return spec.build(); + } + + protected MethodSpec impl() { + return implMethodSignature() + .addModifiers(PUBLIC) + .addStatement("return this.$L", INTERFACE_FIELD) + .build(); + } + + protected MethodSpec.Builder implMethodSignature() { + return MethodSpec + .methodBuilder("impl") + .returns(Dafny.interfaceForResource(targetShape)); + } + + private FieldSpec getField() { + return FieldSpec + .builder(Dafny.interfaceForResource(targetShape), INTERFACE_FIELD) + .addModifiers(PRIVATE_FINAL) + .build(); + } + + protected List getOperationsForTarget() { + return targetShape + .getOperations() + .stream() + .sorted() + .map(shapeId -> subject.model.expectShape(shapeId, OperationShape.class)) + .collect(Collectors.toList()); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/ServiceShim.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/ServiceShim.java index 5dcbc47381..724866a5f2 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/ServiceShim.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/ServiceShim.java @@ -2,94 +2,104 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.library.shims; +import static javax.lang.model.element.Modifier.PROTECTED; +import static javax.lang.model.element.Modifier.PUBLIC; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; - import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; - import software.amazon.polymorph.smithyjava.BuildMethod; import software.amazon.polymorph.smithyjava.BuilderMemberSpec; import software.amazon.polymorph.smithyjava.BuilderSpecs; +import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; import software.amazon.polymorph.smithyjava.generator.library.ShimLibrary; +import software.amazon.polymorph.smithyjava.nameresolver.Dafny; import software.amazon.polymorph.traits.JavaDocTrait; import software.amazon.polymorph.traits.LocalServiceTrait; -import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; -import software.amazon.polymorph.smithyjava.nameresolver.Dafny; - import software.amazon.smithy.model.shapes.ServiceShape; -import static javax.lang.model.element.Modifier.PROTECTED; -import static javax.lang.model.element.Modifier.PUBLIC; - public class ServiceShim extends ShimLibrary { - /** The Service Shape the Shim wraps. */ - protected final ServiceShape targetShape; - /** The class name of the Subject's Shim class. */ - protected final ClassName thisClassName; - - public ServiceShim(JavaLibrary javaLibrary, ServiceShape targetShape) { - super(javaLibrary); - this.targetShape = targetShape; - this.thisClassName = subject.nativeNameResolver.classNameForService(targetShape); - } - - @Override - public Set javaFiles() { - JavaFile.Builder shimFile = JavaFile - .builder(thisClassName.packageName(), shim()); - return Collections.singleton(shimFile.build()); - } - - protected TypeSpec shim() { - TypeSpec.Builder spec = TypeSpec - .classBuilder(thisClassName) - .addModifiers(PUBLIC) - .addField(getField()); - List shimArgs = List.of(getArg()); - BuilderSpecs builderSpecs = new BuilderSpecs( - thisClassName, null, shimArgs, Collections.emptyList()); - targetShape.getTrait(JavaDocTrait.class) - .map(docTrait -> spec.addJavadoc(docTrait.getValue())); - spec.addType(builderSpecs.builderInterface()) - .addType(builderSpecs.builderImpl( - false, - null, - serviceBuilderImplBuildMethod() - )) - .addMethod(serviceConstructor(builderSpecs)) - .addMethod(builderSpecs.builderMethod()) - .addMethod(dafnyConstructor()); - - spec.addMethods(getOperationsForTarget() - .stream().map(this::operation).collect(Collectors.toList())); - spec.addMethod(impl()); - return spec.build(); - } - private BuilderMemberSpec getArg() { - LocalServiceTrait trait = targetShape.expectTrait(LocalServiceTrait.class); - return BuilderMemberSpec.localServiceConfigMemberSpec(trait, subject); - } - - private FieldSpec getField() { - return FieldSpec.builder( - subject.dafnyNameResolver.typeForShape( - targetShape.toShapeId()), - INTERFACE_FIELD) - .addModifiers(PRIVATE_FINAL) - .build(); - } - - /* + /** The Service Shape the Shim wraps. */ + protected final ServiceShape targetShape; + /** The class name of the Subject's Shim class. */ + protected final ClassName thisClassName; + + public ServiceShim(JavaLibrary javaLibrary, ServiceShape targetShape) { + super(javaLibrary); + this.targetShape = targetShape; + this.thisClassName = + subject.nativeNameResolver.classNameForService(targetShape); + } + + @Override + public Set javaFiles() { + JavaFile.Builder shimFile = JavaFile.builder( + thisClassName.packageName(), + shim() + ); + return Collections.singleton(shimFile.build()); + } + + protected TypeSpec shim() { + TypeSpec.Builder spec = TypeSpec + .classBuilder(thisClassName) + .addModifiers(PUBLIC) + .addField(getField()); + List shimArgs = List.of(getArg()); + BuilderSpecs builderSpecs = new BuilderSpecs( + thisClassName, + null, + shimArgs, + Collections.emptyList() + ); + targetShape + .getTrait(JavaDocTrait.class) + .map(docTrait -> spec.addJavadoc(docTrait.getValue())); + spec + .addType(builderSpecs.builderInterface()) + .addType( + builderSpecs.builderImpl(false, null, serviceBuilderImplBuildMethod()) + ) + .addMethod(serviceConstructor(builderSpecs)) + .addMethod(builderSpecs.builderMethod()) + .addMethod(dafnyConstructor()); + + spec.addMethods( + getOperationsForTarget() + .stream() + .map(this::operation) + .collect(Collectors.toList()) + ); + spec.addMethod(impl()); + return spec.build(); + } + + private BuilderMemberSpec getArg() { + LocalServiceTrait trait = targetShape.expectTrait(LocalServiceTrait.class); + return BuilderMemberSpec.localServiceConfigMemberSpec(trait, subject); + } + + private FieldSpec getField() { + return FieldSpec + .builder( + subject.dafnyNameResolver.typeForShape(targetShape.toShapeId()), + INTERFACE_FIELD + ) + .addModifiers(PRIVATE_FINAL) + .build(); + } + + /* The shim is the library's public client. A little like the classes in software.amazon.polymorph.smithyjava.unmodeled, there are elements of the library's public client @@ -98,59 +108,74 @@ private FieldSpec getField() { but there is no @required annotation (or equivalent) to inform Smithy that the service client needs a config. */ - private MethodSpec serviceBuilderImplBuildMethod() { - return MethodSpec.methodBuilder("build") - .addModifiers(PUBLIC) - .returns(thisClassName) - .addCode(BuildMethod.requiredCheck(getArg())) - .addStatement("return new $T(this)", thisClassName) - .build(); - } - - private MethodSpec serviceConstructor(BuilderSpecs builderSpecs) { - LocalServiceTrait trait = targetShape.expectTrait(LocalServiceTrait.class); - MethodSpec.Builder method = MethodSpec - .constructorBuilder() - .addModifiers(PROTECTED) - .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR); - // get config from builder - // i.e: CryptoConfig nativeConfig = builder.CryptoConfig(); - method.addStatement("$T $L = $L.$L()", - getArg().type, - NATIVE_VAR, - BuilderSpecs.BUILDER_VAR, - getArg().name); - // convert config to Dafny - // i.e: software.amazon.cryptography.primitives.internaldafny.types.CryptoConfig dafnyConfig = ToDafny.CryptoConfig(nativeConfig); - method.addStatement(dafnyDeclareAndConvert(trait.getConfigId())); - // Invoke client creation - // i.e.: Result result = software.amazon.cryptography.primitives.internaldafny.__default.AtomicPrimitives(dafnyValue); - TypeName success = subject.dafnyNameResolver.classNameForConcreteServiceClient(subject.serviceShape); - TypeName failure = subject.dafnyNameResolver.abstractClassForError(); - TypeName result = Dafny.asDafnyResult(success, failure); - method.addStatement("$T $L = $T.$L($L)", - result, RESULT_VAR, - subject.dafnyNameResolver.classNameForNamespaceDefault(), - thisClassName.simpleName(), - DAFNY_VAR); - method.addCode(ifFailure()); - method.addStatement("this.$L = $L.dtor_value()", INTERFACE_FIELD, RESULT_VAR); - return method.build(); - } - - protected MethodSpec impl() { - return MethodSpec.methodBuilder(INTERFACE_VAR) - .addModifiers(PROTECTED) - .addStatement("return this.$L", INTERFACE_FIELD) - .returns(Dafny.interfaceForService(this.targetShape)) - .build(); - } - - private MethodSpec dafnyConstructor() { - FieldSpec dafnyInterfaceField = getField(); - return MethodSpec.constructorBuilder() - .addParameter(dafnyInterfaceField.type, INTERFACE_VAR) - .addStatement("this.$L = $L", INTERFACE_FIELD, INTERFACE_VAR) - .build(); - } + private MethodSpec serviceBuilderImplBuildMethod() { + return MethodSpec + .methodBuilder("build") + .addModifiers(PUBLIC) + .returns(thisClassName) + .addCode(BuildMethod.requiredCheck(getArg())) + .addStatement("return new $T(this)", thisClassName) + .build(); + } + + private MethodSpec serviceConstructor(BuilderSpecs builderSpecs) { + LocalServiceTrait trait = targetShape.expectTrait(LocalServiceTrait.class); + MethodSpec.Builder method = MethodSpec + .constructorBuilder() + .addModifiers(PROTECTED) + .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR); + // get config from builder + // i.e: CryptoConfig nativeConfig = builder.CryptoConfig(); + method.addStatement( + "$T $L = $L.$L()", + getArg().type, + NATIVE_VAR, + BuilderSpecs.BUILDER_VAR, + getArg().name + ); + // convert config to Dafny + // i.e: software.amazon.cryptography.primitives.internaldafny.types.CryptoConfig dafnyConfig = ToDafny.CryptoConfig(nativeConfig); + method.addStatement(dafnyDeclareAndConvert(trait.getConfigId())); + // Invoke client creation + // i.e.: Result result = software.amazon.cryptography.primitives.internaldafny.__default.AtomicPrimitives(dafnyValue); + TypeName success = + subject.dafnyNameResolver.classNameForConcreteServiceClient( + subject.serviceShape + ); + TypeName failure = subject.dafnyNameResolver.abstractClassForError(); + TypeName result = Dafny.asDafnyResult(success, failure); + method.addStatement( + "$T $L = $T.$L($L)", + result, + RESULT_VAR, + subject.dafnyNameResolver.classNameForNamespaceDefault(), + thisClassName.simpleName(), + DAFNY_VAR + ); + method.addCode(ifFailure()); + method.addStatement( + "this.$L = $L.dtor_value()", + INTERFACE_FIELD, + RESULT_VAR + ); + return method.build(); + } + + protected MethodSpec impl() { + return MethodSpec + .methodBuilder(INTERFACE_VAR) + .addModifiers(PROTECTED) + .addStatement("return this.$L", INTERFACE_FIELD) + .returns(Dafny.interfaceForService(this.targetShape)) + .build(); + } + + private MethodSpec dafnyConstructor() { + FieldSpec dafnyInterfaceField = getField(); + return MethodSpec + .constructorBuilder() + .addParameter(dafnyInterfaceField.type, INTERFACE_VAR) + .addStatement("this.$L = $L", INTERFACE_FIELD, INTERFACE_VAR) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/TestServiceShim.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/TestServiceShim.java index ef5d825954..0485f7b324 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/TestServiceShim.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/generator/library/shims/TestServiceShim.java @@ -2,17 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.library.shims; +import static javax.lang.model.element.Modifier.PROTECTED; +import static javax.lang.model.element.Modifier.PUBLIC; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeSpec; - import java.util.Collections; import java.util.List; import java.util.Set; import java.util.stream.Collectors; - import software.amazon.polymorph.smithyjava.BuildMethod; import software.amazon.polymorph.smithyjava.BuilderMemberSpec; import software.amazon.polymorph.smithyjava.BuilderSpecs; @@ -20,68 +21,81 @@ import software.amazon.polymorph.smithyjava.modeled.Operation; import software.amazon.smithy.model.shapes.ServiceShape; -import static javax.lang.model.element.Modifier.PROTECTED; -import static javax.lang.model.element.Modifier.PUBLIC; - public class TestServiceShim extends ServiceShim { - /** The Service Shape this Shim Tests. */ - protected final ServiceShape targetShape; - /** The class name of the Subject's Test Shim class. */ - protected final ClassName thisClassName; - public TestServiceShim(JavaLibrary javaLibrary, ServiceShape targetShape) { - super(javaLibrary, targetShape); - this.targetShape = targetShape; - this.thisClassName = subject.nativeNameResolver.classNameForTestService(targetShape); - } + /** The Service Shape this Shim Tests. */ + protected final ServiceShape targetShape; + /** The class name of the Subject's Test Shim class. */ + protected final ClassName thisClassName; - @Override - public Set javaFiles() { - JavaFile.Builder shimFile = JavaFile - .builder(thisClassName.packageName(), shim()); - return Collections.singleton(shimFile.build()); - } + public TestServiceShim(JavaLibrary javaLibrary, ServiceShape targetShape) { + super(javaLibrary, targetShape); + this.targetShape = targetShape; + this.thisClassName = + subject.nativeNameResolver.classNameForTestService(targetShape); + } - @Override - protected TypeSpec shim() { - TypeSpec.Builder spec = TypeSpec - .classBuilder(thisClassName) - .addSuperinterface(subject.dafnyNameResolver.classNameForInterface(this.targetShape)) - .addModifiers(PUBLIC) - .addField(getField()); - BuilderSpecs builderSpecs = new BuilderSpecs( - thisClassName, null, List.of(getArg()), Collections.emptyList()); - // Add the Builder Interface - spec.addType(builderSpecs.builderInterface()); - // Add the Builder Implementation - spec.addType(builderSpecs.builderImpl(false, null, testServiceBuilderImplBuildMethod())); - // Add the class's constructor - spec.addMethod(testServiceConstructor(builderSpecs)); - // Add public static method for creating a builder - spec.addMethod(builderSpecs.builderMethod()); + @Override + public Set javaFiles() { + JavaFile.Builder shimFile = JavaFile.builder( + thisClassName.packageName(), + shim() + ); + return Collections.singleton(shimFile.build()); + } - spec.addMethods(getOperationsForTarget().stream() - .map(shape -> Operation.AsDafny.operation(shape, this.subject, this)) - .collect(Collectors.toList())); - return spec.build(); - } + @Override + protected TypeSpec shim() { + TypeSpec.Builder spec = TypeSpec + .classBuilder(thisClassName) + .addSuperinterface( + subject.dafnyNameResolver.classNameForInterface(this.targetShape) + ) + .addModifiers(PUBLIC) + .addField(getField()); + BuilderSpecs builderSpecs = new BuilderSpecs( + thisClassName, + null, + List.of(getArg()), + Collections.emptyList() + ); + // Add the Builder Interface + spec.addType(builderSpecs.builderInterface()); + // Add the Builder Implementation + spec.addType( + builderSpecs.builderImpl(false, null, testServiceBuilderImplBuildMethod()) + ); + // Add the class's constructor + spec.addMethod(testServiceConstructor(builderSpecs)); + // Add public static method for creating a builder + spec.addMethod(builderSpecs.builderMethod()); - /** The only argument for a shim testing a local service is an instance of the local service.*/ - private BuilderMemberSpec getArg() { - return BuilderMemberSpec.localServiceAsMemberSpec(this.subject); - } + spec.addMethods( + getOperationsForTarget() + .stream() + .map(shape -> Operation.AsDafny.operation(shape, this.subject, this)) + .collect(Collectors.toList()) + ); + return spec.build(); + } + /** The only argument for a shim testing a local service is an instance of the local service.*/ + private BuilderMemberSpec getArg() { + return BuilderMemberSpec.localServiceAsMemberSpec(this.subject); + } - /** The only field for a shim testing a local service is an instance of the local service.*/ - private FieldSpec getField() { - return FieldSpec.builder( - subject.nativeNameResolver.classNameForService(subject.serviceShape), - INTERFACE_FIELD) - .addModifiers(PRIVATE_FINAL) - .build(); - } + /** The only field for a shim testing a local service is an instance of the local service.*/ + private FieldSpec getField() { + return FieldSpec + .builder( + subject.nativeNameResolver.classNameForService(subject.serviceShape), + INTERFACE_FIELD + ) + .addModifiers(PRIVATE_FINAL) + .build(); + } - /* + /* The test shim takes the library's public client. A little like the classes in software.amazon.polymorph.smithyjava.unmodeled, there are elements of the library's test shim @@ -90,22 +104,27 @@ private FieldSpec getField() { but there is no @required annotation (or equivalent) to inform Smithy that the test shim needs an instance of the public client. */ - private MethodSpec testServiceBuilderImplBuildMethod() { - return MethodSpec.methodBuilder("build") - .addModifiers(PUBLIC) - .returns(thisClassName) - .addCode(BuildMethod.requiredCheck(getArg())) - .addStatement("return new $T(this)", thisClassName) - .build(); - } - - private MethodSpec testServiceConstructor(BuilderSpecs builderSpecs) { - MethodSpec.Builder method = MethodSpec - .constructorBuilder() - .addModifiers(PROTECTED) - .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR); - method.addStatement("this.$L = $L.$L()", getField().name, BuilderSpecs.BUILDER_VAR, getArg().name); - return method.build(); - } + private MethodSpec testServiceBuilderImplBuildMethod() { + return MethodSpec + .methodBuilder("build") + .addModifiers(PUBLIC) + .returns(thisClassName) + .addCode(BuildMethod.requiredCheck(getArg())) + .addStatement("return new $T(this)", thisClassName) + .build(); + } + private MethodSpec testServiceConstructor(BuilderSpecs builderSpecs) { + MethodSpec.Builder method = MethodSpec + .constructorBuilder() + .addModifiers(PROTECTED) + .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR); + method.addStatement( + "this.$L = $L.$L()", + getField().name, + BuilderSpecs.BUILDER_VAR, + getArg().name + ); + return method.build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledEnum.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledEnum.java index 17e8a54da8..8ed7f4a06f 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledEnum.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledEnum.java @@ -2,71 +2,91 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.modeled; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PUBLIC; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeSpec; - import software.amazon.polymorph.traits.JavaDocTrait; import software.amazon.smithy.model.shapes.StringShape; import software.amazon.smithy.model.traits.EnumDefinition; import software.amazon.smithy.model.traits.EnumTrait; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PUBLIC; - public class ModeledEnum { - static final String VALUE_VAR = "value"; - static final String TO_STRING_METHOD_NAME = "toString"; - static final FieldSpec ENUM_VALUE_FIELD = FieldSpec.builder(String.class, VALUE_VAR, PRIVATE, FINAL).build(); - public static JavaFile javaFile(String packageName, StringShape shape) { - ClassName className = ClassName.get(packageName, shape.getId().getName()); - TypeSpec.Builder enumSpec = TypeSpec.enumBuilder(className); - enumSpec.addModifiers(PUBLIC); - EnumTrait enumTrait = shape.expectTrait(EnumTrait.class); - for (EnumDefinition value : enumTrait.getValues()) { - if (value.getName().isEmpty()) { - throw new IllegalArgumentException( - "Polymorph requires that Enum Entries have a Name and a Value. " + - "ShapeId: %s does not for value: %s".formatted(shape.getId(), value.getValue()) - ); - } - enumSpec.addEnumConstant(value.getName().get(), enumValueTypeSpec(value)); - } - enumSpec.addField(ENUM_VALUE_FIELD); - enumSpec.addMethod(constructor()); - enumSpec.addMethod(toStringMethod()); - shape.getTrait(JavaDocTrait.class) - .map(docTrait -> enumSpec.addJavadoc(docTrait.getValue())); - return JavaFile.builder(packageName, enumSpec.build()) - .skipJavaLangImports(true) - .build(); - } + static final String VALUE_VAR = "value"; + static final String TO_STRING_METHOD_NAME = "toString"; + static final FieldSpec ENUM_VALUE_FIELD = FieldSpec + .builder(String.class, VALUE_VAR, PRIVATE, FINAL) + .build(); - private static TypeSpec enumValueTypeSpec(EnumDefinition value) { - TypeSpec.Builder enumType = TypeSpec.anonymousClassBuilder("$S", value.getValue()); - if (value.getDocumentation().isPresent()) { - enumType.addJavadoc("$S", value.getDocumentation().get()); - } - return enumType.build(); + public static JavaFile javaFile(String packageName, StringShape shape) { + ClassName className = ClassName.get(packageName, shape.getId().getName()); + TypeSpec.Builder enumSpec = TypeSpec.enumBuilder(className); + enumSpec.addModifiers(PUBLIC); + EnumTrait enumTrait = shape.expectTrait(EnumTrait.class); + for (EnumDefinition value : enumTrait.getValues()) { + if (value.getName().isEmpty()) { + throw new IllegalArgumentException( + "Polymorph requires that Enum Entries have a Name and a Value. " + + "ShapeId: %s does not for value: %s".formatted( + shape.getId(), + value.getValue() + ) + ); + } + enumSpec.addEnumConstant(value.getName().get(), enumValueTypeSpec(value)); } + enumSpec.addField(ENUM_VALUE_FIELD); + enumSpec.addMethod(constructor()); + enumSpec.addMethod(toStringMethod()); + shape + .getTrait(JavaDocTrait.class) + .map(docTrait -> enumSpec.addJavadoc(docTrait.getValue())); + return JavaFile + .builder(packageName, enumSpec.build()) + .skipJavaLangImports(true) + .build(); + } - private static MethodSpec constructor() { - return MethodSpec.constructorBuilder() - .addModifiers(PRIVATE) - .addParameter(ENUM_VALUE_FIELD.type, ENUM_VALUE_FIELD.name) - .addStatement("this.$L = $L", ENUM_VALUE_FIELD.name, ENUM_VALUE_FIELD.name) - .build(); + private static TypeSpec enumValueTypeSpec(EnumDefinition value) { + TypeSpec.Builder enumType = TypeSpec.anonymousClassBuilder( + "$S", + value.getValue() + ); + if (value.getDocumentation().isPresent()) { + enumType.addJavadoc("$S", value.getDocumentation().get()); } + return enumType.build(); + } - private static MethodSpec toStringMethod() { - return MethodSpec.methodBuilder(TO_STRING_METHOD_NAME) - .returns(String.class) - .addModifiers(PUBLIC) - .addStatement("return $T.valueOf($L)", String.class, ENUM_VALUE_FIELD.name) - .build(); - } + private static MethodSpec constructor() { + return MethodSpec + .constructorBuilder() + .addModifiers(PRIVATE) + .addParameter(ENUM_VALUE_FIELD.type, ENUM_VALUE_FIELD.name) + .addStatement( + "this.$L = $L", + ENUM_VALUE_FIELD.name, + ENUM_VALUE_FIELD.name + ) + .build(); + } + + private static MethodSpec toStringMethod() { + return MethodSpec + .methodBuilder(TO_STRING_METHOD_NAME) + .returns(String.class) + .addModifiers(PUBLIC) + .addStatement( + "return $T.valueOf($L)", + String.class, + ENUM_VALUE_FIELD.name + ) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledError.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledError.java index 2b819af421..d69e73b1d8 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledError.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledError.java @@ -2,16 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.modeled; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PROTECTED; +import static software.amazon.polymorph.smithyjava.modeled.ModeledStructure.getterMethod; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeSpec; - import java.util.Collections; import java.util.List; - import javax.lang.model.element.Modifier; - import software.amazon.polymorph.smithyjava.BuildMethod; import software.amazon.polymorph.smithyjava.BuilderMemberSpec; import software.amazon.polymorph.smithyjava.BuilderSpecs; @@ -20,72 +22,97 @@ import software.amazon.polymorph.traits.JavaDocTrait; import software.amazon.smithy.model.shapes.StructureShape; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PROTECTED; -import static software.amazon.polymorph.smithyjava.modeled.ModeledStructure.getterMethod; - public class ModeledError { - public static JavaFile javaFile(String packageName, StructureShape shape, JavaLibrary subject) { - ClassName className = ClassName.get(packageName, shape.getId().getName()); - ClassName superName = ClassName.get(RuntimeException.class); - // Fields in the Smithy Model - List modelFields = BuilderSpecs.shapeToArgs(shape, subject); - // Union of Fields in (Smithy Model) + (THROWABLE_ARGS) - List allFields = ErrorHelpers.prependThrowableArgs(modelFields); - // Fields in (Smithy Model) NOT IN (THROWABLE_ARGS) - List localOnlyFields = ErrorHelpers.removeThrowableArgs(modelFields); - final boolean overrideSuperFalse = false; - BuilderSpecs builderSpecs = new BuilderSpecs( - className, null, allFields, Collections.emptyList()); - TypeSpec.Builder spec = TypeSpec - .classBuilder(className) - .addModifiers(Modifier.PUBLIC) - .superclass(superName); - shape.getTrait(JavaDocTrait.class) - .map(docTrait -> spec.addJavadoc(docTrait.getValue())); - localOnlyFields.forEach(field -> { - // Add local fields - spec.addField(field.toFieldSpec(PRIVATE, FINAL));}); - spec.addMethod(ErrorHelpers.messageFromBuilder(builderSpecs)); - // Add getter methods - spec.addMethods(ErrorHelpers.throwableGetters()); - localOnlyFields.forEach(field -> spec.addMethod(getterMethod(field))); - spec - .addType(builderSpecs.builderInterface()) - .addType(builderSpecs.builderImpl( - overrideSuperFalse, - builderSpecs.implModelConstructor(), - BuildMethod.implBuildMethod( - overrideSuperFalse, - shape, - subject, - packageName - ))); + public static JavaFile javaFile( + String packageName, + StructureShape shape, + JavaLibrary subject + ) { + ClassName className = ClassName.get(packageName, shape.getId().getName()); + ClassName superName = ClassName.get(RuntimeException.class); + // Fields in the Smithy Model + List modelFields = BuilderSpecs.shapeToArgs( + shape, + subject + ); + // Union of Fields in (Smithy Model) + (THROWABLE_ARGS) + List allFields = ErrorHelpers.prependThrowableArgs( + modelFields + ); + // Fields in (Smithy Model) NOT IN (THROWABLE_ARGS) + List localOnlyFields = ErrorHelpers.removeThrowableArgs( + modelFields + ); + final boolean overrideSuperFalse = false; + BuilderSpecs builderSpecs = new BuilderSpecs( + className, + null, + allFields, + Collections.emptyList() + ); + TypeSpec.Builder spec = TypeSpec + .classBuilder(className) + .addModifiers(Modifier.PUBLIC) + .superclass(superName); + shape + .getTrait(JavaDocTrait.class) + .map(docTrait -> spec.addJavadoc(docTrait.getValue())); + localOnlyFields.forEach(field -> { + // Add local fields + spec.addField(field.toFieldSpec(PRIVATE, FINAL)); + }); + spec.addMethod(ErrorHelpers.messageFromBuilder(builderSpecs)); + // Add getter methods + spec.addMethods(ErrorHelpers.throwableGetters()); + localOnlyFields.forEach(field -> spec.addMethod(getterMethod(field))); + spec + .addType(builderSpecs.builderInterface()) + .addType( + builderSpecs.builderImpl( + overrideSuperFalse, + builderSpecs.implModelConstructor(), + BuildMethod.implBuildMethod( + overrideSuperFalse, + shape, + subject, + packageName + ) + ) + ); - spec.addMethod(constructor(builderSpecs, localOnlyFields)) - .addMethod(builderSpecs.toBuilderMethod(overrideSuperFalse)) - .addMethod(builderSpecs.builderMethod()); + spec + .addMethod(constructor(builderSpecs, localOnlyFields)) + .addMethod(builderSpecs.toBuilderMethod(overrideSuperFalse)) + .addMethod(builderSpecs.builderMethod()); - return JavaFile.builder(packageName, spec.build()) - .skipJavaLangImports(true) - .build(); - } + return JavaFile + .builder(packageName, spec.build()) + .skipJavaLangImports(true) + .build(); + } - private static MethodSpec constructor(BuilderSpecs builderSpecs, List localOnlyFields) { - MethodSpec.Builder method = MethodSpec - .constructorBuilder() - .addModifiers(PROTECTED) - .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR) - .addStatement( - "super(messageFromBuilder($L), $L.cause())", - BuilderSpecs.BUILDER_VAR, BuilderSpecs.BUILDER_VAR - ); - localOnlyFields.forEach(field -> method.addStatement( - "this.$L = $L.$L()", - field.name, BuilderSpecs.BUILDER_VAR, field.name - )); - return method.build(); - } + private static MethodSpec constructor( + BuilderSpecs builderSpecs, + List localOnlyFields + ) { + MethodSpec.Builder method = MethodSpec + .constructorBuilder() + .addModifiers(PROTECTED) + .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR) + .addStatement( + "super(messageFromBuilder($L), $L.cause())", + BuilderSpecs.BUILDER_VAR, + BuilderSpecs.BUILDER_VAR + ); + localOnlyFields.forEach(field -> + method.addStatement( + "this.$L = $L.$L()", + field.name, + BuilderSpecs.BUILDER_VAR, + field.name + ) + ); + return method.build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledStructure.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledStructure.java index d0131b9fea..a639db1330 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledStructure.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledStructure.java @@ -2,18 +2,19 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.modeled; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PROTECTED; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeSpec; - import java.util.Collections; import java.util.List; import java.util.Objects; - import javax.annotation.Nonnull; import javax.lang.model.element.Modifier; - import software.amazon.polymorph.smithyjava.BuildMethod; import software.amazon.polymorph.smithyjava.BuilderMemberSpec; import software.amazon.polymorph.smithyjava.BuilderSpecs; @@ -21,82 +22,109 @@ import software.amazon.polymorph.traits.JavaDocTrait; import software.amazon.smithy.model.shapes.Shape; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PROTECTED; - public class ModeledStructure { - public static JavaFile javaFile(String packageName, Shape shape, JavaLibrary subject) { - if (!(shape.isUnionShape() || shape.isStructureShape())) { - throw new IllegalArgumentException( - "ModeledStructure should only be called for Structures or Unions. ShapeId: %s" - .formatted(shape.getId())); - } - ClassName className = ClassName.get(packageName, shape.getId().getName()); - List modelFields = BuilderSpecs.shapeToArgs(shape, subject); - List superFields = Collections.emptyList(); - boolean override = false; - BuilderSpecs builderSpecs = new BuilderSpecs(className, null, modelFields, superFields); - MethodSpec builderImplBuildMethod = BuildMethod.implBuildMethod(override, shape, subject, packageName); - TypeSpec builderInterface = builderSpecs.builderInterface(); - TypeSpec builderImpl = builderSpecs.builderImpl( - override, builderSpecs.implModelConstructor(), builderImplBuildMethod - ); - // Unions are nearly identical to Structures, - // except they have an additional constraint. - if (shape.isUnionShape()) { - // The shape is a union, "asUnionShape" will return a value - //noinspection OptionalGetWithoutIsPresent - builderImpl = builderImpl.toBuilder().addMethod( - ModeledUnion.unionValidate(shape.asUnionShape().get())) - .build(); - } - TypeSpec.Builder spec = TypeSpec - .classBuilder(className) - .addModifiers(Modifier.PUBLIC) - .addType(builderInterface) - .addType(builderImpl); - shape.getTrait(JavaDocTrait.class) - .map(docTrait -> spec.addJavadoc(docTrait.getValue())); - modelFields.forEach(field -> { - // Add fields - spec.addField(field.toFieldSpec(PRIVATE, FINAL)); - // Add getter methods - spec.addMethod(getterMethod(field)); - }); - spec.addMethod(constructor(builderSpecs, modelFields)) - .addMethod(builderSpecs.toBuilderMethod(override)) - .addMethod(builderSpecs.builderMethod()); - return JavaFile.builder(packageName, spec.build()) - .skipJavaLangImports(true) - .build(); + public static JavaFile javaFile( + String packageName, + Shape shape, + JavaLibrary subject + ) { + if (!(shape.isUnionShape() || shape.isStructureShape())) { + throw new IllegalArgumentException( + "ModeledStructure should only be called for Structures or Unions. ShapeId: %s".formatted( + shape.getId() + ) + ); } - - @Nonnull - public static MethodSpec getterMethod(BuilderMemberSpec field) { - MethodSpec.Builder method = MethodSpec - .methodBuilder(field.name) - .addModifiers(Modifier.PUBLIC) - .returns(field.type) - .addStatement("return this.$L", field.name); - if (Objects.nonNull(field.javaDoc)) { - method.addJavadoc( - "@return $L", field.javaDoc); - } - return method.build(); + ClassName className = ClassName.get(packageName, shape.getId().getName()); + List modelFields = BuilderSpecs.shapeToArgs( + shape, + subject + ); + List superFields = Collections.emptyList(); + boolean override = false; + BuilderSpecs builderSpecs = new BuilderSpecs( + className, + null, + modelFields, + superFields + ); + MethodSpec builderImplBuildMethod = BuildMethod.implBuildMethod( + override, + shape, + subject, + packageName + ); + TypeSpec builderInterface = builderSpecs.builderInterface(); + TypeSpec builderImpl = builderSpecs.builderImpl( + override, + builderSpecs.implModelConstructor(), + builderImplBuildMethod + ); + // Unions are nearly identical to Structures, + // except they have an additional constraint. + if (shape.isUnionShape()) { + // The shape is a union, "asUnionShape" will return a value + //noinspection OptionalGetWithoutIsPresent + builderImpl = + builderImpl + .toBuilder() + .addMethod(ModeledUnion.unionValidate(shape.asUnionShape().get())) + .build(); } + TypeSpec.Builder spec = TypeSpec + .classBuilder(className) + .addModifiers(Modifier.PUBLIC) + .addType(builderInterface) + .addType(builderImpl); + shape + .getTrait(JavaDocTrait.class) + .map(docTrait -> spec.addJavadoc(docTrait.getValue())); + modelFields.forEach(field -> { + // Add fields + spec.addField(field.toFieldSpec(PRIVATE, FINAL)); + // Add getter methods + spec.addMethod(getterMethod(field)); + }); + spec + .addMethod(constructor(builderSpecs, modelFields)) + .addMethod(builderSpecs.toBuilderMethod(override)) + .addMethod(builderSpecs.builderMethod()); + return JavaFile + .builder(packageName, spec.build()) + .skipJavaLangImports(true) + .build(); + } - - private static MethodSpec constructor(BuilderSpecs builderSpecs, List fields) { - MethodSpec.Builder method = MethodSpec - .constructorBuilder() - .addModifiers(PROTECTED) - .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR); - fields.forEach(field -> method.addStatement( - "this.$L = $L.$L()", - field.name, BuilderSpecs.BUILDER_VAR, field.name - )); - return method.build(); + @Nonnull + public static MethodSpec getterMethod(BuilderMemberSpec field) { + MethodSpec.Builder method = MethodSpec + .methodBuilder(field.name) + .addModifiers(Modifier.PUBLIC) + .returns(field.type) + .addStatement("return this.$L", field.name); + if (Objects.nonNull(field.javaDoc)) { + method.addJavadoc("@return $L", field.javaDoc); } + return method.build(); + } + + private static MethodSpec constructor( + BuilderSpecs builderSpecs, + List fields + ) { + MethodSpec.Builder method = MethodSpec + .constructorBuilder() + .addModifiers(PROTECTED) + .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR); + fields.forEach(field -> + method.addStatement( + "this.$L = $L.$L()", + field.name, + BuilderSpecs.BUILDER_VAR, + field.name + ) + ); + return method.build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledUnion.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledUnion.java index 42f8574856..359ed95255 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledUnion.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/ModeledUnion.java @@ -5,55 +5,65 @@ import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; - import java.util.List; import java.util.Objects; - import javax.lang.model.element.Modifier; - import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; - import software.amazon.smithy.model.shapes.UnionShape; public class ModeledUnion { - public static final String UNION_VALIDATE_METHOD_NAME = "onlyOneNonNull"; - private static final String ALL_FIELDS_VAR = "allValues"; - /** - * If and only if one entry of {@code ALL_FIELDS_VAR} is non-null, - * return {@code true}. - * Otherwise, return {@code false}.

- * See ... - * @author Sean Swezey

- */ - @SuppressWarnings("JavadocDeclaration") - private static final CodeBlock ONLY_ONE_NON_NULL = CodeBlock.builder() - .addStatement("boolean haveOneNonNull = false") - .beginControlFlow("for (Object o : $L)", ALL_FIELDS_VAR) - .beginControlFlow("if ($T.nonNull(o))", Objects.class) - .beginControlFlow("if (haveOneNonNull)") - .addStatement("return false") - .endControlFlow() - .addStatement("haveOneNonNull = true") - .endControlFlow() - .endControlFlow() - .addStatement("return haveOneNonNull") - .build(); - public static JavaFile javaFile(String packageName, UnionShape shape, JavaLibrary subject) { - return ModeledStructure.javaFile(packageName, shape, subject); - } + public static final String UNION_VALIDATE_METHOD_NAME = "onlyOneNonNull"; + private static final String ALL_FIELDS_VAR = "allValues"; + + /** + * If and only if one entry of {@code ALL_FIELDS_VAR} is non-null, + * return {@code true}. + * Otherwise, return {@code false}.

+ * See ... + * @author Sean Swezey

+ */ + @SuppressWarnings("JavadocDeclaration") + private static final CodeBlock ONLY_ONE_NON_NULL = CodeBlock + .builder() + .addStatement("boolean haveOneNonNull = false") + .beginControlFlow("for (Object o : $L)", ALL_FIELDS_VAR) + .beginControlFlow("if ($T.nonNull(o))", Objects.class) + .beginControlFlow("if (haveOneNonNull)") + .addStatement("return false") + .endControlFlow() + .addStatement("haveOneNonNull = true") + .endControlFlow() + .endControlFlow() + .addStatement("return haveOneNonNull") + .build(); + + public static JavaFile javaFile( + String packageName, + UnionShape shape, + JavaLibrary subject + ) { + return ModeledStructure.javaFile(packageName, shape, subject); + } - /** Aggregates all fields into {@code ALL_FIELDS_VAR} and then {@code ONLY_ONE_NON_NULL} */ - protected static MethodSpec unionValidate(UnionShape shape) { - List thisAllFields = shape.members().stream().map( - member -> CodeBlock.of("this.$L", member.getMemberName())).toList(); - return MethodSpec.methodBuilder(UNION_VALIDATE_METHOD_NAME) - .returns(boolean.class) - .addModifiers(Modifier.PRIVATE) - .addStatement("$T[] $L = {$L}", - Object.class, ALL_FIELDS_VAR, - CodeBlock.join(thisAllFields, ", ")) - .addCode(ONLY_ONE_NON_NULL) - .build(); - } + /** Aggregates all fields into {@code ALL_FIELDS_VAR} and then {@code ONLY_ONE_NON_NULL} */ + protected static MethodSpec unionValidate(UnionShape shape) { + List thisAllFields = shape + .members() + .stream() + .map(member -> CodeBlock.of("this.$L", member.getMemberName())) + .toList(); + return MethodSpec + .methodBuilder(UNION_VALIDATE_METHOD_NAME) + .returns(boolean.class) + .addModifiers(Modifier.PRIVATE) + .addStatement( + "$T[] $L = {$L}", + Object.class, + ALL_FIELDS_VAR, + CodeBlock.join(thisAllFields, ", ") + ) + .addCode(ONLY_ONE_NON_NULL) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/Operation.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/Operation.java index a2bb184e6a..e7c4abd71d 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/Operation.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/modeled/Operation.java @@ -2,11 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.modeled; +import static javax.lang.model.element.Modifier.PUBLIC; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_RESULT_CLASS_NAME; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_TUPLE0_CLASS_NAME; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SMITHY_API_UNIT; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeName; - import software.amazon.polymorph.smithyjava.MethodReference; import software.amazon.polymorph.smithyjava.MethodSignature; import software.amazon.polymorph.smithyjava.generator.CodegenSubject; @@ -14,221 +18,274 @@ import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; import software.amazon.polymorph.smithyjava.generator.library.ShimLibrary; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; - import software.amazon.polymorph.smithyjava.nameresolver.Native; import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; import software.amazon.polymorph.utils.ModelUtils; import software.amazon.polymorph.utils.ModelUtils.ResolvedShapeId; - import software.amazon.smithy.model.shapes.OperationShape; import software.amazon.smithy.model.shapes.Shape; -import static javax.lang.model.element.Modifier.PUBLIC; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_RESULT_CLASS_NAME; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.DAFNY_TUPLE0_CLASS_NAME; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SMITHY_API_UNIT; - /** Logic for generating Operations.*/ public class Operation { - public static final String DAFNY_INPUT = "dafnyInput"; - public static final String NATIVE_INPUT = "nativeInput"; - public static final String NATIVE_OUTPUT = "nativeOutput"; - public static final String DAFNY_OUTPUT = "dafnyOutput"; - - /** Logic for Generating a Method from an Operation Shape - * who's input and output are Dafny-Java. */ - public static class AsDafny { - /** Generate a Method from an operation shape. */ - // TODO: Rather than accept a CodegenSubject & ShimLibrary, - // there SHOULD exist some common Record/Class b/w - // JavaLibrary & JavaAwsSdk that facilitates To(Native,Dafny) class lookup - // TODO: AWS-SDK generators should use this method - public static MethodSpec operation( - final OperationShape operationShape, - JavaLibrary subject, - ShimLibrary shimLibrary - ) { - final MethodSignature signature = methodSignature(operationShape, false, subject); - final ResolvedShapeId inputResolved = signature.resolvedInput(); - final ResolvedShapeId outputResolved = signature.resolvedOutput(); - MethodSpec.Builder method = signature.method(); - final String operationName = operationShape.toShapeId().getName(); - // Try native implementation - method.beginControlFlow("try"); - // Convert Input - method.addStatement(declareNativeInputAndCovert(inputResolved, subject)); - CodeBlock successTypeDescriptor; - if (outputResolved.resolvedId().equals(SMITHY_API_UNIT)) { - // if operation is void - successTypeDescriptor = CodeBlock.of("dafny.Tuple0._typeDescriptor()"); - method - .addStatement(invoke(operationName)) - .addStatement("return $L", - subject.dafnyNameResolver.createSuccess( - successTypeDescriptor, - CodeBlock.of("$T.create()", DAFNY_TUPLE0_CLASS_NAME))); - } else { - // operation is not void - successTypeDescriptor = subject.dafnyNameResolver.typeDescriptor(outputResolved.resolvedId()); - TypeName nativeOutputType = preferNativeInterface(outputResolved, subject); - method - .addStatement(declareNativeOutputAndInvoke(operationName, nativeOutputType)) - .addStatement(declareDafnyOutputAndConvert(outputResolved, subject)) - .addStatement("return $L", - subject.dafnyNameResolver.createSuccess( - successTypeDescriptor, - CodeBlock.of(DAFNY_OUTPUT))); - } - // catch Errors in this Namespace - method - .nextControlFlow("catch ($T ex)", - ClassName.get(RuntimeException.class)) - .addStatement("return $L", - subject.dafnyNameResolver.createFailure( - successTypeDescriptor, - CodeBlock.of("$T.Error(ex)", shimLibrary.toDafnyClassName))) - .endControlFlow(); - return method.build(); - } - - public static MethodSignature methodSignature( - final OperationShape shape, - boolean append_k, - CodegenSubject subject - ) { - final ResolvedShapeId inputResolved = ModelUtils.resolveShape( - shape.getInputShape(), subject.model); - final ResolvedShapeId outputResolved = ModelUtils.resolveShape( - shape.getOutputShape(), subject.model); - final String operationName = append_k ? - // See JavaDoc on operation_K below - shape.toShapeId().getName() + "_k" : - shape.toShapeId().getName(); - final MethodSpec.Builder method = MethodSpec - .methodBuilder(operationName) - .addModifiers(PUBLIC); - // if operation takes an argument - if (!inputResolved.resolvedId().equals(SMITHY_API_UNIT)) { - TypeName inputType = methodInputSignatureTypeName(inputResolved, subject); - method.addParameter(inputType, DAFNY_INPUT); - } - TypeName outputType = methodOutputTypeName(outputResolved, subject); - method.returns(outputType); - return new MethodSignature(method, inputResolved, outputResolved); - } - - /** @return TypeName for a method's signature.*/ - static TypeName methodInputSignatureTypeName( - final ResolvedShapeId resolvedShape, - CodegenSubject subject - ) { - return preferDafnyInterface(resolvedShape, subject); - } - - /** @return TypeName for a method's signature.*/ - static TypeName methodOutputTypeName( - final ResolvedShapeId resolvedShape, - CodegenSubject subject - ) { - final TypeName success = preferDafnyInterface(resolvedShape, subject); - TypeName failure = subject.dafnyNameResolver.abstractClassForError(); - return Dafny.asDafnyResult(success, failure); - } - - /** Declare the Idiomatic-Java input and - * assign the conversion of the Dafny-Java object to it. */ - // TODO: this method may not handle AWS-SDK shapes correctly! - static CodeBlock declareNativeInputAndCovert( - final ResolvedShapeId resolvedShape, - JavaLibrary subject - ) { - CodeBlock leftHand = CodeBlock.of("$T $L", - subject.nativeNameResolver.typeForShape(resolvedShape.resolvedId()), - NATIVE_INPUT); - final Shape naiveShape = subject.model.expectShape(resolvedShape.naiveId()); - final MethodReference toNativeMethod = subject.toNativeLibrary.conversionMethodReference(naiveShape); - return CodeBlock.of("$L = $L($L)", - leftHand, - toNativeMethod.asNormalReference(), - DAFNY_INPUT); - } - - /** Declare the Idiomatic-Java output and - * assign the result of the operation invocation to it. */ - static CodeBlock declareNativeOutputAndInvoke( - final String operationName, - final TypeName nativeOutputType - ) { - return CodeBlock.of("$T $L = $L", - nativeOutputType, NATIVE_OUTPUT, - invoke(operationName)); - } - - /** Invoke the operation. */ - static CodeBlock invoke(final String operationName) { - return CodeBlock.of("this.$L.$L($L)", - Generator.INTERFACE_FIELD, operationName, NATIVE_INPUT); - } - - /** Declare the Dafny-Java output and - * assign the result of converting the Idiomatic-Java output to it. */ - static CodeBlock declareDafnyOutputAndConvert( - final ResolvedShapeId resolvedShape, - JavaLibrary subject - ) { - CodeBlock leftHand = CodeBlock.of("$T $L", - subject.dafnyNameResolver.typeForShape(resolvedShape.resolvedId()), - DAFNY_OUTPUT); - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(resolvedShape.resolvedId())) { - Shape shape = subject.model.expectShape(resolvedShape.resolvedId()); - // TODO: Does this only work for AWS Services? It looks like that!. - // On the bright side, `JavaLibrary.wrapAwsService` throws an error if its not service. - return CodeBlock.of("$L = $L", - leftHand, - JavaLibrary.wrapAwsService(shape, CodeBlock.of(NATIVE_OUTPUT), CodeBlock.of("null"), subject.sdkVersion)); - } - final Shape naiveShape = subject.model.expectShape(resolvedShape.naiveId()); - final MethodReference toDafnyMethod = subject.toDafnyLibrary.conversionMethodReference(naiveShape); - return CodeBlock.of("$L = $L($L)", - leftHand, - toDafnyMethod.asNormalReference(), - NATIVE_OUTPUT); - } + + public static final String DAFNY_INPUT = "dafnyInput"; + public static final String NATIVE_INPUT = "nativeInput"; + public static final String NATIVE_OUTPUT = "nativeOutput"; + public static final String DAFNY_OUTPUT = "dafnyOutput"; + + /** Logic for Generating a Method from an Operation Shape + * who's input and output are Dafny-Java. */ + public static class AsDafny { + + /** Generate a Method from an operation shape. */ + // TODO: Rather than accept a CodegenSubject & ShimLibrary, + // there SHOULD exist some common Record/Class b/w + // JavaLibrary & JavaAwsSdk that facilitates To(Native,Dafny) class lookup + // TODO: AWS-SDK generators should use this method + public static MethodSpec operation( + final OperationShape operationShape, + JavaLibrary subject, + ShimLibrary shimLibrary + ) { + final MethodSignature signature = methodSignature( + operationShape, + false, + subject + ); + final ResolvedShapeId inputResolved = signature.resolvedInput(); + final ResolvedShapeId outputResolved = signature.resolvedOutput(); + MethodSpec.Builder method = signature.method(); + final String operationName = operationShape.toShapeId().getName(); + // Try native implementation + method.beginControlFlow("try"); + // Convert Input + method.addStatement(declareNativeInputAndCovert(inputResolved, subject)); + CodeBlock successTypeDescriptor; + if (outputResolved.resolvedId().equals(SMITHY_API_UNIT)) { + // if operation is void + successTypeDescriptor = CodeBlock.of("dafny.Tuple0._typeDescriptor()"); + method + .addStatement(invoke(operationName)) + .addStatement( + "return $L", + subject.dafnyNameResolver.createSuccess( + successTypeDescriptor, + CodeBlock.of("$T.create()", DAFNY_TUPLE0_CLASS_NAME) + ) + ); + } else { + // operation is not void + successTypeDescriptor = + subject.dafnyNameResolver.typeDescriptor(outputResolved.resolvedId()); + TypeName nativeOutputType = preferNativeInterface( + outputResolved, + subject + ); + method + .addStatement( + declareNativeOutputAndInvoke(operationName, nativeOutputType) + ) + .addStatement(declareDafnyOutputAndConvert(outputResolved, subject)) + .addStatement( + "return $L", + subject.dafnyNameResolver.createSuccess( + successTypeDescriptor, + CodeBlock.of(DAFNY_OUTPUT) + ) + ); + } + // catch Errors in this Namespace + method + .nextControlFlow("catch ($T ex)", ClassName.get(RuntimeException.class)) + .addStatement( + "return $L", + subject.dafnyNameResolver.createFailure( + successTypeDescriptor, + CodeBlock.of("$T.Error(ex)", shimLibrary.toDafnyClassName) + ) + ) + .endControlFlow(); + return method.build(); } - private static TypeName preferDafnyInterface( - final ResolvedShapeId resolvedShape, - CodegenSubject subject + public static MethodSignature methodSignature( + final OperationShape shape, + boolean append_k, + CodegenSubject subject ) { - Shape shape = subject.model.expectShape(resolvedShape.resolvedId()); - if (shape.isServiceShape() || shape.isResourceShape()) { - // If target is a Service or Resource, - // the output type should be an interface. - return subject.dafnyNameResolver.classNameForInterface(shape); - } - return subject.dafnyNameResolver.typeForShape(resolvedShape.resolvedId()); + final ResolvedShapeId inputResolved = ModelUtils.resolveShape( + shape.getInputShape(), + subject.model + ); + final ResolvedShapeId outputResolved = ModelUtils.resolveShape( + shape.getOutputShape(), + subject.model + ); + final String operationName = append_k + ? shape.toShapeId().getName() + "_k" // See JavaDoc on operation_K below + : shape.toShapeId().getName(); + final MethodSpec.Builder method = MethodSpec + .methodBuilder(operationName) + .addModifiers(PUBLIC); + // if operation takes an argument + if (!inputResolved.resolvedId().equals(SMITHY_API_UNIT)) { + TypeName inputType = methodInputSignatureTypeName( + inputResolved, + subject + ); + method.addParameter(inputType, DAFNY_INPUT); + } + TypeName outputType = methodOutputTypeName(outputResolved, subject); + method.returns(outputType); + return new MethodSignature(method, inputResolved, outputResolved); } - public static TypeName preferNativeInterface( - final ResolvedShapeId resolvedShape, - CodegenSubject subject) { - final Shape shape = subject.model.expectShape(resolvedShape.resolvedId()); - if (shape.isServiceShape() || shape.isResourceShape()) { - // If target is a Service or Resource, - // the output type should be an interface. - return Native.classNameForInterfaceOrLocalService(shape, subject.sdkVersion); - } - return subject.nativeNameResolver.typeForShape(resolvedShape.resolvedId()); + /** @return TypeName for a method's signature.*/ + static TypeName methodInputSignatureTypeName( + final ResolvedShapeId resolvedShape, + CodegenSubject subject + ) { + return preferDafnyInterface(resolvedShape, subject); } - /** Generate a Method who's input and output are Idiomatic-Java.*/ - @SuppressWarnings("unused") - public static class AsNative { - // TODO: move - // software.amazon.polymorph.smithyjava.generator.library.ShimLibrary.operation - // and supporting methods here. + /** @return TypeName for a method's signature.*/ + static TypeName methodOutputTypeName( + final ResolvedShapeId resolvedShape, + CodegenSubject subject + ) { + final TypeName success = preferDafnyInterface(resolvedShape, subject); + TypeName failure = subject.dafnyNameResolver.abstractClassForError(); + return Dafny.asDafnyResult(success, failure); + } + + /** Declare the Idiomatic-Java input and + * assign the conversion of the Dafny-Java object to it. */ + // TODO: this method may not handle AWS-SDK shapes correctly! + static CodeBlock declareNativeInputAndCovert( + final ResolvedShapeId resolvedShape, + JavaLibrary subject + ) { + CodeBlock leftHand = CodeBlock.of( + "$T $L", + subject.nativeNameResolver.typeForShape(resolvedShape.resolvedId()), + NATIVE_INPUT + ); + final Shape naiveShape = subject.model.expectShape( + resolvedShape.naiveId() + ); + final MethodReference toNativeMethod = + subject.toNativeLibrary.conversionMethodReference(naiveShape); + return CodeBlock.of( + "$L = $L($L)", + leftHand, + toNativeMethod.asNormalReference(), + DAFNY_INPUT + ); + } + + /** Declare the Idiomatic-Java output and + * assign the result of the operation invocation to it. */ + static CodeBlock declareNativeOutputAndInvoke( + final String operationName, + final TypeName nativeOutputType + ) { + return CodeBlock.of( + "$T $L = $L", + nativeOutputType, + NATIVE_OUTPUT, + invoke(operationName) + ); + } + + /** Invoke the operation. */ + static CodeBlock invoke(final String operationName) { + return CodeBlock.of( + "this.$L.$L($L)", + Generator.INTERFACE_FIELD, + operationName, + NATIVE_INPUT + ); + } + + /** Declare the Dafny-Java output and + * assign the result of converting the Idiomatic-Java output to it. */ + static CodeBlock declareDafnyOutputAndConvert( + final ResolvedShapeId resolvedShape, + JavaLibrary subject + ) { + CodeBlock leftHand = CodeBlock.of( + "$T $L", + subject.dafnyNameResolver.typeForShape(resolvedShape.resolvedId()), + DAFNY_OUTPUT + ); + if ( + AwsSdkNameResolverHelpers.isInAwsSdkNamespace( + resolvedShape.resolvedId() + ) + ) { + Shape shape = subject.model.expectShape(resolvedShape.resolvedId()); + // TODO: Does this only work for AWS Services? It looks like that!. + // On the bright side, `JavaLibrary.wrapAwsService` throws an error if its not service. + return CodeBlock.of( + "$L = $L", + leftHand, + JavaLibrary.wrapAwsService( + shape, + CodeBlock.of(NATIVE_OUTPUT), + CodeBlock.of("null"), + subject.sdkVersion + ) + ); + } + final Shape naiveShape = subject.model.expectShape( + resolvedShape.naiveId() + ); + final MethodReference toDafnyMethod = + subject.toDafnyLibrary.conversionMethodReference(naiveShape); + return CodeBlock.of( + "$L = $L($L)", + leftHand, + toDafnyMethod.asNormalReference(), + NATIVE_OUTPUT + ); + } + } + + private static TypeName preferDafnyInterface( + final ResolvedShapeId resolvedShape, + CodegenSubject subject + ) { + Shape shape = subject.model.expectShape(resolvedShape.resolvedId()); + if (shape.isServiceShape() || shape.isResourceShape()) { + // If target is a Service or Resource, + // the output type should be an interface. + return subject.dafnyNameResolver.classNameForInterface(shape); + } + return subject.dafnyNameResolver.typeForShape(resolvedShape.resolvedId()); + } + public static TypeName preferNativeInterface( + final ResolvedShapeId resolvedShape, + CodegenSubject subject + ) { + final Shape shape = subject.model.expectShape(resolvedShape.resolvedId()); + if (shape.isServiceShape() || shape.isResourceShape()) { + // If target is a Service or Resource, + // the output type should be an interface. + return Native.classNameForInterfaceOrLocalService( + shape, + subject.sdkVersion + ); } + return subject.nativeNameResolver.typeForShape(resolvedShape.resolvedId()); + } + /** Generate a Method who's input and output are Idiomatic-Java.*/ + @SuppressWarnings("unused") + public static class AsNative { + // TODO: move + // software.amazon.polymorph.smithyjava.generator.library.ShimLibrary.operation + // and supporting methods here. + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkDafnyV1.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkDafnyV1.java index d71a7edbeb..82c7431406 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkDafnyV1.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkDafnyV1.java @@ -2,54 +2,65 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.nameresolver; -import com.squareup.javapoet.ClassName; +import static software.amazon.polymorph.smithydafny.DafnyNameResolver.traitNameForServiceClient; +import com.squareup.javapoet.ClassName; import software.amazon.polymorph.smithydafny.DafnyVersion; import software.amazon.polymorph.smithyjava.generator.CodegenSubject; import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; import software.amazon.polymorph.utils.DafnyNameResolverHelpers; - import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.ResourceShape; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.utils.StringUtils; -import static software.amazon.polymorph.smithydafny.DafnyNameResolver.traitNameForServiceClient; - - public class AwsSdkDafnyV1 extends Dafny { - public AwsSdkDafnyV1(ServiceShape serviceShape, Model model, DafnyVersion dafnyVersion) { - super(packageNameForServiceShape(serviceShape), model, serviceShape, CodegenSubject.AwsSdkVersion.V1, dafnyVersion); - } + public AwsSdkDafnyV1( + ServiceShape serviceShape, + Model model, + DafnyVersion dafnyVersion + ) { + super( + packageNameForServiceShape(serviceShape), + model, + serviceShape, + CodegenSubject.AwsSdkVersion.V1, + dafnyVersion + ); + } - @Override - ClassName classNameForService(ServiceShape shape) { - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { - return classNameForAwsService(shape); - } - return super.classNameForService(shape); + @Override + ClassName classNameForService(ServiceShape shape) { + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { + return classNameForAwsService(shape); } + return super.classNameForService(shape); + } - public static ClassName classNameForAwsService(ServiceShape shape) { - return ClassName.get( - modelPackageNameForNamespace(shape.getId().getNamespace()), - DafnyNameResolverHelpers.dafnyCompilesExtra_(traitNameForServiceClient(shape)) - ); - } + public static ClassName classNameForAwsService(ServiceShape shape) { + return ClassName.get( + modelPackageNameForNamespace(shape.getId().getNamespace()), + DafnyNameResolverHelpers.dafnyCompilesExtra_( + traitNameForServiceClient(shape) + ) + ); + } - @Override - ClassName classNameForResource(ResourceShape shape) { - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { - return classNameForAwsResource(shape); - } - return super.classNameForResource(shape); + @Override + ClassName classNameForResource(ResourceShape shape) { + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { + return classNameForAwsResource(shape); } + return super.classNameForResource(shape); + } - public static ClassName classNameForAwsResource(ResourceShape shape) { - return ClassName.get( - modelPackageNameForNamespace(shape.getId().getNamespace()), - DafnyNameResolverHelpers.dafnyCompilesExtra_("I%s".formatted(StringUtils.capitalize(shape.getId().getName()))) - ); - } + public static ClassName classNameForAwsResource(ResourceShape shape) { + return ClassName.get( + modelPackageNameForNamespace(shape.getId().getNamespace()), + DafnyNameResolverHelpers.dafnyCompilesExtra_( + "I%s".formatted(StringUtils.capitalize(shape.getId().getName())) + ) + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkDafnyV2.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkDafnyV2.java index 72c57fe0e5..2d7451444a 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkDafnyV2.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkDafnyV2.java @@ -2,12 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.nameresolver; +import static software.amazon.smithy.utils.StringUtils.capitalize; +import static software.amazon.smithy.utils.StringUtils.uncapitalize; + import com.google.common.base.CaseFormat; import com.squareup.javapoet.ClassName; - import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.TypeName; - import software.amazon.polymorph.smithydafny.DafnyNameResolver; import software.amazon.polymorph.smithydafny.DafnyVersion; import software.amazon.polymorph.smithyjava.generator.CodegenSubject; @@ -21,154 +22,205 @@ import software.amazon.smithy.model.traits.ErrorTrait; import software.amazon.smithy.utils.StringUtils; -import static software.amazon.smithy.utils.StringUtils.capitalize; -import static software.amazon.smithy.utils.StringUtils.uncapitalize; - public class AwsSdkDafnyV2 extends Dafny { - public AwsSdkDafnyV2(ServiceShape serviceShape, Model model, DafnyVersion dafnyVersion) { - super(packageNameForServiceShape(serviceShape), model, serviceShape, CodegenSubject.AwsSdkVersion.V2, dafnyVersion); + public AwsSdkDafnyV2( + ServiceShape serviceShape, + Model model, + DafnyVersion dafnyVersion + ) { + super( + packageNameForServiceShape(serviceShape), + model, + serviceShape, + CodegenSubject.AwsSdkVersion.V2, + dafnyVersion + ); + } + + @Override + ClassName classNameForService(ServiceShape shape) { + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { + return classNameForAwsService(shape); } - - @Override - ClassName classNameForService(ServiceShape shape) { - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { - return classNameForAwsService(shape); - } - return super.classNameForService(shape); - } - - public static ClassName classNameForAwsService(ServiceShape shape) { - return ClassName.get( - modelPackageNameForNamespace(shape.getId().getNamespace()), - DafnyNameResolverHelpers.dafnyCompilesExtra_(DafnyNameResolver.traitNameForServiceClient(shape)) - ); + return super.classNameForService(shape); + } + + public static ClassName classNameForAwsService(ServiceShape shape) { + return ClassName.get( + modelPackageNameForNamespace(shape.getId().getNamespace()), + DafnyNameResolverHelpers.dafnyCompilesExtra_( + DafnyNameResolver.traitNameForServiceClient(shape) + ) + ); + } + + @Override + ClassName classNameForResource(ResourceShape shape) { + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { + return ClassName.get( + modelPackageNameForNamespace(shape.getId().getNamespace()), + "I%s".formatted(StringUtils.capitalize(shape.getId().getName())) + ); } - - @Override - ClassName classNameForResource(ResourceShape shape) { - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { - return ClassName.get( - modelPackageNameForNamespace(shape.getId().getNamespace()), - "I%s".formatted(StringUtils.capitalize(shape.getId().getName())) - ); - } - return super.classNameForResource(shape); + return super.classNameForResource(shape); + } + + /** + * Returns CodeBlock containing something like `variable.member()`. + * Most AWS SDK V2 getters are `uncapitalizedMemberName()` with edge cases in this function + * @param variableName variable to get member from + * @param memberShape member to retrieve from variable + * @return CodeBlock containing something like `variable.member()`. + */ + public CodeBlock methodForGetMember( + CodeBlock variableName, + MemberShape memberShape + ) { + // Some Strings have a token that requires multi-letter decapitalization (e.g. "SSE", "KMS") + String tokenToUncapitalize = + AwsSdkV2NameResolverUtils.tokenToUncapitalizeInShape(memberShape); + if (!tokenToUncapitalize.equals("")) { + return CodeBlock.of( + "$L.$L()", + variableName, + memberShape + .getMemberName() + .replace(tokenToUncapitalize, tokenToUncapitalize.toLowerCase()) + ); } - /** - * Returns CodeBlock containing something like `variable.member()`. - * Most AWS SDK V2 getters are `uncapitalizedMemberName()` with edge cases in this function - * @param variableName variable to get member from - * @param memberShape member to retrieve from variable - * @return CodeBlock containing something like `variable.member()`. - */ - public CodeBlock methodForGetMember(CodeBlock variableName, MemberShape memberShape) { - // Some Strings have a token that requires multi-letter decapitalization (e.g. "SSE", "KMS") - String tokenToUncapitalize = AwsSdkV2NameResolverUtils.tokenToUncapitalizeInShape(memberShape); - if (!tokenToUncapitalize.equals("")) { - return CodeBlock.of("$L.$L()", variableName, - memberShape.getMemberName().replace(tokenToUncapitalize, tokenToUncapitalize.toLowerCase())); - } - - // Message: Exception message. Retrieved via `getMessage()`. - if ("message".equals(uncapitalize(memberShape.getMemberName())) - && model.expectShape(memberShape.getContainer()).hasTrait(ErrorTrait.class)) { - return CodeBlock.of("$L.get$L()", variableName, - capitalize(memberShape.getMemberName())); - } - - // Attributes of SDK AttributeValue shapes are entirely lower-case - if (AwsSdkV2NameResolverUtils.isAttributeValueType(memberShape)) { - // "NULL" attribute is retrieved using "nul" - if (memberShape.getMemberName().equals("NULL")) { - return CodeBlock.of("$L.nul()", variableName); - } - return CodeBlock.of("$L.$L()", variableName, memberShape.getMemberName().toLowerCase()); - } - - return CodeBlock.of("$L.$L()", variableName, uncapitalize(memberShape.getMemberName())); + // Message: Exception message. Retrieved via `getMessage()`. + if ( + "message".equals(uncapitalize(memberShape.getMemberName())) && + model.expectShape(memberShape.getContainer()).hasTrait(ErrorTrait.class) + ) { + return CodeBlock.of( + "$L.get$L()", + variableName, + capitalize(memberShape.getMemberName()) + ); } - /** - * Formats enum name for AWS SDK V2 if name requires reformatting to match Smithy model - * @param dafnyEnumType Smithy-defined and formatted enum type - * @param enumValue - * @return If enum requires formatting to match the Smithy model: reformatted enum name - * else: unchanged name - */ - public String formatEnumCaseName(final TypeName dafnyEnumType, final String enumValue) { - if (enumValue.equals("ECC_SECG_P256K1")) { - return "ECC_SECG_P256_K1"; - } - - return enumRequiresUpperCamelcaseConversion(dafnyEnumType.toString()) - ? CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, enumValue) - : enumValue; + // Attributes of SDK AttributeValue shapes are entirely lower-case + if (AwsSdkV2NameResolverUtils.isAttributeValueType(memberShape)) { + // "NULL" attribute is retrieved using "nul" + if (memberShape.getMemberName().equals("NULL")) { + return CodeBlock.of("$L.nul()", variableName); + } + return CodeBlock.of( + "$L.$L()", + variableName, + memberShape.getMemberName().toLowerCase() + ); } - /** - * Returns trye if values for this enum type require conversion to UpperCamelcase. - * AWS SDK V2 defines values for these enum types as UPPER_UNDERSCORE_FORMATTED. - * The Smithy-defined model has these values UpperCamelcaseFormatted. - * @param dafnyEnumType Smithy-defined and formatted enum type - * @return trye if values for dafnyEnumType require conversion to UpperCamelcase. - */ - protected boolean enumRequiresUpperCamelcaseConversion(final String dafnyEnumType) { - return dafnyEnumType.equals("software.amazon.cryptography.services.kms.internaldafny.types.KeyState") - || dafnyEnumType.equals("software.amazon.cryptography.services.kms.internaldafny.types.GrantOperation") - || dafnyEnumType.equals("software.amazon.cryptography.services.dynamodb.internaldafny.types.BatchStatementErrorCodeEnum"); + return CodeBlock.of( + "$L.$L()", + variableName, + uncapitalize(memberShape.getMemberName()) + ); + } + + /** + * Formats enum name for AWS SDK V2 if name requires reformatting to match Smithy model + * @param dafnyEnumType Smithy-defined and formatted enum type + * @param enumValue + * @return If enum requires formatting to match the Smithy model: reformatted enum name + * else: unchanged name + */ + public String formatEnumCaseName( + final TypeName dafnyEnumType, + final String enumValue + ) { + if (enumValue.equals("ECC_SECG_P256K1")) { + return "ECC_SECG_P256_K1"; } - /** - * Wrapper around Dafny.getMemberFieldValue. - * Checks if shape is a DynamoDB attribute value type: - * - If it is, it doesn't need .dtor_value(); use getMemberField - * - If it isn't, it needs .dtor_value(); use getMemberFieldValue - * @param shape - * @return CodeBlock to get member field for SDK V2 shape - */ - public static CodeBlock getV2MemberFieldValue(MemberShape shape) { - if (AwsSdkV2NameResolverUtils.isAttributeValueType(shape)) { - return getMemberField(shape); - } - return Dafny.getMemberFieldValue(shape); + return enumRequiresUpperCamelcaseConversion(dafnyEnumType.toString()) + ? CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, enumValue) + : enumValue; + } + + /** + * Returns trye if values for this enum type require conversion to UpperCamelcase. + * AWS SDK V2 defines values for these enum types as UPPER_UNDERSCORE_FORMATTED. + * The Smithy-defined model has these values UpperCamelcaseFormatted. + * @param dafnyEnumType Smithy-defined and formatted enum type + * @return trye if values for dafnyEnumType require conversion to UpperCamelcase. + */ + protected boolean enumRequiresUpperCamelcaseConversion( + final String dafnyEnumType + ) { + return ( + dafnyEnumType.equals( + "software.amazon.cryptography.services.kms.internaldafny.types.KeyState" + ) || + dafnyEnumType.equals( + "software.amazon.cryptography.services.kms.internaldafny.types.GrantOperation" + ) || + dafnyEnumType.equals( + "software.amazon.cryptography.services.dynamodb.internaldafny.types.BatchStatementErrorCodeEnum" + ) + ); + } + + /** + * Wrapper around Dafny.getMemberFieldValue. + * Checks if shape is a DynamoDB attribute value type: + * - If it is, it doesn't need .dtor_value(); use getMemberField + * - If it isn't, it needs .dtor_value(); use getMemberFieldValue + * @param shape + * @return CodeBlock to get member field for SDK V2 shape + */ + public static CodeBlock getV2MemberFieldValue(MemberShape shape) { + if (AwsSdkV2NameResolverUtils.isAttributeValueType(shape)) { + return getMemberField(shape); } - - @Override - public CodeBlock typeDescriptor(ShapeId shapeId) { - if (shapeIdRequiresStaticTypeDescriptor(shapeId)) { - // Explicitly assigning this string is reasonable because these 2 classes assign the - // same types. - // Extend this assignment if we find more shapes that don't get classes generated - // require special typeDescriptors. - return CodeBlock. - of("TypeDescriptor.referenceWithInitializer(dafny.DafnyMap.class, () -> dafny.DafnyMap.,AttributeValue> empty())"); - } - return super.typeDescriptor(shapeId); - } - - /** - * AttributeMap and Key require special conversion. - * These are unique; they are the two map types used in generated code that do not have an - * associated Dafny-generated type Java class. - * When Dafny compiles map types into Java, Dafny will not generate a Java class for a map - * if the Dafny type does not have a predicate. - * Some maps are modelled to have a bound on the number of key/value pairs in the map. - * Polymorph translates these as a Dafny predicate. These 2 classes do not have a bound - * on map size, so they don't have a predicate, and aren't compiled into classes. - * Only classes have a _typeDescriptor() method; these are not classes, so they don't have one. - * Below, Polymorph generates a likeness of the _typeDescriptor() method for these types. - * Note that this results in an "unchecked cast" compiler warning, but the Dafny-generated - * cast also produces this warning. - * If we find more shapes that match this criteria, we should extend this logic. - * @param shapeId - * @return - */ - public boolean shapeIdRequiresStaticTypeDescriptor(final ShapeId shapeId) { - String className = classForNotErrorNotUnitShape(shapeId).toString(); - - return (className.equals("software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeMap") - || className.equals("software.amazon.cryptography.services.dynamodb.internaldafny.types.Key")); + return Dafny.getMemberFieldValue(shape); + } + + @Override + public CodeBlock typeDescriptor(ShapeId shapeId) { + if (shapeIdRequiresStaticTypeDescriptor(shapeId)) { + // Explicitly assigning this string is reasonable because these 2 classes assign the + // same types. + // Extend this assignment if we find more shapes that don't get classes generated + // require special typeDescriptors. + return CodeBlock.of( + "TypeDescriptor.referenceWithInitializer(dafny.DafnyMap.class, () -> dafny.DafnyMap.,AttributeValue> empty())" + ); } + return super.typeDescriptor(shapeId); + } + + /** + * AttributeMap and Key require special conversion. + * These are unique; they are the two map types used in generated code that do not have an + * associated Dafny-generated type Java class. + * When Dafny compiles map types into Java, Dafny will not generate a Java class for a map + * if the Dafny type does not have a predicate. + * Some maps are modelled to have a bound on the number of key/value pairs in the map. + * Polymorph translates these as a Dafny predicate. These 2 classes do not have a bound + * on map size, so they don't have a predicate, and aren't compiled into classes. + * Only classes have a _typeDescriptor() method; these are not classes, so they don't have one. + * Below, Polymorph generates a likeness of the _typeDescriptor() method for these types. + * Note that this results in an "unchecked cast" compiler warning, but the Dafny-generated + * cast also produces this warning. + * If we find more shapes that match this criteria, we should extend this logic. + * @param shapeId + * @return + */ + public boolean shapeIdRequiresStaticTypeDescriptor(final ShapeId shapeId) { + String className = classForNotErrorNotUnitShape(shapeId).toString(); + + return ( + className.equals( + "software.amazon.cryptography.services.dynamodb.internaldafny.types.AttributeMap" + ) || + className.equals( + "software.amazon.cryptography.services.dynamodb.internaldafny.types.Key" + ) + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeV1.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeV1.java index 9f5957e572..1c79f5428c 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeV1.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeV1.java @@ -2,14 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.nameresolver; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SHAPE_TYPES_LIST_SET; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; - import java.util.List; import java.util.Map; import java.util.Set; - import software.amazon.polymorph.smithyjava.generator.CodegenSubject; import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; import software.amazon.smithy.model.Model; @@ -21,204 +21,236 @@ import software.amazon.smithy.model.traits.TraitDefinition; import software.amazon.smithy.utils.StringUtils; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SHAPE_TYPES_LIST_SET; - /** * There are certain assumptions we can/have to make about * Types from the AWS SDK for Java V1 libraries. */ public class AwsSdkNativeV1 extends Native { - public AwsSdkNativeV1(final ServiceShape serviceShape, - final Model model) { - super(packageNameForAwsSdkV1Shape(serviceShape), - serviceShape, - model, - defaultModelPackageName(packageNameForAwsSdkV1Shape(serviceShape)), - CodegenSubject.AwsSdkVersion.V1 - ); - checkForAwsServiceConstants(); - } + public AwsSdkNativeV1(final ServiceShape serviceShape, final Model model) { + super( + packageNameForAwsSdkV1Shape(serviceShape), + serviceShape, + model, + defaultModelPackageName(packageNameForAwsSdkV1Shape(serviceShape)), + CodegenSubject.AwsSdkVersion.V1 + ); + checkForAwsServiceConstants(); + } - // The values of these maps are NOT in smithy models and thus must be hard-coded - public static final Map AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE; - public static final Map AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION; - - static { - // These are NOT in the service's model package - // i.e: kms : com.amazonaws.kms.AWSKMS - AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE = Map.ofEntries( - Map.entry("com.amazonaws.kms", "AWSKMS"), - Map.entry("com.amazonaws.dynamodb", "AmazonDynamoDB"), - Map.entry("com.amazonaws.s3", "AmazonS3") - ); - // These are in the service's model package - // i.e.: kms : com.amazonaws.kms.model.AWSKMSException - AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION = Map.ofEntries( - Map.entry("com.amazonaws.kms", "AWSKMSException"), - Map.entry("com.amazonaws.dynamodb", "AmazonDynamoDBException"), - Map.entry("com.amazonaws.s3", "AmazonS3Exception") - ); - } + // The values of these maps are NOT in smithy models and thus must be hard-coded + public static final Map< + String, + String + > AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE; + public static final Map< + String, + String + > AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION; - /** Validates that Polymorph knows non-smithy modeled constants for an AWS Service */ - private void checkForAwsServiceConstants() { - String namespace = serviceShape.getId().getNamespace(); - checkForAwsServiceConstants(namespace); - } + static { + // These are NOT in the service's model package + // i.e: kms : com.amazonaws.kms.AWSKMS + AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE = + Map.ofEntries( + Map.entry("com.amazonaws.kms", "AWSKMS"), + Map.entry("com.amazonaws.dynamodb", "AmazonDynamoDB"), + Map.entry("com.amazonaws.s3", "AmazonS3") + ); + // These are in the service's model package + // i.e.: kms : com.amazonaws.kms.model.AWSKMSException + AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION = + Map.ofEntries( + Map.entry("com.amazonaws.kms", "AWSKMSException"), + Map.entry("com.amazonaws.dynamodb", "AmazonDynamoDBException"), + Map.entry("com.amazonaws.s3", "AmazonS3Exception") + ); + } - public static void checkForAwsServiceConstants(String namespace) { - boolean knowBaseException = AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION.containsKey(namespace); - if (!knowBaseException) { - throw new IllegalArgumentException( - "Polymorph does not know this service's Base Exception: %s".formatted(namespace)); - } - boolean knowClientInterface = AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE.containsKey(namespace); - if (!knowClientInterface) { - throw new IllegalArgumentException( - "Polymorph does not know this service's Client Interface: %s".formatted(namespace)); - } - } + /** Validates that Polymorph knows non-smithy modeled constants for an AWS Service */ + private void checkForAwsServiceConstants() { + String namespace = serviceShape.getId().getNamespace(); + checkForAwsServiceConstants(namespace); + } - /** - * Throws IllegalArgumentException if shapeId is not in namespace - */ - private void checkInServiceNamespace(final ShapeId shapeId) { - if (!isInServiceNameSpace(shapeId)) { - throw new IllegalArgumentException( - "ShapeId %s is not in this namespace %s".formatted( - shapeId, serviceShape.getId().getNamespace())); - } + public static void checkForAwsServiceConstants(String namespace) { + boolean knowBaseException = + AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION.containsKey(namespace); + if (!knowBaseException) { + throw new IllegalArgumentException( + "Polymorph does not know this service's Base Exception: %s".formatted( + namespace + ) + ); } - - /** - *

In the AWS SDK Java V1, - * structures never return Enums, only their string representation. - * Thus, any methods that handle the result of a get Enum value - * must handle String, not the Enum reference.

- * - *

At this time, we believe that is only needs to be called - * for aggregates other than structure or union, - * as only Aggregate converters will indirectly deal with enums.

- * - *

Any direct involvement with Enums are safe, - * since we overload the enum converter methods.

- **/ - private TypeName typeForShapeNoEnum(ShapeId shapeId) { - final Shape shape = model.expectShape(shapeId); - if (shape.hasTrait(EnumTrait.class)) { - return classForString(); - } - if (SHAPE_TYPES_LIST_SET.contains(shape.getType())) { - return typeForListSetOrMapNoEnum(shapeId); - } - return typeForShape(shapeId); + boolean knowClientInterface = + AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE.containsKey(namespace); + if (!knowClientInterface) { + throw new IllegalArgumentException( + "Polymorph does not know this service's Client Interface: %s".formatted( + namespace + ) + ); } + } - @SuppressWarnings("OptionalGetWithoutIsPresent") - public ParameterizedTypeName typeForListSetOrMapNoEnum(final ShapeId shapeId) { - final Shape shape = model.getShape(shapeId) - .orElseThrow(() -> new IllegalStateException("Cannot find shape " + shapeId)); - return switch (shape.getType()) { - case LIST -> ParameterizedTypeName.get( - ClassName.get(List.class), - typeForShapeNoEnum(shape.asListShape().get().getMember().getTarget()) - ); - case SET -> ParameterizedTypeName.get( - ClassName.get(Set.class), - typeForShapeNoEnum(shape.asSetShape().get().getMember().getTarget()) - ); - case MAP -> ParameterizedTypeName.get( - ClassName.get(Map.class), - typeForShapeNoEnum(shape.asMapShape().get().getKey().getTarget()), - typeForShapeNoEnum(shape.asMapShape().get().getValue().getTarget()) - ); - default -> throw new IllegalStateException( - "typeForListOrSetNoEnum only accepts LIST or SET. Got: " + shape.getType() - + " for ShapeId: " + shapeId); - }; + /** + * Throws IllegalArgumentException if shapeId is not in namespace + */ + private void checkInServiceNamespace(final ShapeId shapeId) { + if (!isInServiceNameSpace(shapeId)) { + throw new IllegalArgumentException( + "ShapeId %s is not in this namespace %s".formatted( + shapeId, + serviceShape.getId().getNamespace() + ) + ); } + } - public static ClassName classNameForAwsSdkShape(final Shape shape) { - return ClassName.get( - defaultModelPackageName(packageNameForAwsSdkV1Shape(shape)), - StringUtils.capitalize(shape.getId().getName())); + /** + *

In the AWS SDK Java V1, + * structures never return Enums, only their string representation. + * Thus, any methods that handle the result of a get Enum value + * must handle String, not the Enum reference.

+ * + *

At this time, we believe that is only needs to be called + * for aggregates other than structure or union, + * as only Aggregate converters will indirectly deal with enums.

+ * + *

Any direct involvement with Enums are safe, + * since we overload the enum converter methods.

+ **/ + private TypeName typeForShapeNoEnum(ShapeId shapeId) { + final Shape shape = model.expectShape(shapeId); + if (shape.hasTrait(EnumTrait.class)) { + return classForString(); } - - @Override - public ClassName classNameForStructure(final Shape shape) { - if (!(shape.isUnionShape() || shape.isStructureShape())) { - throw new IllegalArgumentException( - "typeForStructure should only be called for Structures or Unions. ShapeId: %s" - .formatted(shape.getId())); - } - if (shape.hasTrait(TraitDefinition.class)) { - throw new IllegalArgumentException( - "Trait definition structures have no corresponding generated type"); - } - // check if this Shape is in AWS SDK for Java V1 package - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { - AwsSdkNativeV1.classNameForAwsSdkShape(shape); - } - return super.classNameForStructure(shape); + if (SHAPE_TYPES_LIST_SET.contains(shape.getType())) { + return typeForListSetOrMapNoEnum(shapeId); } + return typeForShape(shapeId); + } - /** The AWS SDK for Java V1 replaces - * the last 'Response' with 'Result' - * in operation outputs. - */ - public TypeName typeForOperationOutput(final ShapeId shapeId) { - StructureShape shape = model.expectShape(shapeId, StructureShape.class); - ClassName smithyName = classNameForStructure(shape); - if (smithyName.simpleName().endsWith("Response")) { - return ClassName.get(smithyName.packageName(), - smithyName.simpleName() - .substring( - 0, - smithyName.simpleName().lastIndexOf("Response")) - + "Result" - ); - } - return smithyName; - } + @SuppressWarnings("OptionalGetWithoutIsPresent") + public ParameterizedTypeName typeForListSetOrMapNoEnum( + final ShapeId shapeId + ) { + final Shape shape = model + .getShape(shapeId) + .orElseThrow(() -> + new IllegalStateException("Cannot find shape " + shapeId) + ); + return switch (shape.getType()) { + case LIST -> ParameterizedTypeName.get( + ClassName.get(List.class), + typeForShapeNoEnum(shape.asListShape().get().getMember().getTarget()) + ); + case SET -> ParameterizedTypeName.get( + ClassName.get(Set.class), + typeForShapeNoEnum(shape.asSetShape().get().getMember().getTarget()) + ); + case MAP -> ParameterizedTypeName.get( + ClassName.get(Map.class), + typeForShapeNoEnum(shape.asMapShape().get().getKey().getTarget()), + typeForShapeNoEnum(shape.asMapShape().get().getValue().getTarget()) + ); + default -> throw new IllegalStateException( + "typeForListOrSetNoEnum only accepts LIST or SET. Got: " + + shape.getType() + + " for ShapeId: " + + shapeId + ); + }; + } - public static ClassName classNameForServiceClient(ServiceShape shape) { - String awsServiceSmithyNamespace = shape.toShapeId().getNamespace(); - checkForAwsServiceConstants(awsServiceSmithyNamespace); - return ClassName.get( - packageNameForAwsSdkV1Shape(shape), - AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE.get(awsServiceSmithyNamespace) - ); - } + public static ClassName classNameForAwsSdkShape(final Shape shape) { + return ClassName.get( + defaultModelPackageName(packageNameForAwsSdkV1Shape(shape)), + StringUtils.capitalize(shape.getId().getName()) + ); + } - /** - * Returns the ClassName for an AWS Service's Base Exception. - *

- * To be clear, a Base Exception is concrete. - * But all of a service's other exceptions extend it. - */ - public ClassName baseErrorForService() { - return ClassName.get( - modelPackage, - AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION.get( - serviceShape.getId().getNamespace())); + @Override + public ClassName classNameForStructure(final Shape shape) { + if (!(shape.isUnionShape() || shape.isStructureShape())) { + throw new IllegalArgumentException( + "typeForStructure should only be called for Structures or Unions. ShapeId: %s".formatted( + shape.getId() + ) + ); } - - public static String packageNameForService(final String awsServiceName) { - String rtn = awsServiceName; - if (awsServiceName.equals("dynamodb")) { - rtn = "dynamodbv2"; - } - return "com.amazonaws.services.%s".formatted(rtn); + if (shape.hasTrait(TraitDefinition.class)) { + throw new IllegalArgumentException( + "Trait definition structures have no corresponding generated type" + ); } + // check if this Shape is in AWS SDK for Java V1 package + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { + AwsSdkNativeV1.classNameForAwsSdkShape(shape); + } + return super.classNameForStructure(shape); + } - static String packageNameForAwsSdkV1Shape(final Shape shape) { - String awsServiceName = AwsSdkNameResolverHelpers.awsServiceNameFromShape(shape); - return packageNameForService(awsServiceName); + /** The AWS SDK for Java V1 replaces + * the last 'Response' with 'Result' + * in operation outputs. + */ + public TypeName typeForOperationOutput(final ShapeId shapeId) { + StructureShape shape = model.expectShape(shapeId, StructureShape.class); + ClassName smithyName = classNameForStructure(shape); + if (smithyName.simpleName().endsWith("Response")) { + return ClassName.get( + smithyName.packageName(), + smithyName + .simpleName() + .substring(0, smithyName.simpleName().lastIndexOf("Response")) + + "Result" + ); } + return smithyName; + } + + public static ClassName classNameForServiceClient(ServiceShape shape) { + String awsServiceSmithyNamespace = shape.toShapeId().getNamespace(); + checkForAwsServiceConstants(awsServiceSmithyNamespace); + return ClassName.get( + packageNameForAwsSdkV1Shape(shape), + AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE.get(awsServiceSmithyNamespace) + ); + } - public static String defaultModelPackageName(final String packageName) { - return "%s.model".formatted(packageName); + /** + * Returns the ClassName for an AWS Service's Base Exception. + *

+ * To be clear, a Base Exception is concrete. + * But all of a service's other exceptions extend it. + */ + public ClassName baseErrorForService() { + return ClassName.get( + modelPackage, + AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION.get( + serviceShape.getId().getNamespace() + ) + ); + } + + public static String packageNameForService(final String awsServiceName) { + String rtn = awsServiceName; + if (awsServiceName.equals("dynamodb")) { + rtn = "dynamodbv2"; } + return "com.amazonaws.services.%s".formatted(rtn); + } + + static String packageNameForAwsSdkV1Shape(final Shape shape) { + String awsServiceName = AwsSdkNameResolverHelpers.awsServiceNameFromShape( + shape + ); + return packageNameForService(awsServiceName); + } + public static String defaultModelPackageName(final String packageName) { + return "%s.model".formatted(packageName); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeV2.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeV2.java index 26a0e62526..f33933b8f6 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeV2.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeV2.java @@ -2,15 +2,20 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.nameresolver; +import static software.amazon.polymorph.smithyjava.nameresolver.AwsSdkV2NameResolverUtils.isAttributeValueType; +import static software.amazon.polymorph.smithyjava.nameresolver.AwsSdkV2NameResolverUtils.tokenToUncapitalizeInShape; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SHAPE_TYPES_LIST_SET_MAP; +import static software.amazon.smithy.utils.StringUtils.uncapitalize; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; - import java.util.List; import java.util.Map; import java.util.Set; - +import software.amazon.awssdk.codegen.model.service.ServiceModel; +import software.amazon.awssdk.codegen.naming.DefaultNamingStrategy; import software.amazon.polymorph.smithyjava.generator.CodegenSubject; import software.amazon.polymorph.smithyjava.generator.awssdk.v2.JavaAwsSdkV2; import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; @@ -26,340 +31,385 @@ import software.amazon.smithy.model.traits.TraitDefinition; import software.amazon.smithy.utils.StringUtils; -import software.amazon.awssdk.codegen.naming.DefaultNamingStrategy; -import software.amazon.awssdk.codegen.model.service.ServiceModel; - -import static software.amazon.polymorph.smithyjava.nameresolver.AwsSdkV2NameResolverUtils.isAttributeValueType; -import static software.amazon.polymorph.smithyjava.nameresolver.AwsSdkV2NameResolverUtils.tokenToUncapitalizeInShape; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SHAPE_TYPES_LIST_SET_MAP; -import static software.amazon.smithy.utils.StringUtils.uncapitalize; - /** * There are certain assumptions we can/have to make about * Types from the AWS SDK for Java V2 libraries. */ public class AwsSdkNativeV2 extends Native { - private final DefaultNamingStrategy awsSDKNaming; - - public AwsSdkNativeV2(final ServiceShape serviceShape, - final Model model) { - super(packageNameForAwsSdkV2Shape(serviceShape), - serviceShape, - model, - defaultModelPackageName(packageNameForAwsSdkV2Shape(serviceShape)), - CodegenSubject.AwsSdkVersion.V2); - checkForAwsServiceConstants(); - awsSDKNaming = new DefaultNamingStrategy(new ServiceModel(), null); - } - - // The values of these maps are NOT in smithy models and thus must be hard-coded - private static final Map AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE; - private static final Map AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION; - - static { - // The namespaces used as keys in these maps correspond to the Smithy namespace, - // NOT the SDK V2 namespace. - // Smithy namespace: com.amazonaws.X - // AWSSDK V2 namespace: software.amazon.awssdk.X - - // These clients are NOT located in the services' model package; - // they are located in its parent namespace. - // i.e: kms : software.amazon.awssdk.kms.KmsClient - AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE = Map.ofEntries( - Map.entry("com.amazonaws.kms", "KmsClient"), - Map.entry("com.amazonaws.dynamodb", "DynamoDbClient"), - Map.entry("com.amazonaws.s3", "S3Client") - ); - // These exception are located in the services' model package. - // i.e.: kms : software.amazon.awssdk.kms.model.KmsException - AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION = Map.ofEntries( - Map.entry("com.amazonaws.kms", "KmsException"), - Map.entry("com.amazonaws.dynamodb", "DynamoDbException"), - Map.entry("com.amazonaws.s3", "S3Exception") - ); - } - - /** Validates that Polymorph knows non-smithy modeled constants for an AWS Service */ - private void checkForAwsServiceConstants() { - String namespace = serviceShape.getId().getNamespace(); - checkForAwsServiceConstants(namespace); - } - - /** Validates that Polymorph knows non-smithy modeled constants for an AWS Service */ - private static void checkForAwsServiceConstants(String namespace) { - boolean knowBaseException = AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION.containsKey(namespace); - if (!knowBaseException) { - throw new IllegalArgumentException( - "Polymorph does not know this service's Base Exception: %s".formatted(namespace)); - } - boolean knowClientInterface = AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE.containsKey(namespace); - if (!knowClientInterface) { - throw new IllegalArgumentException( - "Polymorph does not know this service's Client Interface: %s".formatted(namespace)); - } + private final DefaultNamingStrategy awsSDKNaming; + + public AwsSdkNativeV2(final ServiceShape serviceShape, final Model model) { + super( + packageNameForAwsSdkV2Shape(serviceShape), + serviceShape, + model, + defaultModelPackageName(packageNameForAwsSdkV2Shape(serviceShape)), + CodegenSubject.AwsSdkVersion.V2 + ); + checkForAwsServiceConstants(); + awsSDKNaming = new DefaultNamingStrategy(new ServiceModel(), null); + } + + // The values of these maps are NOT in smithy models and thus must be hard-coded + private static final Map< + String, + String + > AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE; + private static final Map< + String, + String + > AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION; + + static { + // The namespaces used as keys in these maps correspond to the Smithy namespace, + // NOT the SDK V2 namespace. + // Smithy namespace: com.amazonaws.X + // AWSSDK V2 namespace: software.amazon.awssdk.X + + // These clients are NOT located in the services' model package; + // they are located in its parent namespace. + // i.e: kms : software.amazon.awssdk.kms.KmsClient + AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE = + Map.ofEntries( + Map.entry("com.amazonaws.kms", "KmsClient"), + Map.entry("com.amazonaws.dynamodb", "DynamoDbClient"), + Map.entry("com.amazonaws.s3", "S3Client") + ); + // These exception are located in the services' model package. + // i.e.: kms : software.amazon.awssdk.kms.model.KmsException + AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION = + Map.ofEntries( + Map.entry("com.amazonaws.kms", "KmsException"), + Map.entry("com.amazonaws.dynamodb", "DynamoDbException"), + Map.entry("com.amazonaws.s3", "S3Exception") + ); + } + + /** Validates that Polymorph knows non-smithy modeled constants for an AWS Service */ + private void checkForAwsServiceConstants() { + String namespace = serviceShape.getId().getNamespace(); + checkForAwsServiceConstants(namespace); + } + + /** Validates that Polymorph knows non-smithy modeled constants for an AWS Service */ + private static void checkForAwsServiceConstants(String namespace) { + boolean knowBaseException = + AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION.containsKey(namespace); + if (!knowBaseException) { + throw new IllegalArgumentException( + "Polymorph does not know this service's Base Exception: %s".formatted( + namespace + ) + ); } - - /** - * Throws IllegalArgumentException if shapeId is not in namespace - */ - private void checkInServiceNamespace(final ShapeId shapeId) { - if (!isInServiceNameSpace(shapeId)) { - throw new IllegalArgumentException( - "ShapeId %s is not in this namespace %s".formatted( - shapeId, serviceShape.getId().getNamespace())); - } + boolean knowClientInterface = + AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE.containsKey(namespace); + if (!knowClientInterface) { + throw new IllegalArgumentException( + "Polymorph does not know this service's Client Interface: %s".formatted( + namespace + ) + ); } - - public static ClassName classNameForServiceClient(ServiceShape shape) { - String awsServiceSmithyNamespace = shape.toShapeId().getNamespace(); - checkForAwsServiceConstants(awsServiceSmithyNamespace); - return ClassName.get( - packageNameForAwsSdkV2Shape(shape), - AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE.get(awsServiceSmithyNamespace) - ); + } + + /** + * Throws IllegalArgumentException if shapeId is not in namespace + */ + private void checkInServiceNamespace(final ShapeId shapeId) { + if (!isInServiceNameSpace(shapeId)) { + throw new IllegalArgumentException( + "ShapeId %s is not in this namespace %s".formatted( + shapeId, + serviceShape.getId().getNamespace() + ) + ); } - - /** - *

In the AWS SDK Java V2, - * structures never return Enums, only their string representation. - * Thus, any methods that handle the result of a get Enum value - * must handle String, not the Enum reference.

- * - *

At this time, we believe that is only needs to be called - * for aggregates other than structure or union, - * as only Aggregate converters will indirectly deal with enums.

- * - *

Any direct involvement with Enums are safe, - * since we overload the enum converter methods.

- **/ - private TypeName typeForShapeNoEnum(ShapeId shapeId) { - final Shape shape = model.expectShape(shapeId); - - if (shape.hasTrait(EnumTrait.class)) { - if (shapeRequiresTypeConversionFromStringToStructure(shapeId)) { - return classForEnum(shape); - } - - return classForString(); - } - if (SHAPE_TYPES_LIST_SET_MAP.contains(shape.getType())) { - return typeForListSetOrMapNoEnum(shapeId); - } - return typeForShape(shapeId); + } + + public static ClassName classNameForServiceClient(ServiceShape shape) { + String awsServiceSmithyNamespace = shape.toShapeId().getNamespace(); + checkForAwsServiceConstants(awsServiceSmithyNamespace); + return ClassName.get( + packageNameForAwsSdkV2Shape(shape), + AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE.get(awsServiceSmithyNamespace) + ); + } + + /** + *

In the AWS SDK Java V2, + * structures never return Enums, only their string representation. + * Thus, any methods that handle the result of a get Enum value + * must handle String, not the Enum reference.

+ * + *

At this time, we believe that is only needs to be called + * for aggregates other than structure or union, + * as only Aggregate converters will indirectly deal with enums.

+ * + *

Any direct involvement with Enums are safe, + * since we overload the enum converter methods.

+ **/ + private TypeName typeForShapeNoEnum(ShapeId shapeId) { + final Shape shape = model.expectShape(shapeId); + + if (shape.hasTrait(EnumTrait.class)) { + if (shapeRequiresTypeConversionFromStringToStructure(shapeId)) { + return classForEnum(shape); + } + + return classForString(); } - - @Override - public TypeName typeForShape(final ShapeId shapeId) { - final Shape shape = model.expectShape(shapeId); - - // Overrides BYTE shapeType type conversion to SdkBytes conversion. - if (shape.getType().equals(ShapeType.BYTE)) { - return JavaAwsSdkV2.BLOB_TO_NATIVE_SDK_BYTES; - } - - // BinarySetAttributeValue is the only list of bytes - if (shapeId.getName().contains("BinarySetAttributeValue")) { - return ParameterizedTypeName.get( - ClassName.get(List.class), - JavaAwsSdkV2.BLOB_TO_NATIVE_SDK_BYTES); - } - - return super.typeForShape(shapeId); + if (SHAPE_TYPES_LIST_SET_MAP.contains(shape.getType())) { + return typeForListSetOrMapNoEnum(shapeId); } + return typeForShape(shapeId); + } - /** - * Returns true if the provided ShapeId has type string in the Smithy model, but AWS SDK for - * Java V2 effectively expects type structure. - * @param shapeId - * @return true if AWS SDK for Java V2 expects this to have been modeled as a structure in Smithy - */ - protected boolean shapeRequiresTypeConversionFromStringToStructure( - ShapeId shapeId) { - return shapeId.toString().contains("com.amazonaws.kms#EncryptionAlgorithmSpec") - || shapeId.toString().contains("com.amazonaws.kms#SigningAlgorithmSpec") - || shapeId.toString().contains("com.amazonaws.kms#GrantOperation"); - } + @Override + public TypeName typeForShape(final ShapeId shapeId) { + final Shape shape = model.expectShape(shapeId); - @SuppressWarnings("OptionalGetWithoutIsPresent") - public ParameterizedTypeName typeForListSetOrMapNoEnum(final ShapeId shapeId) { - final Shape shape = model.getShape(shapeId) - .orElseThrow(() -> new IllegalStateException("Cannot find shape " + shapeId)); - return switch (shape.getType()) { - case LIST -> ParameterizedTypeName.get( - ClassName.get(List.class), - typeForShapeNoEnum(shape.asListShape().get().getMember().getTarget()) - ); - case SET -> ParameterizedTypeName.get( - ClassName.get(Set.class), - typeForShapeNoEnum(shape.asSetShape().get().getMember().getTarget()) - ); - case MAP -> ParameterizedTypeName.get( - ClassName.get(Map.class), - typeForShapeNoEnum(shape.asMapShape().get().getKey().getTarget()), - typeForShapeNoEnum(shape.asMapShape().get().getValue().getTarget()) - ); - default -> throw new IllegalStateException( - "typeForListSetOrMapNoEnum only accepts LIST, SET or MAP. Got: " - + shape.getType() + " for ShapeId: " + shapeId); - }; + // Overrides BYTE shapeType type conversion to SdkBytes conversion. + if (shape.getType().equals(ShapeType.BYTE)) { + return JavaAwsSdkV2.BLOB_TO_NATIVE_SDK_BYTES; } - /** - * Returns CodeBlock containing something like `member`. - * Most AWS SDK V2 setters are `uncapitalizedMemberName` with edge cases in this function - * @param shape - * @return CodeBlock containing something like `member`. - */ - public CodeBlock fieldForSetMember(MemberShape shape) { - // Some strings have a token that requires multi-letter decapitalization (e.g. "SSE", "KMS") - String tokenToUncapitalize = tokenToUncapitalizeInShape(shape); - if (!tokenToUncapitalize.equals("")) { - return CodeBlock.of("$L", shape.getMemberName().replace(tokenToUncapitalize, - tokenToUncapitalize.toLowerCase())); - } - // Attributes of SDK AttributeValue shapes are always lower-case - if (shape.getContainer().getName().equals("AttributeValue") - && isAttributeValueType(shape)) { - // "NULL" attribute is set using "nul" - if (shape.getMemberName().equals("NULL")) { - return CodeBlock.of("nul"); - } - return CodeBlock.of("$L", shape.getMemberName().toLowerCase()); - } - - return CodeBlock.of("$L", uncapitalize(shape.getMemberName())); + // BinarySetAttributeValue is the only list of bytes + if (shapeId.getName().contains("BinarySetAttributeValue")) { + return ParameterizedTypeName.get( + ClassName.get(List.class), + JavaAwsSdkV2.BLOB_TO_NATIVE_SDK_BYTES + ); } - public static ClassName classNameForAwsSdkShape(final Shape shape) { - // Assume that the shape is in the model package - ClassName smithyName = ClassName.get( - defaultModelPackageName(packageNameForAwsSdkV2Shape(shape)), - StringUtils.capitalize(shape.getId().getName())); - - if (smithyName.simpleName().endsWith("Input")) { - return ClassName.get(smithyName.packageName(), - smithyName.simpleName() - .substring( - 0, - smithyName.simpleName().lastIndexOf("Input")) - + "Request" - ); - } - - if (smithyName.simpleName().endsWith("Output")) { - return ClassName.get(smithyName.packageName(), - smithyName.simpleName() - .substring( - 0, - smithyName.simpleName().lastIndexOf("Output")) - + "Response" - ); - } - - if (shape.hasTrait(ErrorTrait.class)) { - if (smithyName.simpleName().contains("KMS")) { - return ClassName.get(smithyName.packageName(), - smithyName.simpleName() - .replace("KMS", "Kms") - ); - } - if (smithyName.simpleName().contains("CMK")) { - return ClassName.get(smithyName.packageName(), - smithyName.simpleName() - .replace("CMK", "CmK") - ); - } - if (smithyName.simpleName().endsWith("InternalServerError")) { - return ClassName.get(smithyName.packageName(), - smithyName.simpleName() - .replace("InternalServerError", "InternalServerErrorException") - ); - } - if (smithyName.simpleName().endsWith("RequestLimitExceeded")) { - return ClassName.get(smithyName.packageName(), - smithyName.simpleName() - .replace("RequestLimitExceeded", "RequestLimitExceededException") - ); - } - } - return smithyName; + return super.typeForShape(shapeId); + } + + /** + * Returns true if the provided ShapeId has type string in the Smithy model, but AWS SDK for + * Java V2 effectively expects type structure. + * @param shapeId + * @return true if AWS SDK for Java V2 expects this to have been modeled as a structure in Smithy + */ + protected boolean shapeRequiresTypeConversionFromStringToStructure( + ShapeId shapeId + ) { + return ( + shapeId + .toString() + .contains("com.amazonaws.kms#EncryptionAlgorithmSpec") || + shapeId.toString().contains("com.amazonaws.kms#SigningAlgorithmSpec") || + shapeId.toString().contains("com.amazonaws.kms#GrantOperation") + ); + } + + @SuppressWarnings("OptionalGetWithoutIsPresent") + public ParameterizedTypeName typeForListSetOrMapNoEnum( + final ShapeId shapeId + ) { + final Shape shape = model + .getShape(shapeId) + .orElseThrow(() -> + new IllegalStateException("Cannot find shape " + shapeId) + ); + return switch (shape.getType()) { + case LIST -> ParameterizedTypeName.get( + ClassName.get(List.class), + typeForShapeNoEnum(shape.asListShape().get().getMember().getTarget()) + ); + case SET -> ParameterizedTypeName.get( + ClassName.get(Set.class), + typeForShapeNoEnum(shape.asSetShape().get().getMember().getTarget()) + ); + case MAP -> ParameterizedTypeName.get( + ClassName.get(Map.class), + typeForShapeNoEnum(shape.asMapShape().get().getKey().getTarget()), + typeForShapeNoEnum(shape.asMapShape().get().getValue().getTarget()) + ); + default -> throw new IllegalStateException( + "typeForListSetOrMapNoEnum only accepts LIST, SET or MAP. Got: " + + shape.getType() + + " for ShapeId: " + + shapeId + ); + }; + } + + /** + * Returns CodeBlock containing something like `member`. + * Most AWS SDK V2 setters are `uncapitalizedMemberName` with edge cases in this function + * @param shape + * @return CodeBlock containing something like `member`. + */ + public CodeBlock fieldForSetMember(MemberShape shape) { + // Some strings have a token that requires multi-letter decapitalization (e.g. "SSE", "KMS") + String tokenToUncapitalize = tokenToUncapitalizeInShape(shape); + if (!tokenToUncapitalize.equals("")) { + return CodeBlock.of( + "$L", + shape + .getMemberName() + .replace(tokenToUncapitalize, tokenToUncapitalize.toLowerCase()) + ); } - - @Override - public ClassName classNameForStructure(final Shape shape) { - if (!(shape.isUnionShape() || shape.isStructureShape())) { - throw new IllegalArgumentException( - "typeForStructure should only be called for Structures or Unions. ShapeId: %s" - .formatted(shape.getId())); - } - if (shape.hasTrait(TraitDefinition.class)) { - throw new IllegalArgumentException( - "Trait definition structures have no corresponding generated type"); - } - // check if this Shape is in AWS SDK for Java V2 package - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { - AwsSdkNativeV2.classNameForAwsSdkShape(shape); - } - return super.classNameForStructure(shape); + // Attributes of SDK AttributeValue shapes are always lower-case + if ( + shape.getContainer().getName().equals("AttributeValue") && + isAttributeValueType(shape) + ) { + // "NULL" attribute is set using "nul" + if (shape.getMemberName().equals("NULL")) { + return CodeBlock.of("nul"); + } + return CodeBlock.of("$L", shape.getMemberName().toLowerCase()); } - public TypeName typeForOperationOutput(final ShapeId shapeId) { - StructureShape shape = model.expectShape(shapeId, StructureShape.class); - return classNameForStructure(shape); + return CodeBlock.of("$L", uncapitalize(shape.getMemberName())); + } + + public static ClassName classNameForAwsSdkShape(final Shape shape) { + // Assume that the shape is in the model package + ClassName smithyName = ClassName.get( + defaultModelPackageName(packageNameForAwsSdkV2Shape(shape)), + StringUtils.capitalize(shape.getId().getName()) + ); + + if (smithyName.simpleName().endsWith("Input")) { + return ClassName.get( + smithyName.packageName(), + smithyName + .simpleName() + .substring(0, smithyName.simpleName().lastIndexOf("Input")) + + "Request" + ); } - public final String v2FormattedEnumValue( - // ShapeIds are great; every method in this class SHOULD accept a ShapeId. - // If we ever need to handle an exception to the enum naming pattern (which the AWS SDK is full of) - // The ShapeId will be used. - @SuppressWarnings("unused") final ShapeId shapeId, - final String enumValueName - ) { - // TODO: We SHOULD employ the awsSDkNaming for more of the logic above.. - return this.awsSDKNaming.getEnumValueName(enumValueName); + if (smithyName.simpleName().endsWith("Output")) { + return ClassName.get( + smithyName.packageName(), + smithyName + .simpleName() + .substring(0, smithyName.simpleName().lastIndexOf("Output")) + + "Response" + ); } - /** - * Returns the TypeName for an AWS Service's Client Interface. - */ - @Override - public ClassName classNameForService(final ServiceShape shape) { - //TODO: refactor to not throw error on other namespace, - // but instead check AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE for - // namespace, and throw exception if not found. - checkInServiceNamespace(shape.getId()); + if (shape.hasTrait(ErrorTrait.class)) { + if (smithyName.simpleName().contains("KMS")) { return ClassName.get( - packageName, - AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE.get( - serviceShape.getId().getNamespace())); - } - - /** - * Returns the TypeName for an AWS Service's Base Exception. - *

- * To be clear, a Base Exception is concrete. - * But all of a service's other exceptions extend it. - */ - public ClassName baseErrorForService() { + smithyName.packageName(), + smithyName.simpleName().replace("KMS", "Kms") + ); + } + if (smithyName.simpleName().contains("CMK")) { + return ClassName.get( + smithyName.packageName(), + smithyName.simpleName().replace("CMK", "CmK") + ); + } + if (smithyName.simpleName().endsWith("InternalServerError")) { + return ClassName.get( + smithyName.packageName(), + smithyName + .simpleName() + .replace("InternalServerError", "InternalServerErrorException") + ); + } + if (smithyName.simpleName().endsWith("RequestLimitExceeded")) { return ClassName.get( - modelPackage, - AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION.get( - serviceShape.getId().getNamespace())); + smithyName.packageName(), + smithyName + .simpleName() + .replace("RequestLimitExceeded", "RequestLimitExceededException") + ); + } } - - public static String packageNameForService(final String awsServiceName) { - String rtn = awsServiceName; - return "software.amazon.awssdk.services.%s".formatted(rtn); + return smithyName; + } + + @Override + public ClassName classNameForStructure(final Shape shape) { + if (!(shape.isUnionShape() || shape.isStructureShape())) { + throw new IllegalArgumentException( + "typeForStructure should only be called for Structures or Unions. ShapeId: %s".formatted( + shape.getId() + ) + ); } - - static String packageNameForAwsSdkV2Shape(final Shape shape) { - String awsServiceName = AwsSdkNameResolverHelpers.awsServiceNameFromShape(shape); - return packageNameForService(awsServiceName); + if (shape.hasTrait(TraitDefinition.class)) { + throw new IllegalArgumentException( + "Trait definition structures have no corresponding generated type" + ); } - - public static String defaultModelPackageName(final String packageName) { - return "%s.model".formatted(packageName); + // check if this Shape is in AWS SDK for Java V2 package + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { + AwsSdkNativeV2.classNameForAwsSdkShape(shape); } - + return super.classNameForStructure(shape); + } + + public TypeName typeForOperationOutput(final ShapeId shapeId) { + StructureShape shape = model.expectShape(shapeId, StructureShape.class); + return classNameForStructure(shape); + } + + public final String v2FormattedEnumValue( + // ShapeIds are great; every method in this class SHOULD accept a ShapeId. + // If we ever need to handle an exception to the enum naming pattern (which the AWS SDK is full of) + // The ShapeId will be used. + @SuppressWarnings("unused") final ShapeId shapeId, + final String enumValueName + ) { + // TODO: We SHOULD employ the awsSDkNaming for more of the logic above.. + return this.awsSDKNaming.getEnumValueName(enumValueName); + } + + /** + * Returns the TypeName for an AWS Service's Client Interface. + */ + @Override + public ClassName classNameForService(final ServiceShape shape) { + //TODO: refactor to not throw error on other namespace, + // but instead check AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE for + // namespace, and throw exception if not found. + checkInServiceNamespace(shape.getId()); + return ClassName.get( + packageName, + AWS_SERVICE_NAMESPACE_TO_CLIENT_INTERFACE.get( + serviceShape.getId().getNamespace() + ) + ); + } + + /** + * Returns the TypeName for an AWS Service's Base Exception. + *

+ * To be clear, a Base Exception is concrete. + * But all of a service's other exceptions extend it. + */ + public ClassName baseErrorForService() { + return ClassName.get( + modelPackage, + AWS_SERVICE_NAMESPACE_TO_BASE_EXCEPTION.get( + serviceShape.getId().getNamespace() + ) + ); + } + + public static String packageNameForService(final String awsServiceName) { + String rtn = awsServiceName; + return "software.amazon.awssdk.services.%s".formatted(rtn); + } + + static String packageNameForAwsSdkV2Shape(final Shape shape) { + String awsServiceName = AwsSdkNameResolverHelpers.awsServiceNameFromShape( + shape + ); + return packageNameForService(awsServiceName); + } + + public static String defaultModelPackageName(final String packageName) { + return "%s.model".formatted(packageName); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkV2NameResolverUtils.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkV2NameResolverUtils.java index 3e3305fc37..65cc896dbe 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkV2NameResolverUtils.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkV2NameResolverUtils.java @@ -5,6 +5,7 @@ import software.amazon.smithy.model.shapes.MemberShape; public class AwsSdkV2NameResolverUtils { + /** * Returns true if shape is an attribute of an AttributeValue shape; false otherwise * @param shape @@ -13,18 +14,19 @@ public class AwsSdkV2NameResolverUtils { public static boolean isAttributeValueType(MemberShape shape) { shape.getContainer().getName().equals("AttributeValue"); String memberName = shape.getMemberName(); - return (shape.getContainer().getName().equals("AttributeValue") - && (memberName.equals("BOOL") - || memberName.equals("NULL") - || memberName.equals("L") - || memberName.equals("M") - || memberName.equals("BS") - || memberName.equals("NS") - || memberName.equals("SS") - || memberName.equals("B") - || memberName.equals("N") - || memberName.equals("S") - )); + return ( + shape.getContainer().getName().equals("AttributeValue") && + (memberName.equals("BOOL") || + memberName.equals("NULL") || + memberName.equals("L") || + memberName.equals("M") || + memberName.equals("BS") || + memberName.equals("NS") || + memberName.equals("SS") || + memberName.equals("B") || + memberName.equals("N") || + memberName.equals("S")) + ); } public static String tokenToUncapitalizeInShape(MemberShape shape) { @@ -41,5 +43,4 @@ public static String tokenToUncapitalizeInShape(MemberShape shape) { } return ""; } - } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Constants.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Constants.java index 9739abe8ef..d245c5435f 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Constants.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Constants.java @@ -3,21 +3,49 @@ package software.amazon.polymorph.smithyjava.nameresolver; import com.squareup.javapoet.ClassName; - import java.util.Set; - import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.ShapeType; public class Constants { - public static final ShapeId SMITHY_API_UNIT = ShapeId.fromParts("smithy.api", "Unit"); - public static final ClassName DAFNY_OPTION_CLASS_NAME = ClassName.get("Wrappers_Compile", "Option"); - public static final ClassName DAFNY_RESULT_CLASS_NAME = ClassName.get("Wrappers_Compile", "Result"); - public static final ClassName DAFNY_TUPLE0_CLASS_NAME = ClassName.get("dafny", "Tuple0"); - public static final ClassName DAFNY_TYPE_DESCRIPTOR_CLASS_NAME = ClassName.get("dafny", "TypeDescriptor"); - public static final ClassName DAFNY_SEQUENCE_CLASS_NAME = ClassName.get("dafny", "DafnySequence"); - public static final ClassName DAFNY_SET_CLASS_NAME = ClassName.get("dafny", "DafnySet"); - public static final ClassName DAFNY_MAP_CLASS_NAME = ClassName.get("dafny", "DafnyMap"); - public static final Set SHAPE_TYPES_LIST_SET = Set.of(ShapeType.LIST, ShapeType.SET); - public static final Set SHAPE_TYPES_LIST_SET_MAP = Set.of(ShapeType.LIST, ShapeType.SET, ShapeType.MAP); + + public static final ShapeId SMITHY_API_UNIT = ShapeId.fromParts( + "smithy.api", + "Unit" + ); + public static final ClassName DAFNY_OPTION_CLASS_NAME = ClassName.get( + "Wrappers_Compile", + "Option" + ); + public static final ClassName DAFNY_RESULT_CLASS_NAME = ClassName.get( + "Wrappers_Compile", + "Result" + ); + public static final ClassName DAFNY_TUPLE0_CLASS_NAME = ClassName.get( + "dafny", + "Tuple0" + ); + public static final ClassName DAFNY_TYPE_DESCRIPTOR_CLASS_NAME = + ClassName.get("dafny", "TypeDescriptor"); + public static final ClassName DAFNY_SEQUENCE_CLASS_NAME = ClassName.get( + "dafny", + "DafnySequence" + ); + public static final ClassName DAFNY_SET_CLASS_NAME = ClassName.get( + "dafny", + "DafnySet" + ); + public static final ClassName DAFNY_MAP_CLASS_NAME = ClassName.get( + "dafny", + "DafnyMap" + ); + public static final Set SHAPE_TYPES_LIST_SET = Set.of( + ShapeType.LIST, + ShapeType.SET + ); + public static final Set SHAPE_TYPES_LIST_SET_MAP = Set.of( + ShapeType.LIST, + ShapeType.SET, + ShapeType.MAP + ); } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Dafny.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Dafny.java index df5743c253..64f53a3d74 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Dafny.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Dafny.java @@ -2,22 +2,20 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.nameresolver; +import static software.amazon.smithy.utils.StringUtils.capitalize; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.WildcardTypeName; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.math.BigDecimal; import java.math.BigInteger; import java.util.Map; import java.util.Objects; - import javax.annotation.Nullable; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import software.amazon.polymorph.smithydafny.DafnyNameResolver; import software.amazon.polymorph.smithydafny.DafnyVersion; import software.amazon.polymorph.smithyjava.MethodReference; @@ -27,7 +25,6 @@ import software.amazon.polymorph.traits.ReferenceTrait; import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; import software.amazon.polymorph.utils.DafnyNameResolverHelpers; - import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.MemberShape; import software.amazon.smithy.model.shapes.ResourceShape; @@ -40,353 +37,505 @@ import software.amazon.smithy.model.traits.EnumTrait; import software.amazon.smithy.model.traits.ErrorTrait; -import static software.amazon.smithy.utils.StringUtils.capitalize; - /** * Provides a consistent mapping between names of * model Shapes and generated identifiers in Java * for the Dafny generated Java code. */ public class Dafny extends NameResolver { - @SuppressWarnings("unused") - private static final Logger LOGGER = LoggerFactory.getLogger(Dafny.class); - public static final Map TYPE_DESCRIPTOR_BY_SHAPE_TYPE; - static { - TYPE_DESCRIPTOR_BY_SHAPE_TYPE = Map.ofEntries( - Map.entry(ShapeType.STRING, CodeBlock.of("$T._typeDescriptor($T.CHAR)", Constants.DAFNY_SEQUENCE_CLASS_NAME, Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME)), - // Tony is not sure BLOB is correct... - Map.entry(ShapeType.BLOB, CodeBlock.of("$T._typeDescriptor($T.BYTE)", Constants.DAFNY_SEQUENCE_CLASS_NAME, Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME)), - Map.entry(ShapeType.BOOLEAN, CodeBlock.of("$T.BOOLEAN", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME)), - Map.entry(ShapeType.BYTE, CodeBlock.of("$T.BYTE", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME)), - Map.entry(ShapeType.SHORT, CodeBlock.of("$T.SHORT", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME)), - Map.entry(ShapeType.INTEGER, CodeBlock.of("$T.INT", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME)), - Map.entry(ShapeType.LONG, CodeBlock.of("$T.LONG", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME)), - Map.entry(ShapeType.TIMESTAMP, CodeBlock.of("$T._typeDescriptor($T.CHAR)", Constants.DAFNY_SEQUENCE_CLASS_NAME, Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME)), - Map.entry(ShapeType.BIG_INTEGER, CodeBlock.of("$T.BIG_INTEGER", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME)) - ); - } - - private final DafnyVersion dafnyVersion; - - public Dafny( - final String packageName, - final Model model, - final ServiceShape serviceShape, - final CodegenSubject.AwsSdkVersion awsSdkVersion, - final DafnyVersion dafnyVersion) { - super( - packageName, - serviceShape, - model, - modelPackageNameForServiceShape(serviceShape), - awsSdkVersion); - this.dafnyVersion = dafnyVersion; - } - - /** - * @param name A Constructor of the Dafny Datatype. - * @param isRecordType Does the datatype have a single data constructor, - * also called a "record type"? - * @return The name of Dafny-Java created method to create an instance of - * the constructor. - */ - public static String datatypeConstructorCreate(String name, boolean isRecordType) { - if (isRecordType) { - return "create"; - } - return "create_" + DafnyNameResolverHelpers.dafnyCompilesExtra_(name); - } - - // Dafnys greater than or equal to this will need Type Descriptors for constructing datatypes - private static final DafnyVersion NEEDS_TYPE_DESCRIPTORS_WHEN_CONSTRUCTING_DATATYPES = new DafnyVersion(4, 3, 0); - - /** - * @return Whether the given Dafny version requires type descriptor values when instantiating datatype constructors. - */ - public static boolean datatypeConstructorsNeedTypeDescriptors(DafnyVersion dafnyVersion) { - return dafnyVersion.compareTo(NEEDS_TYPE_DESCRIPTORS_WHEN_CONSTRUCTING_DATATYPES) >= 0; - } - - private boolean datatypeConstructorsNeedTypeDescriptors() { - return datatypeConstructorsNeedTypeDescriptors(dafnyVersion); - } - - /** - * Code to create an instance of the None constructor of Wrappers.Option. - * @param typeDescriptor the code to create a TypeDescriptor for the type T, - * which is needed if datatypeConstructorsNeedTypeDescriptors() - */ - public CodeBlock createNone(CodeBlock typeDescriptor) { - if (datatypeConstructorsNeedTypeDescriptors()) { - return CodeBlock.of( - "$T.create_None($L)", - ClassName.get("Wrappers_Compile", "Option"), - typeDescriptor); - } else { - return CodeBlock.of( - "$T.create_None()", - ClassName.get("Wrappers_Compile", "Option")); - } - } - - /** - * Code to create an instance of the Some(value: T) constructor of Wrappers.Option. - * @param typeDescriptor the code to create a TypeDescriptor for the type T, - * which is needed if datatypeConstructorsNeedTypeDescriptors() - */ - public CodeBlock createSome(CodeBlock typeDescriptor, CodeBlock value) { - if (datatypeConstructorsNeedTypeDescriptors()) { - return CodeBlock.of( - "$T.create_Some($L, $L)", - Constants.DAFNY_OPTION_CLASS_NAME, - typeDescriptor, - value); - } else { - return CodeBlock.of( - "$T.create_Some($L)", - Constants.DAFNY_OPTION_CLASS_NAME, - value); - } - } - - /** - * Code to create an instance of the Success(value: T) constructor of Wrappers.Result. - * @param valueTypeDescriptor the code to create a TypeDescriptor for the type T, - * which is needed if datatypeConstructorsNeedTypeDescriptors() - */ - public CodeBlock createSuccess(CodeBlock valueTypeDescriptor, CodeBlock value) { - if (datatypeConstructorsNeedTypeDescriptors()) { - return CodeBlock.of( - "$T.create_Success($L, Error._typeDescriptor(), $L)", - Constants.DAFNY_RESULT_CLASS_NAME, - valueTypeDescriptor, - value); - } else { - return CodeBlock.of( - "$T.create_Success($L)", - Constants.DAFNY_RESULT_CLASS_NAME, - value); - } - } - - /** - * Code to create an instance of the Failure(error: Error) constructor of Wrappers.Result. - * @param valueTypeDescriptor the code to create a TypeDescriptor for the type T, - * which is needed if datatypeConstructorsNeedTypeDescriptors() - */ - public CodeBlock createFailure(CodeBlock valueTypeDescriptor, CodeBlock error) { - if (datatypeConstructorsNeedTypeDescriptors()) { - return CodeBlock.of( - "$T.create_Failure($L, Error._typeDescriptor(), $L)", - Constants.DAFNY_RESULT_CLASS_NAME, - valueTypeDescriptor, - error); - } else { - return CodeBlock.of( - "$T.create_Failure($L)", - Constants.DAFNY_RESULT_CLASS_NAME, - error); - } - } - - public static String datatypeConstructorIs(String name) { - String dafnyEnumName = DafnyNameResolverHelpers.dafnyCompilesExtra_(name); - return "is_" + dafnyEnumName; - } - - public static String datatypeDeconstructor(String name) { - String dafnyEnumName = DafnyNameResolverHelpers.dafnyCompilesExtra_(name); - return "dtor_" + dafnyEnumName + "()"; - } - - public static String aggregateSizeMethod(ShapeType shapeType) { - return switch (shapeType) { - case LIST -> "length()"; - case SET, MAP -> "size();"; - default -> throw new IllegalStateException( - "aggregateSizeMethod only accepts LIST, SET, or MAP. Got : " + shapeType); - }; - } - - static String modelPackageNameForNamespace(final String namespace) { - return DafnyNameResolverHelpers.dafnyExternNamespaceForNamespace(namespace); - } - - static String packageNameForServiceShape(ServiceShape serviceShape) { - return DafnyNameResolverHelpers.packageNameForNamespace(serviceShape.getId().getNamespace()); - } - - static String modelPackageNameForServiceShape(ServiceShape serviceShape) { - return modelPackageNameForNamespace(serviceShape.getId().getNamespace()); - } - - public static CodeBlock getMemberField(MemberShape shape) { - return CodeBlock.of("$L", datatypeDeconstructor(shape.getMemberName())); - } - - /** If not optional, get via {@code dtor_()}. - * Otherwise, get via {@code dtor_().dtor_value()}*/ - public static CodeBlock getMemberFieldValue(MemberShape shape) { - // if required, get via Field - if (shape.isRequired()) { - return getMemberField(shape); - } - // if optional, get via dtor_value() - return CodeBlock.of("$L.$L", getMemberField(shape), datatypeDeconstructor("value")); - } - - public static TypeName asDafnyResult(TypeName success, TypeName failure) { - return ParameterizedTypeName.get( - Constants.DAFNY_RESULT_CLASS_NAME, - success, - failure - ); - } - public static TypeName asDafnyOption(TypeName value) { - return ParameterizedTypeName.get( - Constants.DAFNY_OPTION_CLASS_NAME, - value - ); - } - - public String packageName() { - return this.packageName; - } - - /** - * Returns the Dafny-compiled-Java type corresponding to the given shape. - *

- */ - @SuppressWarnings("OptionalGetWithoutIsPresent") - public TypeName typeForShape(final ShapeId shapeId) { - final Shape shape = model.getShape(shapeId) - .orElseThrow(() -> new IllegalStateException("Cannot find shape " + shapeId)); - return switch (shape.getType()) { - case BLOB -> Dafny.typeForBlob(); - case BOOLEAN -> TypeName.BOOLEAN.box(); - case STRING -> typeForString(shape.asStringShape().get()); - case TIMESTAMP -> typeForCharacterSequence(); - case BYTE -> TypeName.BYTE.box(); - case SHORT -> TypeName.SHORT.box(); - case INTEGER -> TypeName.INT.box(); - case LONG -> TypeName.LONG.box(); - case DOUBLE -> Dafny.typeForDouble(); - case BIG_DECIMAL -> ClassName.get(BigDecimal.class); - case BIG_INTEGER -> ClassName.get(BigInteger.class); - case LIST, SET, MAP -> typeForAggregateWithWildcard(shapeId); - case MEMBER -> typeForShape(shape.asMemberShape().get().getTarget()); - case STRUCTURE -> classForStructure(shape.asStructureShape().get()); - case SERVICE -> classNameForService(shape.asServiceShape().get()); - case RESOURCE -> classNameForResource(shape.asResourceShape().get()); - // Unions are identical to Structures (in this context). - case UNION -> classForNotErrorNotUnitShape(shape.asUnionShape().get()); - default -> throw new UnsupportedOperationException("Unsupported shape " + shapeId); - }; - } - - private static TypeName typeForBlob() { - return ParameterizedTypeName.get( - Constants.DAFNY_SEQUENCE_CLASS_NAME, - WildcardTypeName.subtypeOf(TypeName.BYTE.box())); - } - - static TypeName typeForDouble() { - return typeForBlob(); - } - - @SuppressWarnings("OptionalGetWithoutIsPresent") - public TypeName typeForAggregateWithWildcard(final ShapeId shapeId) { - final Shape shape = model.getShape(shapeId) - .orElseThrow(() -> new IllegalStateException("Cannot find shape " + shapeId)); - - if (!Generator.Constants.LIST_MAP_SET_SHAPE_TYPES.contains(shape.getType())) { - throw new UnsupportedOperationException( - "No Dafny Java Type for %s yet.".formatted(shape.getType()) - ); - } - return switch (shape.getType()) { - case LIST -> ParameterizedTypeName.get( - Constants.DAFNY_SEQUENCE_CLASS_NAME, - WildcardTypeName.subtypeOf(typeForShape(shape.asListShape().get().getMember().getTarget())) - ); - case SET -> ParameterizedTypeName.get( - Constants.DAFNY_SET_CLASS_NAME, - WildcardTypeName.subtypeOf(typeForShape(shape.asSetShape().get().getMember().getTarget())) - ); - case MAP -> ParameterizedTypeName.get( - Constants.DAFNY_MAP_CLASS_NAME, - WildcardTypeName.subtypeOf(typeForShape(shape.asMapShape().get().getKey().getTarget())), - WildcardTypeName.subtypeOf(typeForShape(shape.asMapShape().get().getValue().getTarget())) - ); - default -> throw new IllegalStateException("Unexpected value: " + shape.getType()); - }; - } - - public ClassName abstractClassForError() { - return ClassName.get(modelPackage, "Error"); - } - - public ClassName classForOpaqueError() { - return classForDatatypeConstructor("Error", "Opaque"); - } - - public CodeBlock typeDescriptor(ShapeId shapeId) { - Shape shape = model.getShape(shapeId) - .orElseThrow(() -> new IllegalStateException("Cannot find shape " + shapeId)); - if (shape.isMemberShape()) { - // We have just established it is a member shape, asMemberShape will return a value - //noinspection OptionalGetWithoutIsPresent - return typeDescriptor(shape.asMemberShape().get().getTarget()); - } - if (shape.hasTrait(ErrorTrait.class)) { - return CodeBlock.of("$L()", - new MethodReference(abstractClassForError(), "_typeDescriptor").asNormalReference()); - } - if (shape.hasTrait(ReferenceTrait.class) || shape.isServiceShape() || shape.isResourceShape()) { - // It is safe to use typeForShape here, as ReferenceTrait will always turn into a Resource or Service - TypeName interfaceClassName = typeForShape(shapeId); - return CodeBlock.of("$T.reference($T.class)", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME, interfaceClassName); - } - if (shape.getId().equals(Constants.SMITHY_API_UNIT)) { - return CodeBlock.of("$L()", - new MethodReference(Constants.DAFNY_TUPLE0_CLASS_NAME, "_typeDescriptor").asNormalReference()); - } - if (shape.getType().getCategory().equals(ShapeType.Category.SIMPLE) && !shape.hasTrait(EnumTrait.class)) { - @Nullable CodeBlock typeDescriptor = - shape.hasTrait(DafnyUtf8BytesTrait.class) - // A Dafny UTF8 Bytes are basically a blob. - // They are a sequence of uint8 in Dafny, this makes them the same as a Blob. - ? TYPE_DESCRIPTOR_BY_SHAPE_TYPE.get(ShapeType.BLOB) - : TYPE_DESCRIPTOR_BY_SHAPE_TYPE.get(shape.getType()); - if (Objects.nonNull(typeDescriptor)) { - return CodeBlock.of("$L", typeDescriptor); - } - } - if (shape.getType().isShapeType(ShapeType.LIST)) { - CodeBlock elementTypeDescriptor = typeDescriptor(shape.asListShape().get().getMember().getTarget()); - return CodeBlock.of("$T._typeDescriptor($L)", Constants.DAFNY_SEQUENCE_CLASS_NAME, elementTypeDescriptor); - } - if (shape.getType().isShapeType(ShapeType.SET)) { - CodeBlock elementTypeDescriptor = typeDescriptor(shape.asSetShape().get().getMember().getTarget()); - return CodeBlock.of("$T._typeDescriptor($L)", Constants.DAFNY_SET_CLASS_NAME, elementTypeDescriptor); - } - if (shape.getType().isShapeType(ShapeType.MAP)) { - CodeBlock keyTypeDescriptor = typeDescriptor(shape.asMapShape().get().getKey().getTarget()); - CodeBlock valueTypeDescriptor = typeDescriptor(shape.asMapShape().get().getValue().getTarget()); - return CodeBlock.of("$T._typeDescriptor($L, $L)", Constants.DAFNY_MAP_CLASS_NAME, keyTypeDescriptor, valueTypeDescriptor); - } - if (shape.getType().isShapeType(ShapeType.STRUCTURE) - || shape.getType().isShapeType(ShapeType.UNION) - || shape.getType().isShapeType(ShapeType.DOUBLE) - || shape.hasTrait(EnumTrait.class)) { - return CodeBlock.of("$L()", - new MethodReference(classForNotErrorNotUnitShape(shape), "_typeDescriptor").asNormalReference()); - } - throw new IllegalArgumentException("Don't know how to create a type descriptor for this shape: %s".formatted(shape)); - } - - /* + @SuppressWarnings("unused") + private static final Logger LOGGER = LoggerFactory.getLogger(Dafny.class); + + public static final Map TYPE_DESCRIPTOR_BY_SHAPE_TYPE; + + static { + TYPE_DESCRIPTOR_BY_SHAPE_TYPE = + Map.ofEntries( + Map.entry( + ShapeType.STRING, + CodeBlock.of( + "$T._typeDescriptor($T.CHAR)", + Constants.DAFNY_SEQUENCE_CLASS_NAME, + Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME + ) + ), + // Tony is not sure BLOB is correct... + Map.entry( + ShapeType.BLOB, + CodeBlock.of( + "$T._typeDescriptor($T.BYTE)", + Constants.DAFNY_SEQUENCE_CLASS_NAME, + Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME + ) + ), + Map.entry( + ShapeType.BOOLEAN, + CodeBlock.of("$T.BOOLEAN", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME) + ), + Map.entry( + ShapeType.BYTE, + CodeBlock.of("$T.BYTE", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME) + ), + Map.entry( + ShapeType.SHORT, + CodeBlock.of("$T.SHORT", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME) + ), + Map.entry( + ShapeType.INTEGER, + CodeBlock.of("$T.INT", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME) + ), + Map.entry( + ShapeType.LONG, + CodeBlock.of("$T.LONG", Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME) + ), + Map.entry( + ShapeType.TIMESTAMP, + CodeBlock.of( + "$T._typeDescriptor($T.CHAR)", + Constants.DAFNY_SEQUENCE_CLASS_NAME, + Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME + ) + ), + Map.entry( + ShapeType.BIG_INTEGER, + CodeBlock.of( + "$T.BIG_INTEGER", + Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME + ) + ) + ); + } + + private final DafnyVersion dafnyVersion; + + public Dafny( + final String packageName, + final Model model, + final ServiceShape serviceShape, + final CodegenSubject.AwsSdkVersion awsSdkVersion, + final DafnyVersion dafnyVersion + ) { + super( + packageName, + serviceShape, + model, + modelPackageNameForServiceShape(serviceShape), + awsSdkVersion + ); + this.dafnyVersion = dafnyVersion; + } + + /** + * @param name A Constructor of the Dafny Datatype. + * @param isRecordType Does the datatype have a single data constructor, + * also called a "record type"? + * @return The name of Dafny-Java created method to create an instance of + * the constructor. + */ + public static String datatypeConstructorCreate( + String name, + boolean isRecordType + ) { + if (isRecordType) { + return "create"; + } + return "create_" + DafnyNameResolverHelpers.dafnyCompilesExtra_(name); + } + + // Dafnys greater than or equal to this will need Type Descriptors for constructing datatypes + private static final DafnyVersion NEEDS_TYPE_DESCRIPTORS_WHEN_CONSTRUCTING_DATATYPES = + new DafnyVersion(4, 3, 0); + + /** + * @return Whether the given Dafny version requires type descriptor values when instantiating datatype constructors. + */ + public static boolean datatypeConstructorsNeedTypeDescriptors( + DafnyVersion dafnyVersion + ) { + return ( + dafnyVersion.compareTo( + NEEDS_TYPE_DESCRIPTORS_WHEN_CONSTRUCTING_DATATYPES + ) >= + 0 + ); + } + + private boolean datatypeConstructorsNeedTypeDescriptors() { + return datatypeConstructorsNeedTypeDescriptors(dafnyVersion); + } + + /** + * Code to create an instance of the None constructor of Wrappers.Option. + * @param typeDescriptor the code to create a TypeDescriptor for the type T, + * which is needed if datatypeConstructorsNeedTypeDescriptors() + */ + public CodeBlock createNone(CodeBlock typeDescriptor) { + if (datatypeConstructorsNeedTypeDescriptors()) { + return CodeBlock.of( + "$T.create_None($L)", + ClassName.get("Wrappers_Compile", "Option"), + typeDescriptor + ); + } else { + return CodeBlock.of( + "$T.create_None()", + ClassName.get("Wrappers_Compile", "Option") + ); + } + } + + /** + * Code to create an instance of the Some(value: T) constructor of Wrappers.Option. + * @param typeDescriptor the code to create a TypeDescriptor for the type T, + * which is needed if datatypeConstructorsNeedTypeDescriptors() + */ + public CodeBlock createSome(CodeBlock typeDescriptor, CodeBlock value) { + if (datatypeConstructorsNeedTypeDescriptors()) { + return CodeBlock.of( + "$T.create_Some($L, $L)", + Constants.DAFNY_OPTION_CLASS_NAME, + typeDescriptor, + value + ); + } else { + return CodeBlock.of( + "$T.create_Some($L)", + Constants.DAFNY_OPTION_CLASS_NAME, + value + ); + } + } + + /** + * Code to create an instance of the Success(value: T) constructor of Wrappers.Result. + * @param valueTypeDescriptor the code to create a TypeDescriptor for the type T, + * which is needed if datatypeConstructorsNeedTypeDescriptors() + */ + public CodeBlock createSuccess( + CodeBlock valueTypeDescriptor, + CodeBlock value + ) { + if (datatypeConstructorsNeedTypeDescriptors()) { + return CodeBlock.of( + "$T.create_Success($L, Error._typeDescriptor(), $L)", + Constants.DAFNY_RESULT_CLASS_NAME, + valueTypeDescriptor, + value + ); + } else { + return CodeBlock.of( + "$T.create_Success($L)", + Constants.DAFNY_RESULT_CLASS_NAME, + value + ); + } + } + + /** + * Code to create an instance of the Failure(error: Error) constructor of Wrappers.Result. + * @param valueTypeDescriptor the code to create a TypeDescriptor for the type T, + * which is needed if datatypeConstructorsNeedTypeDescriptors() + */ + public CodeBlock createFailure( + CodeBlock valueTypeDescriptor, + CodeBlock error + ) { + if (datatypeConstructorsNeedTypeDescriptors()) { + return CodeBlock.of( + "$T.create_Failure($L, Error._typeDescriptor(), $L)", + Constants.DAFNY_RESULT_CLASS_NAME, + valueTypeDescriptor, + error + ); + } else { + return CodeBlock.of( + "$T.create_Failure($L)", + Constants.DAFNY_RESULT_CLASS_NAME, + error + ); + } + } + + public static String datatypeConstructorIs(String name) { + String dafnyEnumName = DafnyNameResolverHelpers.dafnyCompilesExtra_(name); + return "is_" + dafnyEnumName; + } + + public static String datatypeDeconstructor(String name) { + String dafnyEnumName = DafnyNameResolverHelpers.dafnyCompilesExtra_(name); + return "dtor_" + dafnyEnumName + "()"; + } + + public static String aggregateSizeMethod(ShapeType shapeType) { + return switch (shapeType) { + case LIST -> "length()"; + case SET, MAP -> "size();"; + default -> throw new IllegalStateException( + "aggregateSizeMethod only accepts LIST, SET, or MAP. Got : " + shapeType + ); + }; + } + + static String modelPackageNameForNamespace(final String namespace) { + return DafnyNameResolverHelpers.dafnyExternNamespaceForNamespace(namespace); + } + + static String packageNameForServiceShape(ServiceShape serviceShape) { + return DafnyNameResolverHelpers.packageNameForNamespace( + serviceShape.getId().getNamespace() + ); + } + + static String modelPackageNameForServiceShape(ServiceShape serviceShape) { + return modelPackageNameForNamespace(serviceShape.getId().getNamespace()); + } + + public static CodeBlock getMemberField(MemberShape shape) { + return CodeBlock.of("$L", datatypeDeconstructor(shape.getMemberName())); + } + + /** If not optional, get via {@code dtor_()}. + * Otherwise, get via {@code dtor_().dtor_value()}*/ + public static CodeBlock getMemberFieldValue(MemberShape shape) { + // if required, get via Field + if (shape.isRequired()) { + return getMemberField(shape); + } + // if optional, get via dtor_value() + return CodeBlock.of( + "$L.$L", + getMemberField(shape), + datatypeDeconstructor("value") + ); + } + + public static TypeName asDafnyResult(TypeName success, TypeName failure) { + return ParameterizedTypeName.get( + Constants.DAFNY_RESULT_CLASS_NAME, + success, + failure + ); + } + + public static TypeName asDafnyOption(TypeName value) { + return ParameterizedTypeName.get(Constants.DAFNY_OPTION_CLASS_NAME, value); + } + + public String packageName() { + return this.packageName; + } + + /** + * Returns the Dafny-compiled-Java type corresponding to the given shape. + *

+ */ + @SuppressWarnings("OptionalGetWithoutIsPresent") + public TypeName typeForShape(final ShapeId shapeId) { + final Shape shape = model + .getShape(shapeId) + .orElseThrow(() -> + new IllegalStateException("Cannot find shape " + shapeId) + ); + return switch (shape.getType()) { + case BLOB -> Dafny.typeForBlob(); + case BOOLEAN -> TypeName.BOOLEAN.box(); + case STRING -> typeForString(shape.asStringShape().get()); + case TIMESTAMP -> typeForCharacterSequence(); + case BYTE -> TypeName.BYTE.box(); + case SHORT -> TypeName.SHORT.box(); + case INTEGER -> TypeName.INT.box(); + case LONG -> TypeName.LONG.box(); + case DOUBLE -> Dafny.typeForDouble(); + case BIG_DECIMAL -> ClassName.get(BigDecimal.class); + case BIG_INTEGER -> ClassName.get(BigInteger.class); + case LIST, SET, MAP -> typeForAggregateWithWildcard(shapeId); + case MEMBER -> typeForShape(shape.asMemberShape().get().getTarget()); + case STRUCTURE -> classForStructure(shape.asStructureShape().get()); + case SERVICE -> classNameForService(shape.asServiceShape().get()); + case RESOURCE -> classNameForResource(shape.asResourceShape().get()); + // Unions are identical to Structures (in this context). + case UNION -> classForNotErrorNotUnitShape(shape.asUnionShape().get()); + default -> throw new UnsupportedOperationException( + "Unsupported shape " + shapeId + ); + }; + } + + private static TypeName typeForBlob() { + return ParameterizedTypeName.get( + Constants.DAFNY_SEQUENCE_CLASS_NAME, + WildcardTypeName.subtypeOf(TypeName.BYTE.box()) + ); + } + + static TypeName typeForDouble() { + return typeForBlob(); + } + + @SuppressWarnings("OptionalGetWithoutIsPresent") + public TypeName typeForAggregateWithWildcard(final ShapeId shapeId) { + final Shape shape = model + .getShape(shapeId) + .orElseThrow(() -> + new IllegalStateException("Cannot find shape " + shapeId) + ); + + if ( + !Generator.Constants.LIST_MAP_SET_SHAPE_TYPES.contains(shape.getType()) + ) { + throw new UnsupportedOperationException( + "No Dafny Java Type for %s yet.".formatted(shape.getType()) + ); + } + return switch (shape.getType()) { + case LIST -> ParameterizedTypeName.get( + Constants.DAFNY_SEQUENCE_CLASS_NAME, + WildcardTypeName.subtypeOf( + typeForShape(shape.asListShape().get().getMember().getTarget()) + ) + ); + case SET -> ParameterizedTypeName.get( + Constants.DAFNY_SET_CLASS_NAME, + WildcardTypeName.subtypeOf( + typeForShape(shape.asSetShape().get().getMember().getTarget()) + ) + ); + case MAP -> ParameterizedTypeName.get( + Constants.DAFNY_MAP_CLASS_NAME, + WildcardTypeName.subtypeOf( + typeForShape(shape.asMapShape().get().getKey().getTarget()) + ), + WildcardTypeName.subtypeOf( + typeForShape(shape.asMapShape().get().getValue().getTarget()) + ) + ); + default -> throw new IllegalStateException( + "Unexpected value: " + shape.getType() + ); + }; + } + + public ClassName abstractClassForError() { + return ClassName.get(modelPackage, "Error"); + } + + public ClassName classForOpaqueError() { + return classForDatatypeConstructor("Error", "Opaque"); + } + + public CodeBlock typeDescriptor(ShapeId shapeId) { + Shape shape = model + .getShape(shapeId) + .orElseThrow(() -> + new IllegalStateException("Cannot find shape " + shapeId) + ); + if (shape.isMemberShape()) { + // We have just established it is a member shape, asMemberShape will return a value + //noinspection OptionalGetWithoutIsPresent + return typeDescriptor(shape.asMemberShape().get().getTarget()); + } + if (shape.hasTrait(ErrorTrait.class)) { + return CodeBlock.of( + "$L()", + new MethodReference(abstractClassForError(), "_typeDescriptor") + .asNormalReference() + ); + } + if ( + shape.hasTrait(ReferenceTrait.class) || + shape.isServiceShape() || + shape.isResourceShape() + ) { + // It is safe to use typeForShape here, as ReferenceTrait will always turn into a Resource or Service + TypeName interfaceClassName = typeForShape(shapeId); + return CodeBlock.of( + "$T.reference($T.class)", + Constants.DAFNY_TYPE_DESCRIPTOR_CLASS_NAME, + interfaceClassName + ); + } + if (shape.getId().equals(Constants.SMITHY_API_UNIT)) { + return CodeBlock.of( + "$L()", + new MethodReference( + Constants.DAFNY_TUPLE0_CLASS_NAME, + "_typeDescriptor" + ) + .asNormalReference() + ); + } + if ( + shape.getType().getCategory().equals(ShapeType.Category.SIMPLE) && + !shape.hasTrait(EnumTrait.class) + ) { + @Nullable + CodeBlock typeDescriptor = shape.hasTrait(DafnyUtf8BytesTrait.class) + // A Dafny UTF8 Bytes are basically a blob. + // They are a sequence of uint8 in Dafny, this makes them the same as a Blob. + ? TYPE_DESCRIPTOR_BY_SHAPE_TYPE.get(ShapeType.BLOB) + : TYPE_DESCRIPTOR_BY_SHAPE_TYPE.get(shape.getType()); + if (Objects.nonNull(typeDescriptor)) { + return CodeBlock.of("$L", typeDescriptor); + } + } + if (shape.getType().isShapeType(ShapeType.LIST)) { + CodeBlock elementTypeDescriptor = typeDescriptor( + shape.asListShape().get().getMember().getTarget() + ); + return CodeBlock.of( + "$T._typeDescriptor($L)", + Constants.DAFNY_SEQUENCE_CLASS_NAME, + elementTypeDescriptor + ); + } + if (shape.getType().isShapeType(ShapeType.SET)) { + CodeBlock elementTypeDescriptor = typeDescriptor( + shape.asSetShape().get().getMember().getTarget() + ); + return CodeBlock.of( + "$T._typeDescriptor($L)", + Constants.DAFNY_SET_CLASS_NAME, + elementTypeDescriptor + ); + } + if (shape.getType().isShapeType(ShapeType.MAP)) { + CodeBlock keyTypeDescriptor = typeDescriptor( + shape.asMapShape().get().getKey().getTarget() + ); + CodeBlock valueTypeDescriptor = typeDescriptor( + shape.asMapShape().get().getValue().getTarget() + ); + return CodeBlock.of( + "$T._typeDescriptor($L, $L)", + Constants.DAFNY_MAP_CLASS_NAME, + keyTypeDescriptor, + valueTypeDescriptor + ); + } + if ( + shape.getType().isShapeType(ShapeType.STRUCTURE) || + shape.getType().isShapeType(ShapeType.UNION) || + shape.getType().isShapeType(ShapeType.DOUBLE) || + shape.hasTrait(EnumTrait.class) + ) { + return CodeBlock.of( + "$L()", + new MethodReference( + classForNotErrorNotUnitShape(shape), + "_typeDescriptor" + ) + .asNormalReference() + ); + } + throw new IllegalArgumentException( + "Don't know how to create a type descriptor for this shape: %s".formatted( + shape + ) + ); + } + + /* For Datatypes, the destructor (thing) is the left Hand , and the constructors (x, y) are the right hand of: datatype thing = x | y @@ -394,136 +543,178 @@ and the constructors (x, y) are the right hand of: Outside the Dafny world, Datatype constructors are sometimes called variants. */ - public ClassName classForDatatypeConstructor(String dataTypeName, String constructorName) { - return ClassName.get(modelPackage, "%s_%s".formatted( - DafnyNameResolverHelpers.dafnyCompilesExtra_(dataTypeName), DafnyNameResolverHelpers.dafnyCompilesExtra_(constructorName))); - } - - // This method assumes the shape is not an Error nor a Unit - ClassName classForNotErrorNotUnitShape(Shape shape) { - return classForNotErrorNotUnitShape(shape.toShapeId()); - } - - // This method assumes the shape is not an Error nor a Unit - ClassName classForNotErrorNotUnitShape(ShapeId shapeId) { - // Assume class will be in model package - // i.e.: Dafny..Types.Shape - // And that Shape is not an Error - return ClassName.get( - modelPackageNameForNamespace(shapeId.getNamespace()), - DafnyNameResolverHelpers.dafnyCompilesExtra_(capitalize(shapeId.getName())) - ); - } - - TypeName typeForString(StringShape shape) { - if (shape.hasTrait(EnumTrait.class)) { - return classForNotErrorNotUnitShape(shape); - } - // If the shape has the dafnyUtf8Bytes trait, - // the dafny representation will use Bytes - if (shape.hasTrait(DafnyUtf8BytesTrait.class)) { - return Dafny.typeForBlob(); - } - return typeForCharacterSequence(); - } - - TypeName typeForCharacterSequence() { - return ParameterizedTypeName.get( - Constants.DAFNY_SEQUENCE_CLASS_NAME, - WildcardTypeName.subtypeOf(Character.class) - ); - } - - public TypeName classForStructure(StructureShape shape) { - if (shape.hasTrait(ErrorTrait.class)) { - return classForError(shape); - } - if (shape.hasTrait(ReferenceTrait.class)) { - return typeForShape(shape.expectTrait(ReferenceTrait.class).getReferentId()); - } - if (shape.getId().equals(Constants.SMITHY_API_UNIT)) { - return Constants.DAFNY_TUPLE0_CLASS_NAME; - } - return classForNotErrorNotUnitShape(shape); - } - - public ClassName classForError(Shape shape) { - if (!shape.hasTrait(ErrorTrait.class)) { - throw new IllegalArgumentException("shape MUST have ErrorTrait. ShapeId: %s".formatted(shape.getId())); - } - // AwsCryptographicMaterialProvidersException -> Error_AwsCryptographicMaterialProvidersException - ClassName className = classForNotErrorNotUnitShape(shape); - return ClassName.get(className.packageName(), "Error_" + DafnyNameResolverHelpers.dafnyCompilesExtra_(className.simpleName())); - } - - /** @return The interface for a service client. */ - // This facilitates an override by a subclass - ClassName classNameForService(final ServiceShape shape) { - return interfaceForService(shape); - } - - /** @return The interface for a service client.*/ - public static ClassName interfaceForService(final ServiceShape shape) { - final String packageName = DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shape.getId()); - final String interfaceName = DafnyNameResolver.traitNameForServiceClient(shape); - return ClassName.get(packageName, DafnyNameResolverHelpers.dafnyCompilesExtra_(interfaceName)); - } - - /** @return The concrete class for a service client. */ - public ClassName classNameForConcreteServiceClient(ServiceShape shape) { - String packageName = DafnyNameResolverHelpers.packageNameForNamespace(shape.getId().getNamespace()); - String concreteClass = DafnyNameResolver.classNameForServiceClient(shape); - return ClassName.get(packageName, DafnyNameResolverHelpers.dafnyCompilesExtra_(concreteClass)); - } - - public ClassName classNameForNamespaceDefault() { - String packageName = DafnyNameResolverHelpers.packageNameForNamespace(this.serviceShape.getId().getNamespace()); - return ClassName.get(packageName, "__default"); - } - - /** @return The interface for a resource.*/ - // This facilitates an override by a subclass - ClassName classNameForResource(final ResourceShape shape) { - return Dafny.interfaceForResource(shape); - } - - /** @return The interface for a resource.*/ - public static ClassName interfaceForResource(final ResourceShape shape) { - final String packageName = DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shape.getId()); - final String interfaceName = DafnyNameResolver.traitNameForResource(shape); - return ClassName.get(packageName, DafnyNameResolverHelpers.dafnyCompilesExtra_(interfaceName)); - } - - public ClassName classNameForInterface(Shape shape) { - // if shape is an AWS Service/Resource, return Dafny Types Interface - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.toShapeId())) { - return classNameForAwsSdk(shape, this.awsSdkVersion); - } - // if operation takes a non-AWS Service/Resource, return Dafny Interface Or Local Service - if (shape.isResourceShape()) { - //noinspection OptionalGetWithoutIsPresent - return interfaceForResource(shape.asResourceShape().get()); - } - if (shape.isServiceShape()) { - //noinspection OptionalGetWithoutIsPresent - return interfaceForService(shape.asServiceShape().get()); - } - throw new IllegalArgumentException( - "Polymorph only supports interfaces for Service & Resource Shapes. ShapeId: %s" - .formatted(shape.toShapeId())); - } - - public static ClassName classNameForAwsSdk(Shape shape, CodegenSubject.AwsSdkVersion sdkVersion) { - if (shape.getType() != ShapeType.SERVICE) { - throw new RuntimeException( - "Polymorph only knows the class Name of Service clients. " + - "Would a TypeName suffice? ShapeId: " + shape.toShapeId()); - } - @SuppressWarnings("OptionalGetWithoutIsPresent") - ServiceShape service = shape.asServiceShape().get(); - return switch (sdkVersion) { - case V1 -> AwsSdkDafnyV1.classNameForAwsService(service); - case V2 -> AwsSdkDafnyV2.classNameForAwsService(service); - }; + public ClassName classForDatatypeConstructor( + String dataTypeName, + String constructorName + ) { + return ClassName.get( + modelPackage, + "%s_%s".formatted( + DafnyNameResolverHelpers.dafnyCompilesExtra_(dataTypeName), + DafnyNameResolverHelpers.dafnyCompilesExtra_(constructorName) + ) + ); + } + + // This method assumes the shape is not an Error nor a Unit + ClassName classForNotErrorNotUnitShape(Shape shape) { + return classForNotErrorNotUnitShape(shape.toShapeId()); + } + + // This method assumes the shape is not an Error nor a Unit + ClassName classForNotErrorNotUnitShape(ShapeId shapeId) { + // Assume class will be in model package + // i.e.: Dafny..Types.Shape + // And that Shape is not an Error + return ClassName.get( + modelPackageNameForNamespace(shapeId.getNamespace()), + DafnyNameResolverHelpers.dafnyCompilesExtra_( + capitalize(shapeId.getName()) + ) + ); + } + + TypeName typeForString(StringShape shape) { + if (shape.hasTrait(EnumTrait.class)) { + return classForNotErrorNotUnitShape(shape); + } + // If the shape has the dafnyUtf8Bytes trait, + // the dafny representation will use Bytes + if (shape.hasTrait(DafnyUtf8BytesTrait.class)) { + return Dafny.typeForBlob(); + } + return typeForCharacterSequence(); + } + + TypeName typeForCharacterSequence() { + return ParameterizedTypeName.get( + Constants.DAFNY_SEQUENCE_CLASS_NAME, + WildcardTypeName.subtypeOf(Character.class) + ); + } + + public TypeName classForStructure(StructureShape shape) { + if (shape.hasTrait(ErrorTrait.class)) { + return classForError(shape); + } + if (shape.hasTrait(ReferenceTrait.class)) { + return typeForShape( + shape.expectTrait(ReferenceTrait.class).getReferentId() + ); + } + if (shape.getId().equals(Constants.SMITHY_API_UNIT)) { + return Constants.DAFNY_TUPLE0_CLASS_NAME; + } + return classForNotErrorNotUnitShape(shape); + } + + public ClassName classForError(Shape shape) { + if (!shape.hasTrait(ErrorTrait.class)) { + throw new IllegalArgumentException( + "shape MUST have ErrorTrait. ShapeId: %s".formatted(shape.getId()) + ); + } + // AwsCryptographicMaterialProvidersException -> Error_AwsCryptographicMaterialProvidersException + ClassName className = classForNotErrorNotUnitShape(shape); + return ClassName.get( + className.packageName(), + "Error_" + + DafnyNameResolverHelpers.dafnyCompilesExtra_(className.simpleName()) + ); + } + + /** @return The interface for a service client. */ + // This facilitates an override by a subclass + ClassName classNameForService(final ServiceShape shape) { + return interfaceForService(shape); + } + + /** @return The interface for a service client.*/ + public static ClassName interfaceForService(final ServiceShape shape) { + final String packageName = + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shape.getId()); + final String interfaceName = DafnyNameResolver.traitNameForServiceClient( + shape + ); + return ClassName.get( + packageName, + DafnyNameResolverHelpers.dafnyCompilesExtra_(interfaceName) + ); + } + + /** @return The concrete class for a service client. */ + public ClassName classNameForConcreteServiceClient(ServiceShape shape) { + String packageName = DafnyNameResolverHelpers.packageNameForNamespace( + shape.getId().getNamespace() + ); + String concreteClass = DafnyNameResolver.classNameForServiceClient(shape); + return ClassName.get( + packageName, + DafnyNameResolverHelpers.dafnyCompilesExtra_(concreteClass) + ); + } + + public ClassName classNameForNamespaceDefault() { + String packageName = DafnyNameResolverHelpers.packageNameForNamespace( + this.serviceShape.getId().getNamespace() + ); + return ClassName.get(packageName, "__default"); + } + + /** @return The interface for a resource.*/ + // This facilitates an override by a subclass + ClassName classNameForResource(final ResourceShape shape) { + return Dafny.interfaceForResource(shape); + } + + /** @return The interface for a resource.*/ + public static ClassName interfaceForResource(final ResourceShape shape) { + final String packageName = + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shape.getId()); + final String interfaceName = DafnyNameResolver.traitNameForResource(shape); + return ClassName.get( + packageName, + DafnyNameResolverHelpers.dafnyCompilesExtra_(interfaceName) + ); + } + + public ClassName classNameForInterface(Shape shape) { + // if shape is an AWS Service/Resource, return Dafny Types Interface + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.toShapeId())) { + return classNameForAwsSdk(shape, this.awsSdkVersion); + } + // if operation takes a non-AWS Service/Resource, return Dafny Interface Or Local Service + if (shape.isResourceShape()) { + //noinspection OptionalGetWithoutIsPresent + return interfaceForResource(shape.asResourceShape().get()); + } + if (shape.isServiceShape()) { + //noinspection OptionalGetWithoutIsPresent + return interfaceForService(shape.asServiceShape().get()); + } + throw new IllegalArgumentException( + "Polymorph only supports interfaces for Service & Resource Shapes. ShapeId: %s".formatted( + shape.toShapeId() + ) + ); + } + + public static ClassName classNameForAwsSdk( + Shape shape, + CodegenSubject.AwsSdkVersion sdkVersion + ) { + if (shape.getType() != ShapeType.SERVICE) { + throw new RuntimeException( + "Polymorph only knows the class Name of Service clients. " + + "Would a TypeName suffice? ShapeId: " + + shape.toShapeId() + ); } + @SuppressWarnings("OptionalGetWithoutIsPresent") + ServiceShape service = shape.asServiceShape().get(); + return switch (sdkVersion) { + case V1 -> AwsSdkDafnyV1.classNameForAwsService(service); + case V2 -> AwsSdkDafnyV2.classNameForAwsService(service); + }; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/NameResolver.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/NameResolver.java index 1f1cd2ab70..5ff339604c 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/NameResolver.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/NameResolver.java @@ -3,35 +3,36 @@ package software.amazon.polymorph.smithyjava.nameresolver; import com.squareup.javapoet.TypeName; - import software.amazon.polymorph.smithyjava.generator.CodegenSubject; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.ShapeId; public abstract class NameResolver { - public final String packageName; - protected final Model model; - protected final ServiceShape serviceShape; - public final String modelPackage; - public final CodegenSubject.AwsSdkVersion awsSdkVersion; - public NameResolver( - final String packageName, - final ServiceShape serviceShape, - final Model model, - final String modelPackageName, - CodegenSubject.AwsSdkVersion awsSdkVersion) { - this.packageName = packageName; - this.model = model; - this.serviceShape = serviceShape; - this.modelPackage = modelPackageName; - this.awsSdkVersion = awsSdkVersion; - } + public final String packageName; + protected final Model model; + protected final ServiceShape serviceShape; + public final String modelPackage; + public final CodegenSubject.AwsSdkVersion awsSdkVersion; + + public NameResolver( + final String packageName, + final ServiceShape serviceShape, + final Model model, + final String modelPackageName, + CodegenSubject.AwsSdkVersion awsSdkVersion + ) { + this.packageName = packageName; + this.model = model; + this.serviceShape = serviceShape; + this.modelPackage = modelPackageName; + this.awsSdkVersion = awsSdkVersion; + } - public boolean isInServiceNameSpace(final ShapeId shapeId) { - return shapeId.getNamespace().contains(serviceShape.getId().getNamespace()); - } + public boolean isInServiceNameSpace(final ShapeId shapeId) { + return shapeId.getNamespace().contains(serviceShape.getId().getNamespace()); + } - public abstract TypeName typeForShape(final ShapeId shapeId); + public abstract TypeName typeForShape(final ShapeId shapeId); } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Native.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Native.java index 81c08f4b72..f54243971a 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Native.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/nameresolver/Native.java @@ -2,10 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.nameresolver; +import static software.amazon.smithy.utils.StringUtils.capitalize; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; - import java.math.BigDecimal; import java.math.BigInteger; import java.nio.ByteBuffer; @@ -16,17 +17,15 @@ import java.util.Objects; import java.util.Optional; import java.util.Set; - import javax.annotation.Nullable; - +import software.amazon.polymorph.smithydafny.DafnyNameResolver; import software.amazon.polymorph.smithyjava.NamespaceHelper; import software.amazon.polymorph.smithyjava.generator.CodegenSubject; +import software.amazon.polymorph.smithyjava.unmodeled.OpaqueError; import software.amazon.polymorph.traits.LocalServiceTrait; import software.amazon.polymorph.traits.ReferenceTrait; import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; import software.amazon.polymorph.utils.ModelUtils; -import software.amazon.polymorph.smithydafny.DafnyNameResolver; -import software.amazon.polymorph.smithyjava.unmodeled.OpaqueError; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.ResourceShape; import software.amazon.smithy.model.shapes.ServiceShape; @@ -37,297 +36,341 @@ import software.amazon.smithy.model.traits.BoxTrait; import software.amazon.smithy.model.traits.EnumTrait; -import static software.amazon.smithy.utils.StringUtils.capitalize; - /** * Provides a consistent mapping between names of * model Shapes and generated identifiers in Java * for the native Java code. */ -public class Native extends NameResolver{ - protected static final Map NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME; - protected static final Map NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE; +public class Native extends NameResolver { - static { - NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME = Map.ofEntries( - Map.entry("String", ClassName.get(String.class)), - Map.entry("Blob", ClassName.get(ByteBuffer.class)), - Map.entry("Boolean", TypeName.BOOLEAN.box()), - Map.entry("PrimitiveBoolean", TypeName.BOOLEAN), - Map.entry("Byte", TypeName.BYTE.box()), - Map.entry("PrimitiveByte", TypeName.BYTE), - Map.entry("Short", TypeName.SHORT.box()), - Map.entry("PrimitiveShort", TypeName.SHORT), - Map.entry("Integer", TypeName.INT.box()), - Map.entry("PrimitiveInteger", TypeName.INT), - Map.entry("Long", TypeName.LONG.box()), - Map.entry("PrimitiveLong", TypeName.LONG), - Map.entry("Float", TypeName.FLOAT.box()), - Map.entry("PrimitiveFloat", TypeName.FLOAT), - Map.entry("Double", TypeName.DOUBLE.box()), - Map.entry("PrimitiveDouble", TypeName.DOUBLE), - Map.entry("Timestamp", ClassName.get(Instant.class)) - ); - NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE = Map.ofEntries( - Map.entry(ShapeType.BLOB, ClassName.get(ByteBuffer.class)), - Map.entry(ShapeType.BOOLEAN, TypeName.BOOLEAN), - Map.entry(ShapeType.BYTE, TypeName.BYTE), - Map.entry(ShapeType.SHORT, TypeName.SHORT), - Map.entry(ShapeType.INTEGER, TypeName.INT), - Map.entry(ShapeType.LONG, TypeName.LONG), - Map.entry(ShapeType.FLOAT, TypeName.FLOAT), - Map.entry(ShapeType.DOUBLE, TypeName.DOUBLE), - // TODO: AWS SDK V2 uses Instant, not Date - Map.entry(ShapeType.TIMESTAMP, ClassName.get(Date.class)), - Map.entry(ShapeType.BIG_DECIMAL, ClassName.get(BigDecimal.class)), - Map.entry(ShapeType.BIG_INTEGER, ClassName.get(BigInteger.class)) - ); - } + protected static final Map< + String, + TypeName + > NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME; + protected static final Map< + ShapeType, + TypeName + > NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE; - public Native( - final String packageName, - final ServiceShape serviceShape, - final Model model, - final String modelPackageName, - CodegenSubject.AwsSdkVersion awsSdkVersion) { - super( - packageName, - serviceShape, - model, - modelPackageName, - awsSdkVersion); - } + static { + NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME = + Map.ofEntries( + Map.entry("String", ClassName.get(String.class)), + Map.entry("Blob", ClassName.get(ByteBuffer.class)), + Map.entry("Boolean", TypeName.BOOLEAN.box()), + Map.entry("PrimitiveBoolean", TypeName.BOOLEAN), + Map.entry("Byte", TypeName.BYTE.box()), + Map.entry("PrimitiveByte", TypeName.BYTE), + Map.entry("Short", TypeName.SHORT.box()), + Map.entry("PrimitiveShort", TypeName.SHORT), + Map.entry("Integer", TypeName.INT.box()), + Map.entry("PrimitiveInteger", TypeName.INT), + Map.entry("Long", TypeName.LONG.box()), + Map.entry("PrimitiveLong", TypeName.LONG), + Map.entry("Float", TypeName.FLOAT.box()), + Map.entry("PrimitiveFloat", TypeName.FLOAT), + Map.entry("Double", TypeName.DOUBLE.box()), + Map.entry("PrimitiveDouble", TypeName.DOUBLE), + Map.entry("Timestamp", ClassName.get(Instant.class)) + ); + NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE = + Map.ofEntries( + Map.entry(ShapeType.BLOB, ClassName.get(ByteBuffer.class)), + Map.entry(ShapeType.BOOLEAN, TypeName.BOOLEAN), + Map.entry(ShapeType.BYTE, TypeName.BYTE), + Map.entry(ShapeType.SHORT, TypeName.SHORT), + Map.entry(ShapeType.INTEGER, TypeName.INT), + Map.entry(ShapeType.LONG, TypeName.LONG), + Map.entry(ShapeType.FLOAT, TypeName.FLOAT), + Map.entry(ShapeType.DOUBLE, TypeName.DOUBLE), + // TODO: AWS SDK V2 uses Instant, not Date + Map.entry(ShapeType.TIMESTAMP, ClassName.get(Date.class)), + Map.entry(ShapeType.BIG_DECIMAL, ClassName.get(BigDecimal.class)), + Map.entry(ShapeType.BIG_INTEGER, ClassName.get(BigInteger.class)) + ); + } - public static String aggregateSizeMethod(ShapeType shapeType) { - return switch (shapeType) { - case LIST, SET, MAP -> "size()"; - case STRING -> "length()"; - // This is complicated: A (Byte)Buffer has four landmark indexes: - // mark <= position <= limit <= capacity - // Let us ASSUME that we are validating a buffer that has been - // written to but not read from, and thus the `remaining` bytes - // (limit - position) is the length. - case BLOB -> "remaining()"; - case MEMBER -> throw new IllegalArgumentException( - """ - ShapeType is not defined on MemberShapes but on their target. - The target MUST be looked up with the model. - See software.amazon.polymorph.smithyjava.PolymorphFieldSpec.getTargetShape. - """ - ); - default -> throw new IllegalStateException( - "aggregateSizeMethod only accepts LIST, SET, MAP, STRING, or BLOB. Got : " + shapeType); - }; - } + public Native( + final String packageName, + final ServiceShape serviceShape, + final Model model, + final String modelPackageName, + CodegenSubject.AwsSdkVersion awsSdkVersion + ) { + super(packageName, serviceShape, model, modelPackageName, awsSdkVersion); + } - /** - * Returns the Native type corresponding to the given shape. - */ - @SuppressWarnings("OptionalGetWithoutIsPresent") - public TypeName typeForShape(final ShapeId shapeId) { - final Shape shape = model.expectShape(shapeId); + public static String aggregateSizeMethod(ShapeType shapeType) { + return switch (shapeType) { + case LIST, SET, MAP -> "size()"; + case STRING -> "length()"; + // This is complicated: A (Byte)Buffer has four landmark indexes: + // mark <= position <= limit <= capacity + // Let us ASSUME that we are validating a buffer that has been + // written to but not read from, and thus the `remaining` bytes + // (limit - position) is the length. + case BLOB -> "remaining()"; + case MEMBER -> throw new IllegalArgumentException( + """ + ShapeType is not defined on MemberShapes but on their target. + The target MUST be looked up with the model. + See software.amazon.polymorph.smithyjava.PolymorphFieldSpec.getTargetShape. + """ + ); + default -> throw new IllegalStateException( + "aggregateSizeMethod only accepts LIST, SET, MAP, STRING, or BLOB. Got : " + + shapeType + ); + }; + } - // First check if this is a built-in Smithy shape. If so, we just map it to the native type and return - if (ModelUtils.isSmithyApiShape(shapeId)) { - @Nullable final TypeName typeName = NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME.get(shapeId.getName()); - return Objects.requireNonNull(typeName, - () -> String.format("No native type for prelude shape %s", shapeId)); - } + /** + * Returns the Native type corresponding to the given shape. + */ + @SuppressWarnings("OptionalGetWithoutIsPresent") + public TypeName typeForShape(final ShapeId shapeId) { + final Shape shape = model.expectShape(shapeId); - return switch (shape.getType()) { - case BOOLEAN, BYTE, SHORT, INTEGER, LONG, FLOAT, DOUBLE -> { - /* From the Smithy Docs: - * "Boolean, byte, short, integer, long, float, and double shapes - * are only considered boxed if they are marked with the box trait. - * All other shapes are always considered boxed." - * https://smithy.io/1.0/spec/core/type-refinement-traits.html#box-trait - * While Smithy Models SHOULD use Smithy Prelude shapes to avoid this confusion, - * they do not have to. - * Hence, the need to check if these shapes have the box trait - */ - final TypeName typeName = NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE.get(shape.getType()); - yield shape.hasTrait(BoxTrait.class) ? typeName.box() : typeName; - } - // For supported simple shapes, just map to native types - case BLOB, TIMESTAMP, BIG_DECIMAL, BIG_INTEGER -> NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE.get(shape.getType()); - case STRING -> classForStringOrEnum(shape.asStringShape().get()); - case LIST -> ParameterizedTypeName.get( - ClassName.get(List.class), - typeForShape(shape.asListShape().get().getMember().getTarget()) - ); - case MAP -> ParameterizedTypeName.get( - ClassName.get(Map.class), - typeForShape(shape.asMapShape().get().getKey().getTarget()), - typeForShape(shape.asMapShape().get().getValue().getTarget()) - ); - case SET -> ParameterizedTypeName.get( - ClassName.get(Set.class), - typeForShape(shape.asSetShape().get().getMember().getTarget()) - ); - case MEMBER -> typeForShape(shape.asMemberShape().get().getTarget()); - case STRUCTURE -> classNameForStructure(shape.asStructureShape().get()); - case SERVICE -> classNameForService(shape.asServiceShape().get()); - case RESOURCE -> classNameForResource(shape.asResourceShape().get()); - // Unions are identical to Structures (in this context) - case UNION -> classNameForStructure(shape.asUnionShape().get()); - default -> throw new UnsupportedOperationException("Shape %s has unsupported type %s" - .formatted(shapeId, shape.getType())); - }; + // First check if this is a built-in Smithy shape. If so, we just map it to the native type and return + if (ModelUtils.isSmithyApiShape(shapeId)) { + @Nullable + final TypeName typeName = NATIVE_TYPES_BY_SMITHY_PRELUDE_SHAPE_NAME.get( + shapeId.getName() + ); + return Objects.requireNonNull( + typeName, + () -> String.format("No native type for prelude shape %s", shapeId) + ); } - public ClassName classForStringOrEnum(final StringShape shape) { - if (shape.hasTrait(EnumTrait.class)) { - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { - return switch (awsSdkVersion) { - case V2 -> AwsSdkNativeV2.classNameForAwsSdkShape(shape); - case V1 -> AwsSdkNativeV1.classNameForAwsSdkShape(shape); - }; - } - return classForEnum(shape); - } - return classForString(); - } + return switch (shape.getType()) { + case BOOLEAN, BYTE, SHORT, INTEGER, LONG, FLOAT, DOUBLE -> { + /* From the Smithy Docs: + * "Boolean, byte, short, integer, long, float, and double shapes + * are only considered boxed if they are marked with the box trait. + * All other shapes are always considered boxed." + * https://smithy.io/1.0/spec/core/type-refinement-traits.html#box-trait + * While Smithy Models SHOULD use Smithy Prelude shapes to avoid this confusion, + * they do not have to. + * Hence, the need to check if these shapes have the box trait + */ + final TypeName typeName = NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE.get( + shape.getType() + ); + yield shape.hasTrait(BoxTrait.class) ? typeName.box() : typeName; + } + // For supported simple shapes, just map to native types + case BLOB, + TIMESTAMP, + BIG_DECIMAL, + BIG_INTEGER -> NATIVE_TYPES_BY_SIMPLE_SHAPE_TYPE.get(shape.getType()); + case STRING -> classForStringOrEnum(shape.asStringShape().get()); + case LIST -> ParameterizedTypeName.get( + ClassName.get(List.class), + typeForShape(shape.asListShape().get().getMember().getTarget()) + ); + case MAP -> ParameterizedTypeName.get( + ClassName.get(Map.class), + typeForShape(shape.asMapShape().get().getKey().getTarget()), + typeForShape(shape.asMapShape().get().getValue().getTarget()) + ); + case SET -> ParameterizedTypeName.get( + ClassName.get(Set.class), + typeForShape(shape.asSetShape().get().getMember().getTarget()) + ); + case MEMBER -> typeForShape(shape.asMemberShape().get().getTarget()); + case STRUCTURE -> classNameForStructure(shape.asStructureShape().get()); + case SERVICE -> classNameForService(shape.asServiceShape().get()); + case RESOURCE -> classNameForResource(shape.asResourceShape().get()); + // Unions are identical to Structures (in this context) + case UNION -> classNameForStructure(shape.asUnionShape().get()); + default -> throw new UnsupportedOperationException( + "Shape %s has unsupported type %s".formatted(shapeId, shape.getType()) + ); + }; + } - public ClassName classForEnum(final Shape shape) { - if (isInServiceNameSpace(shape.getId())) { - return ClassName.get(modelPackage, shape.getId().getName()); - } - // For every AWS SDK Java Library and every Library Polymorph generates, - // POJOs (smithy structures), - // most Exceptions (also structures), - // and interfaces (smithy resources or services) - // are placed in a model sub-package. - return ClassName.get( - NamespaceHelper.standardize(shape.getId().getNamespace()) + ".model", - shape.getId().getName()); + public ClassName classForStringOrEnum(final StringShape shape) { + if (shape.hasTrait(EnumTrait.class)) { + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { + return switch (awsSdkVersion) { + case V2 -> AwsSdkNativeV2.classNameForAwsSdkShape(shape); + case V1 -> AwsSdkNativeV1.classNameForAwsSdkShape(shape); + }; + } + return classForEnum(shape); } + return classForString(); + } - public ClassName classForString() { - return ClassName.get(String.class); + public ClassName classForEnum(final Shape shape) { + if (isInServiceNameSpace(shape.getId())) { + return ClassName.get(modelPackage, shape.getId().getName()); } + // For every AWS SDK Java Library and every Library Polymorph generates, + // POJOs (smithy structures), + // most Exceptions (also structures), + // and interfaces (smithy resources or services) + // are placed in a model sub-package. + return ClassName.get( + NamespaceHelper.standardize(shape.getId().getNamespace()) + ".model", + shape.getId().getName() + ); + } - public ClassName classForDouble() { - return ClassName.get(Double.class); - } + public ClassName classForString() { + return ClassName.get(String.class); + } - @SuppressWarnings("OptionalGetWithoutIsPresent") - public TypeName typeForListOrSetMember(ShapeId shapeId) { - Shape shape = model.expectShape(shapeId); - return switch (shape.getType()) { - case MEMBER -> typeForShape(shape.getId()); - case LIST -> typeForShape(shape.asListShape().get().getMember().getTarget()); - case SET -> typeForShape(shape.asSetShape().get().getMember().getTarget()); - default -> throw new IllegalStateException( - "typeForListOrSetMember only accepts MEMBER, LIST, or SET. Got: " + shape.getType()); - }; - } + public ClassName classForDouble() { + return ClassName.get(Double.class); + } - public ClassName classNameForStructure(Shape shape) { - if (!(shape.isUnionShape() || shape.isStructureShape())) { - throw new IllegalArgumentException( - "typeForStructure should only be called for Structures or Unions. ShapeId: %s" - .formatted(shape.getId())); - } - if (shape.hasTrait(ReferenceTrait.class)) { - final ReferenceTrait reference = shape.expectTrait(ReferenceTrait.class); - // A service or resource in a structure should almost always be treated as the interface - Shape rShape = model.expectShape(reference.getReferentId()); - return classNameForInterfaceOrLocalService(rShape, this.awsSdkVersion); - } - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { - return switch (awsSdkVersion) { - case V2 -> AwsSdkNativeV2.classNameForAwsSdkShape(shape); - case V1 -> AwsSdkNativeV1.classNameForAwsSdkShape(shape); - }; - } - if (isInServiceNameSpace(shape.getId())) { - return ClassName.get(modelPackage, shape.getId().getName()); - } - // For every AWS SDK Java Library and every Library Polymorph generates, - // POJOs (smithy structures), - // most Exceptions (also structures), - // are placed in a model sub-package. - return ClassName.get( - NamespaceHelper.standardize(shape.getId().getNamespace()) + ".model", - shape.getId().getName()); - } + @SuppressWarnings("OptionalGetWithoutIsPresent") + public TypeName typeForListOrSetMember(ShapeId shapeId) { + Shape shape = model.expectShape(shapeId); + return switch (shape.getType()) { + case MEMBER -> typeForShape(shape.getId()); + case LIST -> typeForShape( + shape.asListShape().get().getMember().getTarget() + ); + case SET -> typeForShape( + shape.asSetShape().get().getMember().getTarget() + ); + default -> throw new IllegalStateException( + "typeForListOrSetMember only accepts MEMBER, LIST, or SET. Got: " + + shape.getType() + ); + }; + } - public ClassName classNameForService(ServiceShape shape) { - return classNameForInterfaceOrLocalService(shape, this.awsSdkVersion); + public ClassName classNameForStructure(Shape shape) { + if (!(shape.isUnionShape() || shape.isStructureShape())) { + throw new IllegalArgumentException( + "typeForStructure should only be called for Structures or Unions. ShapeId: %s".formatted( + shape.getId() + ) + ); } - - public ClassName classNameForTestService(ServiceShape shape) { - Optional maybeTrait = shape.getTrait(LocalServiceTrait.class); - if (maybeTrait.isEmpty()) { - throw new IllegalArgumentException( - ("ServiceShape for local-service-test MUST have LocalTrait." + - " ShapeId: %s").formatted(shape.toShapeId())); - } - final String namespace = NamespaceHelper.standardize(shape.getId().getNamespace()) + ".wrapped"; - return ClassName.get( - namespace, - "Test" + capitalize(maybeTrait.get().getSdkId())); + if (shape.hasTrait(ReferenceTrait.class)) { + final ReferenceTrait reference = shape.expectTrait(ReferenceTrait.class); + // A service or resource in a structure should almost always be treated as the interface + Shape rShape = model.expectShape(reference.getReferentId()); + return classNameForInterfaceOrLocalService(rShape, this.awsSdkVersion); } - - public static ClassName classNameForResourceInterface(ResourceShape shape) { - return ClassName.get( - NamespaceHelper.standardize(shape.getId().getNamespace()), - DafnyNameResolver.traitNameForResource(shape) - ); + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.getId())) { + return switch (awsSdkVersion) { + case V2 -> AwsSdkNativeV2.classNameForAwsSdkShape(shape); + case V1 -> AwsSdkNativeV1.classNameForAwsSdkShape(shape); + }; } - - public static ClassName classNameForInterfaceOrLocalService( - Shape shape, CodegenSubject.AwsSdkVersion sdkVersion) { - if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.toShapeId())) { - return classNameForAwsSdk(shape, sdkVersion); - } - // if operation takes a non-AWS Service/Resource, return Native Interface Or Local Service - if (shape.isResourceShape()) { - //noinspection OptionalGetWithoutIsPresent - return classNameForResourceInterface(shape.asResourceShape().get()); - } - if (shape.isServiceShape()) { - Optional maybeTrait = shape.getTrait(LocalServiceTrait.class); - if (maybeTrait.isEmpty()) { - throw new IllegalArgumentException( - ("non AWS-Service ServiceShapes MUST have LocalTrait." + - " ShapeId: %s").formatted(shape.toShapeId())); - } - return ClassName.get( - NamespaceHelper.standardize(shape.getId().getNamespace()), - maybeTrait.get().getSdkId()); - } - throw new IllegalArgumentException( - "Polymorph only supports interfaces for Service & Resource Shapes. ShapeId: %s" - .formatted(shape.toShapeId())); + if (isInServiceNameSpace(shape.getId())) { + return ClassName.get(modelPackage, shape.getId().getName()); } + // For every AWS SDK Java Library and every Library Polymorph generates, + // POJOs (smithy structures), + // most Exceptions (also structures), + // are placed in a model sub-package. + return ClassName.get( + NamespaceHelper.standardize(shape.getId().getNamespace()) + ".model", + shape.getId().getName() + ); + } - public static ClassName classNameForAwsSdk(Shape shape, CodegenSubject.AwsSdkVersion sdkVersion) { - if (shape.getType() != ShapeType.SERVICE) { - throw new RuntimeException( - "Polymorph only knows the class Name of Service clients. " + - "Would a TypeName suffice? ShapeId: " + shape.toShapeId()); - } - @SuppressWarnings("OptionalGetWithoutIsPresent") - ServiceShape service = shape.asServiceShape().get(); - return switch (sdkVersion) { - case V1 -> AwsSdkNativeV1.classNameForServiceClient(service); - case V2 -> AwsSdkNativeV2.classNameForServiceClient(service); - }; + public ClassName classNameForService(ServiceShape shape) { + return classNameForInterfaceOrLocalService(shape, this.awsSdkVersion); + } + + public ClassName classNameForTestService(ServiceShape shape) { + Optional maybeTrait = shape.getTrait( + LocalServiceTrait.class + ); + if (maybeTrait.isEmpty()) { + throw new IllegalArgumentException( + ("ServiceShape for local-service-test MUST have LocalTrait." + + " ShapeId: %s").formatted(shape.toShapeId()) + ); } + final String namespace = + NamespaceHelper.standardize(shape.getId().getNamespace()) + ".wrapped"; + return ClassName.get( + namespace, + "Test" + capitalize(maybeTrait.get().getSdkId()) + ); + } - public ClassName classNameForResource(ResourceShape shape) { - return ClassName.get( - NamespaceHelper.standardize(shape.getId().getNamespace()), - shape.getId().getName() + public static ClassName classNameForResourceInterface(ResourceShape shape) { + return ClassName.get( + NamespaceHelper.standardize(shape.getId().getNamespace()), + DafnyNameResolver.traitNameForResource(shape) + ); + } + + public static ClassName classNameForInterfaceOrLocalService( + Shape shape, + CodegenSubject.AwsSdkVersion sdkVersion + ) { + if (AwsSdkNameResolverHelpers.isInAwsSdkNamespace(shape.toShapeId())) { + return classNameForAwsSdk(shape, sdkVersion); + } + // if operation takes a non-AWS Service/Resource, return Native Interface Or Local Service + if (shape.isResourceShape()) { + //noinspection OptionalGetWithoutIsPresent + return classNameForResourceInterface(shape.asResourceShape().get()); + } + if (shape.isServiceShape()) { + Optional maybeTrait = shape.getTrait( + LocalServiceTrait.class + ); + if (maybeTrait.isEmpty()) { + throw new IllegalArgumentException( + ("non AWS-Service ServiceShapes MUST have LocalTrait." + + " ShapeId: %s").formatted(shape.toShapeId()) ); + } + return ClassName.get( + NamespaceHelper.standardize(shape.getId().getNamespace()), + maybeTrait.get().getSdkId() + ); } + throw new IllegalArgumentException( + "Polymorph only supports interfaces for Service & Resource Shapes. ShapeId: %s".formatted( + shape.toShapeId() + ) + ); + } - // TODO: improve exceptions for local services - public ClassName baseErrorForService() { - throw new IllegalArgumentException( - "Local Services no longer have a local error hierarchy." + - "Use `ClassName.get(RuntimeException.class)` instead."); + public static ClassName classNameForAwsSdk( + Shape shape, + CodegenSubject.AwsSdkVersion sdkVersion + ) { + if (shape.getType() != ShapeType.SERVICE) { + throw new RuntimeException( + "Polymorph only knows the class Name of Service clients. " + + "Would a TypeName suffice? ShapeId: " + + shape.toShapeId() + ); } + @SuppressWarnings("OptionalGetWithoutIsPresent") + ServiceShape service = shape.asServiceShape().get(); + return switch (sdkVersion) { + case V1 -> AwsSdkNativeV1.classNameForServiceClient(service); + case V2 -> AwsSdkNativeV2.classNameForServiceClient(service); + }; + } + + public ClassName classNameForResource(ResourceShape shape) { + return ClassName.get( + NamespaceHelper.standardize(shape.getId().getNamespace()), + shape.getId().getName() + ); + } + // TODO: improve exceptions for local services + public ClassName baseErrorForService() { + throw new IllegalArgumentException( + "Local Services no longer have a local error hierarchy." + + "Use `ClassName.get(RuntimeException.class)` instead." + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/CollectionOfErrors.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/CollectionOfErrors.java index dd4e774f25..86dca61a84 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/CollectionOfErrors.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/CollectionOfErrors.java @@ -2,98 +2,111 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.unmodeled; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PROTECTED; +import static javax.lang.model.element.Modifier.PUBLIC; +import static software.amazon.polymorph.smithyjava.BuilderMemberSpec.COLLECTION_ARGS; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeSpec; - import java.util.Collections; import java.util.List; - import software.amazon.polymorph.smithyjava.BuilderMemberSpec; import software.amazon.polymorph.smithyjava.BuilderSpecs; import software.amazon.polymorph.smithyjava.modeled.ModeledStructure; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PROTECTED; -import static javax.lang.model.element.Modifier.PUBLIC; -import static software.amazon.polymorph.smithyjava.BuilderMemberSpec.COLLECTION_ARGS; - public class CollectionOfErrors { - public final static String COLLECTION_ERROR = "CollectionOfErrors"; - public static ClassName nativeClassName(String packageName) { - return ClassName.get(packageName, COLLECTION_ERROR); - } + public static final String COLLECTION_ERROR = "CollectionOfErrors"; + + public static ClassName nativeClassName(String packageName) { + return ClassName.get(packageName, COLLECTION_ERROR); + } - public static JavaFile javaFile(String packageName) { - ClassName className = nativeClassName(packageName); - ClassName superName = ClassName.get(RuntimeException.class); - List localOnlyFields = ErrorHelpers.removeThrowableArgs(COLLECTION_ARGS); - BuilderSpecs builderSpecs = new BuilderSpecs( - className, null, COLLECTION_ARGS, Collections.emptyList()); - final boolean overrideSuperFalse = false; - TypeSpec.Builder spec = TypeSpec - .classBuilder(className) - .addModifiers(PUBLIC) - .superclass(superName); - localOnlyFields.forEach(field -> { - // Add local fields - spec.addField(field.toFieldSpec(PRIVATE, FINAL)); - }); - spec.addMethod(ErrorHelpers.messageFromBuilder(builderSpecs)); - spec.addMethods(ErrorHelpers.throwableGetters()); - localOnlyFields.forEach(field -> spec.addMethod(ModeledStructure.getterMethod(field))); - spec - .addType(builderSpecs.builderInterface()) - .addType(builderSpecs.builderImpl( - overrideSuperFalse, - builderImplConstructor(packageName), - builderSpecs.implBuildMethod(overrideSuperFalse)) - ); - spec.addMethod(constructor(builderSpecs)) - .addMethod(builderSpecs.toBuilderMethod(overrideSuperFalse)) - .addMethod(builderSpecs.builderMethod()); + public static JavaFile javaFile(String packageName) { + ClassName className = nativeClassName(packageName); + ClassName superName = ClassName.get(RuntimeException.class); + List localOnlyFields = ErrorHelpers.removeThrowableArgs( + COLLECTION_ARGS + ); + BuilderSpecs builderSpecs = new BuilderSpecs( + className, + null, + COLLECTION_ARGS, + Collections.emptyList() + ); + final boolean overrideSuperFalse = false; + TypeSpec.Builder spec = TypeSpec + .classBuilder(className) + .addModifiers(PUBLIC) + .superclass(superName); + localOnlyFields.forEach(field -> { + // Add local fields + spec.addField(field.toFieldSpec(PRIVATE, FINAL)); + }); + spec.addMethod(ErrorHelpers.messageFromBuilder(builderSpecs)); + spec.addMethods(ErrorHelpers.throwableGetters()); + localOnlyFields.forEach(field -> + spec.addMethod(ModeledStructure.getterMethod(field)) + ); + spec + .addType(builderSpecs.builderInterface()) + .addType( + builderSpecs.builderImpl( + overrideSuperFalse, + builderImplConstructor(packageName), + builderSpecs.implBuildMethod(overrideSuperFalse) + ) + ); + spec + .addMethod(constructor(builderSpecs)) + .addMethod(builderSpecs.toBuilderMethod(overrideSuperFalse)) + .addMethod(builderSpecs.builderMethod()); - return JavaFile.builder(packageName, spec.build()) - .skipJavaLangImports(true) - .build(); - } + return JavaFile + .builder(packageName, spec.build()) + .skipJavaLangImports(true) + .build(); + } - public static ParameterizedTypeName exceptionList() { - return ParameterizedTypeName.get( - ClassName.get(List.class), - ClassName.get(RuntimeException.class) - ); - } + public static ParameterizedTypeName exceptionList() { + return ParameterizedTypeName.get( + ClassName.get(List.class), + ClassName.get(RuntimeException.class) + ); + } - /** The Class's constructor.*/ - static MethodSpec constructor(BuilderSpecs builderSpecs) { - MethodSpec.Builder method = MethodSpec - .constructorBuilder() - .addModifiers(PROTECTED) - .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR) - .addStatement( - "super(messageFromBuilder($L), $L.cause())", - BuilderSpecs.BUILDER_VAR, BuilderSpecs.BUILDER_VAR - ) - .addStatement("this.list = builder.list()"); - return method.build(); - } + /** The Class's constructor.*/ + static MethodSpec constructor(BuilderSpecs builderSpecs) { + MethodSpec.Builder method = MethodSpec + .constructorBuilder() + .addModifiers(PROTECTED) + .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR) + .addStatement( + "super(messageFromBuilder($L), $L.cause())", + BuilderSpecs.BUILDER_VAR, + BuilderSpecs.BUILDER_VAR + ) + .addStatement("this.list = builder.list()"); + return method.build(); + } - /** - * @return Constructor that that uses {@code RuntimeException}'s getter - * methods to initialize builder. - */ - static MethodSpec builderImplConstructor(String packageName) { - return MethodSpec.constructorBuilder() - .addModifiers(PROTECTED) - .addParameter(nativeClassName(packageName), "model") - .addStatement("this.cause = model.getCause()") - .addStatement("this.message = model.getMessage()") - .addStatement("this.list = model.list()") - .build(); - } + /** + * @return Constructor that that uses {@code RuntimeException}'s getter + * methods to initialize builder. + */ + static MethodSpec builderImplConstructor(String packageName) { + return MethodSpec + .constructorBuilder() + .addModifiers(PROTECTED) + .addParameter(nativeClassName(packageName), "model") + .addStatement("this.cause = model.getCause()") + .addStatement("this.message = model.getMessage()") + .addStatement("this.list = model.list()") + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/ErrorHelpers.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/ErrorHelpers.java index effbc0d133..d5e874c8c9 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/ErrorHelpers.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/ErrorHelpers.java @@ -2,90 +2,106 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.unmodeled; -import com.squareup.javapoet.MethodSpec; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PUBLIC; +import static javax.lang.model.element.Modifier.STATIC; +import static software.amazon.polymorph.smithyjava.BuilderMemberSpec.THROWABLE_ARGS; +import static software.amazon.smithy.utils.StringUtils.capitalize; +import com.squareup.javapoet.MethodSpec; import java.util.ArrayList; import java.util.List; import java.util.Set; import java.util.stream.Collectors; - import software.amazon.polymorph.smithyjava.BuilderMemberSpec; import software.amazon.polymorph.smithyjava.BuilderSpecs; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PUBLIC; -import static javax.lang.model.element.Modifier.STATIC; -import static software.amazon.polymorph.smithyjava.BuilderMemberSpec.THROWABLE_ARGS; -import static software.amazon.smithy.utils.StringUtils.capitalize; - /** * ErrorHelpers holds static methods for generating Error shapes. */ public class ErrorHelpers { - private final static Set _THROWABLE_ARG_NAMES = - THROWABLE_ARGS.stream() - .map(field -> field.name) - .collect(Collectors.toSet()); + private static final Set _THROWABLE_ARG_NAMES = THROWABLE_ARGS + .stream() + .map(field -> field.name) + .collect(Collectors.toSet()); - /** - * @return MethodSpec that checks the message field and cause's - * message field for a valid message. - */ - public static MethodSpec messageFromBuilder(BuilderSpecs builderSpecs) { - return MethodSpec.methodBuilder("messageFromBuilder") - .returns(String.class) - .addModifiers(PRIVATE, STATIC) - .addParameter(builderSpecs.builderInterfaceName(), BuilderSpecs.BUILDER_VAR) - .beginControlFlow("if ($L.message() != null)", BuilderSpecs.BUILDER_VAR) - .addStatement("return $L.message()", BuilderSpecs.BUILDER_VAR) - .endControlFlow() - .beginControlFlow("if ($L.cause() != null)", BuilderSpecs.BUILDER_VAR) - .addStatement("return $L.cause().getMessage()", BuilderSpecs.BUILDER_VAR) - .endControlFlow() - .addStatement("return null") - .build(); - } + /** + * @return MethodSpec that checks the message field and cause's + * message field for a valid message. + */ + public static MethodSpec messageFromBuilder(BuilderSpecs builderSpecs) { + return MethodSpec + .methodBuilder("messageFromBuilder") + .returns(String.class) + .addModifiers(PRIVATE, STATIC) + .addParameter( + builderSpecs.builderInterfaceName(), + BuilderSpecs.BUILDER_VAR + ) + .beginControlFlow("if ($L.message() != null)", BuilderSpecs.BUILDER_VAR) + .addStatement("return $L.message()", BuilderSpecs.BUILDER_VAR) + .endControlFlow() + .beginControlFlow("if ($L.cause() != null)", BuilderSpecs.BUILDER_VAR) + .addStatement("return $L.cause().getMessage()", BuilderSpecs.BUILDER_VAR) + .endControlFlow() + .addStatement("return null") + .build(); + } - /** - * RuntimeException's fields are retrieved by `get + capitalize-field-name`, - * but our generated Java just uses the field name. - */ - public static Iterable throwableGetters() { - //noinspection DataFlowIssue (All THROWABLE_ARGS hava a JavaDoc) - return THROWABLE_ARGS.stream().map(field -> - MethodSpec.methodBuilder(field.name) - .returns(field.type) - .addModifiers(PUBLIC) - .addJavadoc("See {@link $T#$L()}.", - Throwable.class, String.format("get%s", capitalize(field.name))) - .addStatement("return this.$L()", - String.format("get%s", capitalize(field.name))) - .build()).collect(Collectors.toList()); - } + /** + * RuntimeException's fields are retrieved by `get + capitalize-field-name`, + * but our generated Java just uses the field name. + */ + public static Iterable throwableGetters() { + //noinspection DataFlowIssue (All THROWABLE_ARGS hava a JavaDoc) + return THROWABLE_ARGS + .stream() + .map(field -> + MethodSpec + .methodBuilder(field.name) + .returns(field.type) + .addModifiers(PUBLIC) + .addJavadoc( + "See {@link $T#$L()}.", + Throwable.class, + String.format("get%s", capitalize(field.name)) + ) + .addStatement( + "return this.$L()", + String.format("get%s", capitalize(field.name)) + ) + .build() + ) + .collect(Collectors.toList()); + } - /** All Error Shapes MUST HAVE the THROWABLE_ARGS. - * Their Model MAY already include these as Members. - * This method ensures THROWABLE_ARGS are present only once - * in an Error class. */ - public static List prependThrowableArgs( - List originalArgs - ) { - List rtn = new ArrayList<>(THROWABLE_ARGS.size() + originalArgs.size()); - rtn.addAll(THROWABLE_ARGS); - originalArgs.stream() - .filter(field -> !_THROWABLE_ARG_NAMES.contains(field.name)) - .forEach(rtn::add); - return rtn; - } + /** All Error Shapes MUST HAVE the THROWABLE_ARGS. + * Their Model MAY already include these as Members. + * This method ensures THROWABLE_ARGS are present only once + * in an Error class. */ + public static List prependThrowableArgs( + List originalArgs + ) { + List rtn = new ArrayList<>( + THROWABLE_ARGS.size() + originalArgs.size() + ); + rtn.addAll(THROWABLE_ARGS); + originalArgs + .stream() + .filter(field -> !_THROWABLE_ARG_NAMES.contains(field.name)) + .forEach(rtn::add); + return rtn; + } - public static List removeThrowableArgs( - List originalArgs - ) { - List rtn = new ArrayList<>(originalArgs.size()); - originalArgs.stream() - .filter(field -> !_THROWABLE_ARG_NAMES.contains(field.name)) - .forEach(rtn::add); - return rtn; - } + public static List removeThrowableArgs( + List originalArgs + ) { + List rtn = new ArrayList<>(originalArgs.size()); + originalArgs + .stream() + .filter(field -> !_THROWABLE_ARG_NAMES.contains(field.name)) + .forEach(rtn::add); + return rtn; + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/OpaqueError.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/OpaqueError.java index 70d5616c24..0bf762af7f 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/OpaqueError.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/smithyjava/unmodeled/OpaqueError.java @@ -2,116 +2,129 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.unmodeled; +import static javax.lang.model.element.Modifier.FINAL; +import static javax.lang.model.element.Modifier.PRIVATE; +import static javax.lang.model.element.Modifier.PROTECTED; +import static javax.lang.model.element.Modifier.PUBLIC; +import static software.amazon.polymorph.smithyjava.BuilderMemberSpec.OPAQUE_ARGS; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; - import java.util.Collections; import java.util.List; - import javax.annotation.Nonnull; - import software.amazon.polymorph.smithyjava.BuilderMemberSpec; import software.amazon.polymorph.smithyjava.BuilderSpecs; import software.amazon.polymorph.smithyjava.modeled.ModeledStructure; -import static javax.lang.model.element.Modifier.FINAL; -import static javax.lang.model.element.Modifier.PRIVATE; -import static javax.lang.model.element.Modifier.PROTECTED; -import static javax.lang.model.element.Modifier.PUBLIC; -import static software.amazon.polymorph.smithyjava.BuilderMemberSpec.OPAQUE_ARGS; - /** * OpaqueError is a Native-Java allegory to smithy-dafny's * {@code datatype Error}'s {@code Opaque(obj: object)} constructor

* There is no Smithy Shape for this.

*/ public class OpaqueError { - public final static String OPAQUE_ERROR = "OpaqueError"; - /** The class name of a module's Opaque Error. */ - public static ClassName nativeClassName(String packageName) { - return ClassName.get(packageName, OPAQUE_ERROR); - } + public static final String OPAQUE_ERROR = "OpaqueError"; + + /** The class name of a module's Opaque Error. */ + public static ClassName nativeClassName(String packageName) { + return ClassName.get(packageName, OPAQUE_ERROR); + } - /** A JavaFile containing the OpaqueError class definition. */ - public static JavaFile javaFile(String packageName) { - ClassName className = nativeClassName(packageName); - ClassName superName = ClassName.get(RuntimeException.class); - List localOnlyFields = ErrorHelpers.removeThrowableArgs(OPAQUE_ARGS); - BuilderSpecs builderSpecs = new BuilderSpecs( - className, null, OPAQUE_ARGS, Collections.emptyList()); - final boolean overrideSuperFalse = false; + /** A JavaFile containing the OpaqueError class definition. */ + public static JavaFile javaFile(String packageName) { + ClassName className = nativeClassName(packageName); + ClassName superName = ClassName.get(RuntimeException.class); + List localOnlyFields = ErrorHelpers.removeThrowableArgs( + OPAQUE_ARGS + ); + BuilderSpecs builderSpecs = new BuilderSpecs( + className, + null, + OPAQUE_ARGS, + Collections.emptyList() + ); + final boolean overrideSuperFalse = false; - TypeSpec.Builder spec = TypeSpec - .classBuilder(className) - .addModifiers(PUBLIC) - .superclass(superName); - localOnlyFields.forEach(field -> { - // Add local fields - spec.addField(field.toFieldSpec(PRIVATE, FINAL)); - }); - spec.addMethod(ErrorHelpers.messageFromBuilder(builderSpecs)); - spec.addMethods(ErrorHelpers.throwableGetters()); - localOnlyFields.forEach(field -> spec.addMethod(ModeledStructure.getterMethod(field))); - spec - .addType(builderSpecs.builderInterface()) - .addType(builderSpecs.builderImpl( - overrideSuperFalse, - builderImplConstructor(packageName), - implBuildMethod(className)) - ) - .addMethod(constructor(builderSpecs)) - .addMethod(builderSpecs.toBuilderMethod(overrideSuperFalse)) - .addMethod(builderSpecs.builderMethod()); + TypeSpec.Builder spec = TypeSpec + .classBuilder(className) + .addModifiers(PUBLIC) + .superclass(superName); + localOnlyFields.forEach(field -> { + // Add local fields + spec.addField(field.toFieldSpec(PRIVATE, FINAL)); + }); + spec.addMethod(ErrorHelpers.messageFromBuilder(builderSpecs)); + spec.addMethods(ErrorHelpers.throwableGetters()); + localOnlyFields.forEach(field -> + spec.addMethod(ModeledStructure.getterMethod(field)) + ); + spec + .addType(builderSpecs.builderInterface()) + .addType( + builderSpecs.builderImpl( + overrideSuperFalse, + builderImplConstructor(packageName), + implBuildMethod(className) + ) + ) + .addMethod(constructor(builderSpecs)) + .addMethod(builderSpecs.toBuilderMethod(overrideSuperFalse)) + .addMethod(builderSpecs.builderMethod()); - return JavaFile.builder(packageName, spec.build()) - .skipJavaLangImports(true) - .build(); - } + return JavaFile + .builder(packageName, spec.build()) + .skipJavaLangImports(true) + .build(); + } - /** The Class's constructor.*/ - static MethodSpec constructor(BuilderSpecs builderSpecs) { - MethodSpec.Builder method = MethodSpec - .constructorBuilder() - .addModifiers(PROTECTED) - .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR) - .addStatement( - "super(messageFromBuilder($L), $L.cause())", - BuilderSpecs.BUILDER_VAR, BuilderSpecs.BUILDER_VAR - ) - .addStatement("this.obj = builder.obj()"); - return method.build(); - } + /** The Class's constructor.*/ + static MethodSpec constructor(BuilderSpecs builderSpecs) { + MethodSpec.Builder method = MethodSpec + .constructorBuilder() + .addModifiers(PROTECTED) + .addParameter(builderSpecs.builderImplName(), BuilderSpecs.BUILDER_VAR) + .addStatement( + "super(messageFromBuilder($L), $L.cause())", + BuilderSpecs.BUILDER_VAR, + BuilderSpecs.BUILDER_VAR + ) + .addStatement("this.obj = builder.obj()"); + return method.build(); + } - /** - * @return Constructor that that uses {@code RuntimeException}'s getter - * methods to initialize builder. - */ - static MethodSpec builderImplConstructor(String packageName) { - return MethodSpec.constructorBuilder() - .addModifiers(PROTECTED) - .addParameter(nativeClassName(packageName), "model") - .addStatement("this.cause = model.getCause()") - .addStatement("this.message = model.getMessage()") - .addStatement("this.obj = model.obj()") - .build(); - } + /** + * @return Constructor that that uses {@code RuntimeException}'s getter + * methods to initialize builder. + */ + static MethodSpec builderImplConstructor(String packageName) { + return MethodSpec + .constructorBuilder() + .addModifiers(PROTECTED) + .addParameter(nativeClassName(packageName), "model") + .addStatement("this.cause = model.getCause()") + .addStatement("this.message = model.getMessage()") + .addStatement("this.obj = model.obj()") + .build(); + } - static MethodSpec implBuildMethod(ClassName className) { - return MethodSpec - .methodBuilder("build") - .addModifiers(PUBLIC) - .returns(className) - .beginControlFlow("if (this.obj != null && this.cause == null && this.obj instanceof Throwable)") - .addStatement("this.cause = (Throwable) this.obj") - .nextControlFlow("else if (this.obj == null && this.cause != null)") - .addStatement("this.obj = this.cause") - .endControlFlow() - .addStatement("return new $T(this)", className) - .build(); - } + static MethodSpec implBuildMethod(ClassName className) { + return MethodSpec + .methodBuilder("build") + .addModifiers(PUBLIC) + .returns(className) + .beginControlFlow( + "if (this.obj != null && this.cause == null && this.obj instanceof Throwable)" + ) + .addStatement("this.cause = (Throwable) this.obj") + .nextControlFlow("else if (this.obj == null && this.cause != null)") + .addStatement("this.obj = this.cause") + .endControlFlow() + .addStatement("return new $T(this)", className) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ClientConfigTrait.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ClientConfigTrait.java index 81073791ef..a3a76110bf 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ClientConfigTrait.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ClientConfigTrait.java @@ -3,6 +3,7 @@ package software.amazon.polymorph.traits; +import java.util.Optional; import software.amazon.smithy.model.node.Node; import software.amazon.smithy.model.node.ObjectNode; import software.amazon.smithy.model.node.StringNode; @@ -17,88 +18,96 @@ import software.amazon.smithy.utils.SmithyBuilder; import software.amazon.smithy.utils.ToSmithyBuilder; -import java.util.Optional; - /** * A trait indicating the structure that should be used as the client configuration object when generating the client * code for a service structure. */ -public class ClientConfigTrait extends AbstractTrait implements ToSmithyBuilder { - public static final ShapeId ID = ShapeId.from("aws.polymorph#clientConfig"); +public class ClientConfigTrait + extends AbstractTrait + implements ToSmithyBuilder { - private final ShapeId clientConfigId; + public static final ShapeId ID = ShapeId.from("aws.polymorph#clientConfig"); - private static final String CONFIG = "config"; + private final ShapeId clientConfigId; - private ClientConfigTrait(Builder builder) { - super(ID, builder.getSourceLocation()); - this.clientConfigId = builder.clientConfigId; - } + private static final String CONFIG = "config"; - public static final class Provider extends AbstractTrait.Provider { - public Provider() { - super(ID); - } - - @Override - public Trait createTrait(ShapeId target, Node value) { - ObjectNode objectNode = value.expectObjectNode(); - Optional configIdOptional = objectNode.getStringMember(CONFIG).map(StringNode::expectShapeId); - ShapeId configId = configIdOptional.orElseThrow(() -> new IllegalStateException("Must specify a config")); - - return builder() - .clientConfigId(configId) - .build(); - } - } + private ClientConfigTrait(Builder builder) { + super(ID, builder.getSourceLocation()); + this.clientConfigId = builder.clientConfigId; + } - public static Builder builder() { - return new Builder(); - } + public static final class Provider extends AbstractTrait.Provider { - public ShapeId getClientConfigId() { - return this.clientConfigId; + public Provider() { + super(ID); } @Override - protected Node createNode() { - return Node.objectNodeBuilder() - .sourceLocation(getSourceLocation()) - .withMember(CONFIG, this.clientConfigId.toString()) - .build(); + public Trait createTrait(ShapeId target, Node value) { + ObjectNode objectNode = value.expectObjectNode(); + Optional configIdOptional = objectNode + .getStringMember(CONFIG) + .map(StringNode::expectShapeId); + ShapeId configId = configIdOptional.orElseThrow(() -> + new IllegalStateException("Must specify a config") + ); + + return builder().clientConfigId(configId).build(); } + } - @Override - public SmithyBuilder toBuilder() { - return builder() - .sourceLocation(getSourceLocation()); - } + public static Builder builder() { + return new Builder(); + } + + public ShapeId getClientConfigId() { + return this.clientConfigId; + } - /** Builder for {@link ClientConfigTrait}. */ - public static final class Builder extends AbstractTraitBuilder { - private ShapeId clientConfigId; + @Override + protected Node createNode() { + return Node + .objectNodeBuilder() + .sourceLocation(getSourceLocation()) + .withMember(CONFIG, this.clientConfigId.toString()) + .build(); + } - private Builder() {} + @Override + public SmithyBuilder toBuilder() { + return builder().sourceLocation(getSourceLocation()); + } - @Override - public ClientConfigTrait build() { - return new ClientConfigTrait(this); - } + /** Builder for {@link ClientConfigTrait}. */ + public static final class Builder + extends AbstractTraitBuilder { - public Builder clientConfigId(ShapeId clientConfigId) { - this.clientConfigId = clientConfigId; - return this; - } + private ShapeId clientConfigId; + + private Builder() {} + + @Override + public ClientConfigTrait build() { + return new ClientConfigTrait(this); } - public static Shape getDefinition() { - final Trait clientConfigTraitDefinition = TraitDefinition.builder() - .selector(Selector.parse("service")) - .build(); - return StructureShape.builder() - .id(ClientConfigTrait.ID) - .addTrait(clientConfigTraitDefinition) - .addMember(CONFIG, ShapeId.from("smithy.api#String")) - .build(); + public Builder clientConfigId(ShapeId clientConfigId) { + this.clientConfigId = clientConfigId; + return this; } + } + + public static Shape getDefinition() { + final Trait clientConfigTraitDefinition = TraitDefinition + .builder() + .selector(Selector.parse("service")) + .build(); + return StructureShape + .builder() + .id(ClientConfigTrait.ID) + .addTrait(clientConfigTraitDefinition) + .addMember(CONFIG, ShapeId.from("smithy.api#String")) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/DafnyUtf8BytesTrait.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/DafnyUtf8BytesTrait.java index dabd3e9957..b68b0fb9da 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/DafnyUtf8BytesTrait.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/DafnyUtf8BytesTrait.java @@ -31,29 +31,34 @@ */ // TODO: remove this trait public final class DafnyUtf8BytesTrait extends AnnotationTrait { - public static final ShapeId ID = ShapeId.from("aws.polymorph#dafnyUtf8Bytes"); - public DafnyUtf8BytesTrait(ObjectNode node) { - super(ID, node); - } + public static final ShapeId ID = ShapeId.from("aws.polymorph#dafnyUtf8Bytes"); - public DafnyUtf8BytesTrait() { - this(Node.objectNode()); - } + public DafnyUtf8BytesTrait(ObjectNode node) { + super(ID, node); + } - public static final class Provider extends AnnotationTrait.Provider { - public Provider() { - super(ID, DafnyUtf8BytesTrait::new); - } - } + public DafnyUtf8BytesTrait() { + this(Node.objectNode()); + } - public static Shape getDefinition() { - final Trait traitDefinition = TraitDefinition.builder() - .selector(Selector.parse("string")) - .build(); - return StructureShape.builder() - .id(DafnyUtf8BytesTrait.ID) - .addTrait(traitDefinition) - .build(); + public static final class Provider + extends AnnotationTrait.Provider { + + public Provider() { + super(ID, DafnyUtf8BytesTrait::new); } + } + + public static Shape getDefinition() { + final Trait traitDefinition = TraitDefinition + .builder() + .selector(Selector.parse("string")) + .build(); + return StructureShape + .builder() + .id(DafnyUtf8BytesTrait.ID) + .addTrait(traitDefinition) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ExtendableTrait.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ExtendableTrait.java index 937594ac99..cf0b43a9dc 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ExtendableTrait.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ExtendableTrait.java @@ -19,48 +19,63 @@ * A trait indicating the resource is extendable. * i.e.: Users may author their own classes that implement and extend this resource. */ -public class ExtendableTrait extends AbstractTrait implements ToSmithyBuilder { - public static final ShapeId ID = ShapeId.from("aws.polymorph#extendable"); +public class ExtendableTrait + extends AbstractTrait + implements ToSmithyBuilder { - private ExtendableTrait(Builder builder) { super(ID, builder.getSourceLocation()); } + public static final ShapeId ID = ShapeId.from("aws.polymorph#extendable"); - public static final class Provider extends AbstractTrait.Provider { - public Provider() { super(ID); } + private ExtendableTrait(Builder builder) { + super(ID, builder.getSourceLocation()); + } - @Override - public Trait createTrait(ShapeId target, Node value) { return new Builder().build(); } - } - - public static Builder builder() { return new Builder(); } + public static final class Provider extends AbstractTrait.Provider { - @Override - protected Node createNode() { - return Node.objectNodeBuilder() - .sourceLocation(getSourceLocation()) - .build(); + public Provider() { + super(ID); } @Override - public SmithyBuilder toBuilder() { - return builder().sourceLocation(getSourceLocation()); + public Trait createTrait(ShapeId target, Node value) { + return new Builder().build(); } + } - /** Builder for {@link ExtendableTrait}. */ - public static final class Builder extends AbstractTraitBuilder { + public static Builder builder() { + return new Builder(); + } - private Builder() {} + @Override + protected Node createNode() { + return Node.objectNodeBuilder().sourceLocation(getSourceLocation()).build(); + } - @Override - public ExtendableTrait build() { return new ExtendableTrait(this); } - } + @Override + public SmithyBuilder toBuilder() { + return builder().sourceLocation(getSourceLocation()); + } - public static Shape getDefinition() { - final Trait extendableTraitDefinition = TraitDefinition.builder() - .selector(Selector.parse("resource")) - .build(); - return StructureShape.builder() - .id(ExtendableTrait.ID) - .addTrait(extendableTraitDefinition) - .build(); + /** Builder for {@link ExtendableTrait}. */ + public static final class Builder + extends AbstractTraitBuilder { + + private Builder() {} + + @Override + public ExtendableTrait build() { + return new ExtendableTrait(this); } + } + + public static Shape getDefinition() { + final Trait extendableTraitDefinition = TraitDefinition + .builder() + .selector(Selector.parse("resource")) + .build(); + return StructureShape + .builder() + .id(ExtendableTrait.ID) + .addTrait(extendableTraitDefinition) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/JavaDocTrait.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/JavaDocTrait.java index d83f21a970..11dcd9e7cf 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/JavaDocTrait.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/JavaDocTrait.java @@ -12,29 +12,34 @@ import software.amazon.smithy.model.traits.TraitDefinition; public class JavaDocTrait extends StringTrait { - public static final ShapeId ID = ShapeId.from("aws.polymorph#javadoc"); - public JavaDocTrait(String value, SourceLocation sourceLocation) { - super(ID, value, sourceLocation); - } + public static final ShapeId ID = ShapeId.from("aws.polymorph#javadoc"); - public JavaDocTrait(String value) { - this(value, SourceLocation.NONE); - } + public JavaDocTrait(String value, SourceLocation sourceLocation) { + super(ID, value, sourceLocation); + } - public static final class Provider extends StringTrait.Provider { - public Provider() { - super(ID, JavaDocTrait::new); - } - } + public JavaDocTrait(String value) { + this(value, SourceLocation.NONE); + } - public static Shape getDefinition() { - final Trait traitDefinition = TraitDefinition.builder() - .selector(Selector.parse("*")) - .build(); - return StringShape.builder() - .id(JavaDocTrait.ID) - .addTrait(traitDefinition) - .build(); + public static final class Provider + extends StringTrait.Provider { + + public Provider() { + super(ID, JavaDocTrait::new); } + } + + public static Shape getDefinition() { + final Trait traitDefinition = TraitDefinition + .builder() + .selector(Selector.parse("*")) + .build(); + return StringShape + .builder() + .id(JavaDocTrait.ID) + .addTrait(traitDefinition) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/LocalServiceTrait.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/LocalServiceTrait.java index dd40b3e5d9..a8a7572b10 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/LocalServiceTrait.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/LocalServiceTrait.java @@ -8,10 +8,8 @@ import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; - import javax.annotation.Nonnull; import javax.annotation.Nullable; - import software.amazon.smithy.model.node.ArrayNode; import software.amazon.smithy.model.node.Node; import software.amazon.smithy.model.node.ObjectNode; @@ -37,162 +35,221 @@ * 'config' is the structure that customers provide to construct the client. * 'dependencies' is an optional list of services that the target service depends on. */ -public class LocalServiceTrait extends AbstractTrait implements ToSmithyBuilder { - public static final String NAMESPACE = "aws.polymorph"; - public static final ShapeId LOCAL_SERVICE_ID = ShapeId.fromParts(NAMESPACE, "localService"); - public static final ShapeId SERVICE_LIST_ID = ShapeId.fromParts(NAMESPACE, "ServiceList"); - - protected static final String SDKID = "sdkId"; - protected static final String CONFIG = "config"; - private static final String DEPENDENCIES = "dependencies"; - @Nonnull - private final String sdkId; - @Nonnull - private final ShapeId configId; - @Nullable - private final LinkedHashSet dependencies; - - private LocalServiceTrait(Builder builder) { - super(LOCAL_SERVICE_ID, builder.getSourceLocation()); - this.sdkId = builder.sdkId; - this.configId = builder.configId; - this.dependencies = builder.dependencies; - } - - public static final class Provider extends AbstractTrait.Provider { - public Provider() { super(LOCAL_SERVICE_ID); } - - @Override - public Trait createTrait(ShapeId target, Node value) { - ObjectNode objectNode = value.expectObjectNode(); - ShapeId configId = objectNode.expectStringMember(CONFIG).expectShapeId(); - String sdkId = objectNode.expectStringMember(SDKID).toString(); - Optional maybeRawDependencies = objectNode.getArrayMember(DEPENDENCIES); - Builder builder = builder(); - if (maybeRawDependencies.isPresent()) { - ArrayNode rawDependencies = maybeRawDependencies.get(); - final LinkedHashSet dependencies = rawDependencies - .getElementsAs(StringNode.class).stream() - .map(StringNode::expectShapeId) - .collect(Collectors.toCollection(LinkedHashSet::new)); - builder.dependencies(dependencies); - } - - return builder - .sdkId(sdkId) - .configId(configId) - .build(); - } +public class LocalServiceTrait + extends AbstractTrait + implements ToSmithyBuilder { + + public static final String NAMESPACE = "aws.polymorph"; + public static final ShapeId LOCAL_SERVICE_ID = ShapeId.fromParts( + NAMESPACE, + "localService" + ); + public static final ShapeId SERVICE_LIST_ID = ShapeId.fromParts( + NAMESPACE, + "ServiceList" + ); + + protected static final String SDKID = "sdkId"; + protected static final String CONFIG = "config"; + private static final String DEPENDENCIES = "dependencies"; + + @Nonnull + private final String sdkId; + + @Nonnull + private final ShapeId configId; + + @Nullable + private final LinkedHashSet dependencies; + + private LocalServiceTrait(Builder builder) { + super(LOCAL_SERVICE_ID, builder.getSourceLocation()); + this.sdkId = builder.sdkId; + this.configId = builder.configId; + this.dependencies = builder.dependencies; + } + + public static final class Provider extends AbstractTrait.Provider { + + public Provider() { + super(LOCAL_SERVICE_ID); } - public static Builder builder() { return new Builder(); } - - @Nonnull - public String getSdkId() { - return sdkId; + @Override + public Trait createTrait(ShapeId target, Node value) { + ObjectNode objectNode = value.expectObjectNode(); + ShapeId configId = objectNode.expectStringMember(CONFIG).expectShapeId(); + String sdkId = objectNode.expectStringMember(SDKID).toString(); + Optional maybeRawDependencies = objectNode.getArrayMember( + DEPENDENCIES + ); + Builder builder = builder(); + if (maybeRawDependencies.isPresent()) { + ArrayNode rawDependencies = maybeRawDependencies.get(); + final LinkedHashSet dependencies = rawDependencies + .getElementsAs(StringNode.class) + .stream() + .map(StringNode::expectShapeId) + .collect(Collectors.toCollection(LinkedHashSet::new)); + builder.dependencies(dependencies); + } + + return builder.sdkId(sdkId).configId(configId).build(); } - @Nonnull - public ShapeId getConfigId() { - return configId; + } + + public static Builder builder() { + return new Builder(); + } + + @Nonnull + public String getSdkId() { + return sdkId; + } + + @Nonnull + public ShapeId getConfigId() { + return configId; + } + + @Nullable + public LinkedHashSet getDependencies() { + return dependencies; + } + + @Override + protected Node createNode() { + return Node + .objectNodeBuilder() + .sourceLocation(getSourceLocation()) + .withMember(SDKID, this.sdkId) + .withMember(CONFIG, this.configId.toString()) + .withOptionalMember( + DEPENDENCIES, + Optional.ofNullable(dependenciesAsArrayNode()) + ) + .build(); + } + + @Nullable + protected ArrayNode dependenciesAsArrayNode() { + if (Objects.isNull(this.dependencies)) { + return null; } - @Nullable - public LinkedHashSet getDependencies() {return dependencies;} + final ArrayNode.Builder builder = ArrayNode.builder(); + dependencies.stream().map(ShapeId::toString).forEach(builder::withValue); + return builder.build(); + } + + @Override + public SmithyBuilder toBuilder() { + return builder() + .sourceLocation(getSourceLocation()) + .sdkId(this.getSdkId()) + .configId(this.getConfigId()) + .dependencies(this.getDependencies()); + } + + /** Builder for {@link LocalServiceTrait}. */ + public static final class Builder + extends AbstractTraitBuilder { + + private String sdkId; + private ShapeId configId; + private LinkedHashSet dependencies; + + private Builder() {} @Override - protected Node createNode() { - return Node - .objectNodeBuilder() - .sourceLocation(getSourceLocation()) - .withMember(SDKID, this.sdkId) - .withMember(CONFIG, this.configId.toString()) - .withOptionalMember(DEPENDENCIES, Optional.ofNullable(dependenciesAsArrayNode())) - .build(); + public LocalServiceTrait build() { + return new LocalServiceTrait(this); } - @Nullable - protected ArrayNode dependenciesAsArrayNode() { - if (Objects.isNull(this.dependencies)) { - return null; - } - final ArrayNode.Builder builder = ArrayNode.builder(); - dependencies.stream() - .map(ShapeId::toString) - .forEach(builder::withValue); - return builder.build(); + public LocalServiceTrait.Builder sdkId(String sdkId) { + this.sdkId = sdkId; + return this; } - @Override - public SmithyBuilder toBuilder() { - return builder() - .sourceLocation(getSourceLocation()) - .sdkId(this.getSdkId()) - .configId(this.getConfigId()) - .dependencies(this.getDependencies()); + public LocalServiceTrait.Builder configId(ShapeId configId) { + this.configId = configId; + return this; } - /** Builder for {@link LocalServiceTrait}. */ - public static final class Builder extends AbstractTraitBuilder { - private String sdkId; - private ShapeId configId; - private LinkedHashSet dependencies; - - private Builder() {} - - @Override - public LocalServiceTrait build() { return new LocalServiceTrait(this); } - - public LocalServiceTrait.Builder sdkId(String sdkId) { - this.sdkId = sdkId; - return this; - } - - public LocalServiceTrait.Builder configId(ShapeId configId) { - this.configId = configId; - return this; - } - - public LocalServiceTrait.Builder dependencies(LinkedHashSet dependencies) { - this.dependencies = dependencies; - return this; - } + public LocalServiceTrait.Builder dependencies( + LinkedHashSet dependencies + ) { + this.dependencies = dependencies; + return this; } - - public static Stream getDefinitions() { - final MemberShape serviceMember = MemberShape.builder() - .id(ShapeId.fromParts(SERVICE_LIST_ID.getNamespace(), SERVICE_LIST_ID.getName(), "member")) - .addTrait(IdRefTrait.builder() - .selector(Selector.parse("service")) - .failWhenMissing(true) - .build()) - .target("smithy.api#String").build(); - final ListShape serviceListShape = ListShape.builder() - .id(LocalServiceTrait.SERVICE_LIST_ID) - .member(serviceMember) - .build(); - final MemberShape skidShape = MemberShape.builder() - .addTrait(new RequiredTrait()) - .id(ShapeId.fromParts(LOCAL_SERVICE_ID.getNamespace(), LOCAL_SERVICE_ID.getName(), SDKID)) - .target("smithy.api#String") - .build(); - final MemberShape configShape = MemberShape.builder() - .addTrait(new RequiredTrait()) - .addTrait(IdRefTrait.builder() - .selector(Selector.parse("structure")) - .failWhenMissing(true) - .build()) - .id(ShapeId.fromParts(LOCAL_SERVICE_ID.getNamespace(), LOCAL_SERVICE_ID.getName(), CONFIG)) - .target("smithy.api#String") - .build(); - final Trait localServiceTraitDefinition = TraitDefinition.builder() + } + + public static Stream getDefinitions() { + final MemberShape serviceMember = MemberShape + .builder() + .id( + ShapeId.fromParts( + SERVICE_LIST_ID.getNamespace(), + SERVICE_LIST_ID.getName(), + "member" + ) + ) + .addTrait( + IdRefTrait + .builder() .selector(Selector.parse("service")) - .build(); - final StructureShape localService = StructureShape.builder() - .id(LocalServiceTrait.LOCAL_SERVICE_ID) - .addTrait(localServiceTraitDefinition) - .addMember(skidShape) - .addMember(configShape) - .addMember(DEPENDENCIES, LocalServiceTrait.SERVICE_LIST_ID) - .build(); - return Stream.of(serviceListShape, localService); - } + .failWhenMissing(true) + .build() + ) + .target("smithy.api#String") + .build(); + final ListShape serviceListShape = ListShape + .builder() + .id(LocalServiceTrait.SERVICE_LIST_ID) + .member(serviceMember) + .build(); + final MemberShape skidShape = MemberShape + .builder() + .addTrait(new RequiredTrait()) + .id( + ShapeId.fromParts( + LOCAL_SERVICE_ID.getNamespace(), + LOCAL_SERVICE_ID.getName(), + SDKID + ) + ) + .target("smithy.api#String") + .build(); + final MemberShape configShape = MemberShape + .builder() + .addTrait(new RequiredTrait()) + .addTrait( + IdRefTrait + .builder() + .selector(Selector.parse("structure")) + .failWhenMissing(true) + .build() + ) + .id( + ShapeId.fromParts( + LOCAL_SERVICE_ID.getNamespace(), + LOCAL_SERVICE_ID.getName(), + CONFIG + ) + ) + .target("smithy.api#String") + .build(); + final Trait localServiceTraitDefinition = TraitDefinition + .builder() + .selector(Selector.parse("service")) + .build(); + final StructureShape localService = StructureShape + .builder() + .id(LocalServiceTrait.LOCAL_SERVICE_ID) + .addTrait(localServiceTraitDefinition) + .addMember(skidShape) + .addMember(configShape) + .addMember(DEPENDENCIES, LocalServiceTrait.SERVICE_LIST_ID) + .build(); + return Stream.of(serviceListShape, localService); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/MutableLocalStateTrait.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/MutableLocalStateTrait.java index 3250da0d48..01347e70e3 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/MutableLocalStateTrait.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/MutableLocalStateTrait.java @@ -22,61 +22,68 @@ * Polymorph needs to be able to integrate these mutations * with the History DafnyCallEvents. */ -public class MutableLocalStateTrait extends AbstractTrait implements ToSmithyBuilder { - public static final ShapeId ID = ShapeId.from("aws.polymorph#mutableLocalState"); +public class MutableLocalStateTrait + extends AbstractTrait + implements ToSmithyBuilder { - private MutableLocalStateTrait(MutableLocalStateTrait.Builder builder) { - super(ID, builder.getSourceLocation()); - } + public static final ShapeId ID = ShapeId.from( + "aws.polymorph#mutableLocalState" + ); - public static final class Provider extends AbstractTrait.Provider { - public Provider() { - super(ID); - } + private MutableLocalStateTrait(MutableLocalStateTrait.Builder builder) { + super(ID, builder.getSourceLocation()); + } - @Override - public Trait createTrait(ShapeId target, Node value) { - return builder().build(); - } - } + public static final class Provider extends AbstractTrait.Provider { - public static MutableLocalStateTrait.Builder builder() { - return new MutableLocalStateTrait.Builder(); + public Provider() { + super(ID); } @Override - protected Node createNode() { - return Node.objectNodeBuilder() - .sourceLocation(getSourceLocation()) - .build(); + public Trait createTrait(ShapeId target, Node value) { + return builder().build(); } + } - @Override - public SmithyBuilder toBuilder() { - return builder() - .sourceLocation(getSourceLocation()); - } + public static MutableLocalStateTrait.Builder builder() { + return new MutableLocalStateTrait.Builder(); + } - /** Builder for {@link MutableLocalStateTrait}. */ - public static final class Builder extends AbstractTraitBuilder { + @Override + protected Node createNode() { + return Node.objectNodeBuilder().sourceLocation(getSourceLocation()).build(); + } - private Builder() {} + @Override + public SmithyBuilder toBuilder() { + return builder().sourceLocation(getSourceLocation()); + } - @Override - public MutableLocalStateTrait build() { - return new MutableLocalStateTrait(this); - } - } + /** Builder for {@link MutableLocalStateTrait}. */ + public static final class Builder + extends AbstractTraitBuilder< + MutableLocalStateTrait, + MutableLocalStateTrait.Builder + > { - public static Shape getDefinition() { - final Trait mutableLocalStateDefinition = TraitDefinition.builder() - .selector(Selector.parse("resource")) - .build(); - return StructureShape.builder() - .id(MutableLocalStateTrait.ID) - .addTrait(mutableLocalStateDefinition) - .build(); - } + private Builder() {} + @Override + public MutableLocalStateTrait build() { + return new MutableLocalStateTrait(this); + } + } + public static Shape getDefinition() { + final Trait mutableLocalStateDefinition = TraitDefinition + .builder() + .selector(Selector.parse("resource")) + .build(); + return StructureShape + .builder() + .id(MutableLocalStateTrait.ID) + .addTrait(mutableLocalStateDefinition) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/PositionalTrait.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/PositionalTrait.java index 105573ae69..96d5e7afe0 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/PositionalTrait.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/PositionalTrait.java @@ -21,79 +21,84 @@ /** * A trait representing that a structure should be "unwrapped" to its member whenever it is referenced. */ -public class PositionalTrait extends AbstractTrait implements ToSmithyBuilder { - public static final ShapeId ID = ShapeId.from("aws.polymorph#positional"); +public class PositionalTrait + extends AbstractTrait + implements ToSmithyBuilder { - private PositionalTrait(Builder builder) { - super(ID, builder.getSourceLocation()); - } + public static final ShapeId ID = ShapeId.from("aws.polymorph#positional"); - public static final class Provider extends AbstractTrait.Provider { - public Provider() { - super(ID); - } + private PositionalTrait(Builder builder) { + super(ID, builder.getSourceLocation()); + } - @Override - public Trait createTrait(ShapeId target, Node value) { - return builder().build(); - } - } + public static final class Provider extends AbstractTrait.Provider { - public static Builder builder() { - return new Builder(); + public Provider() { + super(ID); } @Override - protected Node createNode() { - return Node.objectNodeBuilder() - .sourceLocation(getSourceLocation()) - .build(); + public Trait createTrait(ShapeId target, Node value) { + return builder().build(); } + } - @Override - public SmithyBuilder toBuilder() { - return builder() - .sourceLocation(getSourceLocation()); - } + public static Builder builder() { + return new Builder(); + } - /** Builder for {@link PositionalTrait}. */ - public static final class Builder extends AbstractTraitBuilder { + @Override + protected Node createNode() { + return Node.objectNodeBuilder().sourceLocation(getSourceLocation()).build(); + } - private Builder() {} + @Override + public SmithyBuilder toBuilder() { + return builder().sourceLocation(getSourceLocation()); + } - @Override - public PositionalTrait build() { - return new PositionalTrait(this); - } - } + /** Builder for {@link PositionalTrait}. */ + public static final class Builder + extends AbstractTraitBuilder { - public static Shape getDefinition() { - final Trait positionalTraitDefinition = TraitDefinition.builder() - .selector(Selector.parse("structure")) - .build(); - return StructureShape.builder() - .id(PositionalTrait.ID) - .addTrait(positionalTraitDefinition) - .build(); - } + private Builder() {} - public static void validateUse(StructureShape shape) { - if (!shape.hasTrait(PositionalTrait.class)) { - return; - } - if (shape.members().size() == 1) { - return; - } - String msg = "Structures with Positional Trait MUST have one and ONLY one member." - + " Structure: %s".formatted(shape.getId()); - throw new IllegalArgumentException(msg); + @Override + public PositionalTrait build() { + return new PositionalTrait(this); } - - public static MemberShape onlyMember(StructureShape shape) { - validateUse(shape); - // validateUse ensures there will be 1 member; - // thus we know `Optional.get()` will succeed. - //noinspection OptionalGetWithoutIsPresent - return shape.members().stream().findFirst().get(); + } + + public static Shape getDefinition() { + final Trait positionalTraitDefinition = TraitDefinition + .builder() + .selector(Selector.parse("structure")) + .build(); + return StructureShape + .builder() + .id(PositionalTrait.ID) + .addTrait(positionalTraitDefinition) + .build(); + } + + public static void validateUse(StructureShape shape) { + if (!shape.hasTrait(PositionalTrait.class)) { + return; + } + if (shape.members().size() == 1) { + return; } + String msg = + "Structures with Positional Trait MUST have one and ONLY one member." + + " Structure: %s".formatted(shape.getId()); + throw new IllegalArgumentException(msg); + } + + public static MemberShape onlyMember(StructureShape shape) { + validateUse(shape); + // validateUse ensures there will be 1 member; + // thus we know `Optional.get()` will succeed. + //noinspection OptionalGetWithoutIsPresent + return shape.members().stream().findFirst().get(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ReferenceTrait.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ReferenceTrait.java index fe04e3161e..74acdec8f1 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ReferenceTrait.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/traits/ReferenceTrait.java @@ -3,6 +3,7 @@ package software.amazon.polymorph.traits; +import java.util.Optional; import software.amazon.smithy.model.node.Node; import software.amazon.smithy.model.node.ObjectNode; import software.amazon.smithy.model.node.StringNode; @@ -17,132 +18,150 @@ import software.amazon.smithy.utils.SmithyBuilder; import software.amazon.smithy.utils.ToSmithyBuilder; -import java.util.Optional; - /** * A trait representing a reference to either a service or resource, which we call the referent. A process holding such * a reference can invoke operations on the referent. */ -public class ReferenceTrait extends AbstractTrait implements ToSmithyBuilder { - public static final ShapeId ID = ShapeId.from("aws.polymorph#reference"); +public class ReferenceTrait + extends AbstractTrait + implements ToSmithyBuilder { - private static final String SERVICE = "service"; - private static final String RESOURCE = "resource"; + public static final ShapeId ID = ShapeId.from("aws.polymorph#reference"); - private final ReferentType referentType; - private final ShapeId referentId; + private static final String SERVICE = "service"; + private static final String RESOURCE = "resource"; - private ReferenceTrait(Builder builder) { - super(ID, builder.getSourceLocation()); - this.referentType = builder.referentType; - this.referentId = builder.referentId; - } + private final ReferentType referentType; + private final ShapeId referentId; - public static final class Provider extends AbstractTrait.Provider { - public Provider() { - super(ID); - } - - @Override - public Trait createTrait(ShapeId target, Node value) { - ObjectNode objectNode = value.expectObjectNode(); - Optional serviceId = objectNode.getStringMember(SERVICE).map(StringNode::expectShapeId); - Optional resourceId = objectNode.getStringMember(RESOURCE).map(StringNode::expectShapeId); - if (serviceId.isPresent() == resourceId.isPresent()) { - throw new IllegalStateException("Must specify either service or resource, but not both"); - } - ReferentType referentType = serviceId.isPresent() ? ReferentType.SERVICE : ReferentType.RESOURCE; - ShapeId referentId = serviceId.orElseGet(resourceId::get); - - return builder() - .referentType(referentType) - .referentId(referentId) - .build(); - } - } + private ReferenceTrait(Builder builder) { + super(ID, builder.getSourceLocation()); + this.referentType = builder.referentType; + this.referentId = builder.referentId; + } - public static Builder builder() { - return new Builder(); + public static final class Provider extends AbstractTrait.Provider { + + public Provider() { + super(ID); } - public ReferentType getReferentType() { - return referentType; + @Override + public Trait createTrait(ShapeId target, Node value) { + ObjectNode objectNode = value.expectObjectNode(); + Optional serviceId = objectNode + .getStringMember(SERVICE) + .map(StringNode::expectShapeId); + Optional resourceId = objectNode + .getStringMember(RESOURCE) + .map(StringNode::expectShapeId); + if (serviceId.isPresent() == resourceId.isPresent()) { + throw new IllegalStateException( + "Must specify either service or resource, but not both" + ); + } + ReferentType referentType = serviceId.isPresent() + ? ReferentType.SERVICE + : ReferentType.RESOURCE; + ShapeId referentId = serviceId.orElseGet(resourceId::get); + + return builder() + .referentType(referentType) + .referentId(referentId) + .build(); } + } - public boolean isService() { return referentType == ReferentType.SERVICE; } + public static Builder builder() { + return new Builder(); + } - public ShapeId getReferentId() { - return referentId; - } + public ReferentType getReferentType() { + return referentType; + } - public enum ReferentType { - SERVICE, RESOURCE; - - @Override - public String toString() { - return switch (this) { - case SERVICE -> ReferenceTrait.SERVICE; - case RESOURCE -> ReferenceTrait.RESOURCE; - }; - } - - public static ReferentType fromString(String referentTypeStr) { - return switch (referentTypeStr) { - case ReferenceTrait.SERVICE -> SERVICE; - case ReferenceTrait.RESOURCE -> RESOURCE; - default -> throw new UnsupportedOperationException(); - }; - } - } + public boolean isService() { + return referentType == ReferentType.SERVICE; + } - @Override - protected Node createNode() { - return Node.objectNodeBuilder() - .sourceLocation(getSourceLocation()) - .withMember(this.referentType.toString(), this.referentId.toString()) - .build(); - } + public ShapeId getReferentId() { + return referentId; + } + + public enum ReferentType { + SERVICE, + RESOURCE; @Override - public SmithyBuilder toBuilder() { - return builder() - .sourceLocation(getSourceLocation()) - .referentType(this.getReferentType()) - .referentId(this.getReferentId()); + public String toString() { + return switch (this) { + case SERVICE -> ReferenceTrait.SERVICE; + case RESOURCE -> ReferenceTrait.RESOURCE; + }; } - /** Builder for {@link ReferenceTrait}. */ - public static final class Builder extends AbstractTraitBuilder { - private ReferentType referentType; - private ShapeId referentId; - - private Builder() {} - - @Override - public ReferenceTrait build() { - return new ReferenceTrait(this); - } + public static ReferentType fromString(String referentTypeStr) { + return switch (referentTypeStr) { + case ReferenceTrait.SERVICE -> SERVICE; + case ReferenceTrait.RESOURCE -> RESOURCE; + default -> throw new UnsupportedOperationException(); + }; + } + } + + @Override + protected Node createNode() { + return Node + .objectNodeBuilder() + .sourceLocation(getSourceLocation()) + .withMember(this.referentType.toString(), this.referentId.toString()) + .build(); + } + + @Override + public SmithyBuilder toBuilder() { + return builder() + .sourceLocation(getSourceLocation()) + .referentType(this.getReferentType()) + .referentId(this.getReferentId()); + } + + /** Builder for {@link ReferenceTrait}. */ + public static final class Builder + extends AbstractTraitBuilder { + + private ReferentType referentType; + private ShapeId referentId; + + private Builder() {} - public Builder referentType(ReferentType referentType) { - this.referentType = referentType; - return this; - } + @Override + public ReferenceTrait build() { + return new ReferenceTrait(this); + } - public Builder referentId(ShapeId referentId) { - this.referentId = referentId; - return this; - } + public Builder referentType(ReferentType referentType) { + this.referentType = referentType; + return this; } - public static Shape getDefinition() { - final Trait referenceTraitDefinition = TraitDefinition.builder() - .selector(Selector.parse("structure")) - .build(); - return StructureShape.builder() - .id(ReferenceTrait.ID) - .addTrait(referenceTraitDefinition) - .addMember("service", ShapeId.from("smithy.api#String")) - .addMember("resource", ShapeId.from("smithy.api#String")) - .build(); + public Builder referentId(ShapeId referentId) { + this.referentId = referentId; + return this; } + } + + public static Shape getDefinition() { + final Trait referenceTraitDefinition = TraitDefinition + .builder() + .selector(Selector.parse("structure")) + .build(); + return StructureShape + .builder() + .id(ReferenceTrait.ID) + .addTrait(referenceTraitDefinition) + .addMember("service", ShapeId.from("smithy.api#String")) + .addMember("resource", ShapeId.from("smithy.api#String")) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/AwsSdkNameResolverHelpers.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/AwsSdkNameResolverHelpers.java index 1c15fddb49..34573e01f1 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/AwsSdkNameResolverHelpers.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/AwsSdkNameResolverHelpers.java @@ -13,33 +13,42 @@ * Static Methods for generating/naming AWS SDK shapes */ public class AwsSdkNameResolverHelpers { - public static String namespaceForService(final String awsServiceName) { - return "com.amazonaws.%s".formatted(awsServiceName); - } - - // TODO: similar smarts to capitalize known words ala DotNetNameResolver.capitalizeNamespaceSegment - // See https://smithy.io/2.0/aws/aws-core.html#using-sdk-service-id-for-client-naming - public static String mungeSdkId(String sdkId) { - return StringUtils.capitalize(sdkId.replace(" ", "")); - } - - // TODO Accept a Shape and check if it is in the closure - // of a service with the @aws.api#service trait instead - public static boolean isInAwsSdkNamespace(ShapeId shapeId) { - return shapeId.getNamespace().startsWith("com.amazonaws."); - } - - // TODO: This should be 100% derived from the service name, - // (determined by the shape name or the aws.api#service$sdkId value) - // so I belive we should be able to drop this method. - public static String awsServiceNameFromShape(final Shape shape) { - String[] namespaceParts = shape.getId().getNamespace().split("\\."); - return namespaceParts[namespaceParts.length - 1]; - } - - public static ServiceShape getAwsServiceShape(final Model model, final ShapeId shapeId) { - if (!isInAwsSdkNamespace(shapeId)) throw new IllegalStateException("Shape is not in an AWS SKD namespace:" + shapeId.getName() + ", " + shapeId.getNamespace()); - - return ModelUtils.serviceFromNamespace(model, shapeId.getNamespace()); - } + + public static String namespaceForService(final String awsServiceName) { + return "com.amazonaws.%s".formatted(awsServiceName); + } + + // TODO: similar smarts to capitalize known words ala DotNetNameResolver.capitalizeNamespaceSegment + // See https://smithy.io/2.0/aws/aws-core.html#using-sdk-service-id-for-client-naming + public static String mungeSdkId(String sdkId) { + return StringUtils.capitalize(sdkId.replace(" ", "")); + } + + // TODO Accept a Shape and check if it is in the closure + // of a service with the @aws.api#service trait instead + public static boolean isInAwsSdkNamespace(ShapeId shapeId) { + return shapeId.getNamespace().startsWith("com.amazonaws."); + } + + // TODO: This should be 100% derived from the service name, + // (determined by the shape name or the aws.api#service$sdkId value) + // so I belive we should be able to drop this method. + public static String awsServiceNameFromShape(final Shape shape) { + String[] namespaceParts = shape.getId().getNamespace().split("\\."); + return namespaceParts[namespaceParts.length - 1]; + } + + public static ServiceShape getAwsServiceShape( + final Model model, + final ShapeId shapeId + ) { + if (!isInAwsSdkNamespace(shapeId)) throw new IllegalStateException( + "Shape is not in an AWS SKD namespace:" + + shapeId.getName() + + ", " + + shapeId.getNamespace() + ); + + return ModelUtils.serviceFromNamespace(model, shapeId.getNamespace()); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ConstrainTraitUtils.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ConstrainTraitUtils.java index f4ea8e1059..0ca2c57742 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ConstrainTraitUtils.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ConstrainTraitUtils.java @@ -3,7 +3,6 @@ package software.amazon.polymorph.utils; import java.math.BigDecimal; - import software.amazon.smithy.model.shapes.Shape; import software.amazon.smithy.model.traits.LengthTrait; import software.amazon.smithy.model.traits.RangeTrait; @@ -12,73 +11,85 @@ // TODO: Support idRef, pattern, uniqueItems public class ConstrainTraitUtils { - public static boolean hasRequiredTrait(Shape shape) { return shape.hasTrait(RequiredTrait.class); } + public static boolean hasRequiredTrait(Shape shape) { + return shape.hasTrait(RequiredTrait.class); + } - public static boolean hasRangeTrait(Shape shape) { return shape.hasTrait(RangeTrait.class); } + public static boolean hasRangeTrait(Shape shape) { + return shape.hasTrait(RangeTrait.class); + } - public static boolean hasLengthTrait(Shape shape) { return shape.hasTrait(LengthTrait.class); } + public static boolean hasLengthTrait(Shape shape) { + return shape.hasTrait(LengthTrait.class); + } - public static boolean hasConstraintTrait(Shape shape) { - return hasRequiredTrait(shape) || hasRangeTrait(shape) || hasLengthTrait(shape); - } + public static boolean hasConstraintTrait(Shape shape) { + return ( + hasRequiredTrait(shape) || hasRangeTrait(shape) || hasLengthTrait(shape) + ); + } - public static class RangeTraitUtils { - /** Return the trait's min as an accurate string representation - * that can be written in code */ - public static String minAsShapeType(Shape shape, RangeTrait trait) { - if (trait.getMin().isEmpty()) { - throw new IllegalArgumentException("RangeTrait has no min."); - } - return asShapeType(shape, trait.getMin().get()); - } + public static class RangeTraitUtils { - /** Return the trait's max as an accurate string representation - * that can be written in code */ - public static String maxAsShapeType(Shape shape, RangeTrait trait) { - if (trait.getMax().isEmpty()) { - throw new IllegalArgumentException("RangeTrait has no max."); - } - return asShapeType(shape, trait.getMax().get()); - } + /** Return the trait's min as an accurate string representation + * that can be written in code */ + public static String minAsShapeType(Shape shape, RangeTrait trait) { + if (trait.getMin().isEmpty()) { + throw new IllegalArgumentException("RangeTrait has no min."); + } + return asShapeType(shape, trait.getMin().get()); + } - // TODO: Only INTEGER has been tested - private static String asShapeType(Shape shape, BigDecimal value) { - return switch (shape.getType()) { - case BYTE -> "%d".formatted(value.byteValue()); - case SHORT -> "%d".formatted(value.shortValue()); - case INTEGER -> "%d".formatted(value.intValue()); - case LONG -> "%d".formatted(value.longValue()); - case BIG_INTEGER -> "%d".formatted(value.toBigInteger()); - case FLOAT -> "%g".formatted(value.floatValue()); - case DOUBLE -> "%g".formatted(value.doubleValue()); - case BIG_DECIMAL -> "%g".formatted(value); - case MEMBER -> throw new IllegalArgumentException( - """ - RangeTrait's are not defined on MemberShapes but on their target. - The target MUST be looked up with the model. - See software.amazon.polymorph.smithyjava.PolymorphFieldSpec.getTargetShape. - """ - ); - default -> throw new IllegalArgumentException( - "RangeTrait cannot apply to shape of type `%s`".formatted(shape.getType()) - ); - }; - } + /** Return the trait's max as an accurate string representation + * that can be written in code */ + public static String maxAsShapeType(Shape shape, RangeTrait trait) { + if (trait.getMax().isEmpty()) { + throw new IllegalArgumentException("RangeTrait has no max."); + } + return asShapeType(shape, trait.getMax().get()); } - public static class LengthTraitUtils { - public static String min(LengthTrait trait) { - if (trait.getMin().isEmpty()) { - throw new IllegalArgumentException("Trait has no min."); - } - return "%d".formatted(trait.getMin().get()); - } + // TODO: Only INTEGER has been tested + private static String asShapeType(Shape shape, BigDecimal value) { + return switch (shape.getType()) { + case BYTE -> "%d".formatted(value.byteValue()); + case SHORT -> "%d".formatted(value.shortValue()); + case INTEGER -> "%d".formatted(value.intValue()); + case LONG -> "%d".formatted(value.longValue()); + case BIG_INTEGER -> "%d".formatted(value.toBigInteger()); + case FLOAT -> "%g".formatted(value.floatValue()); + case DOUBLE -> "%g".formatted(value.doubleValue()); + case BIG_DECIMAL -> "%g".formatted(value); + case MEMBER -> throw new IllegalArgumentException( + """ + RangeTrait's are not defined on MemberShapes but on their target. + The target MUST be looked up with the model. + See software.amazon.polymorph.smithyjava.PolymorphFieldSpec.getTargetShape. + """ + ); + default -> throw new IllegalArgumentException( + "RangeTrait cannot apply to shape of type `%s`".formatted( + shape.getType() + ) + ); + }; + } + } + + public static class LengthTraitUtils { + + public static String min(LengthTrait trait) { + if (trait.getMin().isEmpty()) { + throw new IllegalArgumentException("Trait has no min."); + } + return "%d".formatted(trait.getMin().get()); + } - public static String max(LengthTrait trait) { - if (trait.getMax().isEmpty()) { - throw new IllegalArgumentException("Trait has no max."); - } - return "%d".formatted(trait.getMax().get()); - } + public static String max(LengthTrait trait) { + if (trait.getMax().isEmpty()) { + throw new IllegalArgumentException("Trait has no max."); + } + return "%d".formatted(trait.getMax().get()); } + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/DafnyNameResolverHelpers.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/DafnyNameResolverHelpers.java index 1daa26da2e..d16b2e3cb8 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/DafnyNameResolverHelpers.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/DafnyNameResolverHelpers.java @@ -10,36 +10,40 @@ */ public class DafnyNameResolverHelpers { - /** - * Returns the Dafny {@code {:extern}} namespace corresponding to the given shape ID, - * assuming it was generated into a "Types" module. - */ - public static String dafnyExternNamespaceForShapeId(final ShapeId shapeId) { - return DafnyNameResolver.dafnyTypesModuleExternNamespace(shapeId.getNamespace()); - } + /** + * Returns the Dafny {@code {:extern}} namespace corresponding to the given shape ID, + * assuming it was generated into a "Types" module. + */ + public static String dafnyExternNamespaceForShapeId(final ShapeId shapeId) { + return DafnyNameResolver.dafnyTypesModuleExternNamespace( + shapeId.getNamespace() + ); + } - /** - * Returns the Dafny {@code {:extern}} namespace corresponding to the given namespace, - * assuming it was generated into a "Types" module. - */ - public static String dafnyExternNamespaceForNamespace(final String namespace) { - return DafnyNameResolver.dafnyTypesModuleExternNamespace(namespace); - } + /** + * Returns the Dafny {@code {:extern}} namespace corresponding to the given namespace, + * assuming it was generated into a "Types" module. + */ + public static String dafnyExternNamespaceForNamespace( + final String namespace + ) { + return DafnyNameResolver.dafnyTypesModuleExternNamespace(namespace); + } - /** - * Returns the Dafny {@code {:extern}} namespace corresponding to the namespace, - * but NOT the Types module. - */ - public static String packageNameForNamespace(final String namespace) { - return DafnyNameResolver.dafnyExternNamespace(namespace); - } + /** + * Returns the Dafny {@code {:extern}} namespace corresponding to the namespace, + * but NOT the Types module. + */ + public static String packageNameForNamespace(final String namespace) { + return DafnyNameResolver.dafnyExternNamespace(namespace); + } - /** @return The __default for a namespace.*/ - public static String defaultForNamespace(final String namespace){ - return packageNameForNamespace(namespace) + ".__default"; - } + /** @return The __default for a namespace.*/ + public static String defaultForNamespace(final String namespace) { + return packageNameForNamespace(namespace) + ".__default"; + } - public static String dafnyCompilesExtra_(final String name) { - return name.replace("_", "__"); - } + public static String dafnyCompilesExtra_(final String name) { + return name.replace("_", "__"); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/IOUtils.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/IOUtils.java index b3b58b4bd8..b1db4cb8b6 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/IOUtils.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/IOUtils.java @@ -3,54 +3,63 @@ package software.amazon.polymorph.utils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class IOUtils { - private static final Logger LOGGER = LoggerFactory.getLogger(IOUtils.class); - - public static void writeToFile(final String text, final File file) { - try { - final FileWriter fileWriter = new FileWriter(file); - fileWriter.write(text); - if (!text.endsWith("\n")) { - fileWriter.write("\n"); - } - fileWriter.close(); - } catch (IOException e) { - LOGGER.error("Could not write to file {}", file); - e.printStackTrace(); - } + + private static final Logger LOGGER = LoggerFactory.getLogger(IOUtils.class); + + public static void writeToFile(final String text, final File file) { + try { + final FileWriter fileWriter = new FileWriter(file); + fileWriter.write(text); + if (!text.endsWith("\n")) { + fileWriter.write("\n"); + } + fileWriter.close(); + } catch (IOException e) { + LOGGER.error("Could not write to file {}", file); + e.printStackTrace(); } + } + + private static final String COPYRIGHT_HEADER = + """ + // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + // SPDX-License-Identifier: Apache-2.0 + """; + + private static final String GENERATED_HEADER = + """ + // Do not modify this file. This file is machine generated, and any changes to it will be overwritten. + """; - private static final String COPYRIGHT_HEADER = """ - // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. - // SPDX-License-Identifier: Apache-2.0 - """; - - private static final String GENERATED_HEADER = """ - // Do not modify this file. This file is machine generated, and any changes to it will be overwritten. - """; - - public static void writeTokenTreesIntoDir(final Map tokenTreeMap, final Path outputDir) { - for (Map.Entry entry : tokenTreeMap.entrySet()) { - Path localPath = entry.getKey(); - TokenTree tokens = entry.getValue(); - final Path outputPath = Path.of(outputDir.toString(), localPath.toString()); - try { - Files.createDirectories(outputPath.getParent()); - final String content = COPYRIGHT_HEADER + GENERATED_HEADER + tokens.toString(); - writeToFile(content, outputPath.toFile()); - } catch (IOException e) { - e.printStackTrace(); - } - } + public static void writeTokenTreesIntoDir( + final Map tokenTreeMap, + final Path outputDir + ) { + for (Map.Entry entry : tokenTreeMap.entrySet()) { + Path localPath = entry.getKey(); + TokenTree tokens = entry.getValue(); + final Path outputPath = Path.of( + outputDir.toString(), + localPath.toString() + ); + try { + Files.createDirectories(outputPath.getParent()); + final String content = + COPYRIGHT_HEADER + GENERATED_HEADER + tokens.toString(); + writeToFile(content, outputPath.toFile()); + } catch (IOException e) { + e.printStackTrace(); + } } + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java index f3b688d187..f1a7008ce1 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/ModelUtils.java @@ -3,11 +3,12 @@ package software.amazon.polymorph.utils; +import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SMITHY_API_UNIT; + import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; - import org.slf4j.LoggerFactory; import software.amazon.polymorph.traits.ClientConfigTrait; import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; @@ -17,7 +18,6 @@ import software.amazon.polymorph.traits.MutableLocalStateTrait; import software.amazon.polymorph.traits.PositionalTrait; import software.amazon.polymorph.traits.ReferenceTrait; - import software.amazon.smithy.model.Model; import software.amazon.smithy.model.loader.ModelAssembler; import software.amazon.smithy.model.shapes.*; @@ -27,369 +27,470 @@ import software.amazon.smithy.model.transform.ModelTransformer; import software.amazon.smithy.utils.StringUtils; -import static software.amazon.polymorph.smithyjava.nameresolver.Constants.SMITHY_API_UNIT; - public class ModelUtils { - // Require title-case alphanumeric names, so we don't need to check for keyword conflicts. - // - // The spec recommends a similar stricter definition for consistency (uppercase instead of title-case): - // https://smithy.io/1.0/spec/core/constraint-traits.html?highlight=enum#enum-trait - private static final Pattern ENUM_NAME_PATTERN = Pattern.compile("^[A-Z]+[A-Za-z_0-9]*$"); - - /** - * Adds our custom traits (and their definitions) to a {@link ModelAssembler}. - *

- * Note that this only needs to be called if the model file(s) being processed do not define these traits - * (for example, in unit tests). If the model file does define the traits, adding them again does nothing. - */ - public static void addCustomTraitsToModelAssembler(final ModelAssembler assembler) { - assembler.addShape(ReferenceTrait.getDefinition()); - assembler.addShape(PositionalTrait.getDefinition()); - assembler.addShape(ClientConfigTrait.getDefinition()); - assembler.addShape(DafnyUtf8BytesTrait.getDefinition()); - assembler.addShape(ExtendableTrait.getDefinition()); - LocalServiceTrait.getDefinitions().forEach(assembler::addShape); - assembler.addShape(MutableLocalStateTrait.getDefinition()); - assembler.addShape(JavaDocTrait.getDefinition()); - } - /** - * @return a stream of members of the given structure shape - */ - public static Stream streamStructureMembers(final StructureShape structureShape) { - return structureShape.getAllMembers().values().stream(); + // Require title-case alphanumeric names, so we don't need to check for keyword conflicts. + // + // The spec recommends a similar stricter definition for consistency (uppercase instead of title-case): + // https://smithy.io/1.0/spec/core/constraint-traits.html?highlight=enum#enum-trait + private static final Pattern ENUM_NAME_PATTERN = Pattern.compile( + "^[A-Z]+[A-Za-z_0-9]*$" + ); + + /** + * Adds our custom traits (and their definitions) to a {@link ModelAssembler}. + *

+ * Note that this only needs to be called if the model file(s) being processed do not define these traits + * (for example, in unit tests). If the model file does define the traits, adding them again does nothing. + */ + public static void addCustomTraitsToModelAssembler( + final ModelAssembler assembler + ) { + assembler.addShape(ReferenceTrait.getDefinition()); + assembler.addShape(PositionalTrait.getDefinition()); + assembler.addShape(ClientConfigTrait.getDefinition()); + assembler.addShape(DafnyUtf8BytesTrait.getDefinition()); + assembler.addShape(ExtendableTrait.getDefinition()); + LocalServiceTrait.getDefinitions().forEach(assembler::addShape); + assembler.addShape(MutableLocalStateTrait.getDefinition()); + assembler.addShape(JavaDocTrait.getDefinition()); + } + + /** + * @return a stream of members of the given structure shape + */ + public static Stream streamStructureMembers( + final StructureShape structureShape + ) { + return structureShape.getAllMembers().values().stream(); + } + + public static Stream streamUnionMembers( + final UnionShape unionShape + ) { + return unionShape.getAllMembers().values().stream(); + } + + /** + * @return a stream of error structures in the given service shape + */ + public static Stream streamServiceErrors( + final Model model, + final ServiceShape serviceShape + ) { + return streamNamespaceErrors(model, serviceShape.getId().getNamespace()); + } + + /** + * @return a stream of error structures in the given namespace + */ + public static Stream streamNamespaceErrors( + final Model model, + final String namespace + ) { + // Collect into TreeSet so that we generate code in a deterministic order (lexicographic, in particular) + return new TreeSet<>(model.getStructureShapesWithTrait(ErrorTrait.class)) + .stream() + .filter(structureShape -> + structureShape.getId().getNamespace().equals(namespace) + ); + } + + /** + * @return true if the given shape ID is in the given service's namespace + */ + public static boolean isInServiceNamespace( + final ShapeId shapeId, + final ServiceShape serviceShape + ) { + return shapeId.getNamespace().equals(serviceShape.getId().getNamespace()); + } + + /** + * Returns the sole member of the given positional structure shape, or {@link Optional#empty()} if the given shape + * isn't a positional structure. + */ + public static Optional getPositionalStructureMember( + final Shape shape + ) { + if (!shape.hasTrait(PositionalTrait.class)) { + return Optional.empty(); } - public static Stream streamUnionMembers(final UnionShape unionShape) { - return unionShape.getAllMembers().values().stream(); + if (shape.members().size() != 1) { + // For now, we only intend this trait to be used for operation returns, so we therefore only allow one + // member. Eventually if we also want to use this to unwrap operation inputs (or any more general + // unwrapping) we'll need to relax this constraint. + throw new IllegalStateException( + "Structures marked with '@positional' must have exactly one member" + ); } - /** - * @return a stream of error structures in the given service shape - */ - public static Stream streamServiceErrors(final Model model, final ServiceShape serviceShape) { - return streamNamespaceErrors(model, serviceShape.getId().getNamespace()); + //noinspection OptionalGetWithoutIsPresent + final MemberShape memberShape = shape.members().stream().findFirst().get(); + return Optional.of(memberShape.getId()); + } + + public static boolean memberShapeIsOptional( + final Model model, + final MemberShape memberShape + ) { + final Shape containerShape = model.expectShape(memberShape.getContainer()); + return ( + containerShape.isStructureShape() && + !containerShape.hasTrait(PositionalTrait.class) && + !memberShape.isRequired() + ); + } + + /** + * Returns true if the given shape ID is in the {@code smithy.api} namespace, or false otherwise. + */ + public static boolean isSmithyApiShape(final ShapeId shapeId) { + return shapeId.getNamespace().equals("smithy.api"); + } + + public static boolean isValidEnumDefinitionName(final String name) { + return ENUM_NAME_PATTERN.matcher(name).matches(); + } + + /** + * Like {@link ModelUtils#validateErrorStructureMessageNotRequired(StructureShape)}, but with the + * added constraint that the {@code message} member must have the {@code @required} trait applied. + */ + public static void validateErrorStructureMessageRequired( + final StructureShape structureShape + ) { + validateErrorStructureMessageNotRequired(structureShape); + + boolean messageRequired = structureShape + .getMember("message") + .filter(member -> member.hasTrait(RequiredTrait.class)) + .isPresent(); + if (!messageRequired) { + throw new IllegalArgumentException( + "The 'message' member of %s must be @required".formatted( + structureShape.getId() + ) + ); } - - /** - * @return a stream of error structures in the given namespace - */ - public static Stream streamNamespaceErrors(final Model model, final String namespace) { - // Collect into TreeSet so that we generate code in a deterministic order (lexicographic, in particular) - return new TreeSet<>(model.getStructureShapesWithTrait(ErrorTrait.class)) - .stream() - .filter(structureShape -> structureShape.getId().getNamespace().equals(namespace)); + } + + /** + * @return the service in a given namespace + */ + public static ServiceShape serviceFromNamespace( + final Model model, + final String namespace + ) { + final ServiceShape[] tmp = model + .getServiceShapes() + .stream() + .filter(s -> s.toShapeId().getNamespace().equals(namespace)) + .toArray(ServiceShape[]::new); + + if (tmp.length != 1) { + throw new IllegalStateException( + "Found " + + tmp.length + + " services matching " + + namespace + + ", need exactly one" + ); } - /** - * @return true if the given shape ID is in the given service's namespace - */ - public static boolean isInServiceNamespace(final ShapeId shapeId, final ServiceShape serviceShape) { - return shapeId.getNamespace().equals(serviceShape.getId().getNamespace()); + return tmp[0]; + } + + /** + * Throws {@link IllegalArgumentException} unless the given structure shape satisfies code-generation constraints: + *

    + *
  • The structure must have the {@code @error} trait applied
  • + *
  • The structure must have a {@code message} member
  • + *
  • The structure must not have any members except {@code message}
  • + *
+ */ + public static void validateErrorStructureMessageNotRequired( + final StructureShape structureShape + ) { + if (!structureShape.hasTrait(ErrorTrait.class)) { + throw new IllegalArgumentException( + "%s is not an @error structure".formatted(structureShape.getId()) + ); } - /** - * Returns the sole member of the given positional structure shape, or {@link Optional#empty()} if the given shape - * isn't a positional structure. - */ - public static Optional getPositionalStructureMember(final Shape shape) { - if (!shape.hasTrait(PositionalTrait.class)) { - return Optional.empty(); - } - - if (shape.members().size() != 1) { - // For now, we only intend this trait to be used for operation returns, so we therefore only allow one - // member. Eventually if we also want to use this to unwrap operation inputs (or any more general - // unwrapping) we'll need to relax this constraint. - throw new IllegalStateException("Structures marked with '@positional' must have exactly one member"); - } - - //noinspection OptionalGetWithoutIsPresent - final MemberShape memberShape = shape.members() - .stream() - .findFirst() - .get(); - return Optional.of(memberShape.getId()); + boolean hasMessage = structureShape.getMember("message").isPresent(); + if (!hasMessage) { + throw new IllegalArgumentException( + "Error structure %s is missing a 'message' member".formatted( + structureShape.getId() + ) + ); } - public static boolean memberShapeIsOptional(final Model model, final MemberShape memberShape) { - final Shape containerShape = model.expectShape(memberShape.getContainer()); - return containerShape.isStructureShape() - && !containerShape.hasTrait(PositionalTrait.class) - && !memberShape.isRequired(); + // TODO support other members + if (structureShape.getMemberNames().size() > 1) { + throw new IllegalArgumentException( + "Error structure %s cannot have members other than 'message'".formatted( + structureShape.getId() + ) + ); } - - /** - * Returns true if the given shape ID is in the {@code smithy.api} namespace, or false otherwise. - */ - public static boolean isSmithyApiShape(final ShapeId shapeId) { - return shapeId.getNamespace().equals("smithy.api"); - } - - public static boolean isValidEnumDefinitionName(final String name) { - return ENUM_NAME_PATTERN.matcher(name).matches(); + } + + private static final Pattern TRAILING_FACTORY_PATTERN = Pattern.compile( + "Factory$" + ); + + /** + * If the given string ends with "Factory" and has at least one character prior, returns a copy of the string + * without the trailing "Factory". Otherwise, returns a copy of the string with no modifications. + */ + private static String stripTrailingFactory(final CharSequence s) { + return TRAILING_FACTORY_PATTERN + .matcher(s) + // exclude the first char + .region(1, s.length()) + .replaceFirst(""); + } + + /** + * Returns the given service's name without the trailing "Factory", if it exists; otherwise returns the service's + * name unmodified. + */ + public static String serviceNameWithoutTrailingFactory( + final ServiceShape serviceShape + ) { + return stripTrailingFactory(serviceShape.getId().getName()); + } + + public static boolean isSmithyApiOrSimpleShape(Shape shape) { + // Special Enum case + if (shape.hasTrait(EnumTrait.class)) { + return false; } - - /** - * Like {@link ModelUtils#validateErrorStructureMessageNotRequired(StructureShape)}, but with the - * added constraint that the {@code message} member must have the {@code @required} trait applied. - */ - public static void validateErrorStructureMessageRequired(final StructureShape structureShape) { - validateErrorStructureMessageNotRequired(structureShape); - - boolean messageRequired = structureShape.getMember("message") - .filter(member -> member.hasTrait(RequiredTrait.class)).isPresent(); - if (!messageRequired) { - throw new IllegalArgumentException("The 'message' member of %s must be @required" - .formatted(structureShape.getId())); - } + if (isSmithyApiShape(shape.getId())) { + return true; } - - /** - * @return the service in a given namespace - */ - public static ServiceShape serviceFromNamespace(final Model model, final String namespace) { - final ServiceShape[] tmp = model - .getServiceShapes() - .stream() - .filter(s -> s.toShapeId().getNamespace().equals(namespace)) - .toArray(ServiceShape[]::new); - - if (tmp.length != 1) { - throw new IllegalStateException("Found " + tmp.length + " services matching " + namespace + ", need exactly one"); - } - - return tmp[0]; + return shape.getType().getCategory().equals(ShapeType.Category.SIMPLE); + } + + /** + * For every ShapeId in {@code initialShapes}, + * with the given {@code model}, + * find all the member shapes with @reference traits that ShapeId depends on. + */ + public static Set findAllDependentMemberReferenceShapes( + Set initialShapeIds, + Model model + ) { + Set dependentShapes = findAllDependentShapes( + initialShapeIds, + model + ); + return dependentShapes + .stream() + .map(shapeId -> model.expectShape(shapeId, Shape.class)) + .filter(shape -> shape.asMemberShape().isPresent()) + .map(shape -> shape.asMemberShape().get()) + .filter(shape -> + model + .expectShape(shape.getTarget(), Shape.class) + .hasTrait(ReferenceTrait.class) + ) + .collect(Collectors.toSet()); + } + + public static Set findAllDependentNamespaces( + Set initialShapeIds, + Model model + ) { + // Set of all namespaces from all initialShapeIds + Set initialNamespaces = initialShapeIds + .stream() + .map(ShapeId::getNamespace) + .collect(Collectors.toSet()); + + Set dependentShapeIds = findAllDependentShapes( + initialShapeIds, + model + ); + + // Set of all namespaces in dependentShapeIds that are not in initialNamespaces + return dependentShapeIds + .stream() + .map(ShapeId::getNamespace) + .filter(namespace -> !initialNamespaces.contains(namespace)) + // smithy.api is technically a dependent namespace, as models depend on Smithy API. + // However, we are not interested in it as a dependent namespace for our purposes. + .filter(namespace -> !namespace.equals("smithy.api")) + .collect(Collectors.toSet()); + } + + /** + * For every ShapeId in {@code initialShapes}, + * with the given {@code model}, + * find all the shapes that ShapeId depends on. + */ + public static Set findAllDependentShapes( + Set initialShapeIds, + Model model + ) { + final Set shapes = new LinkedHashSet<>(); + // Breadth-first search via getDependencyShapeIds + final Queue toTraverse = new LinkedList<>(initialShapeIds); + while (!toTraverse.isEmpty()) { + final ShapeId currentShapeId = toTraverse.remove(); + if (shapes.add(currentShapeId)) { + final Shape currentShape = model.expectShape(currentShapeId); + getDependencyShapeIds(currentShape).forEach(toTraverse::add); + } } - - /** - * Throws {@link IllegalArgumentException} unless the given structure shape satisfies code-generation constraints: - *
    - *
  • The structure must have the {@code @error} trait applied
  • - *
  • The structure must have a {@code message} member
  • - *
  • The structure must not have any members except {@code message}
  • - *
- */ - public static void validateErrorStructureMessageNotRequired(final StructureShape structureShape) { - if (!structureShape.hasTrait(ErrorTrait.class)) { - throw new IllegalArgumentException("%s is not an @error structure".formatted(structureShape.getId())); + return shapes; + } + + /** + * For every ShapeId in {@code initialShapes}, + * with the given {@code model}, + * return a list of shape IDs where: + * - The first element is the initial shape ID + * - The last element is the shape ID of a reference shape + * - Intermediate elements are a path of shapes from the first to the last shape ID + * such that l[i] is a dependent shape of l[i-1]. + */ + public static Set< + List + > findAllDependentMemberReferenceShapesWithPaths( + Set initialShapeIds, + Model model + ) { + Set> outList = new LinkedHashSet<>(new ArrayList<>()); + + Set> dependentShapesWithPaths = + findAllDependentShapesWithPaths(initialShapeIds, model); + for (List dependentShapeWithPath : dependentShapesWithPaths) { + ShapeId finalDependentShapeId = dependentShapeWithPath.get( + dependentShapeWithPath.size() - 1 + ); + Shape finalDependentShape = model.expectShape( + finalDependentShapeId, + Shape.class + ); + if (finalDependentShape.asMemberShape().isPresent()) { + MemberShape finalDependentShapeAsMember = finalDependentShape + .asMemberShape() + .get(); + if ( + model + .expectShape(finalDependentShapeAsMember.getTarget(), Shape.class) + .hasTrait(ReferenceTrait.class) + ) { + outList.add(dependentShapeWithPath); } - - boolean hasMessage = structureShape.getMember("message").isPresent(); - if (!hasMessage) { - throw new IllegalArgumentException("Error structure %s is missing a 'message' member" - .formatted(structureShape.getId())); - } - - // TODO support other members - if (structureShape.getMemberNames().size() > 1) { - throw new IllegalArgumentException("Error structure %s cannot have members other than 'message'" - .formatted(structureShape.getId())); - } - } - - private static final Pattern TRAILING_FACTORY_PATTERN = Pattern.compile("Factory$"); - - /** - * If the given string ends with "Factory" and has at least one character prior, returns a copy of the string - * without the trailing "Factory". Otherwise, returns a copy of the string with no modifications. - */ - private static String stripTrailingFactory(final CharSequence s) { - return TRAILING_FACTORY_PATTERN.matcher(s) - // exclude the first char - .region(1, s.length()) - .replaceFirst(""); + } } - /** - * Returns the given service's name without the trailing "Factory", if it exists; otherwise returns the service's - * name unmodified. - */ - public static String serviceNameWithoutTrailingFactory(final ServiceShape serviceShape) { - return stripTrailingFactory(serviceShape.getId().getName()); - } - - public static boolean isSmithyApiOrSimpleShape(Shape shape) { - // Special Enum case - if (shape.hasTrait(EnumTrait.class)) { return false; } - if (isSmithyApiShape(shape.getId())) { return true; } - return shape.getType().getCategory().equals(ShapeType.Category.SIMPLE); - } - - /** - * For every ShapeId in {@code initialShapes}, - * with the given {@code model}, - * find all the member shapes with @reference traits that ShapeId depends on. - */ - public static Set findAllDependentMemberReferenceShapes( - Set initialShapeIds, - Model model - ) { - Set dependentShapes = findAllDependentShapes(initialShapeIds, model); - return dependentShapes.stream() - .map(shapeId -> model.expectShape(shapeId, Shape.class)) - .filter(shape -> shape.asMemberShape().isPresent()) - .map(shape -> shape.asMemberShape().get()) - .filter(shape -> model.expectShape(shape.getTarget(), Shape.class).hasTrait(ReferenceTrait.class)) - .collect(Collectors.toSet()); + return outList; + } + + /** + * For every ShapeId in {@code initialShapes}, + * with the given {@code model}, + * return a list of shape IDs where: + * - The first element is the initial shape ID + * - The last element is the shape ID of a reference shape + * - Intermediate elements are a path of shapes from the first to the last shape ID + */ + public static Set> findAllDependentShapesWithPaths( + Set initialShapeIds, + Model model + ) { + Set> initialShapeIdsAsPaths = initialShapeIds + .stream() + .map(Collections::singletonList) + .collect(Collectors.toSet()); + Set> pathsToShapes = new LinkedHashSet<>( + new LinkedHashSet<>() + ); + Set visited = new HashSet<>(); + + // Breadth-first search via getDependencyShapeIds + final Queue> toTraverse = new LinkedList<>( + initialShapeIdsAsPaths + ); + while (!toTraverse.isEmpty()) { + final List currentShapeIdWithPath = toTraverse.remove(); + + // to avoid cycles, only keep the first list with a given last element + ShapeId last = currentShapeIdWithPath.get( + currentShapeIdWithPath.size() - 1 + ); + if (visited.add(last) && pathsToShapes.add(currentShapeIdWithPath)) { + final Shape currentShape = model.expectShape( + currentShapeIdWithPath.get(currentShapeIdWithPath.size() - 1) + ); + final List> dependencyShapeIdsWithPaths = + getDependencyShapeIds(currentShape) + .map(dependencyShapeId -> + Stream + .concat( + currentShapeIdWithPath.stream(), + Stream.of(dependencyShapeId) + ) + .toList() + ) + .toList(); + dependencyShapeIdsWithPaths.forEach(toTraverse::add); + } } - - public static Set findAllDependentNamespaces( - Set initialShapeIds, - Model model - ) { - // Set of all namespaces from all initialShapeIds - Set initialNamespaces = initialShapeIds.stream() - .map(ShapeId::getNamespace) - .collect(Collectors.toSet()); - - Set dependentShapeIds = findAllDependentShapes(initialShapeIds, model); - - // Set of all namespaces in dependentShapeIds that are not in initialNamespaces - return dependentShapeIds.stream() - .map(ShapeId::getNamespace) - .filter(namespace -> !initialNamespaces.contains(namespace)) - // smithy.api is technically a dependent namespace, as models depend on Smithy API. - // However, we are not interested in it as a dependent namespace for our purposes. - .filter(namespace -> !namespace.equals("smithy.api")) - .collect(Collectors.toSet()); - } - - /** - * For every ShapeId in {@code initialShapes}, - * with the given {@code model}, - * find all the shapes that ShapeId depends on. - */ - public static Set findAllDependentShapes( - Set initialShapeIds, - Model model - ) { - final Set shapes = new LinkedHashSet<>(); - // Breadth-first search via getDependencyShapeIds - final Queue toTraverse = new LinkedList<>(initialShapeIds); - while (!toTraverse.isEmpty()) { - final ShapeId currentShapeId = toTraverse.remove(); - if (shapes.add(currentShapeId)) { - final Shape currentShape = model.expectShape(currentShapeId); - getDependencyShapeIds(currentShape).forEach(toTraverse::add); - } - } - return shapes; - } - - - /** - * For every ShapeId in {@code initialShapes}, - * with the given {@code model}, - * return a list of shape IDs where: - * - The first element is the initial shape ID - * - The last element is the shape ID of a reference shape - * - Intermediate elements are a path of shapes from the first to the last shape ID - * such that l[i] is a dependent shape of l[i-1]. - */ - public static Set> findAllDependentMemberReferenceShapesWithPaths( - Set initialShapeIds, - Model model - ) { - Set> outList = new LinkedHashSet<>(new ArrayList<>()); - - Set> dependentShapesWithPaths = findAllDependentShapesWithPaths(initialShapeIds, model); - for (List dependentShapeWithPath : dependentShapesWithPaths) { - ShapeId finalDependentShapeId = dependentShapeWithPath.get( - dependentShapeWithPath.size() - 1); - Shape finalDependentShape = model.expectShape(finalDependentShapeId, Shape.class); - if (finalDependentShape.asMemberShape().isPresent()) { - MemberShape finalDependentShapeAsMember = finalDependentShape.asMemberShape().get(); - if (model.expectShape(finalDependentShapeAsMember.getTarget(), Shape.class) - .hasTrait(ReferenceTrait.class)) { - outList.add(dependentShapeWithPath); - } - } - } - - return outList; - } - - - /** - * For every ShapeId in {@code initialShapes}, - * with the given {@code model}, - * return a list of shape IDs where: - * - The first element is the initial shape ID - * - The last element is the shape ID of a reference shape - * - Intermediate elements are a path of shapes from the first to the last shape ID - */ - public static Set> findAllDependentShapesWithPaths( - Set initialShapeIds, - Model model - ) { - Set> initialShapeIdsAsPaths = initialShapeIds.stream() - .map(Collections::singletonList) - .collect(Collectors.toSet()); - Set> pathsToShapes = new LinkedHashSet<>(new LinkedHashSet<>()); - Set visited = new HashSet<>(); - - // Breadth-first search via getDependencyShapeIds - final Queue> toTraverse = new LinkedList<>(initialShapeIdsAsPaths); - while (!toTraverse.isEmpty()) { - final List currentShapeIdWithPath = toTraverse.remove(); - - // to avoid cycles, only keep the first list with a given last element - ShapeId last = currentShapeIdWithPath.get(currentShapeIdWithPath.size()-1); - if (visited.add(last) && pathsToShapes.add(currentShapeIdWithPath)) { - final Shape currentShape = model.expectShape(currentShapeIdWithPath.get( - currentShapeIdWithPath.size()-1)); - final List> dependencyShapeIdsWithPaths = getDependencyShapeIds(currentShape).map( - dependencyShapeId -> - Stream.concat( - currentShapeIdWithPath.stream(), - Stream.of(dependencyShapeId)) - .toList() - ).toList(); - dependencyShapeIdsWithPaths.forEach(toTraverse::add); - - } - } - return pathsToShapes; - } - - /** - * Returns dependency shape IDs for the given shape. - * A shape {@code S} has a dependency shape {@code D} if a type - * for {@code S} requires the existence of a type for {@code D}. - */ - @SuppressWarnings("OptionalGetWithoutIsPresent") - static Stream getDependencyShapeIds(final Shape shape) { - return switch (shape.getType()) { - case LIST -> Stream.of(shape.asListShape().get().getMember().getId()); - case SET -> Stream.of(shape.asSetShape().get().getMember().getId()); - case MAP -> { - final MapShape mapShape = shape.asMapShape().get(); - yield Stream.of(mapShape.getKey().getId(), mapShape.getValue().getId()); - } - case STRUCTURE -> streamStructureMembers(shape.asStructureShape().get()).map(Shape::getId); - case MEMBER -> Stream.of(shape.asMemberShape().get().getTarget()); - case UNION -> streamUnionMembers(shape.asUnionShape().get()).map(Shape::getId); - default -> Stream.empty(); - }; - } - - @SuppressWarnings("OptionalGetWithoutIsPresent") - static public boolean isListOrSetOfEnums(ShapeId shapeId, Model model) { - Shape shape = model.expectShape(shapeId); - return switch (shape.getType()) { - case LIST -> isEnum(shape.asListShape().get().getMember().getTarget(), model); - case SET -> isEnum(shape.asSetShape().get().getMember().getTarget(), model); - default -> false; - }; - } - - public static boolean isEnum(ShapeId shapeId, Model model) { - Shape shape = model.expectShape(shapeId); - return shape.hasTrait(EnumTrait.class); - } - - /* + return pathsToShapes; + } + + /** + * Returns dependency shape IDs for the given shape. + * A shape {@code S} has a dependency shape {@code D} if a type + * for {@code S} requires the existence of a type for {@code D}. + */ + @SuppressWarnings("OptionalGetWithoutIsPresent") + static Stream getDependencyShapeIds(final Shape shape) { + return switch (shape.getType()) { + case LIST -> Stream.of(shape.asListShape().get().getMember().getId()); + case SET -> Stream.of(shape.asSetShape().get().getMember().getId()); + case MAP -> { + final MapShape mapShape = shape.asMapShape().get(); + yield Stream.of(mapShape.getKey().getId(), mapShape.getValue().getId()); + } + case STRUCTURE -> streamStructureMembers(shape.asStructureShape().get()) + .map(Shape::getId); + case MEMBER -> Stream.of(shape.asMemberShape().get().getTarget()); + case UNION -> streamUnionMembers(shape.asUnionShape().get()) + .map(Shape::getId); + default -> Stream.empty(); + }; + } + + @SuppressWarnings("OptionalGetWithoutIsPresent") + public static boolean isListOrSetOfEnums(ShapeId shapeId, Model model) { + Shape shape = model.expectShape(shapeId); + return switch (shape.getType()) { + case LIST -> isEnum( + shape.asListShape().get().getMember().getTarget(), + model + ); + case SET -> isEnum( + shape.asSetShape().get().getMember().getTarget(), + model + ); + default -> false; + }; + } + + public static boolean isEnum(ShapeId shapeId, Model model) { + Shape shape = model.expectShape(shapeId); + return shape.hasTrait(EnumTrait.class); + } + + /* A reference type will point to a resource or service. Regardless of where this referent is the structure with the reference trait dictates @@ -403,67 +504,90 @@ public static boolean isEnum(ShapeId shapeId, Model model) { This is why the function check to see if the shapes has a reference trait, but then compares the shapes' namespace and not the referent shape. */ - public static Boolean isReferenceDependantModuleType(final Shape shape, final String namespace) { - if (shape.hasTrait(ReferenceTrait.class)) { - return !namespace.equalsIgnoreCase(shape.getId().getNamespace()); - } else { - return false; - } + public static Boolean isReferenceDependantModuleType( + final Shape shape, + final String namespace + ) { + if (shape.hasTrait(ReferenceTrait.class)) { + return !namespace.equalsIgnoreCase(shape.getId().getNamespace()); + } else { + return false; } - - public static ShapeId checkForPositional(ShapeId originalId, Model model) { - Shape originalShape = model.expectShape(originalId); - if (originalShape.hasTrait(PositionalTrait.class)) { - // Positional traits can only be on structures, - // asStructureShape cannot return an empty optional - //noinspection OptionalGetWithoutIsPresent - MemberShape onlyMember = PositionalTrait.onlyMember(originalShape.asStructureShape().get()); - return onlyMember.getTarget(); - } - return originalId; + } + + public static ShapeId checkForPositional(ShapeId originalId, Model model) { + Shape originalShape = model.expectShape(originalId); + if (originalShape.hasTrait(PositionalTrait.class)) { + // Positional traits can only be on structures, + // asStructureShape cannot return an empty optional + //noinspection OptionalGetWithoutIsPresent + MemberShape onlyMember = PositionalTrait.onlyMember( + originalShape.asStructureShape().get() + ); + return onlyMember.getTarget(); } - - /** - * @param shapeId ShapeId that might have positional or reference trait - * @return Fully de-referenced shapeId and naive shapeId as a ResolvedShapeId - */ - public static ResolvedShapeId resolveShape(ShapeId shapeId, Model model) { - if (shapeId.equals(SMITHY_API_UNIT)) { - return new ResolvedShapeId(shapeId, shapeId); - } - ShapeId notPositionalId = checkForPositional(shapeId, model); - if (model.expectShape(notPositionalId).hasTrait(ReferenceTrait.class)) { - ReferenceTrait reference = model.expectShape(notPositionalId).expectTrait(ReferenceTrait.class); - return new ResolvedShapeId(shapeId, reference.getReferentId()); - } - return new ResolvedShapeId(shapeId, notPositionalId); + return originalId; + } + + /** + * @param shapeId ShapeId that might have positional or reference trait + * @return Fully de-referenced shapeId and naive shapeId as a ResolvedShapeId + */ + public static ResolvedShapeId resolveShape(ShapeId shapeId, Model model) { + if (shapeId.equals(SMITHY_API_UNIT)) { + return new ResolvedShapeId(shapeId, shapeId); } - - /** - * @param naiveId ShapeId that might have positional or reference trait. - * @param resolvedId Fully de-referenced shapeId; - * de-referenced means Positional or - * Reference traits have been fully resolved. - */ - public record ResolvedShapeId(ShapeId naiveId, ShapeId resolvedId) {} - - /** - * Adds a "message: String" member to any structure with the error trait - * that doesn't already define one (via case-insensitive match). - */ - public static Model addMissingErrorMessageMembers(Model model) { - return ModelTransformer.create().mapShapes(model, shape -> { - if (shape instanceof StructureShape && shape.hasTrait(ErrorTrait.class)) { - StructureShape errorShape = (StructureShape) shape; - if (errorShape.members().stream().noneMatch(m -> "message".equalsIgnoreCase(m.getMemberName()))) { - MemberShape implicitMessageMember = MemberShape.builder() - .id(errorShape.getId().withMember("message")) - .target(ShapeId.from("smithy.api#String")) - .build(); - return errorShape.toBuilder().addMember(implicitMessageMember).build(); - } - } - return shape; - }); + ShapeId notPositionalId = checkForPositional(shapeId, model); + if (model.expectShape(notPositionalId).hasTrait(ReferenceTrait.class)) { + ReferenceTrait reference = model + .expectShape(notPositionalId) + .expectTrait(ReferenceTrait.class); + return new ResolvedShapeId(shapeId, reference.getReferentId()); } + return new ResolvedShapeId(shapeId, notPositionalId); + } + + /** + * @param naiveId ShapeId that might have positional or reference trait. + * @param resolvedId Fully de-referenced shapeId; + * de-referenced means Positional or + * Reference traits have been fully resolved. + */ + public record ResolvedShapeId(ShapeId naiveId, ShapeId resolvedId) {} + + /** + * Adds a "message: String" member to any structure with the error trait + * that doesn't already define one (via case-insensitive match). + */ + public static Model addMissingErrorMessageMembers(Model model) { + return ModelTransformer + .create() + .mapShapes( + model, + shape -> { + if ( + shape instanceof StructureShape && shape.hasTrait(ErrorTrait.class) + ) { + StructureShape errorShape = (StructureShape) shape; + if ( + errorShape + .members() + .stream() + .noneMatch(m -> "message".equalsIgnoreCase(m.getMemberName())) + ) { + MemberShape implicitMessageMember = MemberShape + .builder() + .id(errorShape.getId().withMember("message")) + .target(ShapeId.from("smithy.api#String")) + .build(); + return errorShape + .toBuilder() + .addMember(implicitMessageMember) + .build(); + } + } + return shape; + } + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/Token.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/Token.java index 20aa4976f9..2af3709cc4 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/Token.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/Token.java @@ -6,32 +6,33 @@ import java.util.stream.Stream; public class Token extends TokenTree { - public static final Token NEWLINE = Token.of("\n"); - private final CharSequence chars; + public static final Token NEWLINE = Token.of("\n"); - public Token(final CharSequence chars) { - this.chars = chars; - } + private final CharSequence chars; - public static Token of(char singleChar) { - return new Token(String.valueOf(singleChar)); - } + public Token(final CharSequence chars) { + this.chars = chars; + } - public static Token of(final CharSequence chars) { - return new Token(chars); - } + public static Token of(char singleChar) { + return new Token(String.valueOf(singleChar)); + } - protected Stream streamChildren() { - return Stream.of(this); - } + public static Token of(final CharSequence chars) { + return new Token(chars); + } - public Boolean isEmpty() { - return "" == chars || null == chars; - } + protected Stream streamChildren() { + return Stream.of(this); + } - @Override - public String toString() { - return chars == null ? "" : chars.toString(); - } + public Boolean isEmpty() { + return "" == chars || null == chars; + } + + @Override + public String toString() { + return chars == null ? "" : chars.toString(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/TokenTree.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/TokenTree.java index 17a29dda2b..1507650496 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/TokenTree.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/polymorph/utils/TokenTree.java @@ -4,7 +4,6 @@ package software.amazon.polymorph.utils; import com.google.common.collect.ImmutableList; - import java.util.Arrays; import java.util.List; import java.util.stream.Stream; @@ -13,134 +12,140 @@ * An immutable rose tree (unbounded branches) for generated code. */ public class TokenTree { - private static final TokenTree EMPTY = new TokenTree(); - - private final List children; - - protected TokenTree() { - this.children = ImmutableList.of(); - } - - private TokenTree(ImmutableList children) { - this.children = children; - } - - public static TokenTree empty() { - return EMPTY; - } - - public static TokenTree of(final TokenTree... trees) { - return new TokenTree(ImmutableList.copyOf(trees)); - } - - public static TokenTree of(final Stream trees) { - return new TokenTree(ImmutableList.copyOf(trees.iterator())); - } - - public static TokenTree of(final CharSequence... charSequences) { - return TokenTree.of(Arrays.stream(charSequences).map(Token::of)); - } - - public TokenTree surround(final TokenTree prefix, final TokenTree suffix) { - return TokenTree.of(prefix, this, suffix); - } - - public TokenTree braced() { - return surround(Token.of("{\n"), Token.of("\n}")); - } - - public TokenTree parenthesized() { - return surround(Token.of('('), Token.of(')')); - } - - public TokenTree angleBracketed() { - return surround(Token.of('<'), Token.of('>')); - } - - public TokenTree prepend(final TokenTree toPrepend) { - return TokenTree.of(toPrepend, this); - } - - public TokenTree append(final TokenTree toAppend) { - return TokenTree.of(this, toAppend); - } - public TokenTree namespaced(final TokenTree namespace) { - return TokenTree.of(Token.of("namespace"), namespace, this.braced()); - } - - public TokenTree namespaced(final String namespace) { - return TokenTree.of(Token.of("namespace"), Token.of(namespace), this.braced()); - } - - public TokenTree prependSeperated(final TokenTree separator) { - Stream separatedTokens = children - .stream() - .flatMap(tokenTree -> Stream.of(separator, tokenTree)); - return new TokenTree(ImmutableList.copyOf(separatedTokens.iterator())); - } - - public TokenTree separated(final TokenTree separator) { - if (children.size() < 2) { - return this; + private static final TokenTree EMPTY = new TokenTree(); + + private final List children; + + protected TokenTree() { + this.children = ImmutableList.of(); + } + + private TokenTree(ImmutableList children) { + this.children = children; + } + + public static TokenTree empty() { + return EMPTY; + } + + public static TokenTree of(final TokenTree... trees) { + return new TokenTree(ImmutableList.copyOf(trees)); + } + + public static TokenTree of(final Stream trees) { + return new TokenTree(ImmutableList.copyOf(trees.iterator())); + } + + public static TokenTree of(final CharSequence... charSequences) { + return TokenTree.of(Arrays.stream(charSequences).map(Token::of)); + } + + public TokenTree surround(final TokenTree prefix, final TokenTree suffix) { + return TokenTree.of(prefix, this, suffix); + } + + public TokenTree braced() { + return surround(Token.of("{\n"), Token.of("\n}")); + } + + public TokenTree parenthesized() { + return surround(Token.of('('), Token.of(')')); + } + + public TokenTree angleBracketed() { + return surround(Token.of('<'), Token.of('>')); + } + + public TokenTree prepend(final TokenTree toPrepend) { + return TokenTree.of(toPrepend, this); + } + + public TokenTree append(final TokenTree toAppend) { + return TokenTree.of(this, toAppend); + } + + public TokenTree namespaced(final TokenTree namespace) { + return TokenTree.of(Token.of("namespace"), namespace, this.braced()); + } + + public TokenTree namespaced(final String namespace) { + return TokenTree.of( + Token.of("namespace"), + Token.of(namespace), + this.braced() + ); + } + + public TokenTree prependSeperated(final TokenTree separator) { + Stream separatedTokens = children + .stream() + .flatMap(tokenTree -> Stream.of(separator, tokenTree)); + return new TokenTree(ImmutableList.copyOf(separatedTokens.iterator())); + } + + public TokenTree separated(final TokenTree separator) { + if (children.size() < 2) { + return this; + } + Stream separatedTokens = children + .stream() + .flatMap(tokenTree -> Stream.of(separator, tokenTree)) + .skip(1); + return new TokenTree(ImmutableList.copyOf(separatedTokens.iterator())); + } + + protected Stream streamChildren() { + return children.stream(); + } + + public TokenTree flatten() { + Stream flattenChildren = children + .stream() + .flatMap(c -> c.streamChildren()); + return new TokenTree(ImmutableList.copyOf(flattenChildren.iterator())); + } + + public Boolean isEmpty() { + return 0 == this.children.size(); + } + + public TokenTree prependToNonEmpty(final TokenTree toPrepend) { + return this.isEmpty() ? this : this.prepend(toPrepend); + } + + public TokenTree appendToNonEmpty(final TokenTree toPrepend) { + return this.isEmpty() ? this : this.append(toPrepend); + } + + public TokenTree dropEmpty() { + Stream separatedTokens = children + .stream() + .filter(tree -> !tree.isEmpty()); + return new TokenTree(ImmutableList.copyOf(separatedTokens.iterator())); + } + + public TokenTree lineSeparated() { + return separated(Token.NEWLINE); + } + + @Override + public String toString() { + if (children.size() == 0) { + return ""; + } + + final StringBuilder builder = new StringBuilder(children.get(0).toString()); + children + .stream() + .skip(1) + .forEach(tokenTree -> { + final String treeAsString = tokenTree.toString(); + if (!treeAsString.startsWith("\n")) { + builder.append(' '); } - Stream separatedTokens = children - .stream() - .flatMap(tokenTree -> Stream.of(separator, tokenTree)) - .skip(1); - return new TokenTree(ImmutableList.copyOf(separatedTokens.iterator())); - } - - protected Stream streamChildren() { - return children.stream(); - } - - public TokenTree flatten() { - Stream flattenChildren = children.stream().flatMap(c -> c.streamChildren()); - return new TokenTree(ImmutableList.copyOf(flattenChildren.iterator())); - } - - public Boolean isEmpty() { - return 0 == this.children.size(); - } - - public TokenTree prependToNonEmpty(final TokenTree toPrepend) { - return this.isEmpty() - ? this - : this.prepend(toPrepend); - } - - public TokenTree appendToNonEmpty(final TokenTree toPrepend) { - return this.isEmpty() - ? this - : this.append(toPrepend); - } - - public TokenTree dropEmpty() { - Stream separatedTokens = children - .stream() - .filter(tree -> !tree.isEmpty()); - return new TokenTree(ImmutableList.copyOf(separatedTokens.iterator())); - } - - public TokenTree lineSeparated() { - return separated(Token.NEWLINE); - } - - @Override - public String toString() { - if (children.size() == 0) { - return ""; - } - - final StringBuilder builder = new StringBuilder(children.get(0).toString()); - children.stream().skip(1).forEach(tokenTree -> { - final String treeAsString = tokenTree.toString(); - if (!treeAsString.startsWith("\n")) { - builder.append(' '); - } - builder.append(treeAsString); - }); - return builder.toString(); - } + builder.append(treeAsString); + }); + return builder.toString(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenEdition.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenEdition.java index a382141769..b12dc06eba 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenEdition.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenEdition.java @@ -5,17 +5,19 @@ import java.util.Objects; public enum DafnyClientCodegenEdition { - // Java identifiers (including enum values) cannot start with a number, but edition names are typically numeric. - EDITION_2023, - EDITION_2023_10; // 2023.10 + // Java identifiers (including enum values) cannot start with a number, but edition names are typically numeric. + EDITION_2023, + EDITION_2023_10; // 2023.10 - /** - * Returns the enum value corresponding to the given numeric string, e.g. "2023". - * - * @throws IllegalArgumentException if there is no corresponding edition - */ - public static DafnyClientCodegenEdition fromNumeric(final String edition) { - Objects.requireNonNull(edition); - return DafnyClientCodegenEdition.valueOf("EDITION_" + edition.replace(".", "_")); - } + /** + * Returns the enum value corresponding to the given numeric string, e.g. "2023". + * + * @throws IllegalArgumentException if there is no corresponding edition + */ + public static DafnyClientCodegenEdition fromNumeric(final String edition) { + Objects.requireNonNull(edition); + return DafnyClientCodegenEdition.valueOf( + "EDITION_" + edition.replace(".", "_") + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPlugin.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPlugin.java index 4e0e853efe..9d6d77583a 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPlugin.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPlugin.java @@ -3,6 +3,10 @@ package software.amazon.smithy.dafny.codegen; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.polymorph.CodegenEngine; @@ -12,54 +16,66 @@ import software.amazon.smithy.build.SmithyBuildPlugin; import software.amazon.smithy.model.Model; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.HashMap; -import java.util.Map; - public final class DafnyClientCodegenPlugin implements SmithyBuildPlugin { - private static final Logger LOGGER = LoggerFactory.getLogger(DafnyClientCodegenPlugin.class); - @Override - public String getName() { - return "dafny-client-codegen"; - } + private static final Logger LOGGER = LoggerFactory.getLogger( + DafnyClientCodegenPlugin.class + ); - @Override - public void execute(PluginContext context) { - final Model model = context.getModel(); - // TODO register generated files to allow to produce a proper manifest - final FileManifest manifest = context.getFileManifest(); - final DafnyClientCodegenPluginSettings settings = DafnyClientCodegenPluginSettings - .fromObject(context.getSettings(), manifest) - .orElseThrow(() -> new RuntimeException("Invalid plugin settings; aborting")); + @Override + public String getName() { + return "dafny-client-codegen"; + } - final Map outputDirs = new HashMap<>(); - outputDirs.put(TargetLanguage.DAFNY, manifest.resolvePath(Paths.get("Model"))); - settings.targetLanguages.forEach(lang -> { - final Path dir = Paths.get("runtimes", lang.name().toLowerCase(), "Generated"); - outputDirs.put(lang, manifest.resolvePath(dir)); - }); - final Path propertiesFile = manifest.resolvePath(Paths.get("project.properties")); + @Override + public void execute(PluginContext context) { + final Model model = context.getModel(); + // TODO register generated files to allow to produce a proper manifest + final FileManifest manifest = context.getFileManifest(); + final DafnyClientCodegenPluginSettings settings = + DafnyClientCodegenPluginSettings + .fromObject(context.getSettings(), manifest) + .orElseThrow(() -> + new RuntimeException("Invalid plugin settings; aborting") + ); - // TODO remove when Java is properly supported - if (settings.targetLanguages.contains(TargetLanguage.JAVA)) { - LOGGER.warn("smithy-dafny-codegen support for Java code generation is experimental and does not yet work for arbitrary service models"); - } + final Map outputDirs = new HashMap<>(); + outputDirs.put( + TargetLanguage.DAFNY, + manifest.resolvePath(Paths.get("Model")) + ); + settings.targetLanguages.forEach(lang -> { + final Path dir = Paths.get( + "runtimes", + lang.name().toLowerCase(), + "Generated" + ); + outputDirs.put(lang, manifest.resolvePath(dir)); + }); + final Path propertiesFile = manifest.resolvePath( + Paths.get("project.properties") + ); - final CodegenEngine codegenEngine = new CodegenEngine.Builder() - .withFromSmithyBuildPlugin(true) - .withLibraryRoot(manifest.getBaseDir()) - .withServiceModel(model) - // TODO generate code based on service closure, not namespace - .withNamespace(settings.serviceId.getNamespace()) - .withDafnyVersion(settings.dafnyVersion) - .withPropertiesFile(propertiesFile) - .withTargetLangOutputDirs(outputDirs) - .withAwsSdkStyle(true) // this plugin only generates AWS SDK-style code - .withIncludeDafnyFile(settings.includeDafnyFile) - .withGenerateProjectFiles(true) - .build(); - codegenEngine.run(); + // TODO remove when Java is properly supported + if (settings.targetLanguages.contains(TargetLanguage.JAVA)) { + LOGGER.warn( + "smithy-dafny-codegen support for Java code generation is experimental and does not yet work for arbitrary service models" + ); } + + final CodegenEngine codegenEngine = new CodegenEngine.Builder() + .withFromSmithyBuildPlugin(true) + .withLibraryRoot(manifest.getBaseDir()) + .withServiceModel(model) + // TODO generate code based on service closure, not namespace + .withNamespace(settings.serviceId.getNamespace()) + .withDafnyVersion(settings.dafnyVersion) + .withPropertiesFile(propertiesFile) + .withTargetLangOutputDirs(outputDirs) + .withAwsSdkStyle(true) // this plugin only generates AWS SDK-style code + .withIncludeDafnyFile(settings.includeDafnyFile) + .withGenerateProjectFiles(true) + .build(); + codegenEngine.run(); + } } diff --git a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPluginSettings.java b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPluginSettings.java index de57e4f240..cbced7c12e 100644 --- a/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPluginSettings.java +++ b/codegen/smithy-dafny-codegen/src/main/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPluginSettings.java @@ -2,6 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.smithy.dafny.codegen; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; +import java.util.stream.Stream; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import software.amazon.polymorph.CodegenEngine; @@ -12,145 +20,170 @@ import software.amazon.smithy.model.node.StringNode; import software.amazon.smithy.model.shapes.ShapeId; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.stream.Collectors; -import java.util.stream.Stream; - class DafnyClientCodegenPluginSettings { - private static final Logger LOGGER = LoggerFactory.getLogger(DafnyClientCodegenPluginSettings.class); - - /** - * Configures the code generator to use the best practices of a specific edition. - * - * @see - * Smithy edition property - */ - public final DafnyClientCodegenEdition edition; - - /** - * The service shape ID for which to generate code. - * - * @see - * Smithy service property - */ - public final ShapeId serviceId; - - /** - * Set of language(s) for which the plugin should generate code. - * The plugin always generates Dafny code, so Dafny should not be specified explicitly. - */ - public final Set targetLanguages; - - /** - * Path to the TestModels/dafny-dependencies/StandardLibrary/src/Index.dfy file in the smithy-dafny - * repository, relative to the smithy-build.json file. - *

- * TODO: replace this with something cleaner - */ - public final Path includeDafnyFile; - - /** - * The Dafny version to generate code compatible with. - * This is used to ensure both Dafny source compatibility - * and compatibility with the Dafny compiler and runtime internals, - * which shim code generation currently depends on. - * Required when the edition is 2023.10 or later. - */ - public final DafnyVersion dafnyVersion; - - private DafnyClientCodegenPluginSettings( - final DafnyClientCodegenEdition edition, - final ShapeId serviceId, - final Set targetLanguages, - final Path includeDafnyFile, - final DafnyVersion dafnyVersion - ) { - this.edition = edition; - this.serviceId = serviceId; - this.targetLanguages = targetLanguages; - this.includeDafnyFile = includeDafnyFile; - this.dafnyVersion = dafnyVersion; - } - static Optional fromObject(final ObjectNode node, final FileManifest manifest) { - final ShapeId serviceId = node.expectStringMember("service").expectShapeId(); - - final String editionNumeric = node.expectStringMember("edition").getValue(); - final DafnyClientCodegenEdition edition = DafnyClientCodegenEdition.fromNumeric(editionNumeric); - - final List targetLangNodes = - node.expectArrayMember("targetLanguages").getElementsAs(StringNode.class); - AtomicBoolean foundUnknownTargetLanguage = new AtomicBoolean(false); - final Set targetLanguages = targetLangNodes.stream() - .flatMap(strNode -> switch (strNode.getValue().toUpperCase()) { - case "JAVA" -> Stream.of(CodegenEngine.TargetLanguage.JAVA); - case "DOTNET", "CSHARP", "CS" -> Stream.of(CodegenEngine.TargetLanguage.DOTNET); - case "DAFNY" -> { - LOGGER.error("Dafny code is always generated, and shouldn't be specified explicitly"); - foundUnknownTargetLanguage.set(true); - yield Stream.empty(); - } - default -> { - LOGGER.error("Unknown target language: {}", strNode.getValue()); - foundUnknownTargetLanguage.set(true); - yield Stream.empty(); - } - }).collect(Collectors.toSet()); - if (foundUnknownTargetLanguage.get()) { - return Optional.empty(); - } - if (targetLanguages.size() < targetLangNodes.size()) { - LOGGER.error("Duplicate target languages specified; aborting"); - return Optional.empty(); - } - - final Optional buildRoot = findSmithyBuildJson(manifest.getBaseDir()).map(p -> p.getParent()); - final String includeDafnyFileStr = node.expectStringMember("includeDafnyFile").getValue(); - final Path includeDafnyFile = Path.of(includeDafnyFileStr); - final Path includeDafnyFileNormalized = buildRoot.isPresent() && !includeDafnyFile.isAbsolute() - ? buildRoot.get().resolve(includeDafnyFile).toAbsolutePath().normalize() - : includeDafnyFile; - if (Files.notExists(includeDafnyFileNormalized)) { - LOGGER.warn("Generated Dafny code may not compile because the includeDafnyFile could not be found: {}", - includeDafnyFileNormalized); + private static final Logger LOGGER = LoggerFactory.getLogger( + DafnyClientCodegenPluginSettings.class + ); + + /** + * Configures the code generator to use the best practices of a specific edition. + * + * @see + * Smithy edition property + */ + public final DafnyClientCodegenEdition edition; + + /** + * The service shape ID for which to generate code. + * + * @see + * Smithy service property + */ + public final ShapeId serviceId; + + /** + * Set of language(s) for which the plugin should generate code. + * The plugin always generates Dafny code, so Dafny should not be specified explicitly. + */ + public final Set targetLanguages; + + /** + * Path to the TestModels/dafny-dependencies/StandardLibrary/src/Index.dfy file in the smithy-dafny + * repository, relative to the smithy-build.json file. + *

+ * TODO: replace this with something cleaner + */ + public final Path includeDafnyFile; + + /** + * The Dafny version to generate code compatible with. + * This is used to ensure both Dafny source compatibility + * and compatibility with the Dafny compiler and runtime internals, + * which shim code generation currently depends on. + * Required when the edition is 2023.10 or later. + */ + public final DafnyVersion dafnyVersion; + + private DafnyClientCodegenPluginSettings( + final DafnyClientCodegenEdition edition, + final ShapeId serviceId, + final Set targetLanguages, + final Path includeDafnyFile, + final DafnyVersion dafnyVersion + ) { + this.edition = edition; + this.serviceId = serviceId; + this.targetLanguages = targetLanguages; + this.includeDafnyFile = includeDafnyFile; + this.dafnyVersion = dafnyVersion; + } + + static Optional fromObject( + final ObjectNode node, + final FileManifest manifest + ) { + final ShapeId serviceId = node + .expectStringMember("service") + .expectShapeId(); + + final String editionNumeric = node.expectStringMember("edition").getValue(); + final DafnyClientCodegenEdition edition = + DafnyClientCodegenEdition.fromNumeric(editionNumeric); + + final List targetLangNodes = node + .expectArrayMember("targetLanguages") + .getElementsAs(StringNode.class); + AtomicBoolean foundUnknownTargetLanguage = new AtomicBoolean(false); + final Set targetLanguages = targetLangNodes + .stream() + .flatMap(strNode -> + switch (strNode.getValue().toUpperCase()) { + case "JAVA" -> Stream.of(CodegenEngine.TargetLanguage.JAVA); + case "DOTNET", "CSHARP", "CS" -> Stream.of( + CodegenEngine.TargetLanguage.DOTNET + ); + case "DAFNY" -> { + LOGGER.error( + "Dafny code is always generated, and shouldn't be specified explicitly" + ); + foundUnknownTargetLanguage.set(true); + yield Stream.empty(); + } + default -> { + LOGGER.error("Unknown target language: {}", strNode.getValue()); + foundUnknownTargetLanguage.set(true); + yield Stream.empty(); + } } + ) + .collect(Collectors.toSet()); + if (foundUnknownTargetLanguage.get()) { + return Optional.empty(); + } + if (targetLanguages.size() < targetLangNodes.size()) { + LOGGER.error("Duplicate target languages specified; aborting"); + return Optional.empty(); + } - final String dafnyVersionString; - if (edition.ordinal() >= DafnyClientCodegenEdition.EDITION_2023_10.ordinal()) { - // Required from this edition on - dafnyVersionString = node.expectStringMember("dafnyVersion").getValue(); - } else { - dafnyVersionString = node.getStringMemberOrDefault("dafnyVersion", "4.1"); - } + final Optional buildRoot = findSmithyBuildJson(manifest.getBaseDir()) + .map(p -> p.getParent()); + final String includeDafnyFileStr = node + .expectStringMember("includeDafnyFile") + .getValue(); + final Path includeDafnyFile = Path.of(includeDafnyFileStr); + final Path includeDafnyFileNormalized = buildRoot.isPresent() && + !includeDafnyFile.isAbsolute() + ? buildRoot.get().resolve(includeDafnyFile).toAbsolutePath().normalize() + : includeDafnyFile; + if (Files.notExists(includeDafnyFileNormalized)) { + LOGGER.warn( + "Generated Dafny code may not compile because the includeDafnyFile could not be found: {}", + includeDafnyFileNormalized + ); + } - return Optional.of( - new DafnyClientCodegenPluginSettings(edition, serviceId, targetLanguages, includeDafnyFileNormalized, - DafnyVersion.parse(dafnyVersionString))); + final String dafnyVersionString; + if ( + edition.ordinal() >= DafnyClientCodegenEdition.EDITION_2023_10.ordinal() + ) { + // Required from this edition on + dafnyVersionString = node.expectStringMember("dafnyVersion").getValue(); + } else { + dafnyVersionString = node.getStringMemberOrDefault("dafnyVersion", "4.1"); } - /** - * Traverses up from the given start path, - * searching for a "smithy-build.json" file and returning its path if found. - */ - private static Optional findSmithyBuildJson(final Path start) { - if (start == null || !start.isAbsolute()) { - throw new IllegalArgumentException("Start path must be non-null and absolute"); - } - Path cursor = start.normalize(); - final Path root = cursor.getRoot(); - // Shouldn't need to traverse more than 100 levels... but don't hang forever - for (int i = 0; !root.equals(cursor) && i < 100; i++) { - final Path config = cursor.resolve("smithy-build.json"); - if (Files.exists(config)) { - return Optional.of(config); - } - cursor = cursor.getParent(); - } - return Optional.empty(); + return Optional.of( + new DafnyClientCodegenPluginSettings( + edition, + serviceId, + targetLanguages, + includeDafnyFileNormalized, + DafnyVersion.parse(dafnyVersionString) + ) + ); + } + + /** + * Traverses up from the given start path, + * searching for a "smithy-build.json" file and returning its path if found. + */ + private static Optional findSmithyBuildJson(final Path start) { + if (start == null || !start.isAbsolute()) { + throw new IllegalArgumentException( + "Start path must be non-null and absolute" + ); + } + Path cursor = start.normalize(); + final Path root = cursor.getRoot(); + // Shouldn't need to traverse more than 100 levels... but don't hang forever + for (int i = 0; !root.equals(cursor) && i < 100; i++) { + final Path config = cursor.resolve("smithy-build.json"); + if (Files.exists(config)) { + return Optional.of(config); + } + cursor = cursor.getParent(); } + return Optional.empty(); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpLexer.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpLexer.java index 677b9e3c43..875ded786e 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpLexer.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpLexer.java @@ -5,1297 +5,1925 @@ // Generated from CSharpLexer.g4 by ANTLR 4.9.2 import java.util.Stack; -import org.antlr.v4.runtime.Lexer; +import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.CharStream; +import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.TokenStream; -import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; import org.antlr.v4.runtime.misc.*; -@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +@SuppressWarnings({ "all", "warnings", "unchecked", "unused", "cast" }) public class CSharpLexer extends Lexer { - static { RuntimeMetaData.checkVersion("4.9.2", RuntimeMetaData.VERSION); } + static { + RuntimeMetaData.checkVersion("4.9.2", RuntimeMetaData.VERSION); + } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int BYTE_ORDER_MARK = 1, SINGLE_LINE_DOC_COMMENT = + 2, EMPTY_DELIMITED_DOC_COMMENT = 3, DELIMITED_DOC_COMMENT = + 4, SINGLE_LINE_COMMENT = 5, DELIMITED_COMMENT = 6, WHITESPACES = 7, SHARP = + 8, ABSTRACT = 9, ADD = 10, ALIAS = 11, ARGLIST = 12, AS = 13, ASCENDING = + 14, ASYNC = 15, AWAIT = 16, BASE = 17, BOOL = 18, BREAK = 19, BY = + 20, BYTE = 21, CASE = 22, CATCH = 23, CHAR = 24, CHECKED = 25, CLASS = + 26, CONST = 27, CONTINUE = 28, DECIMAL = 29, DEFAULT = 30, DELEGATE = + 31, DESCENDING = 32, DO = 33, DOUBLE = 34, DYNAMIC = 35, ELSE = 36, ENUM = + 37, EQUALS = 38, EVENT = 39, EXPLICIT = 40, EXTERN = 41, FALSE = + 42, FINALLY = 43, FIXED = 44, FLOAT = 45, FOR = 46, FOREACH = 47, FROM = + 48, GET = 49, GOTO = 50, GROUP = 51, IF = 52, IMPLICIT = 53, IN = 54, INT = + 55, INTERFACE = 56, INTERNAL = 57, INTO = 58, IS = 59, JOIN = 60, LET = + 61, LOCK = 62, LONG = 63, NAMEOF = 64, NAMESPACE = 65, NEW = 66, NULL_ = + 67, OBJECT = 68, ON = 69, OPERATOR = 70, ORDERBY = 71, OUT = 72, OVERRIDE = + 73, PARAMS = 74, PARTIAL = 75, PRIVATE = 76, PROTECTED = 77, PUBLIC = + 78, READONLY = 79, REF = 80, REMOVE = 81, RETURN = 82, SBYTE = 83, SEALED = + 84, SELECT = 85, SET = 86, SHORT = 87, SIZEOF = 88, STACKALLOC = + 89, STATIC = 90, STRING = 91, STRUCT = 92, SWITCH = 93, THIS = 94, THROW = + 95, TRUE = 96, TRY = 97, TYPEOF = 98, UINT = 99, ULONG = 100, UNCHECKED = + 101, UNMANAGED = 102, UNSAFE = 103, USHORT = 104, USING = 105, VAR = + 106, VIRTUAL = 107, VOID = 108, VOLATILE = 109, WHEN = 110, WHERE = + 111, WHILE = 112, YIELD = 113, IDENTIFIER = 114, LITERAL_ACCESS = + 115, INTEGER_LITERAL = 116, HEX_INTEGER_LITERAL = 117, BIN_INTEGER_LITERAL = + 118, REAL_LITERAL = 119, CHARACTER_LITERAL = 120, REGULAR_STRING = + 121, VERBATIUM_STRING = 122, INTERPOLATED_REGULAR_STRING_START = + 123, INTERPOLATED_VERBATIUM_STRING_START = 124, OPEN_BRACE = + 125, CLOSE_BRACE = 126, OPEN_BRACKET = 127, CLOSE_BRACKET = + 128, OPEN_PARENS = 129, CLOSE_PARENS = 130, DOT = 131, COMMA = 132, COLON = + 133, SEMICOLON = 134, PLUS = 135, MINUS = 136, STAR = 137, DIV = + 138, PERCENT = 139, AMP = 140, BITWISE_OR = 141, CARET = 142, BANG = + 143, TILDE = 144, ASSIGNMENT = 145, LT = 146, GT = 147, INTERR = + 148, DOUBLE_COLON = 149, OP_COALESCING = 150, OP_INC = 151, OP_DEC = + 152, OP_AND = 153, OP_OR = 154, OP_PTR = 155, OP_EQ = 156, OP_NE = + 157, OP_LE = 158, OP_GE = 159, OP_ADD_ASSIGNMENT = 160, OP_SUB_ASSIGNMENT = + 161, OP_MULT_ASSIGNMENT = 162, OP_DIV_ASSIGNMENT = 163, OP_MOD_ASSIGNMENT = + 164, OP_AND_ASSIGNMENT = 165, OP_OR_ASSIGNMENT = 166, OP_XOR_ASSIGNMENT = + 167, OP_LEFT_SHIFT = 168, OP_LEFT_SHIFT_ASSIGNMENT = + 169, OP_COALESCING_ASSIGNMENT = 170, OP_RANGE = 171, DOUBLE_CURLY_INSIDE = + 172, OPEN_BRACE_INSIDE = 173, REGULAR_CHAR_INSIDE = + 174, VERBATIUM_DOUBLE_QUOTE_INSIDE = 175, DOUBLE_QUOTE_INSIDE = + 176, REGULAR_STRING_INSIDE = 177, VERBATIUM_INSIDE_STRING = + 178, CLOSE_BRACE_INSIDE = 179, FORMAT_STRING = 180, DIRECTIVE_WHITESPACES = + 181, DIGITS = 182, DEFINE = 183, UNDEF = 184, ELIF = 185, ENDIF = + 186, LINE = 187, ERROR = 188, WARNING = 189, REGION = 190, ENDREGION = + 191, PRAGMA = 192, NULLABLE = 193, DIRECTIVE_HIDDEN = + 194, CONDITIONAL_SYMBOL = 195, DIRECTIVE_NEW_LINE = 196, TEXT = + 197, DOUBLE_CURLY_CLOSE_INSIDE = 198; + public static final int COMMENTS_CHANNEL = 2, DIRECTIVE = 3; + public static final int INTERPOLATION_STRING = 1, INTERPOLATION_FORMAT = + 2, DIRECTIVE_MODE = 3, DIRECTIVE_TEXT = 4; + public static String[] channelNames = { + "DEFAULT_TOKEN_CHANNEL", + "HIDDEN", + "COMMENTS_CHANNEL", + "DIRECTIVE", + }; + + public static String[] modeNames = { + "DEFAULT_MODE", + "INTERPOLATION_STRING", + "INTERPOLATION_FORMAT", + "DIRECTIVE_MODE", + "DIRECTIVE_TEXT", + }; + + private static String[] makeRuleNames() { + return new String[] { + "BYTE_ORDER_MARK", + "SINGLE_LINE_DOC_COMMENT", + "EMPTY_DELIMITED_DOC_COMMENT", + "DELIMITED_DOC_COMMENT", + "SINGLE_LINE_COMMENT", + "DELIMITED_COMMENT", + "WHITESPACES", + "SHARP", + "ABSTRACT", + "ADD", + "ALIAS", + "ARGLIST", + "AS", + "ASCENDING", + "ASYNC", + "AWAIT", + "BASE", + "BOOL", + "BREAK", + "BY", + "BYTE", + "CASE", + "CATCH", + "CHAR", + "CHECKED", + "CLASS", + "CONST", + "CONTINUE", + "DECIMAL", + "DEFAULT", + "DELEGATE", + "DESCENDING", + "DO", + "DOUBLE", + "DYNAMIC", + "ELSE", + "ENUM", + "EQUALS", + "EVENT", + "EXPLICIT", + "EXTERN", + "FALSE", + "FINALLY", + "FIXED", + "FLOAT", + "FOR", + "FOREACH", + "FROM", + "GET", + "GOTO", + "GROUP", + "IF", + "IMPLICIT", + "IN", + "INT", + "INTERFACE", + "INTERNAL", + "INTO", + "IS", + "JOIN", + "LET", + "LOCK", + "LONG", + "NAMEOF", + "NAMESPACE", + "NEW", + "NULL_", + "OBJECT", + "ON", + "OPERATOR", + "ORDERBY", + "OUT", + "OVERRIDE", + "PARAMS", + "PARTIAL", + "PRIVATE", + "PROTECTED", + "PUBLIC", + "READONLY", + "REF", + "REMOVE", + "RETURN", + "SBYTE", + "SEALED", + "SELECT", + "SET", + "SHORT", + "SIZEOF", + "STACKALLOC", + "STATIC", + "STRING", + "STRUCT", + "SWITCH", + "THIS", + "THROW", + "TRUE", + "TRY", + "TYPEOF", + "UINT", + "ULONG", + "UNCHECKED", + "UNMANAGED", + "UNSAFE", + "USHORT", + "USING", + "VAR", + "VIRTUAL", + "VOID", + "VOLATILE", + "WHEN", + "WHERE", + "WHILE", + "YIELD", + "IDENTIFIER", + "LITERAL_ACCESS", + "INTEGER_LITERAL", + "HEX_INTEGER_LITERAL", + "BIN_INTEGER_LITERAL", + "REAL_LITERAL", + "CHARACTER_LITERAL", + "REGULAR_STRING", + "VERBATIUM_STRING", + "INTERPOLATED_REGULAR_STRING_START", + "INTERPOLATED_VERBATIUM_STRING_START", + "OPEN_BRACE", + "CLOSE_BRACE", + "OPEN_BRACKET", + "CLOSE_BRACKET", + "OPEN_PARENS", + "CLOSE_PARENS", + "DOT", + "COMMA", + "COLON", + "SEMICOLON", + "PLUS", + "MINUS", + "STAR", + "DIV", + "PERCENT", + "AMP", + "BITWISE_OR", + "CARET", + "BANG", + "TILDE", + "ASSIGNMENT", + "LT", + "GT", + "INTERR", + "DOUBLE_COLON", + "OP_COALESCING", + "OP_INC", + "OP_DEC", + "OP_AND", + "OP_OR", + "OP_PTR", + "OP_EQ", + "OP_NE", + "OP_LE", + "OP_GE", + "OP_ADD_ASSIGNMENT", + "OP_SUB_ASSIGNMENT", + "OP_MULT_ASSIGNMENT", + "OP_DIV_ASSIGNMENT", + "OP_MOD_ASSIGNMENT", + "OP_AND_ASSIGNMENT", + "OP_OR_ASSIGNMENT", + "OP_XOR_ASSIGNMENT", + "OP_LEFT_SHIFT", + "OP_LEFT_SHIFT_ASSIGNMENT", + "OP_COALESCING_ASSIGNMENT", + "OP_RANGE", + "DOUBLE_CURLY_INSIDE", + "OPEN_BRACE_INSIDE", + "REGULAR_CHAR_INSIDE", + "VERBATIUM_DOUBLE_QUOTE_INSIDE", + "DOUBLE_QUOTE_INSIDE", + "REGULAR_STRING_INSIDE", + "VERBATIUM_INSIDE_STRING", + "DOUBLE_CURLY_CLOSE_INSIDE", + "CLOSE_BRACE_INSIDE", + "FORMAT_STRING", + "DIRECTIVE_WHITESPACES", + "DIGITS", + "DIRECTIVE_TRUE", + "DIRECTIVE_FALSE", + "DEFINE", + "UNDEF", + "DIRECTIVE_IF", + "ELIF", + "DIRECTIVE_ELSE", + "ENDIF", + "LINE", + "ERROR", + "WARNING", + "REGION", + "ENDREGION", + "PRAGMA", + "NULLABLE", + "DIRECTIVE_DEFAULT", + "DIRECTIVE_HIDDEN", + "DIRECTIVE_OPEN_PARENS", + "DIRECTIVE_CLOSE_PARENS", + "DIRECTIVE_BANG", + "DIRECTIVE_OP_EQ", + "DIRECTIVE_OP_NE", + "DIRECTIVE_OP_AND", + "DIRECTIVE_OP_OR", + "DIRECTIVE_STRING", + "CONDITIONAL_SYMBOL", + "DIRECTIVE_SINGLE_LINE_COMMENT", + "DIRECTIVE_NEW_LINE", + "TEXT", + "TEXT_NEW_LINE", + "InputCharacter", + "NewLineCharacter", + "IntegerTypeSuffix", + "ExponentPart", + "CommonCharacter", + "SimpleEscapeSequence", + "HexEscapeSequence", + "NewLine", + "Whitespace", + "UnicodeClassZS", + "IdentifierOrKeyword", + "IdentifierStartCharacter", + "IdentifierPartCharacter", + "LetterCharacter", + "DecimalDigitCharacter", + "ConnectingCharacter", + "CombiningCharacter", + "FormattingCharacter", + "UnicodeEscapeSequence", + "HexDigit", + "UnicodeClassLU", + "UnicodeClassLL", + "UnicodeClassLT", + "UnicodeClassLM", + "UnicodeClassLO", + "UnicodeClassNL", + "UnicodeClassMN", + "UnicodeClassMC", + "UnicodeClassCF", + "UnicodeClassPC", + "UnicodeClassND", + }; + } + + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, + "'\u00EF\u00BB\u00BF'", + null, + "'/***/'", + null, + null, + null, + null, + "'#'", + "'abstract'", + "'add'", + "'alias'", + "'__arglist'", + "'as'", + "'ascending'", + "'async'", + "'await'", + "'base'", + "'bool'", + "'break'", + "'by'", + "'byte'", + "'case'", + "'catch'", + "'char'", + "'checked'", + "'class'", + "'const'", + "'continue'", + "'decimal'", + "'default'", + "'delegate'", + "'descending'", + "'do'", + "'double'", + "'dynamic'", + "'else'", + "'enum'", + "'equals'", + "'event'", + "'explicit'", + "'extern'", + "'false'", + "'finally'", + "'fixed'", + "'float'", + "'for'", + "'foreach'", + "'from'", + "'get'", + "'goto'", + "'group'", + "'if'", + "'implicit'", + "'in'", + "'int'", + "'interface'", + "'internal'", + "'into'", + "'is'", + "'join'", + "'let'", + "'lock'", + "'long'", + "'nameof'", + "'namespace'", + "'new'", + "'null'", + "'object'", + "'on'", + "'operator'", + "'orderby'", + "'out'", + "'override'", + "'params'", + "'partial'", + "'private'", + "'protected'", + "'public'", + "'readonly'", + "'ref'", + "'remove'", + "'return'", + "'sbyte'", + "'sealed'", + "'select'", + "'set'", + "'short'", + "'sizeof'", + "'stackalloc'", + "'static'", + "'string'", + "'struct'", + "'switch'", + "'this'", + "'throw'", + "'true'", + "'try'", + "'typeof'", + "'uint'", + "'ulong'", + "'unchecked'", + "'unmanaged'", + "'unsafe'", + "'ushort'", + "'using'", + "'var'", + "'virtual'", + "'void'", + "'volatile'", + "'when'", + "'where'", + "'while'", + "'yield'", + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + "'{'", + "'}'", + "'['", + "']'", + "'('", + "')'", + "'.'", + "','", + "':'", + "';'", + "'+'", + "'-'", + "'*'", + "'/'", + "'%'", + "'&'", + "'|'", + "'^'", + "'!'", + "'~'", + "'='", + "'<'", + "'>'", + "'?'", + "'::'", + "'??'", + "'++'", + "'--'", + "'&&'", + "'||'", + "'->'", + "'=='", + "'!='", + "'<='", + "'>='", + "'+='", + "'-='", + "'*='", + "'/='", + "'%='", + "'&='", + "'|='", + "'^='", + "'<<'", + "'<<='", + "'??='", + "'..'", + "'{{'", + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + "'define'", + "'undef'", + "'elif'", + "'endif'", + "'line'", + null, + null, + null, + null, + null, + null, + "'hidden'", + null, + null, + null, + "'}}'", + }; + } + + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + + private static String[] makeSymbolicNames() { + return new String[] { + null, + "BYTE_ORDER_MARK", + "SINGLE_LINE_DOC_COMMENT", + "EMPTY_DELIMITED_DOC_COMMENT", + "DELIMITED_DOC_COMMENT", + "SINGLE_LINE_COMMENT", + "DELIMITED_COMMENT", + "WHITESPACES", + "SHARP", + "ABSTRACT", + "ADD", + "ALIAS", + "ARGLIST", + "AS", + "ASCENDING", + "ASYNC", + "AWAIT", + "BASE", + "BOOL", + "BREAK", + "BY", + "BYTE", + "CASE", + "CATCH", + "CHAR", + "CHECKED", + "CLASS", + "CONST", + "CONTINUE", + "DECIMAL", + "DEFAULT", + "DELEGATE", + "DESCENDING", + "DO", + "DOUBLE", + "DYNAMIC", + "ELSE", + "ENUM", + "EQUALS", + "EVENT", + "EXPLICIT", + "EXTERN", + "FALSE", + "FINALLY", + "FIXED", + "FLOAT", + "FOR", + "FOREACH", + "FROM", + "GET", + "GOTO", + "GROUP", + "IF", + "IMPLICIT", + "IN", + "INT", + "INTERFACE", + "INTERNAL", + "INTO", + "IS", + "JOIN", + "LET", + "LOCK", + "LONG", + "NAMEOF", + "NAMESPACE", + "NEW", + "NULL_", + "OBJECT", + "ON", + "OPERATOR", + "ORDERBY", + "OUT", + "OVERRIDE", + "PARAMS", + "PARTIAL", + "PRIVATE", + "PROTECTED", + "PUBLIC", + "READONLY", + "REF", + "REMOVE", + "RETURN", + "SBYTE", + "SEALED", + "SELECT", + "SET", + "SHORT", + "SIZEOF", + "STACKALLOC", + "STATIC", + "STRING", + "STRUCT", + "SWITCH", + "THIS", + "THROW", + "TRUE", + "TRY", + "TYPEOF", + "UINT", + "ULONG", + "UNCHECKED", + "UNMANAGED", + "UNSAFE", + "USHORT", + "USING", + "VAR", + "VIRTUAL", + "VOID", + "VOLATILE", + "WHEN", + "WHERE", + "WHILE", + "YIELD", + "IDENTIFIER", + "LITERAL_ACCESS", + "INTEGER_LITERAL", + "HEX_INTEGER_LITERAL", + "BIN_INTEGER_LITERAL", + "REAL_LITERAL", + "CHARACTER_LITERAL", + "REGULAR_STRING", + "VERBATIUM_STRING", + "INTERPOLATED_REGULAR_STRING_START", + "INTERPOLATED_VERBATIUM_STRING_START", + "OPEN_BRACE", + "CLOSE_BRACE", + "OPEN_BRACKET", + "CLOSE_BRACKET", + "OPEN_PARENS", + "CLOSE_PARENS", + "DOT", + "COMMA", + "COLON", + "SEMICOLON", + "PLUS", + "MINUS", + "STAR", + "DIV", + "PERCENT", + "AMP", + "BITWISE_OR", + "CARET", + "BANG", + "TILDE", + "ASSIGNMENT", + "LT", + "GT", + "INTERR", + "DOUBLE_COLON", + "OP_COALESCING", + "OP_INC", + "OP_DEC", + "OP_AND", + "OP_OR", + "OP_PTR", + "OP_EQ", + "OP_NE", + "OP_LE", + "OP_GE", + "OP_ADD_ASSIGNMENT", + "OP_SUB_ASSIGNMENT", + "OP_MULT_ASSIGNMENT", + "OP_DIV_ASSIGNMENT", + "OP_MOD_ASSIGNMENT", + "OP_AND_ASSIGNMENT", + "OP_OR_ASSIGNMENT", + "OP_XOR_ASSIGNMENT", + "OP_LEFT_SHIFT", + "OP_LEFT_SHIFT_ASSIGNMENT", + "OP_COALESCING_ASSIGNMENT", + "OP_RANGE", + "DOUBLE_CURLY_INSIDE", + "OPEN_BRACE_INSIDE", + "REGULAR_CHAR_INSIDE", + "VERBATIUM_DOUBLE_QUOTE_INSIDE", + "DOUBLE_QUOTE_INSIDE", + "REGULAR_STRING_INSIDE", + "VERBATIUM_INSIDE_STRING", + "CLOSE_BRACE_INSIDE", + "FORMAT_STRING", + "DIRECTIVE_WHITESPACES", + "DIGITS", + "DEFINE", + "UNDEF", + "ELIF", + "ENDIF", + "LINE", + "ERROR", + "WARNING", + "REGION", + "ENDREGION", + "PRAGMA", + "NULLABLE", + "DIRECTIVE_HIDDEN", + "CONDITIONAL_SYMBOL", + "DIRECTIVE_NEW_LINE", + "TEXT", + "DOUBLE_CURLY_CLOSE_INSIDE", + }; + } + + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl( + _LITERAL_NAMES, + _SYMBOLIC_NAMES + ); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + private int interpolatedStringLevel; + private Stack interpolatedVerbatiums = new Stack(); + private Stack curlyLevels = new Stack(); + private boolean verbatium; - protected static final DFA[] _decisionToDFA; - protected static final PredictionContextCache _sharedContextCache = - new PredictionContextCache(); - public static final int - BYTE_ORDER_MARK=1, SINGLE_LINE_DOC_COMMENT=2, EMPTY_DELIMITED_DOC_COMMENT=3, - DELIMITED_DOC_COMMENT=4, SINGLE_LINE_COMMENT=5, DELIMITED_COMMENT=6, WHITESPACES=7, - SHARP=8, ABSTRACT=9, ADD=10, ALIAS=11, ARGLIST=12, AS=13, ASCENDING=14, - ASYNC=15, AWAIT=16, BASE=17, BOOL=18, BREAK=19, BY=20, BYTE=21, CASE=22, - CATCH=23, CHAR=24, CHECKED=25, CLASS=26, CONST=27, CONTINUE=28, DECIMAL=29, - DEFAULT=30, DELEGATE=31, DESCENDING=32, DO=33, DOUBLE=34, DYNAMIC=35, - ELSE=36, ENUM=37, EQUALS=38, EVENT=39, EXPLICIT=40, EXTERN=41, FALSE=42, - FINALLY=43, FIXED=44, FLOAT=45, FOR=46, FOREACH=47, FROM=48, GET=49, GOTO=50, - GROUP=51, IF=52, IMPLICIT=53, IN=54, INT=55, INTERFACE=56, INTERNAL=57, - INTO=58, IS=59, JOIN=60, LET=61, LOCK=62, LONG=63, NAMEOF=64, NAMESPACE=65, - NEW=66, NULL_=67, OBJECT=68, ON=69, OPERATOR=70, ORDERBY=71, OUT=72, OVERRIDE=73, - PARAMS=74, PARTIAL=75, PRIVATE=76, PROTECTED=77, PUBLIC=78, READONLY=79, - REF=80, REMOVE=81, RETURN=82, SBYTE=83, SEALED=84, SELECT=85, SET=86, - SHORT=87, SIZEOF=88, STACKALLOC=89, STATIC=90, STRING=91, STRUCT=92, SWITCH=93, - THIS=94, THROW=95, TRUE=96, TRY=97, TYPEOF=98, UINT=99, ULONG=100, UNCHECKED=101, - UNMANAGED=102, UNSAFE=103, USHORT=104, USING=105, VAR=106, VIRTUAL=107, - VOID=108, VOLATILE=109, WHEN=110, WHERE=111, WHILE=112, YIELD=113, IDENTIFIER=114, - LITERAL_ACCESS=115, INTEGER_LITERAL=116, HEX_INTEGER_LITERAL=117, BIN_INTEGER_LITERAL=118, - REAL_LITERAL=119, CHARACTER_LITERAL=120, REGULAR_STRING=121, VERBATIUM_STRING=122, - INTERPOLATED_REGULAR_STRING_START=123, INTERPOLATED_VERBATIUM_STRING_START=124, - OPEN_BRACE=125, CLOSE_BRACE=126, OPEN_BRACKET=127, CLOSE_BRACKET=128, - OPEN_PARENS=129, CLOSE_PARENS=130, DOT=131, COMMA=132, COLON=133, SEMICOLON=134, - PLUS=135, MINUS=136, STAR=137, DIV=138, PERCENT=139, AMP=140, BITWISE_OR=141, - CARET=142, BANG=143, TILDE=144, ASSIGNMENT=145, LT=146, GT=147, INTERR=148, - DOUBLE_COLON=149, OP_COALESCING=150, OP_INC=151, OP_DEC=152, OP_AND=153, - OP_OR=154, OP_PTR=155, OP_EQ=156, OP_NE=157, OP_LE=158, OP_GE=159, OP_ADD_ASSIGNMENT=160, - OP_SUB_ASSIGNMENT=161, OP_MULT_ASSIGNMENT=162, OP_DIV_ASSIGNMENT=163, - OP_MOD_ASSIGNMENT=164, OP_AND_ASSIGNMENT=165, OP_OR_ASSIGNMENT=166, OP_XOR_ASSIGNMENT=167, - OP_LEFT_SHIFT=168, OP_LEFT_SHIFT_ASSIGNMENT=169, OP_COALESCING_ASSIGNMENT=170, - OP_RANGE=171, DOUBLE_CURLY_INSIDE=172, OPEN_BRACE_INSIDE=173, REGULAR_CHAR_INSIDE=174, - VERBATIUM_DOUBLE_QUOTE_INSIDE=175, DOUBLE_QUOTE_INSIDE=176, REGULAR_STRING_INSIDE=177, - VERBATIUM_INSIDE_STRING=178, CLOSE_BRACE_INSIDE=179, FORMAT_STRING=180, - DIRECTIVE_WHITESPACES=181, DIGITS=182, DEFINE=183, UNDEF=184, ELIF=185, - ENDIF=186, LINE=187, ERROR=188, WARNING=189, REGION=190, ENDREGION=191, - PRAGMA=192, NULLABLE=193, DIRECTIVE_HIDDEN=194, CONDITIONAL_SYMBOL=195, - DIRECTIVE_NEW_LINE=196, TEXT=197, DOUBLE_CURLY_CLOSE_INSIDE=198; - public static final int - COMMENTS_CHANNEL=2, DIRECTIVE=3; - public static final int - INTERPOLATION_STRING=1, INTERPOLATION_FORMAT=2, DIRECTIVE_MODE=3, DIRECTIVE_TEXT=4; - public static String[] channelNames = { - "DEFAULT_TOKEN_CHANNEL", "HIDDEN", "COMMENTS_CHANNEL", "DIRECTIVE" - }; + public CSharpLexer(CharStream input) { + super(input); + _interp = + new LexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache); + } - public static String[] modeNames = { - "DEFAULT_MODE", "INTERPOLATION_STRING", "INTERPOLATION_FORMAT", "DIRECTIVE_MODE", - "DIRECTIVE_TEXT" - }; + @Override + public String getGrammarFileName() { + return "CSharpLexer.g4"; + } - private static String[] makeRuleNames() { - return new String[] { - "BYTE_ORDER_MARK", "SINGLE_LINE_DOC_COMMENT", "EMPTY_DELIMITED_DOC_COMMENT", - "DELIMITED_DOC_COMMENT", "SINGLE_LINE_COMMENT", "DELIMITED_COMMENT", - "WHITESPACES", "SHARP", "ABSTRACT", "ADD", "ALIAS", "ARGLIST", "AS", - "ASCENDING", "ASYNC", "AWAIT", "BASE", "BOOL", "BREAK", "BY", "BYTE", - "CASE", "CATCH", "CHAR", "CHECKED", "CLASS", "CONST", "CONTINUE", "DECIMAL", - "DEFAULT", "DELEGATE", "DESCENDING", "DO", "DOUBLE", "DYNAMIC", "ELSE", - "ENUM", "EQUALS", "EVENT", "EXPLICIT", "EXTERN", "FALSE", "FINALLY", - "FIXED", "FLOAT", "FOR", "FOREACH", "FROM", "GET", "GOTO", "GROUP", "IF", - "IMPLICIT", "IN", "INT", "INTERFACE", "INTERNAL", "INTO", "IS", "JOIN", - "LET", "LOCK", "LONG", "NAMEOF", "NAMESPACE", "NEW", "NULL_", "OBJECT", - "ON", "OPERATOR", "ORDERBY", "OUT", "OVERRIDE", "PARAMS", "PARTIAL", - "PRIVATE", "PROTECTED", "PUBLIC", "READONLY", "REF", "REMOVE", "RETURN", - "SBYTE", "SEALED", "SELECT", "SET", "SHORT", "SIZEOF", "STACKALLOC", - "STATIC", "STRING", "STRUCT", "SWITCH", "THIS", "THROW", "TRUE", "TRY", - "TYPEOF", "UINT", "ULONG", "UNCHECKED", "UNMANAGED", "UNSAFE", "USHORT", - "USING", "VAR", "VIRTUAL", "VOID", "VOLATILE", "WHEN", "WHERE", "WHILE", - "YIELD", "IDENTIFIER", "LITERAL_ACCESS", "INTEGER_LITERAL", "HEX_INTEGER_LITERAL", - "BIN_INTEGER_LITERAL", "REAL_LITERAL", "CHARACTER_LITERAL", "REGULAR_STRING", - "VERBATIUM_STRING", "INTERPOLATED_REGULAR_STRING_START", "INTERPOLATED_VERBATIUM_STRING_START", - "OPEN_BRACE", "CLOSE_BRACE", "OPEN_BRACKET", "CLOSE_BRACKET", "OPEN_PARENS", - "CLOSE_PARENS", "DOT", "COMMA", "COLON", "SEMICOLON", "PLUS", "MINUS", - "STAR", "DIV", "PERCENT", "AMP", "BITWISE_OR", "CARET", "BANG", "TILDE", - "ASSIGNMENT", "LT", "GT", "INTERR", "DOUBLE_COLON", "OP_COALESCING", - "OP_INC", "OP_DEC", "OP_AND", "OP_OR", "OP_PTR", "OP_EQ", "OP_NE", "OP_LE", - "OP_GE", "OP_ADD_ASSIGNMENT", "OP_SUB_ASSIGNMENT", "OP_MULT_ASSIGNMENT", - "OP_DIV_ASSIGNMENT", "OP_MOD_ASSIGNMENT", "OP_AND_ASSIGNMENT", "OP_OR_ASSIGNMENT", - "OP_XOR_ASSIGNMENT", "OP_LEFT_SHIFT", "OP_LEFT_SHIFT_ASSIGNMENT", "OP_COALESCING_ASSIGNMENT", - "OP_RANGE", "DOUBLE_CURLY_INSIDE", "OPEN_BRACE_INSIDE", "REGULAR_CHAR_INSIDE", - "VERBATIUM_DOUBLE_QUOTE_INSIDE", "DOUBLE_QUOTE_INSIDE", "REGULAR_STRING_INSIDE", - "VERBATIUM_INSIDE_STRING", "DOUBLE_CURLY_CLOSE_INSIDE", "CLOSE_BRACE_INSIDE", - "FORMAT_STRING", "DIRECTIVE_WHITESPACES", "DIGITS", "DIRECTIVE_TRUE", - "DIRECTIVE_FALSE", "DEFINE", "UNDEF", "DIRECTIVE_IF", "ELIF", "DIRECTIVE_ELSE", - "ENDIF", "LINE", "ERROR", "WARNING", "REGION", "ENDREGION", "PRAGMA", - "NULLABLE", "DIRECTIVE_DEFAULT", "DIRECTIVE_HIDDEN", "DIRECTIVE_OPEN_PARENS", - "DIRECTIVE_CLOSE_PARENS", "DIRECTIVE_BANG", "DIRECTIVE_OP_EQ", "DIRECTIVE_OP_NE", - "DIRECTIVE_OP_AND", "DIRECTIVE_OP_OR", "DIRECTIVE_STRING", "CONDITIONAL_SYMBOL", - "DIRECTIVE_SINGLE_LINE_COMMENT", "DIRECTIVE_NEW_LINE", "TEXT", "TEXT_NEW_LINE", - "InputCharacter", "NewLineCharacter", "IntegerTypeSuffix", "ExponentPart", - "CommonCharacter", "SimpleEscapeSequence", "HexEscapeSequence", "NewLine", - "Whitespace", "UnicodeClassZS", "IdentifierOrKeyword", "IdentifierStartCharacter", - "IdentifierPartCharacter", "LetterCharacter", "DecimalDigitCharacter", - "ConnectingCharacter", "CombiningCharacter", "FormattingCharacter", "UnicodeEscapeSequence", - "HexDigit", "UnicodeClassLU", "UnicodeClassLL", "UnicodeClassLT", "UnicodeClassLM", - "UnicodeClassLO", "UnicodeClassNL", "UnicodeClassMN", "UnicodeClassMC", - "UnicodeClassCF", "UnicodeClassPC", "UnicodeClassND" - }; - } - public static final String[] ruleNames = makeRuleNames(); + @Override + public String[] getRuleNames() { + return ruleNames; + } - private static String[] makeLiteralNames() { - return new String[] { - null, "'\u00EF\u00BB\u00BF'", null, "'/***/'", null, null, null, null, - "'#'", "'abstract'", "'add'", "'alias'", "'__arglist'", "'as'", "'ascending'", - "'async'", "'await'", "'base'", "'bool'", "'break'", "'by'", "'byte'", - "'case'", "'catch'", "'char'", "'checked'", "'class'", "'const'", "'continue'", - "'decimal'", "'default'", "'delegate'", "'descending'", "'do'", "'double'", - "'dynamic'", "'else'", "'enum'", "'equals'", "'event'", "'explicit'", - "'extern'", "'false'", "'finally'", "'fixed'", "'float'", "'for'", "'foreach'", - "'from'", "'get'", "'goto'", "'group'", "'if'", "'implicit'", "'in'", - "'int'", "'interface'", "'internal'", "'into'", "'is'", "'join'", "'let'", - "'lock'", "'long'", "'nameof'", "'namespace'", "'new'", "'null'", "'object'", - "'on'", "'operator'", "'orderby'", "'out'", "'override'", "'params'", - "'partial'", "'private'", "'protected'", "'public'", "'readonly'", "'ref'", - "'remove'", "'return'", "'sbyte'", "'sealed'", "'select'", "'set'", "'short'", - "'sizeof'", "'stackalloc'", "'static'", "'string'", "'struct'", "'switch'", - "'this'", "'throw'", "'true'", "'try'", "'typeof'", "'uint'", "'ulong'", - "'unchecked'", "'unmanaged'", "'unsafe'", "'ushort'", "'using'", "'var'", - "'virtual'", "'void'", "'volatile'", "'when'", "'where'", "'while'", - "'yield'", null, null, null, null, null, null, null, null, null, null, - null, "'{'", "'}'", "'['", "']'", "'('", "')'", "'.'", "','", "':'", - "';'", "'+'", "'-'", "'*'", "'/'", "'%'", "'&'", "'|'", "'^'", "'!'", - "'~'", "'='", "'<'", "'>'", "'?'", "'::'", "'??'", "'++'", "'--'", "'&&'", - "'||'", "'->'", "'=='", "'!='", "'<='", "'>='", "'+='", "'-='", "'*='", - "'/='", "'%='", "'&='", "'|='", "'^='", "'<<'", "'<<='", "'??='", "'..'", - "'{{'", null, null, null, null, null, null, null, null, null, null, "'define'", - "'undef'", "'elif'", "'endif'", "'line'", null, null, null, null, null, - null, "'hidden'", null, null, null, "'}}'" - }; - } - private static final String[] _LITERAL_NAMES = makeLiteralNames(); - private static String[] makeSymbolicNames() { - return new String[] { - null, "BYTE_ORDER_MARK", "SINGLE_LINE_DOC_COMMENT", "EMPTY_DELIMITED_DOC_COMMENT", - "DELIMITED_DOC_COMMENT", "SINGLE_LINE_COMMENT", "DELIMITED_COMMENT", - "WHITESPACES", "SHARP", "ABSTRACT", "ADD", "ALIAS", "ARGLIST", "AS", - "ASCENDING", "ASYNC", "AWAIT", "BASE", "BOOL", "BREAK", "BY", "BYTE", - "CASE", "CATCH", "CHAR", "CHECKED", "CLASS", "CONST", "CONTINUE", "DECIMAL", - "DEFAULT", "DELEGATE", "DESCENDING", "DO", "DOUBLE", "DYNAMIC", "ELSE", - "ENUM", "EQUALS", "EVENT", "EXPLICIT", "EXTERN", "FALSE", "FINALLY", - "FIXED", "FLOAT", "FOR", "FOREACH", "FROM", "GET", "GOTO", "GROUP", "IF", - "IMPLICIT", "IN", "INT", "INTERFACE", "INTERNAL", "INTO", "IS", "JOIN", - "LET", "LOCK", "LONG", "NAMEOF", "NAMESPACE", "NEW", "NULL_", "OBJECT", - "ON", "OPERATOR", "ORDERBY", "OUT", "OVERRIDE", "PARAMS", "PARTIAL", - "PRIVATE", "PROTECTED", "PUBLIC", "READONLY", "REF", "REMOVE", "RETURN", - "SBYTE", "SEALED", "SELECT", "SET", "SHORT", "SIZEOF", "STACKALLOC", - "STATIC", "STRING", "STRUCT", "SWITCH", "THIS", "THROW", "TRUE", "TRY", - "TYPEOF", "UINT", "ULONG", "UNCHECKED", "UNMANAGED", "UNSAFE", "USHORT", - "USING", "VAR", "VIRTUAL", "VOID", "VOLATILE", "WHEN", "WHERE", "WHILE", - "YIELD", "IDENTIFIER", "LITERAL_ACCESS", "INTEGER_LITERAL", "HEX_INTEGER_LITERAL", - "BIN_INTEGER_LITERAL", "REAL_LITERAL", "CHARACTER_LITERAL", "REGULAR_STRING", - "VERBATIUM_STRING", "INTERPOLATED_REGULAR_STRING_START", "INTERPOLATED_VERBATIUM_STRING_START", - "OPEN_BRACE", "CLOSE_BRACE", "OPEN_BRACKET", "CLOSE_BRACKET", "OPEN_PARENS", - "CLOSE_PARENS", "DOT", "COMMA", "COLON", "SEMICOLON", "PLUS", "MINUS", - "STAR", "DIV", "PERCENT", "AMP", "BITWISE_OR", "CARET", "BANG", "TILDE", - "ASSIGNMENT", "LT", "GT", "INTERR", "DOUBLE_COLON", "OP_COALESCING", - "OP_INC", "OP_DEC", "OP_AND", "OP_OR", "OP_PTR", "OP_EQ", "OP_NE", "OP_LE", - "OP_GE", "OP_ADD_ASSIGNMENT", "OP_SUB_ASSIGNMENT", "OP_MULT_ASSIGNMENT", - "OP_DIV_ASSIGNMENT", "OP_MOD_ASSIGNMENT", "OP_AND_ASSIGNMENT", "OP_OR_ASSIGNMENT", - "OP_XOR_ASSIGNMENT", "OP_LEFT_SHIFT", "OP_LEFT_SHIFT_ASSIGNMENT", "OP_COALESCING_ASSIGNMENT", - "OP_RANGE", "DOUBLE_CURLY_INSIDE", "OPEN_BRACE_INSIDE", "REGULAR_CHAR_INSIDE", - "VERBATIUM_DOUBLE_QUOTE_INSIDE", "DOUBLE_QUOTE_INSIDE", "REGULAR_STRING_INSIDE", - "VERBATIUM_INSIDE_STRING", "CLOSE_BRACE_INSIDE", "FORMAT_STRING", "DIRECTIVE_WHITESPACES", - "DIGITS", "DEFINE", "UNDEF", "ELIF", "ENDIF", "LINE", "ERROR", "WARNING", - "REGION", "ENDREGION", "PRAGMA", "NULLABLE", "DIRECTIVE_HIDDEN", "CONDITIONAL_SYMBOL", - "DIRECTIVE_NEW_LINE", "TEXT", "DOUBLE_CURLY_CLOSE_INSIDE" - }; - } - private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); - public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); + @Override + public String getSerializedATN() { + return _serializedATN; + } - /** - * @deprecated Use {@link #VOCABULARY} instead. - */ - @Deprecated - public static final String[] tokenNames; - static { - tokenNames = new String[_SYMBOLIC_NAMES.length]; - for (int i = 0; i < tokenNames.length; i++) { - tokenNames[i] = VOCABULARY.getLiteralName(i); - if (tokenNames[i] == null) { - tokenNames[i] = VOCABULARY.getSymbolicName(i); - } + @Override + public String[] getChannelNames() { + return channelNames; + } - if (tokenNames[i] == null) { - tokenNames[i] = ""; - } - } - } + @Override + public String[] getModeNames() { + return modeNames; + } - @Override - @Deprecated - public String[] getTokenNames() { - return tokenNames; - } + @Override + public ATN getATN() { + return _ATN; + } - @Override + @Override + public void action(RuleContext _localctx, int ruleIndex, int actionIndex) { + switch (ruleIndex) { + case 122: + INTERPOLATED_REGULAR_STRING_START_action( + (RuleContext) _localctx, + actionIndex + ); + break; + case 123: + INTERPOLATED_VERBATIUM_STRING_START_action( + (RuleContext) _localctx, + actionIndex + ); + break; + case 124: + OPEN_BRACE_action((RuleContext) _localctx, actionIndex); + break; + case 125: + CLOSE_BRACE_action((RuleContext) _localctx, actionIndex); + break; + case 132: + COLON_action((RuleContext) _localctx, actionIndex); + break; + case 172: + OPEN_BRACE_INSIDE_action((RuleContext) _localctx, actionIndex); + break; + case 175: + DOUBLE_QUOTE_INSIDE_action((RuleContext) _localctx, actionIndex); + break; + case 179: + CLOSE_BRACE_INSIDE_action((RuleContext) _localctx, actionIndex); + break; + } + } - public Vocabulary getVocabulary() { - return VOCABULARY; - } + private void INTERPOLATED_REGULAR_STRING_START_action( + RuleContext _localctx, + int actionIndex + ) { + switch (actionIndex) { + case 0: + interpolatedStringLevel++; + interpolatedVerbatiums.push(false); + verbatium = false; + break; + } + } - private int interpolatedStringLevel; - private Stack interpolatedVerbatiums = new Stack(); - private Stack curlyLevels = new Stack(); - private boolean verbatium; + private void INTERPOLATED_VERBATIUM_STRING_START_action( + RuleContext _localctx, + int actionIndex + ) { + switch (actionIndex) { + case 1: + interpolatedStringLevel++; + interpolatedVerbatiums.push(true); + verbatium = true; + break; + } + } + private void OPEN_BRACE_action(RuleContext _localctx, int actionIndex) { + switch (actionIndex) { + case 2: + if (interpolatedStringLevel > 0) { + curlyLevels.push(curlyLevels.pop() + 1); + } + break; + } + } - public CSharpLexer(CharStream input) { - super(input); - _interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); - } + private void CLOSE_BRACE_action(RuleContext _localctx, int actionIndex) { + switch (actionIndex) { + case 3: + if (interpolatedStringLevel > 0) { + curlyLevels.push(curlyLevels.pop() - 1); + if (curlyLevels.peek() == 0) { + curlyLevels.pop(); + skip(); + popMode(); + } + } - @Override - public String getGrammarFileName() { return "CSharpLexer.g4"; } + break; + } + } - @Override - public String[] getRuleNames() { return ruleNames; } + private void COLON_action(RuleContext _localctx, int actionIndex) { + switch (actionIndex) { + case 4: + if (interpolatedStringLevel > 0) { + int ind = 1; + boolean switchToFormatString = true; + while ((char) _input.LA(ind) != '}') { + if (_input.LA(ind) == ':' || _input.LA(ind) == ')') { + switchToFormatString = false; + break; + } + ind++; + } + if (switchToFormatString) { + mode(INTERPOLATION_FORMAT); + } + } - @Override - public String getSerializedATN() { return _serializedATN; } + break; + } + } - @Override - public String[] getChannelNames() { return channelNames; } + private void OPEN_BRACE_INSIDE_action( + RuleContext _localctx, + int actionIndex + ) { + switch (actionIndex) { + case 5: + curlyLevels.push(1); + break; + } + } - @Override - public String[] getModeNames() { return modeNames; } + private void DOUBLE_QUOTE_INSIDE_action( + RuleContext _localctx, + int actionIndex + ) { + switch (actionIndex) { + case 6: + interpolatedStringLevel--; + interpolatedVerbatiums.pop(); + verbatium = + (interpolatedVerbatiums.size() > 0 + ? interpolatedVerbatiums.peek() + : false); + break; + } + } - @Override - public ATN getATN() { return _ATN; } + private void CLOSE_BRACE_INSIDE_action( + RuleContext _localctx, + int actionIndex + ) { + switch (actionIndex) { + case 7: + curlyLevels.pop(); + break; + } + } - @Override - public void action(RuleContext _localctx, int ruleIndex, int actionIndex) { - switch (ruleIndex) { - case 122: - INTERPOLATED_REGULAR_STRING_START_action((RuleContext)_localctx, actionIndex); - break; - case 123: - INTERPOLATED_VERBATIUM_STRING_START_action((RuleContext)_localctx, actionIndex); - break; - case 124: - OPEN_BRACE_action((RuleContext)_localctx, actionIndex); - break; - case 125: - CLOSE_BRACE_action((RuleContext)_localctx, actionIndex); - break; - case 132: - COLON_action((RuleContext)_localctx, actionIndex); - break; - case 172: - OPEN_BRACE_INSIDE_action((RuleContext)_localctx, actionIndex); - break; - case 175: - DOUBLE_QUOTE_INSIDE_action((RuleContext)_localctx, actionIndex); - break; - case 179: - CLOSE_BRACE_INSIDE_action((RuleContext)_localctx, actionIndex); - break; - } - } - private void INTERPOLATED_REGULAR_STRING_START_action(RuleContext _localctx, int actionIndex) { - switch (actionIndex) { - case 0: - interpolatedStringLevel++; interpolatedVerbatiums.push(false); verbatium = false; - break; - } - } - private void INTERPOLATED_VERBATIUM_STRING_START_action(RuleContext _localctx, int actionIndex) { - switch (actionIndex) { - case 1: - interpolatedStringLevel++; interpolatedVerbatiums.push(true); verbatium = true; - break; - } - } - private void OPEN_BRACE_action(RuleContext _localctx, int actionIndex) { - switch (actionIndex) { - case 2: + @Override + public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { + switch (ruleIndex) { + case 173: + return REGULAR_CHAR_INSIDE_sempred((RuleContext) _localctx, predIndex); + case 174: + return VERBATIUM_DOUBLE_QUOTE_INSIDE_sempred( + (RuleContext) _localctx, + predIndex + ); + case 176: + return REGULAR_STRING_INSIDE_sempred( + (RuleContext) _localctx, + predIndex + ); + case 177: + return VERBATIUM_INSIDE_STRING_sempred( + (RuleContext) _localctx, + predIndex + ); + } + return true; + } - if (interpolatedStringLevel > 0) - { - curlyLevels.push(curlyLevels.pop() + 1); - } - break; - } - } - private void CLOSE_BRACE_action(RuleContext _localctx, int actionIndex) { - switch (actionIndex) { - case 3: + private boolean REGULAR_CHAR_INSIDE_sempred( + RuleContext _localctx, + int predIndex + ) { + switch (predIndex) { + case 0: + return !verbatium; + } + return true; + } - if (interpolatedStringLevel > 0) - { - curlyLevels.push(curlyLevels.pop() - 1); - if (curlyLevels.peek() == 0) - { - curlyLevels.pop(); - skip(); - popMode(); - } - } + private boolean VERBATIUM_DOUBLE_QUOTE_INSIDE_sempred( + RuleContext _localctx, + int predIndex + ) { + switch (predIndex) { + case 1: + return verbatium; + } + return true; + } - break; - } - } - private void COLON_action(RuleContext _localctx, int actionIndex) { - switch (actionIndex) { - case 4: + private boolean REGULAR_STRING_INSIDE_sempred( + RuleContext _localctx, + int predIndex + ) { + switch (predIndex) { + case 2: + return !verbatium; + } + return true; + } - if (interpolatedStringLevel > 0) - { - int ind = 1; - boolean switchToFormatString = true; - while ((char)_input.LA(ind) != '}') - { - if (_input.LA(ind) == ':' || _input.LA(ind) == ')') - { - switchToFormatString = false; - break; - } - ind++; - } - if (switchToFormatString) - { - mode(INTERPOLATION_FORMAT); - } - } + private boolean VERBATIUM_INSIDE_STRING_sempred( + RuleContext _localctx, + int predIndex + ) { + switch (predIndex) { + case 3: + return verbatium; + } + return true; + } - break; - } - } - private void OPEN_BRACE_INSIDE_action(RuleContext _localctx, int actionIndex) { - switch (actionIndex) { - case 5: - curlyLevels.push(1); - break; - } - } - private void DOUBLE_QUOTE_INSIDE_action(RuleContext _localctx, int actionIndex) { - switch (actionIndex) { - case 6: - interpolatedStringLevel--; interpolatedVerbatiums.pop(); - verbatium = (interpolatedVerbatiums.size() > 0 ? interpolatedVerbatiums.peek() : false); - break; - } - } - private void CLOSE_BRACE_INSIDE_action(RuleContext _localctx, int actionIndex) { - switch (actionIndex) { - case 7: - curlyLevels.pop(); - break; - } - } - @Override - public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { - switch (ruleIndex) { - case 173: - return REGULAR_CHAR_INSIDE_sempred((RuleContext)_localctx, predIndex); - case 174: - return VERBATIUM_DOUBLE_QUOTE_INSIDE_sempred((RuleContext)_localctx, predIndex); - case 176: - return REGULAR_STRING_INSIDE_sempred((RuleContext)_localctx, predIndex); - case 177: - return VERBATIUM_INSIDE_STRING_sempred((RuleContext)_localctx, predIndex); - } - return true; - } - private boolean REGULAR_CHAR_INSIDE_sempred(RuleContext _localctx, int predIndex) { - switch (predIndex) { - case 0: - return !verbatium ; - } - return true; - } - private boolean VERBATIUM_DOUBLE_QUOTE_INSIDE_sempred(RuleContext _localctx, int predIndex) { - switch (predIndex) { - case 1: - return verbatium ; - } - return true; - } - private boolean REGULAR_STRING_INSIDE_sempred(RuleContext _localctx, int predIndex) { - switch (predIndex) { - case 2: - return !verbatium ; - } - return true; - } - private boolean VERBATIUM_INSIDE_STRING_sempred(RuleContext _localctx, int predIndex) { - switch (predIndex) { - case 3: - return verbatium ; - } - return true; - } + public static final String _serializedATN = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\u00c8\u0816\b\1\b" + + "\1\b\1\b\1\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b" + + "\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t" + + "\20\4\21\t\21\4\22\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t" + + "\27\4\30\t\30\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t" + + "\36\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t" + + "(\4)\t)\4*\t*\4+\t+\4,\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t" + + "\62\4\63\t\63\4\64\t\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t" + + ":\4;\t;\4<\t<\4=\t=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4" + + "F\tF\4G\tG\4H\tH\4I\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\t" + + "Q\4R\tR\4S\tS\4T\tT\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\" + + "\4]\t]\4^\t^\4_\t_\4`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h" + + "\th\4i\ti\4j\tj\4k\tk\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4q\tq\4r\tr\4s\ts" + + "\4t\tt\4u\tu\4v\tv\4w\tw\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177" + + "\t\177\4\u0080\t\u0080\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083" + + "\4\u0084\t\u0084\4\u0085\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087\4\u0088" + + "\t\u0088\4\u0089\t\u0089\4\u008a\t\u008a\4\u008b\t\u008b\4\u008c\t\u008c" + + "\4\u008d\t\u008d\4\u008e\t\u008e\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091" + + "\t\u0091\4\u0092\t\u0092\4\u0093\t\u0093\4\u0094\t\u0094\4\u0095\t\u0095" + + "\4\u0096\t\u0096\4\u0097\t\u0097\4\u0098\t\u0098\4\u0099\t\u0099\4\u009a" + + "\t\u009a\4\u009b\t\u009b\4\u009c\t\u009c\4\u009d\t\u009d\4\u009e\t\u009e" + + "\4\u009f\t\u009f\4\u00a0\t\u00a0\4\u00a1\t\u00a1\4\u00a2\t\u00a2\4\u00a3" + + "\t\u00a3\4\u00a4\t\u00a4\4\u00a5\t\u00a5\4\u00a6\t\u00a6\4\u00a7\t\u00a7" + + "\4\u00a8\t\u00a8\4\u00a9\t\u00a9\4\u00aa\t\u00aa\4\u00ab\t\u00ab\4\u00ac" + + "\t\u00ac\4\u00ad\t\u00ad\4\u00ae\t\u00ae\4\u00af\t\u00af\4\u00b0\t\u00b0" + + "\4\u00b1\t\u00b1\4\u00b2\t\u00b2\4\u00b3\t\u00b3\4\u00b4\t\u00b4\4\u00b5" + + "\t\u00b5\4\u00b6\t\u00b6\4\u00b7\t\u00b7\4\u00b8\t\u00b8\4\u00b9\t\u00b9" + + "\4\u00ba\t\u00ba\4\u00bb\t\u00bb\4\u00bc\t\u00bc\4\u00bd\t\u00bd\4\u00be" + + "\t\u00be\4\u00bf\t\u00bf\4\u00c0\t\u00c0\4\u00c1\t\u00c1\4\u00c2\t\u00c2" + + "\4\u00c3\t\u00c3\4\u00c4\t\u00c4\4\u00c5\t\u00c5\4\u00c6\t\u00c6\4\u00c7" + + "\t\u00c7\4\u00c8\t\u00c8\4\u00c9\t\u00c9\4\u00ca\t\u00ca\4\u00cb\t\u00cb" + + "\4\u00cc\t\u00cc\4\u00cd\t\u00cd\4\u00ce\t\u00ce\4\u00cf\t\u00cf\4\u00d0" + + "\t\u00d0\4\u00d1\t\u00d1\4\u00d2\t\u00d2\4\u00d3\t\u00d3\4\u00d4\t\u00d4" + + "\4\u00d5\t\u00d5\4\u00d6\t\u00d6\4\u00d7\t\u00d7\4\u00d8\t\u00d8\4\u00d9" + + "\t\u00d9\4\u00da\t\u00da\4\u00db\t\u00db\4\u00dc\t\u00dc\4\u00dd\t\u00dd" + + "\4\u00de\t\u00de\4\u00df\t\u00df\4\u00e0\t\u00e0\4\u00e1\t\u00e1\4\u00e2" + + "\t\u00e2\4\u00e3\t\u00e3\4\u00e4\t\u00e4\4\u00e5\t\u00e5\4\u00e6\t\u00e6" + + "\4\u00e7\t\u00e7\4\u00e8\t\u00e8\4\u00e9\t\u00e9\4\u00ea\t\u00ea\4\u00eb" + + "\t\u00eb\4\u00ec\t\u00ec\4\u00ed\t\u00ed\4\u00ee\t\u00ee\4\u00ef\t\u00ef" + + "\4\u00f0\t\u00f0\4\u00f1\t\u00f1\4\u00f2\t\u00f2\4\u00f3\t\u00f3\4\u00f4" + + "\t\u00f4\4\u00f5\t\u00f5\3\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\7\3\u01f9" + + "\n\3\f\3\16\3\u01fc\13\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3" + + "\5\3\5\3\5\3\5\3\5\7\5\u020e\n\5\f\5\16\5\u0211\13\5\3\5\3\5\3\5\3\5\3" + + "\5\3\6\3\6\3\6\3\6\7\6\u021c\n\6\f\6\16\6\u021f\13\6\3\6\3\6\3\7\3\7\3" + + "\7\3\7\7\7\u0227\n\7\f\7\16\7\u022a\13\7\3\7\3\7\3\7\3\7\3\7\3\b\3\b\6" + + "\b\u0233\n\b\r\b\16\b\u0234\3\b\3\b\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3" + + "\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r" + + "\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3" + + "\17\3\17\3\17\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\20\3\20\3\21\3\21\3" + + "\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23\3" + + "\24\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\26\3\26\3\26\3\26\3\26\3" + + "\27\3\27\3\27\3\27\3\27\3\30\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\31\3" + + "\31\3\31\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3" + + "\33\3\33\3\34\3\34\3\34\3\34\3\34\3\34\3\35\3\35\3\35\3\35\3\35\3\35\3" + + "\35\3\35\3\35\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\37\3\37\3\37\3" + + "\37\3\37\3\37\3\37\3\37\3 \3 \3 \3 \3 \3 \3 \3 \3 \3!\3!\3!\3!\3!\3!\3" + + "!\3!\3!\3!\3!\3\"\3\"\3\"\3#\3#\3#\3#\3#\3#\3#\3$\3$\3$\3$\3$\3$\3$\3" + + "$\3%\3%\3%\3%\3%\3&\3&\3&\3&\3&\3\'\3\'\3\'\3\'\3\'\3\'\3\'\3(\3(\3(\3" + + "(\3(\3(\3)\3)\3)\3)\3)\3)\3)\3)\3)\3*\3*\3*\3*\3*\3*\3*\3+\3+\3+\3+\3" + + "+\3+\3,\3,\3,\3,\3,\3,\3,\3,\3-\3-\3-\3-\3-\3-\3.\3.\3.\3.\3.\3.\3/\3" + + "/\3/\3/\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\61\3\61\3\61\3\61\3" + + "\61\3\62\3\62\3\62\3\62\3\63\3\63\3\63\3\63\3\63\3\64\3\64\3\64\3\64\3" + + "\64\3\64\3\65\3\65\3\65\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3" + + "\67\3\67\3\67\38\38\38\38\39\39\39\39\39\39\39\39\39\39\3:\3:\3:\3:\3" + + ":\3:\3:\3:\3:\3;\3;\3;\3;\3;\3<\3<\3<\3=\3=\3=\3=\3=\3>\3>\3>\3>\3?\3" + + "?\3?\3?\3?\3@\3@\3@\3@\3@\3A\3A\3A\3A\3A\3A\3A\3B\3B\3B\3B\3B\3B\3B\3" + + "B\3B\3B\3C\3C\3C\3C\3D\3D\3D\3D\3D\3E\3E\3E\3E\3E\3E\3E\3F\3F\3F\3G\3" + + "G\3G\3G\3G\3G\3G\3G\3G\3H\3H\3H\3H\3H\3H\3H\3H\3I\3I\3I\3I\3J\3J\3J\3" + + "J\3J\3J\3J\3J\3J\3K\3K\3K\3K\3K\3K\3K\3L\3L\3L\3L\3L\3L\3L\3L\3M\3M\3" + + "M\3M\3M\3M\3M\3M\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3O\3O\3O\3O\3O\3O\3O\3" + + "P\3P\3P\3P\3P\3P\3P\3P\3P\3Q\3Q\3Q\3Q\3R\3R\3R\3R\3R\3R\3R\3S\3S\3S\3" + + "S\3S\3S\3S\3T\3T\3T\3T\3T\3T\3U\3U\3U\3U\3U\3U\3U\3V\3V\3V\3V\3V\3V\3" + + "V\3W\3W\3W\3W\3X\3X\3X\3X\3X\3X\3Y\3Y\3Y\3Y\3Y\3Y\3Y\3Z\3Z\3Z\3Z\3Z\3" + + "Z\3Z\3Z\3Z\3Z\3Z\3[\3[\3[\3[\3[\3[\3[\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3]\3" + + "]\3]\3]\3]\3]\3]\3^\3^\3^\3^\3^\3^\3^\3_\3_\3_\3_\3_\3`\3`\3`\3`\3`\3" + + "`\3a\3a\3a\3a\3a\3b\3b\3b\3b\3c\3c\3c\3c\3c\3c\3c\3d\3d\3d\3d\3d\3e\3" + + "e\3e\3e\3e\3e\3f\3f\3f\3f\3f\3f\3f\3f\3f\3f\3g\3g\3g\3g\3g\3g\3g\3g\3" + + "g\3g\3h\3h\3h\3h\3h\3h\3h\3i\3i\3i\3i\3i\3i\3i\3j\3j\3j\3j\3j\3j\3k\3" + + "k\3k\3k\3l\3l\3l\3l\3l\3l\3l\3l\3m\3m\3m\3m\3m\3n\3n\3n\3n\3n\3n\3n\3" + + "n\3n\3o\3o\3o\3o\3o\3p\3p\3p\3p\3p\3p\3q\3q\3q\3q\3q\3q\3r\3r\3r\3r\3" + + "r\3r\3s\5s\u04e1\ns\3s\3s\3t\3t\7t\u04e7\nt\ft\16t\u04ea\13t\3t\7t\u04ed" + + "\nt\ft\16t\u04f0\13t\3t\5t\u04f3\nt\3t\3t\5t\u04f7\nt\3t\3t\3u\3u\7u\u04fd" + + "\nu\fu\16u\u0500\13u\3u\7u\u0503\nu\fu\16u\u0506\13u\3u\5u\u0509\nu\3" + + "v\3v\3v\7v\u050e\nv\fv\16v\u0511\13v\3v\6v\u0514\nv\rv\16v\u0515\3v\5" + + "v\u0519\nv\3w\3w\3w\7w\u051e\nw\fw\16w\u0521\13w\3w\6w\u0524\nw\rw\16" + + "w\u0525\3w\5w\u0529\nw\3x\3x\7x\u052d\nx\fx\16x\u0530\13x\3x\7x\u0533" + + "\nx\fx\16x\u0536\13x\5x\u0538\nx\3x\3x\3x\7x\u053d\nx\fx\16x\u0540\13" + + "x\3x\7x\u0543\nx\fx\16x\u0546\13x\3x\5x\u0549\nx\3x\5x\u054c\nx\3x\3x" + + "\7x\u0550\nx\fx\16x\u0553\13x\3x\7x\u0556\nx\fx\16x\u0559\13x\3x\3x\3" + + "x\5x\u055e\nx\5x\u0560\nx\5x\u0562\nx\3y\3y\3y\5y\u0567\ny\3y\3y\3z\3" + + "z\3z\7z\u056e\nz\fz\16z\u0571\13z\3z\3z\3{\3{\3{\3{\3{\3{\7{\u057b\n{" + + "\f{\16{\u057e\13{\3{\3{\3|\3|\3|\3|\3|\3|\3|\3}\3}\3}\3}\3}\3}\3}\3}\3" + + "~\3~\3~\3\177\3\177\3\177\3\u0080\3\u0080\3\u0081\3\u0081\3\u0082\3\u0082" + + "\3\u0083\3\u0083\3\u0084\3\u0084\3\u0085\3\u0085\3\u0086\3\u0086\3\u0086" + + "\3\u0087\3\u0087\3\u0088\3\u0088\3\u0089\3\u0089\3\u008a\3\u008a\3\u008b" + + "\3\u008b\3\u008c\3\u008c\3\u008d\3\u008d\3\u008e\3\u008e\3\u008f\3\u008f" + + "\3\u0090\3\u0090\3\u0091\3\u0091\3\u0092\3\u0092\3\u0093\3\u0093\3\u0094" + + "\3\u0094\3\u0095\3\u0095\3\u0096\3\u0096\3\u0096\3\u0097\3\u0097\3\u0097" + + "\3\u0098\3\u0098\3\u0098\3\u0099\3\u0099\3\u0099\3\u009a\3\u009a\3\u009a" + + "\3\u009b\3\u009b\3\u009b\3\u009c\3\u009c\3\u009c\3\u009d\3\u009d\3\u009d" + + "\3\u009e\3\u009e\3\u009e\3\u009f\3\u009f\3\u009f\3\u00a0\3\u00a0\3\u00a0" + + "\3\u00a1\3\u00a1\3\u00a1\3\u00a2\3\u00a2\3\u00a2\3\u00a3\3\u00a3\3\u00a3" + + "\3\u00a4\3\u00a4\3\u00a4\3\u00a5\3\u00a5\3\u00a5\3\u00a6\3\u00a6\3\u00a6" + + "\3\u00a7\3\u00a7\3\u00a7\3\u00a8\3\u00a8\3\u00a8\3\u00a9\3\u00a9\3\u00a9" + + "\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00ab\3\u00ab\3\u00ab\3\u00ab\3\u00ac" + + "\3\u00ac\3\u00ac\3\u00ad\3\u00ad\3\u00ad\3\u00ae\3\u00ae\3\u00ae\3\u00ae" + + "\3\u00ae\3\u00ae\3\u00af\3\u00af\3\u00af\3\u00b0\3\u00b0\3\u00b0\3\u00b0" + + "\3\u00b1\3\u00b1\3\u00b1\3\u00b1\3\u00b1\3\u00b2\3\u00b2\6\u00b2\u0622" + + "\n\u00b2\r\u00b2\16\u00b2\u0623\3\u00b3\3\u00b3\6\u00b3\u0628\n\u00b3" + + "\r\u00b3\16\u00b3\u0629\3\u00b4\3\u00b4\3\u00b4\3\u00b4\3\u00b4\3\u00b5" + + "\3\u00b5\3\u00b5\3\u00b5\3\u00b5\3\u00b5\3\u00b6\6\u00b6\u0638\n\u00b6" + + "\r\u00b6\16\u00b6\u0639\3\u00b7\6\u00b7\u063d\n\u00b7\r\u00b7\16\u00b7" + + "\u063e\3\u00b7\3\u00b7\3\u00b8\6\u00b8\u0644\n\u00b8\r\u00b8\16\u00b8" + + "\u0645\3\u00b8\3\u00b8\3\u00b9\3\u00b9\3\u00b9\3\u00b9\3\u00b9\3\u00b9" + + "\3\u00b9\3\u00b9\3\u00ba\3\u00ba\3\u00ba\3\u00ba\3\u00ba\3\u00ba\3\u00ba" + + "\3\u00ba\3\u00ba\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bb" + + "\3\u00bb\3\u00bb\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc" + + "\3\u00bc\3\u00bd\3\u00bd\3\u00bd\3\u00bd\3\u00bd\3\u00bd\3\u00be\3\u00be" + + "\3\u00be\3\u00be\3\u00be\3\u00be\3\u00be\3\u00bf\3\u00bf\3\u00bf\3\u00bf" + + "\3\u00bf\3\u00bf\3\u00bf\3\u00bf\3\u00c0\3\u00c0\3\u00c0\3\u00c0\3\u00c0" + + "\3\u00c0\3\u00c0\3\u00c0\3\u00c1\3\u00c1\3\u00c1\3\u00c1\3\u00c1\3\u00c1" + + "\3\u00c1\3\u00c2\3\u00c2\3\u00c2\3\u00c2\3\u00c2\3\u00c2\3\u00c2\6\u00c2" + + "\u0697\n\u00c2\r\u00c2\16\u00c2\u0698\3\u00c2\3\u00c2\3\u00c2\3\u00c3" + + "\3\u00c3\3\u00c3\3\u00c3\3\u00c3\3\u00c3\3\u00c3\3\u00c3\3\u00c3\6\u00c3" + + "\u06a7\n\u00c3\r\u00c3\16\u00c3\u06a8\3\u00c3\3\u00c3\3\u00c3\3\u00c4" + + "\3\u00c4\3\u00c4\3\u00c4\3\u00c4\3\u00c4\3\u00c4\3\u00c4\7\u00c4\u06b6" + + "\n\u00c4\f\u00c4\16\u00c4\u06b9\13\u00c4\3\u00c4\3\u00c4\3\u00c4\3\u00c5" + + "\3\u00c5\3\u00c5\3\u00c5\3\u00c5\3\u00c5\3\u00c5\3\u00c5\3\u00c5\3\u00c5" + + "\3\u00c5\7\u00c5\u06c9\n\u00c5\f\u00c5\16\u00c5\u06cc\13\u00c5\3\u00c5" + + "\3\u00c5\3\u00c5\3\u00c6\3\u00c6\3\u00c6\3\u00c6\3\u00c6\3\u00c6\3\u00c6" + + "\3\u00c6\6\u00c6\u06d9\n\u00c6\r\u00c6\16\u00c6\u06da\3\u00c6\3\u00c6" + + "\3\u00c6\3\u00c7\3\u00c7\3\u00c7\3\u00c7\3\u00c7\3\u00c7\3\u00c7\3\u00c7" + + "\3\u00c7\3\u00c7\6\u00c7\u06ea\n\u00c7\r\u00c7\16\u00c7\u06eb\3\u00c7" + + "\3\u00c7\3\u00c7\3\u00c8\3\u00c8\3\u00c8\3\u00c8\3\u00c8\3\u00c8\3\u00c8" + + "\3\u00c8\3\u00c8\3\u00c8\3\u00c8\3\u00c9\3\u00c9\3\u00c9\3\u00c9\3\u00c9" + + "\3\u00c9\3\u00c9\3\u00c9\3\u00c9\3\u00ca\3\u00ca\3\u00ca\3\u00ca\3\u00ca" + + "\3\u00cb\3\u00cb\3\u00cb\3\u00cb\3\u00cb\3\u00cc\3\u00cc\3\u00cc\3\u00cc" + + "\3\u00cc\3\u00cd\3\u00cd\3\u00cd\3\u00cd\3\u00cd\3\u00cd\3\u00ce\3\u00ce" + + "\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00cf\3\u00cf\3\u00cf\3\u00cf\3\u00cf" + + "\3\u00cf\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d1\3\u00d1" + + "\7\u00d1\u072e\n\u00d1\f\u00d1\16\u00d1\u0731\13\u00d1\3\u00d1\3\u00d1" + + "\3\u00d1\3\u00d1\3\u00d1\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d3\3\u00d3" + + "\3\u00d3\3\u00d3\7\u00d3\u0740\n\u00d3\f\u00d3\16\u00d3\u0743\13\u00d3" + + "\3\u00d3\3\u00d3\3\u00d3\3\u00d4\3\u00d4\3\u00d4\3\u00d4\3\u00d4\3\u00d5" + + "\6\u00d5\u074e\n\u00d5\r\u00d5\16\u00d5\u074f\3\u00d5\3\u00d5\3\u00d6" + + "\3\u00d6\3\u00d6\3\u00d6\3\u00d6\3\u00d6\3\u00d7\3\u00d7\3\u00d8\3\u00d8" + + "\3\u00d9\5\u00d9\u075f\n\u00d9\3\u00d9\3\u00d9\5\u00d9\u0763\n\u00d9\3" + + "\u00d9\5\u00d9\u0766\n\u00d9\3\u00da\3\u00da\5\u00da\u076a\n\u00da\3\u00da" + + "\3\u00da\7\u00da\u076e\n\u00da\f\u00da\16\u00da\u0771\13\u00da\3\u00da" + + "\7\u00da\u0774\n\u00da\f\u00da\16\u00da\u0777\13\u00da\3\u00db\3\u00db" + + "\3\u00db\5\u00db\u077c\n\u00db\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc" + + "\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc" + + "\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\5\u00dc" + + "\u0794\n\u00dc\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd" + + "\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd" + + "\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd" + + "\5\u00dd\u07af\n\u00dd\3\u00de\3\u00de\3\u00de\5\u00de\u07b4\n\u00de\3" + + "\u00df\3\u00df\5\u00df\u07b8\n\u00df\3\u00e0\3\u00e0\3\u00e1\3\u00e1\7" + + "\u00e1\u07be\n\u00e1\f\u00e1\16\u00e1\u07c1\13\u00e1\3\u00e2\3\u00e2\5" + + "\u00e2\u07c5\n\u00e2\3\u00e3\3\u00e3\3\u00e3\3\u00e3\3\u00e3\5\u00e3\u07cc" + + "\n\u00e3\3\u00e4\3\u00e4\3\u00e4\3\u00e4\3\u00e4\3\u00e4\3\u00e4\5\u00e4" + + "\u07d5\n\u00e4\3\u00e5\3\u00e5\5\u00e5\u07d9\n\u00e5\3\u00e6\3\u00e6\5" + + "\u00e6\u07dd\n\u00e6\3\u00e7\3\u00e7\3\u00e7\5\u00e7\u07e2\n\u00e7\3\u00e8" + + "\3\u00e8\5\u00e8\u07e6\n\u00e8\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9" + + "\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9" + + "\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\5\u00e9\u07fc\n\u00e9" + + "\3\u00ea\5\u00ea\u07ff\n\u00ea\3\u00eb\3\u00eb\3\u00ec\3\u00ec\3\u00ed" + + "\3\u00ed\3\u00ee\3\u00ee\3\u00ef\3\u00ef\3\u00f0\3\u00f0\3\u00f1\3\u00f1" + + "\3\u00f2\3\u00f2\3\u00f3\3\u00f3\3\u00f4\3\u00f4\3\u00f5\3\u00f5\4\u020f" + + "\u0228\2\u00f6\7\3\t\4\13\5\r\6\17\7\21\b\23\t\25\n\27\13\31\f\33\r\35" + + "\16\37\17!\20#\21%\22\'\23)\24+\25-\26/\27\61\30\63\31\65\32\67\339\34" + + ";\35=\36?\37A C!E\"G#I$K%M&O\'Q(S)U*W+Y,[-]._/a\60c\61e\62g\63i\64k\65" + + "m\66o\67q8s9u:w;y<{=}>\177?\u0081@\u0083A\u0085B\u0087C\u0089D\u008bE" + + "\u008dF\u008fG\u0091H\u0093I\u0095J\u0097K\u0099L\u009bM\u009dN\u009f" + + "O\u00a1P\u00a3Q\u00a5R\u00a7S\u00a9T\u00abU\u00adV\u00afW\u00b1X\u00b3" + + "Y\u00b5Z\u00b7[\u00b9\\\u00bb]\u00bd^\u00bf_\u00c1`\u00c3a\u00c5b\u00c7" + + "c\u00c9d\u00cbe\u00cdf\u00cfg\u00d1h\u00d3i\u00d5j\u00d7k\u00d9l\u00db" + + "m\u00ddn\u00dfo\u00e1p\u00e3q\u00e5r\u00e7s\u00e9t\u00ebu\u00edv\u00ef" + + "w\u00f1x\u00f3y\u00f5z\u00f7{\u00f9|\u00fb}\u00fd~\u00ff\177\u0101\u0080" + + "\u0103\u0081\u0105\u0082\u0107\u0083\u0109\u0084\u010b\u0085\u010d\u0086" + + "\u010f\u0087\u0111\u0088\u0113\u0089\u0115\u008a\u0117\u008b\u0119\u008c" + + "\u011b\u008d\u011d\u008e\u011f\u008f\u0121\u0090\u0123\u0091\u0125\u0092" + + "\u0127\u0093\u0129\u0094\u012b\u0095\u012d\u0096\u012f\u0097\u0131\u0098" + + "\u0133\u0099\u0135\u009a\u0137\u009b\u0139\u009c\u013b\u009d\u013d\u009e" + + "\u013f\u009f\u0141\u00a0\u0143\u00a1\u0145\u00a2\u0147\u00a3\u0149\u00a4" + + "\u014b\u00a5\u014d\u00a6\u014f\u00a7\u0151\u00a8\u0153\u00a9\u0155\u00aa" + + "\u0157\u00ab\u0159\u00ac\u015b\u00ad\u015d\u00ae\u015f\u00af\u0161\u00b0" + + "\u0163\u00b1\u0165\u00b2\u0167\u00b3\u0169\u00b4\u016b\u00c8\u016d\u00b5" + + "\u016f\u00b6\u0171\u00b7\u0173\u00b8\u0175\2\u0177\2\u0179\u00b9\u017b" + + "\u00ba\u017d\2\u017f\u00bb\u0181\2\u0183\u00bc\u0185\u00bd\u0187\u00be" + + "\u0189\u00bf\u018b\u00c0\u018d\u00c1\u018f\u00c2\u0191\u00c3\u0193\2\u0195" + + "\u00c4\u0197\2\u0199\2\u019b\2\u019d\2\u019f\2\u01a1\2\u01a3\2\u01a5\2" + + "\u01a7\u00c5\u01a9\2\u01ab\u00c6\u01ad\u00c7\u01af\2\u01b1\2\u01b3\2\u01b5" + + "\2\u01b7\2\u01b9\2\u01bb\2\u01bd\2\u01bf\2\u01c1\2\u01c3\2\u01c5\2\u01c7" + + "\2\u01c9\2\u01cb\2\u01cd\2\u01cf\2\u01d1\2\u01d3\2\u01d5\2\u01d7\2\u01d9" + + "\2\u01db\2\u01dd\2\u01df\2\u01e1\2\u01e3\2\u01e5\2\u01e7\2\u01e9\2\u01eb" + + "\2\u01ed\2\7\2\3\4\5\6!\3\2\61\61\3\2\62;\4\2ZZzz\4\2DDdd\3\2\62\63\b" + + "\2FFHHOOffhhoo\b\2\f\f\17\17))^^\u0087\u0087\u202a\u202b\b\2\f\f\17\17" + + "$$^^\u0087\u0087\u202a\u202b\3\2$$\5\2$$^^}}\4\2$$}}\3\2\177\177\7\2\f" + + "\f\17\17$$\u0087\u0087\u202a\u202b\6\2\f\f\17\17\u0087\u0087\u202a\u202b" + + "\4\2NNnn\4\2WWww\4\2GGgg\4\2--//\4\2\13\13\r\16\13\2\"\"\u00a2\u00a2\u1682" + + "\u1682\u1810\u1810\u2002\u2008\u200a\u200c\u2031\u2031\u2061\u2061\u3002" + + "\u3002\5\2\62;CHchT\2C\\\u00c2\u00d8\u00da\u00e0\u0102\u0138\u013b\u0149" + + "\u014c\u017f\u0183\u0184\u0186\u018d\u0190\u0193\u0195\u0196\u0198\u019a" + + "\u019e\u019f\u01a1\u01a2\u01a4\u01ab\u01ae\u01b5\u01b7\u01be\u01c6\u01cf" + + "\u01d1\u01dd\u01e0\u01f0\u01f3\u01f6\u01f8\u01fa\u01fc\u0234\u023c\u023d" + + "\u023f\u0240\u0243\u0248\u024a\u0250\u0372\u0374\u0378\u0381\u0388\u038c" + + "\u038e\u03a3\u03a5\u03ad\u03d1\u03d6\u03da\u03f0\u03f6\u03f9\u03fb\u03fc" + + "\u03ff\u0431\u0462\u0482\u048c\u04cf\u04d2\u0530\u0533\u0558\u10a2\u10c7" + + "\u10c9\u10cf\u1e02\u1e96\u1ea0\u1f00\u1f0a\u1f11\u1f1a\u1f1f\u1f2a\u1f31" + + "\u1f3a\u1f41\u1f4a\u1f4f\u1f5b\u1f61\u1f6a\u1f71\u1fba\u1fbd\u1fca\u1fcd" + + "\u1fda\u1fdd\u1fea\u1fee\u1ffa\u1ffd\u2104\u2109\u210d\u210f\u2112\u2114" + + "\u2117\u211f\u2126\u212f\u2132\u2135\u2140\u2141\u2147\u2185\u2c02\u2c30" + + "\u2c62\u2c66\u2c69\u2c72\u2c74\u2c77\u2c80\u2c82\u2c84\u2ce4\u2ced\u2cef" + + "\u2cf4\ua642\ua644\ua66e\ua682\ua69c\ua724\ua730\ua734\ua770\ua77b\ua788" + + "\ua78d\ua78f\ua792\ua794\ua798\ua7af\ua7b2\ua7b3\uff23\uff3cS\2c|\u00b7" + + "\u00f8\u00fa\u0101\u0103\u0179\u017c\u0182\u0185\u0187\u018a\u0194\u0197" + + "\u019d\u01a0\u01a3\u01a5\u01a7\u01aa\u01af\u01b2\u01b6\u01b8\u01c1\u01c8" + + "\u01ce\u01d0\u01f5\u01f7\u01fb\u01fd\u023b\u023e\u0244\u0249\u0295\u0297" + + "\u02b1\u0373\u0375\u0379\u037f\u0392\u03d0\u03d2\u03d3\u03d7\u03d9\u03db" + + "\u03f5\u03f7\u0461\u0463\u0483\u048d\u04c1\u04c4\u0531\u0563\u0589\u1d02" + + "\u1d2d\u1d6d\u1d79\u1d7b\u1d9c\u1e03\u1e9f\u1ea1\u1f09\u1f12\u1f17\u1f22" + + "\u1f29\u1f32\u1f39\u1f42\u1f47\u1f52\u1f59\u1f62\u1f69\u1f72\u1f7f\u1f82" + + "\u1f89\u1f92\u1f99\u1fa2\u1fa9\u1fb2\u1fb6\u1fb8\u1fb9\u1fc0\u1fc6\u1fc8" + + "\u1fc9\u1fd2\u1fd5\u1fd8\u1fd9\u1fe2\u1fe9\u1ff4\u1ff6\u1ff8\u1ff9\u210c" + + "\u2115\u2131\u213b\u213e\u213f\u2148\u214b\u2150\u2186\u2c32\u2c60\u2c63" + + "\u2c6e\u2c73\u2c7d\u2c83\u2cee\u2cf0\u2cf5\u2d02\u2d27\u2d29\u2d2f\ua643" + + "\ua66f\ua683\ua69d\ua725\ua733\ua735\ua77a\ua77c\ua77e\ua781\ua789\ua78e" + + "\ua790\ua793\ua797\ua799\ua7ab\ua7fc\uab5c\uab66\uab67\ufb02\ufb08\ufb15" + + "\ufb19\uff43\uff5c\b\2\u01c7\u01cd\u01f4\u1f91\u1f9a\u1fa1\u1faa\u1fb1" + + "\u1fbe\u1fce\u1ffe\u1ffe#\2\u02b2\u02c3\u02c8\u02d3\u02e2\u02e6\u02ee" + + "\u02f0\u0376\u037c\u055b\u0642\u06e7\u06e8\u07f6\u07f7\u07fc\u081c\u0826" + + "\u082a\u0973\u0e48\u0ec8\u10fe\u17d9\u1845\u1aa9\u1c7f\u1d2e\u1d6c\u1d7a" + + "\u1dc1\u2073\u2081\u2092\u209e\u2c7e\u2c7f\u2d71\u2e31\u3007\u3037\u303d" + + "\u3100\ua017\ua4ff\ua60e\ua681\ua69e\ua69f\ua719\ua721\ua772\ua78a\ua7fa" + + "\ua7fb\ua9d1\ua9e8\uaa72\uaadf\uaaf5\uaaf6\uab5e\uab61\uff72\uffa1\u00ec" + + "\2\u00ac\u00bc\u01bd\u01c5\u0296\u05ec\u05f2\u05f4\u0622\u0641\u0643\u064c" + + "\u0670\u0671\u0673\u06d5\u06d7\u06fe\u0701\u0712\u0714\u0731\u074f\u07a7" + + "\u07b3\u07ec\u0802\u0817\u0842\u085a\u08a2\u08b4\u0906\u093b\u093f\u0952" + + "\u095a\u0963\u0974\u0982\u0987\u098e\u0991\u0992\u0995\u09aa\u09ac\u09b2" + + "\u09b4\u09bb\u09bf\u09d0\u09de\u09df\u09e1\u09e3\u09f2\u09f3\u0a07\u0a0c" + + "\u0a11\u0a12\u0a15\u0a2a\u0a2c\u0a32\u0a34\u0a35\u0a37\u0a38\u0a3a\u0a3b" + + "\u0a5b\u0a5e\u0a60\u0a76\u0a87\u0a8f\u0a91\u0a93\u0a95\u0aaa\u0aac\u0ab2" + + "\u0ab4\u0ab5\u0ab7\u0abb\u0abf\u0ad2\u0ae2\u0ae3\u0b07\u0b0e\u0b11\u0b12" + + "\u0b15\u0b2a\u0b2c\u0b32\u0b34\u0b35\u0b37\u0b3b\u0b3f\u0b63\u0b73\u0b85" + + "\u0b87\u0b8c\u0b90\u0b92\u0b94\u0b97\u0b9b\u0b9c\u0b9e\u0bac\u0bb0\u0bbb" + + "\u0bd2\u0c0e\u0c10\u0c12\u0c14\u0c2a\u0c2c\u0c3b\u0c3f\u0c8e\u0c90\u0c92" + + "\u0c94\u0caa\u0cac\u0cb5\u0cb7\u0cbb\u0cbf\u0ce0\u0ce2\u0ce3\u0cf3\u0cf4" + + "\u0d07\u0d0e\u0d10\u0d12\u0d14\u0d3c\u0d3f\u0d50\u0d62\u0d63\u0d7c\u0d81" + + "\u0d87\u0d98\u0d9c\u0db3\u0db5\u0dbd\u0dbf\u0dc8\u0e03\u0e32\u0e34\u0e35" + + "\u0e42\u0e47\u0e83\u0e84\u0e86\u0e8c\u0e8f\u0e99\u0e9b\u0ea1\u0ea3\u0ea5" + + "\u0ea7\u0ea9\u0eac\u0ead\u0eaf\u0eb2\u0eb4\u0eb5\u0ebf\u0ec6\u0ede\u0ee1" + + "\u0f02\u0f49\u0f4b\u0f6e\u0f8a\u0f8e\u1002\u102c\u1041\u1057\u105c\u105f" + + "\u1063\u1072\u1077\u1083\u1090\u10fc\u10ff\u124a\u124c\u124f\u1252\u1258" + + "\u125a\u125f\u1262\u128a\u128c\u128f\u1292\u12b2\u12b4\u12b7\u12ba\u12c0" + + "\u12c2\u12c7\u12ca\u12d8\u12da\u1312\u1314\u1317\u131a\u135c\u1382\u1391" + + "\u13a2\u13f6\u1403\u166e\u1671\u1681\u1683\u169c\u16a2\u16ec\u16f3\u16fa" + + "\u1702\u170e\u1710\u1713\u1722\u1733\u1742\u1753\u1762\u176e\u1770\u1772" + + "\u1782\u17b5\u17de\u1844\u1846\u1879\u1882\u18aa\u18ac\u18f7\u1902\u1920" + + "\u1952\u196f\u1972\u1976\u1982\u19ad\u19c3\u19c9\u1a02\u1a18\u1a22\u1a56" + + "\u1b07\u1b35\u1b47\u1b4d\u1b85\u1ba2\u1bb0\u1bb1\u1bbc\u1be7\u1c02\u1c25" + + "\u1c4f\u1c51\u1c5c\u1c79\u1ceb\u1cee\u1cf0\u1cf3\u1cf7\u1cf8\u2137\u213a" + + "\u2d32\u2d69\u2d82\u2d98\u2da2\u2da8\u2daa\u2db0\u2db2\u2db8\u2dba\u2dc0" + + "\u2dc2\u2dc8\u2dca\u2dd0\u2dd2\u2dd8\u2dda\u2de0\u3008\u303e\u3043\u3098" + + "\u30a1\u30fc\u3101\u312f\u3133\u3190\u31a2\u31bc\u31f2\u3201\u3402\u4db7" + + "\u4e02\u9fce\ua002\ua016\ua018\ua48e\ua4d2\ua4f9\ua502\ua60d\ua612\ua621" + + "\ua62c\ua62d\ua670\ua6e7\ua7f9\ua803\ua805\ua807\ua809\ua80c\ua80e\ua824" + + "\ua842\ua875\ua884\ua8b5\ua8f4\ua8f9\ua8fd\ua927\ua932\ua948\ua962\ua97e" + + "\ua986\ua9b4\ua9e2\ua9e6\ua9e9\ua9f1\ua9fc\uaa00\uaa02\uaa2a\uaa42\uaa44" + + "\uaa46\uaa4d\uaa62\uaa71\uaa73\uaa78\uaa7c\uaab1\uaab3\uaabf\uaac2\uaac4" + + "\uaadd\uaade\uaae2\uaaec\uaaf4\uab08\uab0b\uab10\uab13\uab18\uab22\uab28" + + "\uab2a\uab30\uabc2\uabe4\uac02\ud7a5\ud7b2\ud7c8\ud7cd\ud7fd\uf902\ufa6f" + + "\ufa72\ufadb\ufb1f\ufb2a\ufb2c\ufb38\ufb3a\ufb3e\ufb40\ufbb3\ufbd5\ufd3f" + + "\ufd52\ufd91\ufd94\ufdc9\ufdf2\ufdfd\ufe72\ufe76\ufe78\ufefe\uff68\uff71" + + "\uff73\uff9f\uffa2\uffc0\uffc4\uffc9\uffcc\uffd1\uffd4\uffd9\uffdc\uffde" + + "\4\2\u16f0\u16f2\u2162\u2171\5\2\u0905\u0905\u0940\u0942\u094b\u094e\5" + + "\2\u00af\u00af\u0602\u0605\u06df\u06df\b\2aa\u2041\u2042\u2056\u2056\ufe35" + + "\ufe36\ufe4f\ufe51\uff41\uff41\'\2\62;\u0662\u066b\u06f2\u06fb\u07c2\u07cb" + + "\u0968\u0971\u09e8\u09f1\u0a68\u0a71\u0ae8\u0af1\u0b68\u0b71\u0be8\u0bf1" + + "\u0c68\u0c71\u0ce8\u0cf1\u0d68\u0d71\u0de8\u0df1\u0e52\u0e5b\u0ed2\u0edb" + + "\u0f22\u0f2b\u1042\u104b\u1092\u109b\u17e2\u17eb\u1812\u181b\u1948\u1951" + + "\u19d2\u19db\u1a82\u1a8b\u1a92\u1a9b\u1b52\u1b5b\u1bb2\u1bbb\u1c42\u1c4b" + + "\u1c52\u1c5b\ua622\ua62b\ua8d2\ua8db\ua902\ua90b\ua9d2\ua9db\ua9f2\ua9fb" + + "\uaa52\uaa5b\uabf2\uabfb\uff12\uff1b\2\u084e\2\7\3\2\2\2\2\t\3\2\2\2\2" + + "\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3" + + "\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2" + + "\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2" + + "\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2" + + "\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2" + + "\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q" + + "\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2" + + "\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2\2\2i\3\2\2\2" + + "\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2q\3\2\2\2\2s\3\2\2\2\2u\3\2\2\2\2w" + + "\3\2\2\2\2y\3\2\2\2\2{\3\2\2\2\2}\3\2\2\2\2\177\3\2\2\2\2\u0081\3\2\2" + + "\2\2\u0083\3\2\2\2\2\u0085\3\2\2\2\2\u0087\3\2\2\2\2\u0089\3\2\2\2\2\u008b" + + "\3\2\2\2\2\u008d\3\2\2\2\2\u008f\3\2\2\2\2\u0091\3\2\2\2\2\u0093\3\2\2" + + "\2\2\u0095\3\2\2\2\2\u0097\3\2\2\2\2\u0099\3\2\2\2\2\u009b\3\2\2\2\2\u009d" + + "\3\2\2\2\2\u009f\3\2\2\2\2\u00a1\3\2\2\2\2\u00a3\3\2\2\2\2\u00a5\3\2\2" + + "\2\2\u00a7\3\2\2\2\2\u00a9\3\2\2\2\2\u00ab\3\2\2\2\2\u00ad\3\2\2\2\2\u00af" + + "\3\2\2\2\2\u00b1\3\2\2\2\2\u00b3\3\2\2\2\2\u00b5\3\2\2\2\2\u00b7\3\2\2" + + "\2\2\u00b9\3\2\2\2\2\u00bb\3\2\2\2\2\u00bd\3\2\2\2\2\u00bf\3\2\2\2\2\u00c1" + + "\3\2\2\2\2\u00c3\3\2\2\2\2\u00c5\3\2\2\2\2\u00c7\3\2\2\2\2\u00c9\3\2\2" + + "\2\2\u00cb\3\2\2\2\2\u00cd\3\2\2\2\2\u00cf\3\2\2\2\2\u00d1\3\2\2\2\2\u00d3" + + "\3\2\2\2\2\u00d5\3\2\2\2\2\u00d7\3\2\2\2\2\u00d9\3\2\2\2\2\u00db\3\2\2" + + "\2\2\u00dd\3\2\2\2\2\u00df\3\2\2\2\2\u00e1\3\2\2\2\2\u00e3\3\2\2\2\2\u00e5" + + "\3\2\2\2\2\u00e7\3\2\2\2\2\u00e9\3\2\2\2\2\u00eb\3\2\2\2\2\u00ed\3\2\2" + + "\2\2\u00ef\3\2\2\2\2\u00f1\3\2\2\2\2\u00f3\3\2\2\2\2\u00f5\3\2\2\2\2\u00f7" + + "\3\2\2\2\2\u00f9\3\2\2\2\2\u00fb\3\2\2\2\2\u00fd\3\2\2\2\2\u00ff\3\2\2" + + "\2\2\u0101\3\2\2\2\2\u0103\3\2\2\2\2\u0105\3\2\2\2\2\u0107\3\2\2\2\2\u0109" + + "\3\2\2\2\2\u010b\3\2\2\2\2\u010d\3\2\2\2\2\u010f\3\2\2\2\2\u0111\3\2\2" + + "\2\2\u0113\3\2\2\2\2\u0115\3\2\2\2\2\u0117\3\2\2\2\2\u0119\3\2\2\2\2\u011b" + + "\3\2\2\2\2\u011d\3\2\2\2\2\u011f\3\2\2\2\2\u0121\3\2\2\2\2\u0123\3\2\2" + + "\2\2\u0125\3\2\2\2\2\u0127\3\2\2\2\2\u0129\3\2\2\2\2\u012b\3\2\2\2\2\u012d" + + "\3\2\2\2\2\u012f\3\2\2\2\2\u0131\3\2\2\2\2\u0133\3\2\2\2\2\u0135\3\2\2" + + "\2\2\u0137\3\2\2\2\2\u0139\3\2\2\2\2\u013b\3\2\2\2\2\u013d\3\2\2\2\2\u013f" + + "\3\2\2\2\2\u0141\3\2\2\2\2\u0143\3\2\2\2\2\u0145\3\2\2\2\2\u0147\3\2\2" + + "\2\2\u0149\3\2\2\2\2\u014b\3\2\2\2\2\u014d\3\2\2\2\2\u014f\3\2\2\2\2\u0151" + + "\3\2\2\2\2\u0153\3\2\2\2\2\u0155\3\2\2\2\2\u0157\3\2\2\2\2\u0159\3\2\2" + + "\2\2\u015b\3\2\2\2\3\u015d\3\2\2\2\3\u015f\3\2\2\2\3\u0161\3\2\2\2\3\u0163" + + "\3\2\2\2\3\u0165\3\2\2\2\3\u0167\3\2\2\2\3\u0169\3\2\2\2\4\u016b\3\2\2" + + "\2\4\u016d\3\2\2\2\4\u016f\3\2\2\2\5\u0171\3\2\2\2\5\u0173\3\2\2\2\5\u0175" + + "\3\2\2\2\5\u0177\3\2\2\2\5\u0179\3\2\2\2\5\u017b\3\2\2\2\5\u017d\3\2\2" + + "\2\5\u017f\3\2\2\2\5\u0181\3\2\2\2\5\u0183\3\2\2\2\5\u0185\3\2\2\2\5\u0187" + + "\3\2\2\2\5\u0189\3\2\2\2\5\u018b\3\2\2\2\5\u018d\3\2\2\2\5\u018f\3\2\2" + + "\2\5\u0191\3\2\2\2\5\u0193\3\2\2\2\5\u0195\3\2\2\2\5\u0197\3\2\2\2\5\u0199" + + "\3\2\2\2\5\u019b\3\2\2\2\5\u019d\3\2\2\2\5\u019f\3\2\2\2\5\u01a1\3\2\2" + + "\2\5\u01a3\3\2\2\2\5\u01a5\3\2\2\2\5\u01a7\3\2\2\2\5\u01a9\3\2\2\2\5\u01ab" + + "\3\2\2\2\6\u01ad\3\2\2\2\6\u01af\3\2\2\2\7\u01ef\3\2\2\2\t\u01f3\3\2\2" + + "\2\13\u01ff\3\2\2\2\r\u0207\3\2\2\2\17\u0217\3\2\2\2\21\u0222\3\2\2\2" + + "\23\u0232\3\2\2\2\25\u0238\3\2\2\2\27\u023c\3\2\2\2\31\u0245\3\2\2\2\33" + + "\u0249\3\2\2\2\35\u024f\3\2\2\2\37\u0259\3\2\2\2!\u025c\3\2\2\2#\u0266" + + "\3\2\2\2%\u026c\3\2\2\2\'\u0272\3\2\2\2)\u0277\3\2\2\2+\u027c\3\2\2\2" + + "-\u0282\3\2\2\2/\u0285\3\2\2\2\61\u028a\3\2\2\2\63\u028f\3\2\2\2\65\u0295" + + "\3\2\2\2\67\u029a\3\2\2\29\u02a2\3\2\2\2;\u02a8\3\2\2\2=\u02ae\3\2\2\2" + + "?\u02b7\3\2\2\2A\u02bf\3\2\2\2C\u02c7\3\2\2\2E\u02d0\3\2\2\2G\u02db\3" + + "\2\2\2I\u02de\3\2\2\2K\u02e5\3\2\2\2M\u02ed\3\2\2\2O\u02f2\3\2\2\2Q\u02f7" + + "\3\2\2\2S\u02fe\3\2\2\2U\u0304\3\2\2\2W\u030d\3\2\2\2Y\u0314\3\2\2\2[" + + "\u031a\3\2\2\2]\u0322\3\2\2\2_\u0328\3\2\2\2a\u032e\3\2\2\2c\u0332\3\2" + + "\2\2e\u033a\3\2\2\2g\u033f\3\2\2\2i\u0343\3\2\2\2k\u0348\3\2\2\2m\u034e" + + "\3\2\2\2o\u0351\3\2\2\2q\u035a\3\2\2\2s\u035d\3\2\2\2u\u0361\3\2\2\2w" + + "\u036b\3\2\2\2y\u0374\3\2\2\2{\u0379\3\2\2\2}\u037c\3\2\2\2\177\u0381" + + "\3\2\2\2\u0081\u0385\3\2\2\2\u0083\u038a\3\2\2\2\u0085\u038f\3\2\2\2\u0087" + + "\u0396\3\2\2\2\u0089\u03a0\3\2\2\2\u008b\u03a4\3\2\2\2\u008d\u03a9\3\2" + + "\2\2\u008f\u03b0\3\2\2\2\u0091\u03b3\3\2\2\2\u0093\u03bc\3\2\2\2\u0095" + + "\u03c4\3\2\2\2\u0097\u03c8\3\2\2\2\u0099\u03d1\3\2\2\2\u009b\u03d8\3\2" + + "\2\2\u009d\u03e0\3\2\2\2\u009f\u03e8\3\2\2\2\u00a1\u03f2\3\2\2\2\u00a3" + + "\u03f9\3\2\2\2\u00a5\u0402\3\2\2\2\u00a7\u0406\3\2\2\2\u00a9\u040d\3\2" + + "\2\2\u00ab\u0414\3\2\2\2\u00ad\u041a\3\2\2\2\u00af\u0421\3\2\2\2\u00b1" + + "\u0428\3\2\2\2\u00b3\u042c\3\2\2\2\u00b5\u0432\3\2\2\2\u00b7\u0439\3\2" + + "\2\2\u00b9\u0444\3\2\2\2\u00bb\u044b\3\2\2\2\u00bd\u0452\3\2\2\2\u00bf" + + "\u0459\3\2\2\2\u00c1\u0460\3\2\2\2\u00c3\u0465\3\2\2\2\u00c5\u046b\3\2" + + "\2\2\u00c7\u0470\3\2\2\2\u00c9\u0474\3\2\2\2\u00cb\u047b\3\2\2\2\u00cd" + + "\u0480\3\2\2\2\u00cf\u0486\3\2\2\2\u00d1\u0490\3\2\2\2\u00d3\u049a\3\2" + + "\2\2\u00d5\u04a1\3\2\2\2\u00d7\u04a8\3\2\2\2\u00d9\u04ae\3\2\2\2\u00db" + + "\u04b2\3\2\2\2\u00dd\u04ba\3\2\2\2\u00df\u04bf\3\2\2\2\u00e1\u04c8\3\2" + + "\2\2\u00e3\u04cd\3\2\2\2\u00e5\u04d3\3\2\2\2\u00e7\u04d9\3\2\2\2\u00e9" + + "\u04e0\3\2\2\2\u00eb\u04e4\3\2\2\2\u00ed\u04fa\3\2\2\2\u00ef\u050a\3\2" + + "\2\2\u00f1\u051a\3\2\2\2\u00f3\u0561\3\2\2\2\u00f5\u0563\3\2\2\2\u00f7" + + "\u056a\3\2\2\2\u00f9\u0574\3\2\2\2\u00fb\u0581\3\2\2\2\u00fd\u0588\3\2" + + "\2\2\u00ff\u0590\3\2\2\2\u0101\u0593\3\2\2\2\u0103\u0596\3\2\2\2\u0105" + + "\u0598\3\2\2\2\u0107\u059a\3\2\2\2\u0109\u059c\3\2\2\2\u010b\u059e\3\2" + + "\2\2\u010d\u05a0\3\2\2\2\u010f\u05a2\3\2\2\2\u0111\u05a5\3\2\2\2\u0113" + + "\u05a7\3\2\2\2\u0115\u05a9\3\2\2\2\u0117\u05ab\3\2\2\2\u0119\u05ad\3\2" + + "\2\2\u011b\u05af\3\2\2\2\u011d\u05b1\3\2\2\2\u011f\u05b3\3\2\2\2\u0121" + + "\u05b5\3\2\2\2\u0123\u05b7\3\2\2\2\u0125\u05b9\3\2\2\2\u0127\u05bb\3\2" + + "\2\2\u0129\u05bd\3\2\2\2\u012b\u05bf\3\2\2\2\u012d\u05c1\3\2\2\2\u012f" + + "\u05c3\3\2\2\2\u0131\u05c6\3\2\2\2\u0133\u05c9\3\2\2\2\u0135\u05cc\3\2" + + "\2\2\u0137\u05cf\3\2\2\2\u0139\u05d2\3\2\2\2\u013b\u05d5\3\2\2\2\u013d" + + "\u05d8\3\2\2\2\u013f\u05db\3\2\2\2\u0141\u05de\3\2\2\2\u0143\u05e1\3\2" + + "\2\2\u0145\u05e4\3\2\2\2\u0147\u05e7\3\2\2\2\u0149\u05ea\3\2\2\2\u014b" + + "\u05ed\3\2\2\2\u014d\u05f0\3\2\2\2\u014f\u05f3\3\2\2\2\u0151\u05f6\3\2" + + "\2\2\u0153\u05f9\3\2\2\2\u0155\u05fc\3\2\2\2\u0157\u05ff\3\2\2\2\u0159" + + "\u0603\3\2\2\2\u015b\u0607\3\2\2\2\u015d\u060a\3\2\2\2\u015f\u060d\3\2" + + "\2\2\u0161\u0613\3\2\2\2\u0163\u0616\3\2\2\2\u0165\u061a\3\2\2\2\u0167" + + "\u061f\3\2\2\2\u0169\u0625\3\2\2\2\u016b\u062b\3\2\2\2\u016d\u0630\3\2" + + "\2\2\u016f\u0637\3\2\2\2\u0171\u063c\3\2\2\2\u0173\u0643\3\2\2\2\u0175" + + "\u0649\3\2\2\2\u0177\u0651\3\2\2\2\u0179\u065a\3\2\2\2\u017b\u0663\3\2" + + "\2\2\u017d\u066b\3\2\2\2\u017f\u0671\3\2\2\2\u0181\u0678\3\2\2\2\u0183" + + "\u0680\3\2\2\2\u0185\u0688\3\2\2\2\u0187\u068f\3\2\2\2\u0189\u069d\3\2" + + "\2\2\u018b\u06ad\3\2\2\2\u018d\u06bd\3\2\2\2\u018f\u06d0\3\2\2\2\u0191" + + "\u06df\3\2\2\2\u0193\u06f0\3\2\2\2\u0195\u06fb\3\2\2\2\u0197\u0704\3\2" + + "\2\2\u0199\u0709\3\2\2\2\u019b\u070e\3\2\2\2\u019d\u0713\3\2\2\2\u019f" + + "\u0719\3\2\2\2\u01a1\u071f\3\2\2\2\u01a3\u0725\3\2\2\2\u01a5\u072b\3\2" + + "\2\2\u01a7\u0737\3\2\2\2\u01a9\u073b\3\2\2\2\u01ab\u0747\3\2\2\2\u01ad" + + "\u074d\3\2\2\2\u01af\u0753\3\2\2\2\u01b1\u0759\3\2\2\2\u01b3\u075b\3\2" + + "\2\2\u01b5\u0765\3\2\2\2\u01b7\u0767\3\2\2\2\u01b9\u077b\3\2\2\2\u01bb" + + "\u0793\3\2\2\2\u01bd\u07ae\3\2\2\2\u01bf\u07b3\3\2\2\2\u01c1\u07b7\3\2" + + "\2\2\u01c3\u07b9\3\2\2\2\u01c5\u07bb\3\2\2\2\u01c7\u07c4\3\2\2\2\u01c9" + + "\u07cb\3\2\2\2\u01cb\u07d4\3\2\2\2\u01cd\u07d8\3\2\2\2\u01cf\u07dc\3\2" + + "\2\2\u01d1\u07e1\3\2\2\2\u01d3\u07e5\3\2\2\2\u01d5\u07fb\3\2\2\2\u01d7" + + "\u07fe\3\2\2\2\u01d9\u0800\3\2\2\2\u01db\u0802\3\2\2\2\u01dd\u0804\3\2" + + "\2\2\u01df\u0806\3\2\2\2\u01e1\u0808\3\2\2\2\u01e3\u080a\3\2\2\2\u01e5" + + "\u080c\3\2\2\2\u01e7\u080e\3\2\2\2\u01e9\u0810\3\2\2\2\u01eb\u0812\3\2" + + "\2\2\u01ed\u0814\3\2\2\2\u01ef\u01f0\7\u00f1\2\2\u01f0\u01f1\7\u00bd\2" + + "\2\u01f1\u01f2\7\u00c1\2\2\u01f2\b\3\2\2\2\u01f3\u01f4\7\61\2\2\u01f4" + + "\u01f5\7\61\2\2\u01f5\u01f6\7\61\2\2\u01f6\u01fa\3\2\2\2\u01f7\u01f9\5" + + "\u01b1\u00d7\2\u01f8\u01f7\3\2\2\2\u01f9\u01fc\3\2\2\2\u01fa\u01f8\3\2" + + "\2\2\u01fa\u01fb\3\2\2\2\u01fb\u01fd\3\2\2\2\u01fc\u01fa\3\2\2\2\u01fd" + + "\u01fe\b\3\2\2\u01fe\n\3\2\2\2\u01ff\u0200\7\61\2\2\u0200\u0201\7,\2\2" + + "\u0201\u0202\7,\2\2\u0202\u0203\7,\2\2\u0203\u0204\7\61\2\2\u0204\u0205" + + "\3\2\2\2\u0205\u0206\b\4\2\2\u0206\f\3\2\2\2\u0207\u0208\7\61\2\2\u0208" + + "\u0209\7,\2\2\u0209\u020a\7,\2\2\u020a\u020b\3\2\2\2\u020b\u020f\n\2\2" + + "\2\u020c\u020e\13\2\2\2\u020d\u020c\3\2\2\2\u020e\u0211\3\2\2\2\u020f" + + "\u0210\3\2\2\2\u020f\u020d\3\2\2\2\u0210\u0212\3\2\2\2\u0211\u020f\3\2" + + "\2\2\u0212\u0213\7,\2\2\u0213\u0214\7\61\2\2\u0214\u0215\3\2\2\2\u0215" + + "\u0216\b\5\2\2\u0216\16\3\2\2\2\u0217\u0218\7\61\2\2\u0218\u0219\7\61" + + "\2\2\u0219\u021d\3\2\2\2\u021a\u021c\5\u01b1\u00d7\2\u021b\u021a\3\2\2" + + "\2\u021c\u021f\3\2\2\2\u021d\u021b\3\2\2\2\u021d\u021e\3\2\2\2\u021e\u0220" + + "\3\2\2\2\u021f\u021d\3\2\2\2\u0220\u0221\b\6\2\2\u0221\20\3\2\2\2\u0222" + + "\u0223\7\61\2\2\u0223\u0224\7,\2\2\u0224\u0228\3\2\2\2\u0225\u0227\13" + + "\2\2\2\u0226\u0225\3\2\2\2\u0227\u022a\3\2\2\2\u0228\u0229\3\2\2\2\u0228" + + "\u0226\3\2\2\2\u0229\u022b\3\2\2\2\u022a\u0228\3\2\2\2\u022b\u022c\7," + + "\2\2\u022c\u022d\7\61\2\2\u022d\u022e\3\2\2\2\u022e\u022f\b\7\2\2\u022f" + + "\22\3\2\2\2\u0230\u0233\5\u01c1\u00df\2\u0231\u0233\5\u01bf\u00de\2\u0232" + + "\u0230\3\2\2\2\u0232\u0231\3\2\2\2\u0233\u0234\3\2\2\2\u0234\u0232\3\2" + + "\2\2\u0234\u0235\3\2\2\2\u0235\u0236\3\2\2\2\u0236\u0237\b\b\3\2\u0237" + + "\24\3\2\2\2\u0238\u0239\7%\2\2\u0239\u023a\3\2\2\2\u023a\u023b\b\t\4\2" + + "\u023b\26\3\2\2\2\u023c\u023d\7c\2\2\u023d\u023e\7d\2\2\u023e\u023f\7" + + "u\2\2\u023f\u0240\7v\2\2\u0240\u0241\7t\2\2\u0241\u0242\7c\2\2\u0242\u0243" + + "\7e\2\2\u0243\u0244\7v\2\2\u0244\30\3\2\2\2\u0245\u0246\7c\2\2\u0246\u0247" + + "\7f\2\2\u0247\u0248\7f\2\2\u0248\32\3\2\2\2\u0249\u024a\7c\2\2\u024a\u024b" + + "\7n\2\2\u024b\u024c\7k\2\2\u024c\u024d\7c\2\2\u024d\u024e\7u\2\2\u024e" + + "\34\3\2\2\2\u024f\u0250\7a\2\2\u0250\u0251\7a\2\2\u0251\u0252\7c\2\2\u0252" + + "\u0253\7t\2\2\u0253\u0254\7i\2\2\u0254\u0255\7n\2\2\u0255\u0256\7k\2\2" + + "\u0256\u0257\7u\2\2\u0257\u0258\7v\2\2\u0258\36\3\2\2\2\u0259\u025a\7" + + "c\2\2\u025a\u025b\7u\2\2\u025b \3\2\2\2\u025c\u025d\7c\2\2\u025d\u025e" + + "\7u\2\2\u025e\u025f\7e\2\2\u025f\u0260\7g\2\2\u0260\u0261\7p\2\2\u0261" + + "\u0262\7f\2\2\u0262\u0263\7k\2\2\u0263\u0264\7p\2\2\u0264\u0265\7i\2\2" + + "\u0265\"\3\2\2\2\u0266\u0267\7c\2\2\u0267\u0268\7u\2\2\u0268\u0269\7{" + + "\2\2\u0269\u026a\7p\2\2\u026a\u026b\7e\2\2\u026b$\3\2\2\2\u026c\u026d" + + "\7c\2\2\u026d\u026e\7y\2\2\u026e\u026f\7c\2\2\u026f\u0270\7k\2\2\u0270" + + "\u0271\7v\2\2\u0271&\3\2\2\2\u0272\u0273\7d\2\2\u0273\u0274\7c\2\2\u0274" + + "\u0275\7u\2\2\u0275\u0276\7g\2\2\u0276(\3\2\2\2\u0277\u0278\7d\2\2\u0278" + + "\u0279\7q\2\2\u0279\u027a\7q\2\2\u027a\u027b\7n\2\2\u027b*\3\2\2\2\u027c" + + "\u027d\7d\2\2\u027d\u027e\7t\2\2\u027e\u027f\7g\2\2\u027f\u0280\7c\2\2" + + "\u0280\u0281\7m\2\2\u0281,\3\2\2\2\u0282\u0283\7d\2\2\u0283\u0284\7{\2" + + "\2\u0284.\3\2\2\2\u0285\u0286\7d\2\2\u0286\u0287\7{\2\2\u0287\u0288\7" + + "v\2\2\u0288\u0289\7g\2\2\u0289\60\3\2\2\2\u028a\u028b\7e\2\2\u028b\u028c" + + "\7c\2\2\u028c\u028d\7u\2\2\u028d\u028e\7g\2\2\u028e\62\3\2\2\2\u028f\u0290" + + "\7e\2\2\u0290\u0291\7c\2\2\u0291\u0292\7v\2\2\u0292\u0293\7e\2\2\u0293" + + "\u0294\7j\2\2\u0294\64\3\2\2\2\u0295\u0296\7e\2\2\u0296\u0297\7j\2\2\u0297" + + "\u0298\7c\2\2\u0298\u0299\7t\2\2\u0299\66\3\2\2\2\u029a\u029b\7e\2\2\u029b" + + "\u029c\7j\2\2\u029c\u029d\7g\2\2\u029d\u029e\7e\2\2\u029e\u029f\7m\2\2" + + "\u029f\u02a0\7g\2\2\u02a0\u02a1\7f\2\2\u02a18\3\2\2\2\u02a2\u02a3\7e\2" + + "\2\u02a3\u02a4\7n\2\2\u02a4\u02a5\7c\2\2\u02a5\u02a6\7u\2\2\u02a6\u02a7" + + "\7u\2\2\u02a7:\3\2\2\2\u02a8\u02a9\7e\2\2\u02a9\u02aa\7q\2\2\u02aa\u02ab" + + "\7p\2\2\u02ab\u02ac\7u\2\2\u02ac\u02ad\7v\2\2\u02ad<\3\2\2\2\u02ae\u02af" + + "\7e\2\2\u02af\u02b0\7q\2\2\u02b0\u02b1\7p\2\2\u02b1\u02b2\7v\2\2\u02b2" + + "\u02b3\7k\2\2\u02b3\u02b4\7p\2\2\u02b4\u02b5\7w\2\2\u02b5\u02b6\7g\2\2" + + "\u02b6>\3\2\2\2\u02b7\u02b8\7f\2\2\u02b8\u02b9\7g\2\2\u02b9\u02ba\7e\2" + + "\2\u02ba\u02bb\7k\2\2\u02bb\u02bc\7o\2\2\u02bc\u02bd\7c\2\2\u02bd\u02be" + + "\7n\2\2\u02be@\3\2\2\2\u02bf\u02c0\7f\2\2\u02c0\u02c1\7g\2\2\u02c1\u02c2" + + "\7h\2\2\u02c2\u02c3\7c\2\2\u02c3\u02c4\7w\2\2\u02c4\u02c5\7n\2\2\u02c5" + + "\u02c6\7v\2\2\u02c6B\3\2\2\2\u02c7\u02c8\7f\2\2\u02c8\u02c9\7g\2\2\u02c9" + + "\u02ca\7n\2\2\u02ca\u02cb\7g\2\2\u02cb\u02cc\7i\2\2\u02cc\u02cd\7c\2\2" + + "\u02cd\u02ce\7v\2\2\u02ce\u02cf\7g\2\2\u02cfD\3\2\2\2\u02d0\u02d1\7f\2" + + "\2\u02d1\u02d2\7g\2\2\u02d2\u02d3\7u\2\2\u02d3\u02d4\7e\2\2\u02d4\u02d5" + + "\7g\2\2\u02d5\u02d6\7p\2\2\u02d6\u02d7\7f\2\2\u02d7\u02d8\7k\2\2\u02d8" + + "\u02d9\7p\2\2\u02d9\u02da\7i\2\2\u02daF\3\2\2\2\u02db\u02dc\7f\2\2\u02dc" + + "\u02dd\7q\2\2\u02ddH\3\2\2\2\u02de\u02df\7f\2\2\u02df\u02e0\7q\2\2\u02e0" + + "\u02e1\7w\2\2\u02e1\u02e2\7d\2\2\u02e2\u02e3\7n\2\2\u02e3\u02e4\7g\2\2" + + "\u02e4J\3\2\2\2\u02e5\u02e6\7f\2\2\u02e6\u02e7\7{\2\2\u02e7\u02e8\7p\2" + + "\2\u02e8\u02e9\7c\2\2\u02e9\u02ea\7o\2\2\u02ea\u02eb\7k\2\2\u02eb\u02ec" + + "\7e\2\2\u02ecL\3\2\2\2\u02ed\u02ee\7g\2\2\u02ee\u02ef\7n\2\2\u02ef\u02f0" + + "\7u\2\2\u02f0\u02f1\7g\2\2\u02f1N\3\2\2\2\u02f2\u02f3\7g\2\2\u02f3\u02f4" + + "\7p\2\2\u02f4\u02f5\7w\2\2\u02f5\u02f6\7o\2\2\u02f6P\3\2\2\2\u02f7\u02f8" + + "\7g\2\2\u02f8\u02f9\7s\2\2\u02f9\u02fa\7w\2\2\u02fa\u02fb\7c\2\2\u02fb" + + "\u02fc\7n\2\2\u02fc\u02fd\7u\2\2\u02fdR\3\2\2\2\u02fe\u02ff\7g\2\2\u02ff" + + "\u0300\7x\2\2\u0300\u0301\7g\2\2\u0301\u0302\7p\2\2\u0302\u0303\7v\2\2" + + "\u0303T\3\2\2\2\u0304\u0305\7g\2\2\u0305\u0306\7z\2\2\u0306\u0307\7r\2" + + "\2\u0307\u0308\7n\2\2\u0308\u0309\7k\2\2\u0309\u030a\7e\2\2\u030a\u030b" + + "\7k\2\2\u030b\u030c\7v\2\2\u030cV\3\2\2\2\u030d\u030e\7g\2\2\u030e\u030f" + + "\7z\2\2\u030f\u0310\7v\2\2\u0310\u0311\7g\2\2\u0311\u0312\7t\2\2\u0312" + + "\u0313\7p\2\2\u0313X\3\2\2\2\u0314\u0315\7h\2\2\u0315\u0316\7c\2\2\u0316" + + "\u0317\7n\2\2\u0317\u0318\7u\2\2\u0318\u0319\7g\2\2\u0319Z\3\2\2\2\u031a" + + "\u031b\7h\2\2\u031b\u031c\7k\2\2\u031c\u031d\7p\2\2\u031d\u031e\7c\2\2" + + "\u031e\u031f\7n\2\2\u031f\u0320\7n\2\2\u0320\u0321\7{\2\2\u0321\\\3\2" + + "\2\2\u0322\u0323\7h\2\2\u0323\u0324\7k\2\2\u0324\u0325\7z\2\2\u0325\u0326" + + "\7g\2\2\u0326\u0327\7f\2\2\u0327^\3\2\2\2\u0328\u0329\7h\2\2\u0329\u032a" + + "\7n\2\2\u032a\u032b\7q\2\2\u032b\u032c\7c\2\2\u032c\u032d\7v\2\2\u032d" + + "`\3\2\2\2\u032e\u032f\7h\2\2\u032f\u0330\7q\2\2\u0330\u0331\7t\2\2\u0331" + + "b\3\2\2\2\u0332\u0333\7h\2\2\u0333\u0334\7q\2\2\u0334\u0335\7t\2\2\u0335" + + "\u0336\7g\2\2\u0336\u0337\7c\2\2\u0337\u0338\7e\2\2\u0338\u0339\7j\2\2" + + "\u0339d\3\2\2\2\u033a\u033b\7h\2\2\u033b\u033c\7t\2\2\u033c\u033d\7q\2" + + "\2\u033d\u033e\7o\2\2\u033ef\3\2\2\2\u033f\u0340\7i\2\2\u0340\u0341\7" + + "g\2\2\u0341\u0342\7v\2\2\u0342h\3\2\2\2\u0343\u0344\7i\2\2\u0344\u0345" + + "\7q\2\2\u0345\u0346\7v\2\2\u0346\u0347\7q\2\2\u0347j\3\2\2\2\u0348\u0349" + + "\7i\2\2\u0349\u034a\7t\2\2\u034a\u034b\7q\2\2\u034b\u034c\7w\2\2\u034c" + + "\u034d\7r\2\2\u034dl\3\2\2\2\u034e\u034f\7k\2\2\u034f\u0350\7h\2\2\u0350" + + "n\3\2\2\2\u0351\u0352\7k\2\2\u0352\u0353\7o\2\2\u0353\u0354\7r\2\2\u0354" + + "\u0355\7n\2\2\u0355\u0356\7k\2\2\u0356\u0357\7e\2\2\u0357\u0358\7k\2\2" + + "\u0358\u0359\7v\2\2\u0359p\3\2\2\2\u035a\u035b\7k\2\2\u035b\u035c\7p\2" + + "\2\u035cr\3\2\2\2\u035d\u035e\7k\2\2\u035e\u035f\7p\2\2\u035f\u0360\7" + + "v\2\2\u0360t\3\2\2\2\u0361\u0362\7k\2\2\u0362\u0363\7p\2\2\u0363\u0364" + + "\7v\2\2\u0364\u0365\7g\2\2\u0365\u0366\7t\2\2\u0366\u0367\7h\2\2\u0367" + + "\u0368\7c\2\2\u0368\u0369\7e\2\2\u0369\u036a\7g\2\2\u036av\3\2\2\2\u036b" + + "\u036c\7k\2\2\u036c\u036d\7p\2\2\u036d\u036e\7v\2\2\u036e\u036f\7g\2\2" + + "\u036f\u0370\7t\2\2\u0370\u0371\7p\2\2\u0371\u0372\7c\2\2\u0372\u0373" + + "\7n\2\2\u0373x\3\2\2\2\u0374\u0375\7k\2\2\u0375\u0376\7p\2\2\u0376\u0377" + + "\7v\2\2\u0377\u0378\7q\2\2\u0378z\3\2\2\2\u0379\u037a\7k\2\2\u037a\u037b" + + "\7u\2\2\u037b|\3\2\2\2\u037c\u037d\7l\2\2\u037d\u037e\7q\2\2\u037e\u037f" + + "\7k\2\2\u037f\u0380\7p\2\2\u0380~\3\2\2\2\u0381\u0382\7n\2\2\u0382\u0383" + + "\7g\2\2\u0383\u0384\7v\2\2\u0384\u0080\3\2\2\2\u0385\u0386\7n\2\2\u0386" + + "\u0387\7q\2\2\u0387\u0388\7e\2\2\u0388\u0389\7m\2\2\u0389\u0082\3\2\2" + + "\2\u038a\u038b\7n\2\2\u038b\u038c\7q\2\2\u038c\u038d\7p\2\2\u038d\u038e" + + "\7i\2\2\u038e\u0084\3\2\2\2\u038f\u0390\7p\2\2\u0390\u0391\7c\2\2\u0391" + + "\u0392\7o\2\2\u0392\u0393\7g\2\2\u0393\u0394\7q\2\2\u0394\u0395\7h\2\2" + + "\u0395\u0086\3\2\2\2\u0396\u0397\7p\2\2\u0397\u0398\7c\2\2\u0398\u0399" + + "\7o\2\2\u0399\u039a\7g\2\2\u039a\u039b\7u\2\2\u039b\u039c\7r\2\2\u039c" + + "\u039d\7c\2\2\u039d\u039e\7e\2\2\u039e\u039f\7g\2\2\u039f\u0088\3\2\2" + + "\2\u03a0\u03a1\7p\2\2\u03a1\u03a2\7g\2\2\u03a2\u03a3\7y\2\2\u03a3\u008a" + + "\3\2\2\2\u03a4\u03a5\7p\2\2\u03a5\u03a6\7w\2\2\u03a6\u03a7\7n\2\2\u03a7" + + "\u03a8\7n\2\2\u03a8\u008c\3\2\2\2\u03a9\u03aa\7q\2\2\u03aa\u03ab\7d\2" + + "\2\u03ab\u03ac\7l\2\2\u03ac\u03ad\7g\2\2\u03ad\u03ae\7e\2\2\u03ae\u03af" + + "\7v\2\2\u03af\u008e\3\2\2\2\u03b0\u03b1\7q\2\2\u03b1\u03b2\7p\2\2\u03b2" + + "\u0090\3\2\2\2\u03b3\u03b4\7q\2\2\u03b4\u03b5\7r\2\2\u03b5\u03b6\7g\2" + + "\2\u03b6\u03b7\7t\2\2\u03b7\u03b8\7c\2\2\u03b8\u03b9\7v\2\2\u03b9\u03ba" + + "\7q\2\2\u03ba\u03bb\7t\2\2\u03bb\u0092\3\2\2\2\u03bc\u03bd\7q\2\2\u03bd" + + "\u03be\7t\2\2\u03be\u03bf\7f\2\2\u03bf\u03c0\7g\2\2\u03c0\u03c1\7t\2\2" + + "\u03c1\u03c2\7d\2\2\u03c2\u03c3\7{\2\2\u03c3\u0094\3\2\2\2\u03c4\u03c5" + + "\7q\2\2\u03c5\u03c6\7w\2\2\u03c6\u03c7\7v\2\2\u03c7\u0096\3\2\2\2\u03c8" + + "\u03c9\7q\2\2\u03c9\u03ca\7x\2\2\u03ca\u03cb\7g\2\2\u03cb\u03cc\7t\2\2" + + "\u03cc\u03cd\7t\2\2\u03cd\u03ce\7k\2\2\u03ce\u03cf\7f\2\2\u03cf\u03d0" + + "\7g\2\2\u03d0\u0098\3\2\2\2\u03d1\u03d2\7r\2\2\u03d2\u03d3\7c\2\2\u03d3" + + "\u03d4\7t\2\2\u03d4\u03d5\7c\2\2\u03d5\u03d6\7o\2\2\u03d6\u03d7\7u\2\2" + + "\u03d7\u009a\3\2\2\2\u03d8\u03d9\7r\2\2\u03d9\u03da\7c\2\2\u03da\u03db" + + "\7t\2\2\u03db\u03dc\7v\2\2\u03dc\u03dd\7k\2\2\u03dd\u03de\7c\2\2\u03de" + + "\u03df\7n\2\2\u03df\u009c\3\2\2\2\u03e0\u03e1\7r\2\2\u03e1\u03e2\7t\2" + + "\2\u03e2\u03e3\7k\2\2\u03e3\u03e4\7x\2\2\u03e4\u03e5\7c\2\2\u03e5\u03e6" + + "\7v\2\2\u03e6\u03e7\7g\2\2\u03e7\u009e\3\2\2\2\u03e8\u03e9\7r\2\2\u03e9" + + "\u03ea\7t\2\2\u03ea\u03eb\7q\2\2\u03eb\u03ec\7v\2\2\u03ec\u03ed\7g\2\2" + + "\u03ed\u03ee\7e\2\2\u03ee\u03ef\7v\2\2\u03ef\u03f0\7g\2\2\u03f0\u03f1" + + "\7f\2\2\u03f1\u00a0\3\2\2\2\u03f2\u03f3\7r\2\2\u03f3\u03f4\7w\2\2\u03f4" + + "\u03f5\7d\2\2\u03f5\u03f6\7n\2\2\u03f6\u03f7\7k\2\2\u03f7\u03f8\7e\2\2" + + "\u03f8\u00a2\3\2\2\2\u03f9\u03fa\7t\2\2\u03fa\u03fb\7g\2\2\u03fb\u03fc" + + "\7c\2\2\u03fc\u03fd\7f\2\2\u03fd\u03fe\7q\2\2\u03fe\u03ff\7p\2\2\u03ff" + + "\u0400\7n\2\2\u0400\u0401\7{\2\2\u0401\u00a4\3\2\2\2\u0402\u0403\7t\2" + + "\2\u0403\u0404\7g\2\2\u0404\u0405\7h\2\2\u0405\u00a6\3\2\2\2\u0406\u0407" + + "\7t\2\2\u0407\u0408\7g\2\2\u0408\u0409\7o\2\2\u0409\u040a\7q\2\2\u040a" + + "\u040b\7x\2\2\u040b\u040c\7g\2\2\u040c\u00a8\3\2\2\2\u040d\u040e\7t\2" + + "\2\u040e\u040f\7g\2\2\u040f\u0410\7v\2\2\u0410\u0411\7w\2\2\u0411\u0412" + + "\7t\2\2\u0412\u0413\7p\2\2\u0413\u00aa\3\2\2\2\u0414\u0415\7u\2\2\u0415" + + "\u0416\7d\2\2\u0416\u0417\7{\2\2\u0417\u0418\7v\2\2\u0418\u0419\7g\2\2" + + "\u0419\u00ac\3\2\2\2\u041a\u041b\7u\2\2\u041b\u041c\7g\2\2\u041c\u041d" + + "\7c\2\2\u041d\u041e\7n\2\2\u041e\u041f\7g\2\2\u041f\u0420\7f\2\2\u0420" + + "\u00ae\3\2\2\2\u0421\u0422\7u\2\2\u0422\u0423\7g\2\2\u0423\u0424\7n\2" + + "\2\u0424\u0425\7g\2\2\u0425\u0426\7e\2\2\u0426\u0427\7v\2\2\u0427\u00b0" + + "\3\2\2\2\u0428\u0429\7u\2\2\u0429\u042a\7g\2\2\u042a\u042b\7v\2\2\u042b" + + "\u00b2\3\2\2\2\u042c\u042d\7u\2\2\u042d\u042e\7j\2\2\u042e\u042f\7q\2" + + "\2\u042f\u0430\7t\2\2\u0430\u0431\7v\2\2\u0431\u00b4\3\2\2\2\u0432\u0433" + + "\7u\2\2\u0433\u0434\7k\2\2\u0434\u0435\7|\2\2\u0435\u0436\7g\2\2\u0436" + + "\u0437\7q\2\2\u0437\u0438\7h\2\2\u0438\u00b6\3\2\2\2\u0439\u043a\7u\2" + + "\2\u043a\u043b\7v\2\2\u043b\u043c\7c\2\2\u043c\u043d\7e\2\2\u043d\u043e" + + "\7m\2\2\u043e\u043f\7c\2\2\u043f\u0440\7n\2\2\u0440\u0441\7n\2\2\u0441" + + "\u0442\7q\2\2\u0442\u0443\7e\2\2\u0443\u00b8\3\2\2\2\u0444\u0445\7u\2" + + "\2\u0445\u0446\7v\2\2\u0446\u0447\7c\2\2\u0447\u0448\7v\2\2\u0448\u0449" + + "\7k\2\2\u0449\u044a\7e\2\2\u044a\u00ba\3\2\2\2\u044b\u044c\7u\2\2\u044c" + + "\u044d\7v\2\2\u044d\u044e\7t\2\2\u044e\u044f\7k\2\2\u044f\u0450\7p\2\2" + + "\u0450\u0451\7i\2\2\u0451\u00bc\3\2\2\2\u0452\u0453\7u\2\2\u0453\u0454" + + "\7v\2\2\u0454\u0455\7t\2\2\u0455\u0456\7w\2\2\u0456\u0457\7e\2\2\u0457" + + "\u0458\7v\2\2\u0458\u00be\3\2\2\2\u0459\u045a\7u\2\2\u045a\u045b\7y\2" + + "\2\u045b\u045c\7k\2\2\u045c\u045d\7v\2\2\u045d\u045e\7e\2\2\u045e\u045f" + + "\7j\2\2\u045f\u00c0\3\2\2\2\u0460\u0461\7v\2\2\u0461\u0462\7j\2\2\u0462" + + "\u0463\7k\2\2\u0463\u0464\7u\2\2\u0464\u00c2\3\2\2\2\u0465\u0466\7v\2" + + "\2\u0466\u0467\7j\2\2\u0467\u0468\7t\2\2\u0468\u0469\7q\2\2\u0469\u046a" + + "\7y\2\2\u046a\u00c4\3\2\2\2\u046b\u046c\7v\2\2\u046c\u046d\7t\2\2\u046d" + + "\u046e\7w\2\2\u046e\u046f\7g\2\2\u046f\u00c6\3\2\2\2\u0470\u0471\7v\2" + + "\2\u0471\u0472\7t\2\2\u0472\u0473\7{\2\2\u0473\u00c8\3\2\2\2\u0474\u0475" + + "\7v\2\2\u0475\u0476\7{\2\2\u0476\u0477\7r\2\2\u0477\u0478\7g\2\2\u0478" + + "\u0479\7q\2\2\u0479\u047a\7h\2\2\u047a\u00ca\3\2\2\2\u047b\u047c\7w\2" + + "\2\u047c\u047d\7k\2\2\u047d\u047e\7p\2\2\u047e\u047f\7v\2\2\u047f\u00cc" + + "\3\2\2\2\u0480\u0481\7w\2\2\u0481\u0482\7n\2\2\u0482\u0483\7q\2\2\u0483" + + "\u0484\7p\2\2\u0484\u0485\7i\2\2\u0485\u00ce\3\2\2\2\u0486\u0487\7w\2" + + "\2\u0487\u0488\7p\2\2\u0488\u0489\7e\2\2\u0489\u048a\7j\2\2\u048a\u048b" + + "\7g\2\2\u048b\u048c\7e\2\2\u048c\u048d\7m\2\2\u048d\u048e\7g\2\2\u048e" + + "\u048f\7f\2\2\u048f\u00d0\3\2\2\2\u0490\u0491\7w\2\2\u0491\u0492\7p\2" + + "\2\u0492\u0493\7o\2\2\u0493\u0494\7c\2\2\u0494\u0495\7p\2\2\u0495\u0496" + + "\7c\2\2\u0496\u0497\7i\2\2\u0497\u0498\7g\2\2\u0498\u0499\7f\2\2\u0499" + + "\u00d2\3\2\2\2\u049a\u049b\7w\2\2\u049b\u049c\7p\2\2\u049c\u049d\7u\2" + + "\2\u049d\u049e\7c\2\2\u049e\u049f\7h\2\2\u049f\u04a0\7g\2\2\u04a0\u00d4" + + "\3\2\2\2\u04a1\u04a2\7w\2\2\u04a2\u04a3\7u\2\2\u04a3\u04a4\7j\2\2\u04a4" + + "\u04a5\7q\2\2\u04a5\u04a6\7t\2\2\u04a6\u04a7\7v\2\2\u04a7\u00d6\3\2\2" + + "\2\u04a8\u04a9\7w\2\2\u04a9\u04aa\7u\2\2\u04aa\u04ab\7k\2\2\u04ab\u04ac" + + "\7p\2\2\u04ac\u04ad\7i\2\2\u04ad\u00d8\3\2\2\2\u04ae\u04af\7x\2\2\u04af" + + "\u04b0\7c\2\2\u04b0\u04b1\7t\2\2\u04b1\u00da\3\2\2\2\u04b2\u04b3\7x\2" + + "\2\u04b3\u04b4\7k\2\2\u04b4\u04b5\7t\2\2\u04b5\u04b6\7v\2\2\u04b6\u04b7" + + "\7w\2\2\u04b7\u04b8\7c\2\2\u04b8\u04b9\7n\2\2\u04b9\u00dc\3\2\2\2\u04ba" + + "\u04bb\7x\2\2\u04bb\u04bc\7q\2\2\u04bc\u04bd\7k\2\2\u04bd\u04be\7f\2\2" + + "\u04be\u00de\3\2\2\2\u04bf\u04c0\7x\2\2\u04c0\u04c1\7q\2\2\u04c1\u04c2" + + "\7n\2\2\u04c2\u04c3\7c\2\2\u04c3\u04c4\7v\2\2\u04c4\u04c5\7k\2\2\u04c5" + + "\u04c6\7n\2\2\u04c6\u04c7\7g\2\2\u04c7\u00e0\3\2\2\2\u04c8\u04c9\7y\2" + + "\2\u04c9\u04ca\7j\2\2\u04ca\u04cb\7g\2\2\u04cb\u04cc\7p\2\2\u04cc\u00e2" + + "\3\2\2\2\u04cd\u04ce\7y\2\2\u04ce\u04cf\7j\2\2\u04cf\u04d0\7g\2\2\u04d0" + + "\u04d1\7t\2\2\u04d1\u04d2\7g\2\2\u04d2\u00e4\3\2\2\2\u04d3\u04d4\7y\2" + + "\2\u04d4\u04d5\7j\2\2\u04d5\u04d6\7k\2\2\u04d6\u04d7\7n\2\2\u04d7\u04d8" + + "\7g\2\2\u04d8\u00e6\3\2\2\2\u04d9\u04da\7{\2\2\u04da\u04db\7k\2\2\u04db" + + "\u04dc\7g\2\2\u04dc\u04dd\7n\2\2\u04dd\u04de\7f\2\2\u04de\u00e8\3\2\2" + + "\2\u04df\u04e1\7B\2\2\u04e0\u04df\3\2\2\2\u04e0\u04e1\3\2\2\2\u04e1\u04e2" + + "\3\2\2\2\u04e2\u04e3\5\u01c5\u00e1\2\u04e3\u00ea\3\2\2\2\u04e4\u04ee\t" + + "\3\2\2\u04e5\u04e7\7a\2\2\u04e6\u04e5\3\2\2\2\u04e7\u04ea\3\2\2\2\u04e8" + + "\u04e6\3\2\2\2\u04e8\u04e9\3\2\2\2\u04e9\u04eb\3\2\2\2\u04ea\u04e8\3\2" + + "\2\2\u04eb\u04ed\t\3\2\2\u04ec\u04e8\3\2\2\2\u04ed\u04f0\3\2\2\2\u04ee" + + "\u04ec\3\2\2\2\u04ee\u04ef\3\2\2\2\u04ef\u04f2\3\2\2\2\u04f0\u04ee\3\2" + + "\2\2\u04f1\u04f3\5\u01b5\u00d9\2\u04f2\u04f1\3\2\2\2\u04f2\u04f3\3\2\2" + + "\2\u04f3\u04f4\3\2\2\2\u04f4\u04f6\7\60\2\2\u04f5\u04f7\7B\2\2\u04f6\u04f5" + + "\3\2\2\2\u04f6\u04f7\3\2\2\2\u04f7\u04f8\3\2\2\2\u04f8\u04f9\5\u01c5\u00e1" + + "\2\u04f9\u00ec\3\2\2\2\u04fa\u0504\t\3\2\2\u04fb\u04fd\7a\2\2\u04fc\u04fb" + + "\3\2\2\2\u04fd\u0500\3\2\2\2\u04fe\u04fc\3\2\2\2\u04fe\u04ff\3\2\2\2\u04ff" + + "\u0501\3\2\2\2\u0500\u04fe\3\2\2\2\u0501\u0503\t\3\2\2\u0502\u04fe\3\2" + + "\2\2\u0503\u0506\3\2\2\2\u0504\u0502\3\2\2\2\u0504\u0505\3\2\2\2\u0505" + + "\u0508\3\2\2\2\u0506\u0504\3\2\2\2\u0507\u0509\5\u01b5\u00d9\2\u0508\u0507" + + "\3\2\2\2\u0508\u0509\3\2\2\2\u0509\u00ee\3\2\2\2\u050a\u050b\7\62\2\2" + + "\u050b\u0513\t\4\2\2\u050c\u050e\7a\2\2\u050d\u050c\3\2\2\2\u050e\u0511" + + "\3\2\2\2\u050f\u050d\3\2\2\2\u050f\u0510\3\2\2\2\u0510\u0512\3\2\2\2\u0511" + + "\u050f\3\2\2\2\u0512\u0514\5\u01d7\u00ea\2\u0513\u050f\3\2\2\2\u0514\u0515" + + "\3\2\2\2\u0515\u0513\3\2\2\2\u0515\u0516\3\2\2\2\u0516\u0518\3\2\2\2\u0517" + + "\u0519\5\u01b5\u00d9\2\u0518\u0517\3\2\2\2\u0518\u0519\3\2\2\2\u0519\u00f0" + + "\3\2\2\2\u051a\u051b\7\62\2\2\u051b\u0523\t\5\2\2\u051c\u051e\7a\2\2\u051d" + + "\u051c\3\2\2\2\u051e\u0521\3\2\2\2\u051f\u051d\3\2\2\2\u051f\u0520\3\2" + + "\2\2\u0520\u0522\3\2\2\2\u0521\u051f\3\2\2\2\u0522\u0524\t\6\2\2\u0523" + + "\u051f\3\2\2\2\u0524\u0525\3\2\2\2\u0525\u0523\3\2\2\2\u0525\u0526\3\2" + + "\2\2\u0526\u0528\3\2\2\2\u0527\u0529\5\u01b5\u00d9\2\u0528\u0527\3\2\2" + + "\2\u0528\u0529\3\2\2\2\u0529\u00f2\3\2\2\2\u052a\u0534\t\3\2\2\u052b\u052d" + + "\7a\2\2\u052c\u052b\3\2\2\2\u052d\u0530\3\2\2\2\u052e\u052c\3\2\2\2\u052e" + + "\u052f\3\2\2\2\u052f\u0531\3\2\2\2\u0530\u052e\3\2\2\2\u0531\u0533\t\3" + + "\2\2\u0532\u052e\3\2\2\2\u0533\u0536\3\2\2\2\u0534\u0532\3\2\2\2\u0534" + + "\u0535\3\2\2\2\u0535\u0538\3\2\2\2\u0536\u0534\3\2\2\2\u0537\u052a\3\2" + + "\2\2\u0537\u0538\3\2\2\2\u0538\u0539\3\2\2\2\u0539\u053a\7\60\2\2\u053a" + + "\u0544\t\3\2\2\u053b\u053d\7a\2\2\u053c\u053b\3\2\2\2\u053d\u0540\3\2" + + "\2\2\u053e\u053c\3\2\2\2\u053e\u053f\3\2\2\2\u053f\u0541\3\2\2\2\u0540" + + "\u053e\3\2\2\2\u0541\u0543\t\3\2\2\u0542\u053e\3\2\2\2\u0543\u0546\3\2" + + "\2\2\u0544\u0542\3\2\2\2\u0544\u0545\3\2\2\2\u0545\u0548\3\2\2\2\u0546" + + "\u0544\3\2\2\2\u0547\u0549\5\u01b7\u00da\2\u0548\u0547\3\2\2\2\u0548\u0549" + + "\3\2\2\2\u0549\u054b\3\2\2\2\u054a\u054c\t\7\2\2\u054b\u054a\3\2\2\2\u054b" + + "\u054c\3\2\2\2\u054c\u0562\3\2\2\2\u054d\u0557\t\3\2\2\u054e\u0550\7a" + + "\2\2\u054f\u054e\3\2\2\2\u0550\u0553\3\2\2\2\u0551\u054f\3\2\2\2\u0551" + + "\u0552\3\2\2\2\u0552\u0554\3\2\2\2\u0553\u0551\3\2\2\2\u0554\u0556\t\3" + + "\2\2\u0555\u0551\3\2\2\2\u0556\u0559\3\2\2\2\u0557\u0555\3\2\2\2\u0557" + + "\u0558\3\2\2\2\u0558\u055f\3\2\2\2\u0559\u0557\3\2\2\2\u055a\u0560\t\7" + + "\2\2\u055b\u055d\5\u01b7\u00da\2\u055c\u055e\t\7\2\2\u055d\u055c\3\2\2" + + "\2\u055d\u055e\3\2\2\2\u055e\u0560\3\2\2\2\u055f\u055a\3\2\2\2\u055f\u055b" + + "\3\2\2\2\u0560\u0562\3\2\2\2\u0561\u0537\3\2\2\2\u0561\u054d\3\2\2\2\u0562" + + "\u00f4\3\2\2\2\u0563\u0566\7)\2\2\u0564\u0567\n\b\2\2\u0565\u0567\5\u01b9" + + "\u00db\2\u0566\u0564\3\2\2\2\u0566\u0565\3\2\2\2\u0567\u0568\3\2\2\2\u0568" + + "\u0569\7)\2\2\u0569\u00f6\3\2\2\2\u056a\u056f\7$\2\2\u056b\u056e\n\t\2" + + "\2\u056c\u056e\5\u01b9\u00db\2\u056d\u056b\3\2\2\2\u056d\u056c\3\2\2\2" + + "\u056e\u0571\3\2\2\2\u056f\u056d\3\2\2\2\u056f\u0570\3\2\2\2\u0570\u0572" + + "\3\2\2\2\u0571\u056f\3\2\2\2\u0572\u0573\7$\2\2\u0573\u00f8\3\2\2\2\u0574" + + "\u0575\7B\2\2\u0575\u0576\7$\2\2\u0576\u057c\3\2\2\2\u0577\u057b\n\n\2" + + "\2\u0578\u0579\7$\2\2\u0579\u057b\7$\2\2\u057a\u0577\3\2\2\2\u057a\u0578" + + "\3\2\2\2\u057b\u057e\3\2\2\2\u057c\u057a\3\2\2\2\u057c\u057d\3\2\2\2\u057d" + + "\u057f\3\2\2\2\u057e\u057c\3\2\2\2\u057f\u0580\7$\2\2\u0580\u00fa\3\2" + + "\2\2\u0581\u0582\7&\2\2\u0582\u0583\7$\2\2\u0583\u0584\3\2\2\2\u0584\u0585" + + "\b|\5\2\u0585\u0586\3\2\2\2\u0586\u0587\b|\6\2\u0587\u00fc\3\2\2\2\u0588" + + "\u0589\7&\2\2\u0589\u058a\7B\2\2\u058a\u058b\7$\2\2\u058b\u058c\3\2\2" + + "\2\u058c\u058d\b}\7\2\u058d\u058e\3\2\2\2\u058e\u058f\b}\6\2\u058f\u00fe" + + "\3\2\2\2\u0590\u0591\7}\2\2\u0591\u0592\b~\b\2\u0592\u0100\3\2\2\2\u0593" + + "\u0594\7\177\2\2\u0594\u0595\b\177\t\2\u0595\u0102\3\2\2\2\u0596\u0597" + + "\7]\2\2\u0597\u0104\3\2\2\2\u0598\u0599\7_\2\2\u0599\u0106\3\2\2\2\u059a" + + "\u059b\7*\2\2\u059b\u0108\3\2\2\2\u059c\u059d\7+\2\2\u059d\u010a\3\2\2" + + "\2\u059e\u059f\7\60\2\2\u059f\u010c\3\2\2\2\u05a0\u05a1\7.\2\2\u05a1\u010e" + + "\3\2\2\2\u05a2\u05a3\7<\2\2\u05a3\u05a4\b\u0086\n\2\u05a4\u0110\3\2\2" + + "\2\u05a5\u05a6\7=\2\2\u05a6\u0112\3\2\2\2\u05a7\u05a8\7-\2\2\u05a8\u0114" + + "\3\2\2\2\u05a9\u05aa\7/\2\2\u05aa\u0116\3\2\2\2\u05ab\u05ac\7,\2\2\u05ac" + + "\u0118\3\2\2\2\u05ad\u05ae\7\61\2\2\u05ae\u011a\3\2\2\2\u05af\u05b0\7" + + "\'\2\2\u05b0\u011c\3\2\2\2\u05b1\u05b2\7(\2\2\u05b2\u011e\3\2\2\2\u05b3" + + "\u05b4\7~\2\2\u05b4\u0120\3\2\2\2\u05b5\u05b6\7`\2\2\u05b6\u0122\3\2\2" + + "\2\u05b7\u05b8\7#\2\2\u05b8\u0124\3\2\2\2\u05b9\u05ba\7\u0080\2\2\u05ba" + + "\u0126\3\2\2\2\u05bb\u05bc\7?\2\2\u05bc\u0128\3\2\2\2\u05bd\u05be\7>\2" + + "\2\u05be\u012a\3\2\2\2\u05bf\u05c0\7@\2\2\u05c0\u012c\3\2\2\2\u05c1\u05c2" + + "\7A\2\2\u05c2\u012e\3\2\2\2\u05c3\u05c4\7<\2\2\u05c4\u05c5\7<\2\2\u05c5" + + "\u0130\3\2\2\2\u05c6\u05c7\7A\2\2\u05c7\u05c8\7A\2\2\u05c8\u0132\3\2\2" + + "\2\u05c9\u05ca\7-\2\2\u05ca\u05cb\7-\2\2\u05cb\u0134\3\2\2\2\u05cc\u05cd" + + "\7/\2\2\u05cd\u05ce\7/\2\2\u05ce\u0136\3\2\2\2\u05cf\u05d0\7(\2\2\u05d0" + + "\u05d1\7(\2\2\u05d1\u0138\3\2\2\2\u05d2\u05d3\7~\2\2\u05d3\u05d4\7~\2" + + "\2\u05d4\u013a\3\2\2\2\u05d5\u05d6\7/\2\2\u05d6\u05d7\7@\2\2\u05d7\u013c" + + "\3\2\2\2\u05d8\u05d9\7?\2\2\u05d9\u05da\7?\2\2\u05da\u013e\3\2\2\2\u05db" + + "\u05dc\7#\2\2\u05dc\u05dd\7?\2\2\u05dd\u0140\3\2\2\2\u05de\u05df\7>\2" + + "\2\u05df\u05e0\7?\2\2\u05e0\u0142\3\2\2\2\u05e1\u05e2\7@\2\2\u05e2\u05e3" + + "\7?\2\2\u05e3\u0144\3\2\2\2\u05e4\u05e5\7-\2\2\u05e5\u05e6\7?\2\2\u05e6" + + "\u0146\3\2\2\2\u05e7\u05e8\7/\2\2\u05e8\u05e9\7?\2\2\u05e9\u0148\3\2\2" + + "\2\u05ea\u05eb\7,\2\2\u05eb\u05ec\7?\2\2\u05ec\u014a\3\2\2\2\u05ed\u05ee" + + "\7\61\2\2\u05ee\u05ef\7?\2\2\u05ef\u014c\3\2\2\2\u05f0\u05f1\7\'\2\2\u05f1" + + "\u05f2\7?\2\2\u05f2\u014e\3\2\2\2\u05f3\u05f4\7(\2\2\u05f4\u05f5\7?\2" + + "\2\u05f5\u0150\3\2\2\2\u05f6\u05f7\7~\2\2\u05f7\u05f8\7?\2\2\u05f8\u0152" + + "\3\2\2\2\u05f9\u05fa\7`\2\2\u05fa\u05fb\7?\2\2\u05fb\u0154\3\2\2\2\u05fc" + + "\u05fd\7>\2\2\u05fd\u05fe\7>\2\2\u05fe\u0156\3\2\2\2\u05ff\u0600\7>\2" + + "\2\u0600\u0601\7>\2\2\u0601\u0602\7?\2\2\u0602\u0158\3\2\2\2\u0603\u0604" + + "\7A\2\2\u0604\u0605\7A\2\2\u0605\u0606\7?\2\2\u0606\u015a\3\2\2\2\u0607" + + "\u0608\7\60\2\2\u0608\u0609\7\60\2\2\u0609\u015c\3\2\2\2\u060a\u060b\7" + + "}\2\2\u060b\u060c\7}\2\2\u060c\u015e\3\2\2\2\u060d\u060e\7}\2\2\u060e" + + "\u060f\b\u00ae\13\2\u060f\u0610\3\2\2\2\u0610\u0611\b\u00ae\f\2\u0611" + + "\u0612\b\u00ae\r\2\u0612\u0160\3\2\2\2\u0613\u0614\6\u00af\2\2\u0614\u0615" + + "\5\u01bb\u00dc\2\u0615\u0162\3\2\2\2\u0616\u0617\6\u00b0\3\2\u0617\u0618" + + "\7$\2\2\u0618\u0619\7$\2\2\u0619\u0164\3\2\2\2\u061a\u061b\7$\2\2\u061b" + + "\u061c\b\u00b1\16\2\u061c\u061d\3\2\2\2\u061d\u061e\b\u00b1\17\2\u061e" + + "\u0166\3\2\2\2\u061f\u0621\6\u00b2\4\2\u0620\u0622\n\13\2\2\u0621\u0620" + + "\3\2\2\2\u0622\u0623\3\2\2\2\u0623\u0621\3\2\2\2\u0623\u0624\3\2\2\2\u0624" + + "\u0168\3\2\2\2\u0625\u0627\6\u00b3\5\2\u0626\u0628\n\f\2\2\u0627\u0626" + + "\3\2\2\2\u0628\u0629\3\2\2\2\u0629\u0627\3\2\2\2\u0629\u062a\3\2\2\2\u062a" + + "\u016a\3\2\2\2\u062b\u062c\7\177\2\2\u062c\u062d\7\177\2\2\u062d\u062e" + + "\3\2\2\2\u062e\u062f\b\u00b4\20\2\u062f\u016c\3\2\2\2\u0630\u0631\7\177" + + "\2\2\u0631\u0632\b\u00b5\21\2\u0632\u0633\3\2\2\2\u0633\u0634\b\u00b5" + + "\f\2\u0634\u0635\b\u00b5\17\2\u0635\u016e\3\2\2\2\u0636\u0638\n\r\2\2" + + "\u0637\u0636\3\2\2\2\u0638\u0639\3\2\2\2\u0639\u0637\3\2\2\2\u0639\u063a" + + "\3\2\2\2\u063a\u0170\3\2\2\2\u063b\u063d\5\u01c1\u00df\2\u063c\u063b\3" + + "\2\2\2\u063d\u063e\3\2\2\2\u063e\u063c\3\2\2\2\u063e\u063f\3\2\2\2\u063f" + + "\u0640\3\2\2\2\u0640\u0641\b\u00b7\3\2\u0641\u0172\3\2\2\2\u0642\u0644" + + "\t\3\2\2\u0643\u0642\3\2\2\2\u0644\u0645\3\2\2\2\u0645\u0643\3\2\2\2\u0645" + + "\u0646\3\2\2\2\u0646\u0647\3\2\2\2\u0647\u0648\b\u00b8\22\2\u0648\u0174" + + "\3\2\2\2\u0649\u064a\7v\2\2\u064a\u064b\7t\2\2\u064b\u064c\7w\2\2\u064c" + + "\u064d\7g\2\2\u064d\u064e\3\2\2\2\u064e\u064f\b\u00b9\22\2\u064f\u0650" + + "\b\u00b9\23\2\u0650\u0176\3\2\2\2\u0651\u0652\7h\2\2\u0652\u0653\7c\2" + + "\2\u0653\u0654\7n\2\2\u0654\u0655\7u\2\2\u0655\u0656\7g\2\2\u0656\u0657" + + "\3\2\2\2\u0657\u0658\b\u00ba\22\2\u0658\u0659\b\u00ba\24\2\u0659\u0178" + + "\3\2\2\2\u065a\u065b\7f\2\2\u065b\u065c\7g\2\2\u065c\u065d\7h\2\2\u065d" + + "\u065e\7k\2\2\u065e\u065f\7p\2\2\u065f\u0660\7g\2\2\u0660\u0661\3\2\2" + + "\2\u0661\u0662\b\u00bb\22\2\u0662\u017a\3\2\2\2\u0663\u0664\7w\2\2\u0664" + + "\u0665\7p\2\2\u0665\u0666\7f\2\2\u0666\u0667\7g\2\2\u0667\u0668\7h\2\2" + + "\u0668\u0669\3\2\2\2\u0669\u066a\b\u00bc\22\2\u066a\u017c\3\2\2\2\u066b" + + "\u066c\7k\2\2\u066c\u066d\7h\2\2\u066d\u066e\3\2\2\2\u066e\u066f\b\u00bd" + + "\22\2\u066f\u0670\b\u00bd\25\2\u0670\u017e\3\2\2\2\u0671\u0672\7g\2\2" + + "\u0672\u0673\7n\2\2\u0673\u0674\7k\2\2\u0674\u0675\7h\2\2\u0675\u0676" + + "\3\2\2\2\u0676\u0677\b\u00be\22\2\u0677\u0180\3\2\2\2\u0678\u0679\7g\2" + + "\2\u0679\u067a\7n\2\2\u067a\u067b\7u\2\2\u067b\u067c\7g\2\2\u067c\u067d" + + "\3\2\2\2\u067d\u067e\b\u00bf\22\2\u067e\u067f\b\u00bf\26\2\u067f\u0182" + + "\3\2\2\2\u0680\u0681\7g\2\2\u0681\u0682\7p\2\2\u0682\u0683\7f\2\2\u0683" + + "\u0684\7k\2\2\u0684\u0685\7h\2\2\u0685\u0686\3\2\2\2\u0686\u0687\b\u00c0" + + "\22\2\u0687\u0184\3\2\2\2\u0688\u0689\7n\2\2\u0689\u068a\7k\2\2\u068a" + + "\u068b\7p\2\2\u068b\u068c\7g\2\2\u068c\u068d\3\2\2\2\u068d\u068e\b\u00c1" + + "\22\2\u068e\u0186\3\2\2\2\u068f\u0690\7g\2\2\u0690\u0691\7t\2\2\u0691" + + "\u0692\7t\2\2\u0692\u0693\7q\2\2\u0693\u0694\7t\2\2\u0694\u0696\3\2\2" + + "\2\u0695\u0697\5\u01c1\u00df\2\u0696\u0695\3\2\2\2\u0697\u0698\3\2\2\2" + + "\u0698\u0696\3\2\2\2\u0698\u0699\3\2\2\2\u0699\u069a\3\2\2\2\u069a\u069b" + + "\b\u00c2\22\2\u069b\u069c\b\u00c2\27\2\u069c\u0188\3\2\2\2\u069d\u069e" + + "\7y\2\2\u069e\u069f\7c\2\2\u069f\u06a0\7t\2\2\u06a0\u06a1\7p\2\2\u06a1" + + "\u06a2\7k\2\2\u06a2\u06a3\7p\2\2\u06a3\u06a4\7i\2\2\u06a4\u06a6\3\2\2" + + "\2\u06a5\u06a7\5\u01c1\u00df\2\u06a6\u06a5\3\2\2\2\u06a7\u06a8\3\2\2\2" + + "\u06a8\u06a6\3\2\2\2\u06a8\u06a9\3\2\2\2\u06a9\u06aa\3\2\2\2\u06aa\u06ab" + + "\b\u00c3\22\2\u06ab\u06ac\b\u00c3\27\2\u06ac\u018a\3\2\2\2\u06ad\u06ae" + + "\7t\2\2\u06ae\u06af\7g\2\2\u06af\u06b0\7i\2\2\u06b0\u06b1\7k\2\2\u06b1" + + "\u06b2\7q\2\2\u06b2\u06b3\7p\2\2\u06b3\u06b7\3\2\2\2\u06b4\u06b6\5\u01c1" + + "\u00df\2\u06b5\u06b4\3\2\2\2\u06b6\u06b9\3\2\2\2\u06b7\u06b5\3\2\2\2\u06b7" + + "\u06b8\3\2\2\2\u06b8\u06ba\3\2\2\2\u06b9\u06b7\3\2\2\2\u06ba\u06bb\b\u00c4" + + "\22\2\u06bb\u06bc\b\u00c4\27\2\u06bc\u018c\3\2\2\2\u06bd\u06be\7g\2\2" + + "\u06be\u06bf\7p\2\2\u06bf\u06c0\7f\2\2\u06c0\u06c1\7t\2\2\u06c1\u06c2" + + "\7g\2\2\u06c2\u06c3\7i\2\2\u06c3\u06c4\7k\2\2\u06c4\u06c5\7q\2\2\u06c5" + + "\u06c6\7p\2\2\u06c6\u06ca\3\2\2\2\u06c7\u06c9\5\u01c1\u00df\2\u06c8\u06c7" + + "\3\2\2\2\u06c9\u06cc\3\2\2\2\u06ca\u06c8\3\2\2\2\u06ca\u06cb\3\2\2\2\u06cb" + + "\u06cd\3\2\2\2\u06cc\u06ca\3\2\2\2\u06cd\u06ce\b\u00c5\22\2\u06ce\u06cf" + + "\b\u00c5\27\2\u06cf\u018e\3\2\2\2\u06d0\u06d1\7r\2\2\u06d1\u06d2\7t\2" + + "\2\u06d2\u06d3\7c\2\2\u06d3\u06d4\7i\2\2\u06d4\u06d5\7o\2\2\u06d5\u06d6" + + "\7c\2\2\u06d6\u06d8\3\2\2\2\u06d7\u06d9\5\u01c1\u00df\2\u06d8\u06d7\3" + + "\2\2\2\u06d9\u06da\3\2\2\2\u06da\u06d8\3\2\2\2\u06da\u06db\3\2\2\2\u06db" + + "\u06dc\3\2\2\2\u06dc\u06dd\b\u00c6\22\2\u06dd\u06de\b\u00c6\27\2\u06de" + + "\u0190\3\2\2\2\u06df\u06e0\7p\2\2\u06e0\u06e1\7w\2\2\u06e1\u06e2\7n\2" + + "\2\u06e2\u06e3\7n\2\2\u06e3\u06e4\7c\2\2\u06e4\u06e5\7d\2\2\u06e5\u06e6" + + "\7n\2\2\u06e6\u06e7\7g\2\2\u06e7\u06e9\3\2\2\2\u06e8\u06ea\5\u01c1\u00df" + + "\2\u06e9\u06e8\3\2\2\2\u06ea\u06eb\3\2\2\2\u06eb\u06e9\3\2\2\2\u06eb\u06ec" + + "\3\2\2\2\u06ec\u06ed\3\2\2\2\u06ed\u06ee\b\u00c7\22\2\u06ee\u06ef\b\u00c7" + + "\27\2\u06ef\u0192\3\2\2\2\u06f0\u06f1\7f\2\2\u06f1\u06f2\7g\2\2\u06f2" + + "\u06f3\7h\2\2\u06f3\u06f4\7c\2\2\u06f4\u06f5\7w\2\2\u06f5\u06f6\7n\2\2" + + "\u06f6\u06f7\7v\2\2\u06f7\u06f8\3\2\2\2\u06f8\u06f9\b\u00c8\22\2\u06f9" + + "\u06fa\b\u00c8\30\2\u06fa\u0194\3\2\2\2\u06fb\u06fc\7j\2\2\u06fc\u06fd" + + "\7k\2\2\u06fd\u06fe\7f\2\2\u06fe\u06ff\7f\2\2\u06ff\u0700\7g\2\2\u0700" + + "\u0701\7p\2\2\u0701\u0702\3\2\2\2\u0702\u0703\b\u00c9\22\2\u0703\u0196" + + "\3\2\2\2\u0704\u0705\7*\2\2\u0705\u0706\3\2\2\2\u0706\u0707\b\u00ca\22" + + "\2\u0707\u0708\b\u00ca\31\2\u0708\u0198\3\2\2\2\u0709\u070a\7+\2\2\u070a" + + "\u070b\3\2\2\2\u070b\u070c\b\u00cb\22\2\u070c\u070d\b\u00cb\32\2\u070d" + + "\u019a\3\2\2\2\u070e\u070f\7#\2\2\u070f\u0710\3\2\2\2\u0710\u0711\b\u00cc" + + "\22\2\u0711\u0712\b\u00cc\33\2\u0712\u019c\3\2\2\2\u0713\u0714\7?\2\2" + + "\u0714\u0715\7?\2\2\u0715\u0716\3\2\2\2\u0716\u0717\b\u00cd\22\2\u0717" + + "\u0718\b\u00cd\34\2\u0718\u019e\3\2\2\2\u0719\u071a\7#\2\2\u071a\u071b" + + "\7?\2\2\u071b\u071c\3\2\2\2\u071c\u071d\b\u00ce\22\2\u071d\u071e\b\u00ce" + + "\35\2\u071e\u01a0\3\2\2\2\u071f\u0720\7(\2\2\u0720\u0721\7(\2\2\u0721" + + "\u0722\3\2\2\2\u0722\u0723\b\u00cf\22\2\u0723\u0724\b\u00cf\36\2\u0724" + + "\u01a2\3\2\2\2\u0725\u0726\7~\2\2\u0726\u0727\7~\2\2\u0727\u0728\3\2\2" + + "\2\u0728\u0729\b\u00d0\22\2\u0729\u072a\b\u00d0\37\2\u072a\u01a4\3\2\2" + + "\2\u072b\u072f\7$\2\2\u072c\u072e\n\16\2\2\u072d\u072c\3\2\2\2\u072e\u0731" + + "\3\2\2\2\u072f\u072d\3\2\2\2\u072f\u0730\3\2\2\2\u0730\u0732\3\2\2\2\u0731" + + "\u072f\3\2\2\2\u0732\u0733\7$\2\2\u0733\u0734\3\2\2\2\u0734\u0735\b\u00d1" + + "\22\2\u0735\u0736\b\u00d1 \2\u0736\u01a6\3\2\2\2\u0737\u0738\5\u01c5\u00e1" + + "\2\u0738\u0739\3\2\2\2\u0739\u073a\b\u00d2\22\2\u073a\u01a8\3\2\2\2\u073b" + + "\u073c\7\61\2\2\u073c\u073d\7\61\2\2\u073d\u0741\3\2\2\2\u073e\u0740\n" + + "\17\2\2\u073f\u073e\3\2\2\2\u0740\u0743\3\2\2\2\u0741\u073f\3\2\2\2\u0741" + + "\u0742\3\2\2\2\u0742\u0744\3\2\2\2\u0743\u0741\3\2\2\2\u0744\u0745\b\u00d3" + + "\2\2\u0745\u0746\b\u00d3!\2\u0746\u01aa\3\2\2\2\u0747\u0748\5\u01bf\u00de" + + "\2\u0748\u0749\3\2\2\2\u0749\u074a\b\u00d4\22\2\u074a\u074b\b\u00d4\"" + + "\2\u074b\u01ac\3\2\2\2\u074c\u074e\n\17\2\2\u074d\u074c\3\2\2\2\u074e" + + "\u074f\3\2\2\2\u074f\u074d\3\2\2\2\u074f\u0750\3\2\2\2\u0750\u0751\3\2" + + "\2\2\u0751\u0752\b\u00d5\22\2\u0752\u01ae\3\2\2\2\u0753\u0754\5\u01bf" + + "\u00de\2\u0754\u0755\3\2\2\2\u0755\u0756\b\u00d6\22\2\u0756\u0757\b\u00d6" + + "#\2\u0757\u0758\b\u00d6\"\2\u0758\u01b0\3\2\2\2\u0759\u075a\n\17\2\2\u075a" + + "\u01b2\3\2\2\2\u075b\u075c\t\17\2\2\u075c\u01b4\3\2\2\2\u075d\u075f\t" + + "\20\2\2\u075e\u075d\3\2\2\2\u075e\u075f\3\2\2\2\u075f\u0760\3\2\2\2\u0760" + + "\u0766\t\21\2\2\u0761\u0763\t\21\2\2\u0762\u0761\3\2\2\2\u0762\u0763\3" + + "\2\2\2\u0763\u0764\3\2\2\2\u0764\u0766\t\20\2\2\u0765\u075e\3\2\2\2\u0765" + + "\u0762\3\2\2\2\u0766\u01b6\3\2\2\2\u0767\u0769\t\22\2\2\u0768\u076a\t" + + "\23\2\2\u0769\u0768\3\2\2\2\u0769\u076a\3\2\2\2\u076a\u076b\3\2\2\2\u076b" + + "\u0775\t\3\2\2\u076c\u076e\7a\2\2\u076d\u076c\3\2\2\2\u076e\u0771\3\2" + + "\2\2\u076f\u076d\3\2\2\2\u076f\u0770\3\2\2\2\u0770\u0772\3\2\2\2\u0771" + + "\u076f\3\2\2\2\u0772\u0774\t\3\2\2\u0773\u076f\3\2\2\2\u0774\u0777\3\2" + + "\2\2\u0775\u0773\3\2\2\2\u0775\u0776\3\2\2\2\u0776\u01b8\3\2\2\2\u0777" + + "\u0775\3\2\2\2\u0778\u077c\5\u01bb\u00dc\2\u0779\u077c\5\u01bd\u00dd\2" + + "\u077a\u077c\5\u01d5\u00e9\2\u077b\u0778\3\2\2\2\u077b\u0779\3\2\2\2\u077b" + + "\u077a\3\2\2\2\u077c\u01ba\3\2\2\2\u077d\u077e\7^\2\2\u077e\u0794\7)\2" + + "\2\u077f\u0780\7^\2\2\u0780\u0794\7$\2\2\u0781\u0782\7^\2\2\u0782\u0794" + + "\7^\2\2\u0783\u0784\7^\2\2\u0784\u0794\7\62\2\2\u0785\u0786\7^\2\2\u0786" + + "\u0794\7c\2\2\u0787\u0788\7^\2\2\u0788\u0794\7d\2\2\u0789\u078a\7^\2\2" + + "\u078a\u0794\7h\2\2\u078b\u078c\7^\2\2\u078c\u0794\7p\2\2\u078d\u078e" + + "\7^\2\2\u078e\u0794\7t\2\2\u078f\u0790\7^\2\2\u0790\u0794\7v\2\2\u0791" + + "\u0792\7^\2\2\u0792\u0794\7x\2\2\u0793\u077d\3\2\2\2\u0793\u077f\3\2\2" + + "\2\u0793\u0781\3\2\2\2\u0793\u0783\3\2\2\2\u0793\u0785\3\2\2\2\u0793\u0787" + + "\3\2\2\2\u0793\u0789\3\2\2\2\u0793\u078b\3\2\2\2\u0793\u078d\3\2\2\2\u0793" + + "\u078f\3\2\2\2\u0793\u0791\3\2\2\2\u0794\u01bc\3\2\2\2\u0795\u0796\7^" + + "\2\2\u0796\u0797\7z\2\2\u0797\u0798\3\2\2\2\u0798\u07af\5\u01d7\u00ea" + + "\2\u0799\u079a\7^\2\2\u079a\u079b\7z\2\2\u079b\u079c\3\2\2\2\u079c\u079d" + + "\5\u01d7\u00ea\2\u079d\u079e\5\u01d7\u00ea\2\u079e\u07af\3\2\2\2\u079f" + + "\u07a0\7^\2\2\u07a0\u07a1\7z\2\2\u07a1\u07a2\3\2\2\2\u07a2\u07a3\5\u01d7" + + "\u00ea\2\u07a3\u07a4\5\u01d7\u00ea\2\u07a4\u07a5\5\u01d7\u00ea\2\u07a5" + + "\u07af\3\2\2\2\u07a6\u07a7\7^\2\2\u07a7\u07a8\7z\2\2\u07a8\u07a9\3\2\2" + + "\2\u07a9\u07aa\5\u01d7\u00ea\2\u07aa\u07ab\5\u01d7\u00ea\2\u07ab\u07ac" + + "\5\u01d7\u00ea\2\u07ac\u07ad\5\u01d7\u00ea\2\u07ad\u07af\3\2\2\2\u07ae" + + "\u0795\3\2\2\2\u07ae\u0799\3\2\2\2\u07ae\u079f\3\2\2\2\u07ae\u07a6\3\2" + + "\2\2\u07af\u01be\3\2\2\2\u07b0\u07b1\7\17\2\2\u07b1\u07b4\7\f\2\2\u07b2" + + "\u07b4\t\17\2\2\u07b3\u07b0\3\2\2\2\u07b3\u07b2\3\2\2\2\u07b4\u01c0\3" + + "\2\2\2\u07b5\u07b8\5\u01c3\u00e0\2\u07b6\u07b8\t\24\2\2\u07b7\u07b5\3" + + "\2\2\2\u07b7\u07b6\3\2\2\2\u07b8\u01c2\3\2\2\2\u07b9\u07ba\t\25\2\2\u07ba" + + "\u01c4\3\2\2\2\u07bb\u07bf\5\u01c7\u00e2\2\u07bc\u07be\5\u01c9\u00e3\2" + + "\u07bd\u07bc\3\2\2\2\u07be\u07c1\3\2\2\2\u07bf\u07bd\3\2\2\2\u07bf\u07c0" + + "\3\2\2\2\u07c0\u01c6\3\2\2\2\u07c1\u07bf\3\2\2\2\u07c2\u07c5\5\u01cb\u00e4" + + "\2\u07c3\u07c5\7a\2\2\u07c4\u07c2\3\2\2\2\u07c4\u07c3\3\2\2\2\u07c5\u01c8" + + "\3\2\2\2\u07c6\u07cc\5\u01cb\u00e4\2\u07c7\u07cc\5\u01cd\u00e5\2\u07c8" + + "\u07cc\5\u01cf\u00e6\2\u07c9\u07cc\5\u01d1\u00e7\2\u07ca\u07cc\5\u01d3" + + "\u00e8\2\u07cb\u07c6\3\2\2\2\u07cb\u07c7\3\2\2\2\u07cb\u07c8\3\2\2\2\u07cb" + + "\u07c9\3\2\2\2\u07cb\u07ca\3\2\2\2\u07cc\u01ca\3\2\2\2\u07cd\u07d5\5\u01d9" + + "\u00eb\2\u07ce\u07d5\5\u01db\u00ec\2\u07cf\u07d5\5\u01dd\u00ed\2\u07d0" + + "\u07d5\5\u01df\u00ee\2\u07d1\u07d5\5\u01e1\u00ef\2\u07d2\u07d5\5\u01e3" + + "\u00f0\2\u07d3\u07d5\5\u01d5\u00e9\2\u07d4\u07cd\3\2\2\2\u07d4\u07ce\3" + + "\2\2\2\u07d4\u07cf\3\2\2\2\u07d4\u07d0\3\2\2\2\u07d4\u07d1\3\2\2\2\u07d4" + + "\u07d2\3\2\2\2\u07d4\u07d3\3\2\2\2\u07d5\u01cc\3\2\2\2\u07d6\u07d9\5\u01ed" + + "\u00f5\2\u07d7\u07d9\5\u01d5\u00e9\2\u07d8\u07d6\3\2\2\2\u07d8\u07d7\3" + + "\2\2\2\u07d9\u01ce\3\2\2\2\u07da\u07dd\5\u01eb\u00f4\2\u07db\u07dd\5\u01d5" + + "\u00e9\2\u07dc\u07da\3\2\2\2\u07dc\u07db\3\2\2\2\u07dd\u01d0\3\2\2\2\u07de" + + "\u07e2\5\u01e5\u00f1\2\u07df\u07e2\5\u01e7\u00f2\2\u07e0\u07e2\5\u01d5" + + "\u00e9\2\u07e1\u07de\3\2\2\2\u07e1\u07df\3\2\2\2\u07e1\u07e0\3\2\2\2\u07e2" + + "\u01d2\3\2\2\2\u07e3\u07e6\5\u01e9\u00f3\2\u07e4\u07e6\5\u01d5\u00e9\2" + + "\u07e5\u07e3\3\2\2\2\u07e5\u07e4\3\2\2\2\u07e6\u01d4\3\2\2\2\u07e7\u07e8" + + "\7^\2\2\u07e8\u07e9\7w\2\2\u07e9\u07ea\3\2\2\2\u07ea\u07eb\5\u01d7\u00ea" + + "\2\u07eb\u07ec\5\u01d7\u00ea\2\u07ec\u07ed\5\u01d7\u00ea\2\u07ed\u07ee" + + "\5\u01d7\u00ea\2\u07ee\u07fc\3\2\2\2\u07ef\u07f0\7^\2\2\u07f0\u07f1\7" + + "W\2\2\u07f1\u07f2\3\2\2\2\u07f2\u07f3\5\u01d7\u00ea\2\u07f3\u07f4\5\u01d7" + + "\u00ea\2\u07f4\u07f5\5\u01d7\u00ea\2\u07f5\u07f6\5\u01d7\u00ea\2\u07f6" + + "\u07f7\5\u01d7\u00ea\2\u07f7\u07f8\5\u01d7\u00ea\2\u07f8\u07f9\5\u01d7" + + "\u00ea\2\u07f9\u07fa\5\u01d7\u00ea\2\u07fa\u07fc\3\2\2\2\u07fb\u07e7\3" + + "\2\2\2\u07fb\u07ef\3\2\2\2\u07fc\u01d6\3\2\2\2\u07fd\u07ff\t\26\2\2\u07fe" + + "\u07fd\3\2\2\2\u07ff\u01d8\3\2\2\2\u0800\u0801\t\27\2\2\u0801\u01da\3" + + "\2\2\2\u0802\u0803\t\30\2\2\u0803\u01dc\3\2\2\2\u0804\u0805\t\31\2\2\u0805" + + "\u01de\3\2\2\2\u0806\u0807\t\32\2\2\u0807\u01e0\3\2\2\2\u0808\u0809\t" + + "\33\2\2\u0809\u01e2\3\2\2\2\u080a\u080b\t\34\2\2\u080b\u01e4\3\2\2\2\u080c" + + "\u080d\4\u0302\u0312\2\u080d\u01e6\3\2\2\2\u080e\u080f\t\35\2\2\u080f" + + "\u01e8\3\2\2\2\u0810\u0811\t\36\2\2\u0811\u01ea\3\2\2\2\u0812\u0813\t" + + "\37\2\2\u0813\u01ec\3\2\2\2\u0814\u0815\t \2\2\u0815\u01ee\3\2\2\2O\2" + + "\3\4\5\6\u01fa\u020f\u021d\u0228\u0232\u0234\u04e0\u04e8\u04ee\u04f2\u04f6" + + "\u04fe\u0504\u0508\u050f\u0515\u0518\u051f\u0525\u0528\u052e\u0534\u0537" + + "\u053e\u0544\u0548\u054b\u0551\u0557\u055d\u055f\u0561\u0566\u056d\u056f" + + "\u057a\u057c\u0623\u0629\u0639\u063e\u0645\u0698\u06a8\u06b7\u06ca\u06da" + + "\u06eb\u072f\u0741\u074f\u075e\u0762\u0765\u0769\u076f\u0775\u077b\u0793" + + "\u07ae\u07b3\u07b7\u07bf\u07c4\u07cb\u07d4\u07d8\u07dc\u07e1\u07e5\u07fb" + + "\u07fe$\2\4\2\2\3\2\4\5\2\3|\2\7\3\2\3}\3\3~\4\3\177\5\3\u0086\6\3\u00ae" + + "\7\b\2\2\7\2\2\3\u00b1\b\6\2\2\t\u00b6\2\3\u00b5\t\2\5\2\tb\2\t,\2\t\66" + + "\2\t&\2\4\6\2\t \2\t\u0083\2\t\u0084\2\t\u0091\2\t\u009e\2\t\u009f\2\t" + + "\u009b\2\t\u009c\2\t]\2\t\7\2\4\2\2\t\u00c6\2"; + public static final ATN _ATN = new ATNDeserializer() + .deserialize(_serializedATN.toCharArray()); - public static final String _serializedATN = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\u00c8\u0816\b\1\b"+ - "\1\b\1\b\1\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b"+ - "\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t"+ - "\20\4\21\t\21\4\22\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t"+ - "\27\4\30\t\30\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t"+ - "\36\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t"+ - "(\4)\t)\4*\t*\4+\t+\4,\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t"+ - "\62\4\63\t\63\4\64\t\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t"+ - ":\4;\t;\4<\t<\4=\t=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4"+ - "F\tF\4G\tG\4H\tH\4I\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\t"+ - "Q\4R\tR\4S\tS\4T\tT\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\"+ - "\4]\t]\4^\t^\4_\t_\4`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h"+ - "\th\4i\ti\4j\tj\4k\tk\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4q\tq\4r\tr\4s\ts"+ - "\4t\tt\4u\tu\4v\tv\4w\tw\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177"+ - "\t\177\4\u0080\t\u0080\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083"+ - "\4\u0084\t\u0084\4\u0085\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087\4\u0088"+ - "\t\u0088\4\u0089\t\u0089\4\u008a\t\u008a\4\u008b\t\u008b\4\u008c\t\u008c"+ - "\4\u008d\t\u008d\4\u008e\t\u008e\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091"+ - "\t\u0091\4\u0092\t\u0092\4\u0093\t\u0093\4\u0094\t\u0094\4\u0095\t\u0095"+ - "\4\u0096\t\u0096\4\u0097\t\u0097\4\u0098\t\u0098\4\u0099\t\u0099\4\u009a"+ - "\t\u009a\4\u009b\t\u009b\4\u009c\t\u009c\4\u009d\t\u009d\4\u009e\t\u009e"+ - "\4\u009f\t\u009f\4\u00a0\t\u00a0\4\u00a1\t\u00a1\4\u00a2\t\u00a2\4\u00a3"+ - "\t\u00a3\4\u00a4\t\u00a4\4\u00a5\t\u00a5\4\u00a6\t\u00a6\4\u00a7\t\u00a7"+ - "\4\u00a8\t\u00a8\4\u00a9\t\u00a9\4\u00aa\t\u00aa\4\u00ab\t\u00ab\4\u00ac"+ - "\t\u00ac\4\u00ad\t\u00ad\4\u00ae\t\u00ae\4\u00af\t\u00af\4\u00b0\t\u00b0"+ - "\4\u00b1\t\u00b1\4\u00b2\t\u00b2\4\u00b3\t\u00b3\4\u00b4\t\u00b4\4\u00b5"+ - "\t\u00b5\4\u00b6\t\u00b6\4\u00b7\t\u00b7\4\u00b8\t\u00b8\4\u00b9\t\u00b9"+ - "\4\u00ba\t\u00ba\4\u00bb\t\u00bb\4\u00bc\t\u00bc\4\u00bd\t\u00bd\4\u00be"+ - "\t\u00be\4\u00bf\t\u00bf\4\u00c0\t\u00c0\4\u00c1\t\u00c1\4\u00c2\t\u00c2"+ - "\4\u00c3\t\u00c3\4\u00c4\t\u00c4\4\u00c5\t\u00c5\4\u00c6\t\u00c6\4\u00c7"+ - "\t\u00c7\4\u00c8\t\u00c8\4\u00c9\t\u00c9\4\u00ca\t\u00ca\4\u00cb\t\u00cb"+ - "\4\u00cc\t\u00cc\4\u00cd\t\u00cd\4\u00ce\t\u00ce\4\u00cf\t\u00cf\4\u00d0"+ - "\t\u00d0\4\u00d1\t\u00d1\4\u00d2\t\u00d2\4\u00d3\t\u00d3\4\u00d4\t\u00d4"+ - "\4\u00d5\t\u00d5\4\u00d6\t\u00d6\4\u00d7\t\u00d7\4\u00d8\t\u00d8\4\u00d9"+ - "\t\u00d9\4\u00da\t\u00da\4\u00db\t\u00db\4\u00dc\t\u00dc\4\u00dd\t\u00dd"+ - "\4\u00de\t\u00de\4\u00df\t\u00df\4\u00e0\t\u00e0\4\u00e1\t\u00e1\4\u00e2"+ - "\t\u00e2\4\u00e3\t\u00e3\4\u00e4\t\u00e4\4\u00e5\t\u00e5\4\u00e6\t\u00e6"+ - "\4\u00e7\t\u00e7\4\u00e8\t\u00e8\4\u00e9\t\u00e9\4\u00ea\t\u00ea\4\u00eb"+ - "\t\u00eb\4\u00ec\t\u00ec\4\u00ed\t\u00ed\4\u00ee\t\u00ee\4\u00ef\t\u00ef"+ - "\4\u00f0\t\u00f0\4\u00f1\t\u00f1\4\u00f2\t\u00f2\4\u00f3\t\u00f3\4\u00f4"+ - "\t\u00f4\4\u00f5\t\u00f5\3\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\7\3\u01f9"+ - "\n\3\f\3\16\3\u01fc\13\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\5\3"+ - "\5\3\5\3\5\3\5\3\5\7\5\u020e\n\5\f\5\16\5\u0211\13\5\3\5\3\5\3\5\3\5\3"+ - "\5\3\6\3\6\3\6\3\6\7\6\u021c\n\6\f\6\16\6\u021f\13\6\3\6\3\6\3\7\3\7\3"+ - "\7\3\7\7\7\u0227\n\7\f\7\16\7\u022a\13\7\3\7\3\7\3\7\3\7\3\7\3\b\3\b\6"+ - "\b\u0233\n\b\r\b\16\b\u0234\3\b\3\b\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3"+ - "\n\3\n\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r"+ - "\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3"+ - "\17\3\17\3\17\3\17\3\17\3\17\3\20\3\20\3\20\3\20\3\20\3\20\3\21\3\21\3"+ - "\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23\3"+ - "\24\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\26\3\26\3\26\3\26\3\26\3"+ - "\27\3\27\3\27\3\27\3\27\3\30\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\31\3"+ - "\31\3\31\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3"+ - "\33\3\33\3\34\3\34\3\34\3\34\3\34\3\34\3\35\3\35\3\35\3\35\3\35\3\35\3"+ - "\35\3\35\3\35\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\37\3\37\3\37\3"+ - "\37\3\37\3\37\3\37\3\37\3 \3 \3 \3 \3 \3 \3 \3 \3 \3!\3!\3!\3!\3!\3!\3"+ - "!\3!\3!\3!\3!\3\"\3\"\3\"\3#\3#\3#\3#\3#\3#\3#\3$\3$\3$\3$\3$\3$\3$\3"+ - "$\3%\3%\3%\3%\3%\3&\3&\3&\3&\3&\3\'\3\'\3\'\3\'\3\'\3\'\3\'\3(\3(\3(\3"+ - "(\3(\3(\3)\3)\3)\3)\3)\3)\3)\3)\3)\3*\3*\3*\3*\3*\3*\3*\3+\3+\3+\3+\3"+ - "+\3+\3,\3,\3,\3,\3,\3,\3,\3,\3-\3-\3-\3-\3-\3-\3.\3.\3.\3.\3.\3.\3/\3"+ - "/\3/\3/\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\61\3\61\3\61\3\61\3"+ - "\61\3\62\3\62\3\62\3\62\3\63\3\63\3\63\3\63\3\63\3\64\3\64\3\64\3\64\3"+ - "\64\3\64\3\65\3\65\3\65\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3\66\3"+ - "\67\3\67\3\67\38\38\38\38\39\39\39\39\39\39\39\39\39\39\3:\3:\3:\3:\3"+ - ":\3:\3:\3:\3:\3;\3;\3;\3;\3;\3<\3<\3<\3=\3=\3=\3=\3=\3>\3>\3>\3>\3?\3"+ - "?\3?\3?\3?\3@\3@\3@\3@\3@\3A\3A\3A\3A\3A\3A\3A\3B\3B\3B\3B\3B\3B\3B\3"+ - "B\3B\3B\3C\3C\3C\3C\3D\3D\3D\3D\3D\3E\3E\3E\3E\3E\3E\3E\3F\3F\3F\3G\3"+ - "G\3G\3G\3G\3G\3G\3G\3G\3H\3H\3H\3H\3H\3H\3H\3H\3I\3I\3I\3I\3J\3J\3J\3"+ - "J\3J\3J\3J\3J\3J\3K\3K\3K\3K\3K\3K\3K\3L\3L\3L\3L\3L\3L\3L\3L\3M\3M\3"+ - "M\3M\3M\3M\3M\3M\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3O\3O\3O\3O\3O\3O\3O\3"+ - "P\3P\3P\3P\3P\3P\3P\3P\3P\3Q\3Q\3Q\3Q\3R\3R\3R\3R\3R\3R\3R\3S\3S\3S\3"+ - "S\3S\3S\3S\3T\3T\3T\3T\3T\3T\3U\3U\3U\3U\3U\3U\3U\3V\3V\3V\3V\3V\3V\3"+ - "V\3W\3W\3W\3W\3X\3X\3X\3X\3X\3X\3Y\3Y\3Y\3Y\3Y\3Y\3Y\3Z\3Z\3Z\3Z\3Z\3"+ - "Z\3Z\3Z\3Z\3Z\3Z\3[\3[\3[\3[\3[\3[\3[\3\\\3\\\3\\\3\\\3\\\3\\\3\\\3]\3"+ - "]\3]\3]\3]\3]\3]\3^\3^\3^\3^\3^\3^\3^\3_\3_\3_\3_\3_\3`\3`\3`\3`\3`\3"+ - "`\3a\3a\3a\3a\3a\3b\3b\3b\3b\3c\3c\3c\3c\3c\3c\3c\3d\3d\3d\3d\3d\3e\3"+ - "e\3e\3e\3e\3e\3f\3f\3f\3f\3f\3f\3f\3f\3f\3f\3g\3g\3g\3g\3g\3g\3g\3g\3"+ - "g\3g\3h\3h\3h\3h\3h\3h\3h\3i\3i\3i\3i\3i\3i\3i\3j\3j\3j\3j\3j\3j\3k\3"+ - "k\3k\3k\3l\3l\3l\3l\3l\3l\3l\3l\3m\3m\3m\3m\3m\3n\3n\3n\3n\3n\3n\3n\3"+ - "n\3n\3o\3o\3o\3o\3o\3p\3p\3p\3p\3p\3p\3q\3q\3q\3q\3q\3q\3r\3r\3r\3r\3"+ - "r\3r\3s\5s\u04e1\ns\3s\3s\3t\3t\7t\u04e7\nt\ft\16t\u04ea\13t\3t\7t\u04ed"+ - "\nt\ft\16t\u04f0\13t\3t\5t\u04f3\nt\3t\3t\5t\u04f7\nt\3t\3t\3u\3u\7u\u04fd"+ - "\nu\fu\16u\u0500\13u\3u\7u\u0503\nu\fu\16u\u0506\13u\3u\5u\u0509\nu\3"+ - "v\3v\3v\7v\u050e\nv\fv\16v\u0511\13v\3v\6v\u0514\nv\rv\16v\u0515\3v\5"+ - "v\u0519\nv\3w\3w\3w\7w\u051e\nw\fw\16w\u0521\13w\3w\6w\u0524\nw\rw\16"+ - "w\u0525\3w\5w\u0529\nw\3x\3x\7x\u052d\nx\fx\16x\u0530\13x\3x\7x\u0533"+ - "\nx\fx\16x\u0536\13x\5x\u0538\nx\3x\3x\3x\7x\u053d\nx\fx\16x\u0540\13"+ - "x\3x\7x\u0543\nx\fx\16x\u0546\13x\3x\5x\u0549\nx\3x\5x\u054c\nx\3x\3x"+ - "\7x\u0550\nx\fx\16x\u0553\13x\3x\7x\u0556\nx\fx\16x\u0559\13x\3x\3x\3"+ - "x\5x\u055e\nx\5x\u0560\nx\5x\u0562\nx\3y\3y\3y\5y\u0567\ny\3y\3y\3z\3"+ - "z\3z\7z\u056e\nz\fz\16z\u0571\13z\3z\3z\3{\3{\3{\3{\3{\3{\7{\u057b\n{"+ - "\f{\16{\u057e\13{\3{\3{\3|\3|\3|\3|\3|\3|\3|\3}\3}\3}\3}\3}\3}\3}\3}\3"+ - "~\3~\3~\3\177\3\177\3\177\3\u0080\3\u0080\3\u0081\3\u0081\3\u0082\3\u0082"+ - "\3\u0083\3\u0083\3\u0084\3\u0084\3\u0085\3\u0085\3\u0086\3\u0086\3\u0086"+ - "\3\u0087\3\u0087\3\u0088\3\u0088\3\u0089\3\u0089\3\u008a\3\u008a\3\u008b"+ - "\3\u008b\3\u008c\3\u008c\3\u008d\3\u008d\3\u008e\3\u008e\3\u008f\3\u008f"+ - "\3\u0090\3\u0090\3\u0091\3\u0091\3\u0092\3\u0092\3\u0093\3\u0093\3\u0094"+ - "\3\u0094\3\u0095\3\u0095\3\u0096\3\u0096\3\u0096\3\u0097\3\u0097\3\u0097"+ - "\3\u0098\3\u0098\3\u0098\3\u0099\3\u0099\3\u0099\3\u009a\3\u009a\3\u009a"+ - "\3\u009b\3\u009b\3\u009b\3\u009c\3\u009c\3\u009c\3\u009d\3\u009d\3\u009d"+ - "\3\u009e\3\u009e\3\u009e\3\u009f\3\u009f\3\u009f\3\u00a0\3\u00a0\3\u00a0"+ - "\3\u00a1\3\u00a1\3\u00a1\3\u00a2\3\u00a2\3\u00a2\3\u00a3\3\u00a3\3\u00a3"+ - "\3\u00a4\3\u00a4\3\u00a4\3\u00a5\3\u00a5\3\u00a5\3\u00a6\3\u00a6\3\u00a6"+ - "\3\u00a7\3\u00a7\3\u00a7\3\u00a8\3\u00a8\3\u00a8\3\u00a9\3\u00a9\3\u00a9"+ - "\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00ab\3\u00ab\3\u00ab\3\u00ab\3\u00ac"+ - "\3\u00ac\3\u00ac\3\u00ad\3\u00ad\3\u00ad\3\u00ae\3\u00ae\3\u00ae\3\u00ae"+ - "\3\u00ae\3\u00ae\3\u00af\3\u00af\3\u00af\3\u00b0\3\u00b0\3\u00b0\3\u00b0"+ - "\3\u00b1\3\u00b1\3\u00b1\3\u00b1\3\u00b1\3\u00b2\3\u00b2\6\u00b2\u0622"+ - "\n\u00b2\r\u00b2\16\u00b2\u0623\3\u00b3\3\u00b3\6\u00b3\u0628\n\u00b3"+ - "\r\u00b3\16\u00b3\u0629\3\u00b4\3\u00b4\3\u00b4\3\u00b4\3\u00b4\3\u00b5"+ - "\3\u00b5\3\u00b5\3\u00b5\3\u00b5\3\u00b5\3\u00b6\6\u00b6\u0638\n\u00b6"+ - "\r\u00b6\16\u00b6\u0639\3\u00b7\6\u00b7\u063d\n\u00b7\r\u00b7\16\u00b7"+ - "\u063e\3\u00b7\3\u00b7\3\u00b8\6\u00b8\u0644\n\u00b8\r\u00b8\16\u00b8"+ - "\u0645\3\u00b8\3\u00b8\3\u00b9\3\u00b9\3\u00b9\3\u00b9\3\u00b9\3\u00b9"+ - "\3\u00b9\3\u00b9\3\u00ba\3\u00ba\3\u00ba\3\u00ba\3\u00ba\3\u00ba\3\u00ba"+ - "\3\u00ba\3\u00ba\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bb"+ - "\3\u00bb\3\u00bb\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc"+ - "\3\u00bc\3\u00bd\3\u00bd\3\u00bd\3\u00bd\3\u00bd\3\u00bd\3\u00be\3\u00be"+ - "\3\u00be\3\u00be\3\u00be\3\u00be\3\u00be\3\u00bf\3\u00bf\3\u00bf\3\u00bf"+ - "\3\u00bf\3\u00bf\3\u00bf\3\u00bf\3\u00c0\3\u00c0\3\u00c0\3\u00c0\3\u00c0"+ - "\3\u00c0\3\u00c0\3\u00c0\3\u00c1\3\u00c1\3\u00c1\3\u00c1\3\u00c1\3\u00c1"+ - "\3\u00c1\3\u00c2\3\u00c2\3\u00c2\3\u00c2\3\u00c2\3\u00c2\3\u00c2\6\u00c2"+ - "\u0697\n\u00c2\r\u00c2\16\u00c2\u0698\3\u00c2\3\u00c2\3\u00c2\3\u00c3"+ - "\3\u00c3\3\u00c3\3\u00c3\3\u00c3\3\u00c3\3\u00c3\3\u00c3\3\u00c3\6\u00c3"+ - "\u06a7\n\u00c3\r\u00c3\16\u00c3\u06a8\3\u00c3\3\u00c3\3\u00c3\3\u00c4"+ - "\3\u00c4\3\u00c4\3\u00c4\3\u00c4\3\u00c4\3\u00c4\3\u00c4\7\u00c4\u06b6"+ - "\n\u00c4\f\u00c4\16\u00c4\u06b9\13\u00c4\3\u00c4\3\u00c4\3\u00c4\3\u00c5"+ - "\3\u00c5\3\u00c5\3\u00c5\3\u00c5\3\u00c5\3\u00c5\3\u00c5\3\u00c5\3\u00c5"+ - "\3\u00c5\7\u00c5\u06c9\n\u00c5\f\u00c5\16\u00c5\u06cc\13\u00c5\3\u00c5"+ - "\3\u00c5\3\u00c5\3\u00c6\3\u00c6\3\u00c6\3\u00c6\3\u00c6\3\u00c6\3\u00c6"+ - "\3\u00c6\6\u00c6\u06d9\n\u00c6\r\u00c6\16\u00c6\u06da\3\u00c6\3\u00c6"+ - "\3\u00c6\3\u00c7\3\u00c7\3\u00c7\3\u00c7\3\u00c7\3\u00c7\3\u00c7\3\u00c7"+ - "\3\u00c7\3\u00c7\6\u00c7\u06ea\n\u00c7\r\u00c7\16\u00c7\u06eb\3\u00c7"+ - "\3\u00c7\3\u00c7\3\u00c8\3\u00c8\3\u00c8\3\u00c8\3\u00c8\3\u00c8\3\u00c8"+ - "\3\u00c8\3\u00c8\3\u00c8\3\u00c8\3\u00c9\3\u00c9\3\u00c9\3\u00c9\3\u00c9"+ - "\3\u00c9\3\u00c9\3\u00c9\3\u00c9\3\u00ca\3\u00ca\3\u00ca\3\u00ca\3\u00ca"+ - "\3\u00cb\3\u00cb\3\u00cb\3\u00cb\3\u00cb\3\u00cc\3\u00cc\3\u00cc\3\u00cc"+ - "\3\u00cc\3\u00cd\3\u00cd\3\u00cd\3\u00cd\3\u00cd\3\u00cd\3\u00ce\3\u00ce"+ - "\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00cf\3\u00cf\3\u00cf\3\u00cf\3\u00cf"+ - "\3\u00cf\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d1\3\u00d1"+ - "\7\u00d1\u072e\n\u00d1\f\u00d1\16\u00d1\u0731\13\u00d1\3\u00d1\3\u00d1"+ - "\3\u00d1\3\u00d1\3\u00d1\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d3\3\u00d3"+ - "\3\u00d3\3\u00d3\7\u00d3\u0740\n\u00d3\f\u00d3\16\u00d3\u0743\13\u00d3"+ - "\3\u00d3\3\u00d3\3\u00d3\3\u00d4\3\u00d4\3\u00d4\3\u00d4\3\u00d4\3\u00d5"+ - "\6\u00d5\u074e\n\u00d5\r\u00d5\16\u00d5\u074f\3\u00d5\3\u00d5\3\u00d6"+ - "\3\u00d6\3\u00d6\3\u00d6\3\u00d6\3\u00d6\3\u00d7\3\u00d7\3\u00d8\3\u00d8"+ - "\3\u00d9\5\u00d9\u075f\n\u00d9\3\u00d9\3\u00d9\5\u00d9\u0763\n\u00d9\3"+ - "\u00d9\5\u00d9\u0766\n\u00d9\3\u00da\3\u00da\5\u00da\u076a\n\u00da\3\u00da"+ - "\3\u00da\7\u00da\u076e\n\u00da\f\u00da\16\u00da\u0771\13\u00da\3\u00da"+ - "\7\u00da\u0774\n\u00da\f\u00da\16\u00da\u0777\13\u00da\3\u00db\3\u00db"+ - "\3\u00db\5\u00db\u077c\n\u00db\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc"+ - "\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc"+ - "\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\3\u00dc\5\u00dc"+ - "\u0794\n\u00dc\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd"+ - "\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd"+ - "\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd\3\u00dd"+ - "\5\u00dd\u07af\n\u00dd\3\u00de\3\u00de\3\u00de\5\u00de\u07b4\n\u00de\3"+ - "\u00df\3\u00df\5\u00df\u07b8\n\u00df\3\u00e0\3\u00e0\3\u00e1\3\u00e1\7"+ - "\u00e1\u07be\n\u00e1\f\u00e1\16\u00e1\u07c1\13\u00e1\3\u00e2\3\u00e2\5"+ - "\u00e2\u07c5\n\u00e2\3\u00e3\3\u00e3\3\u00e3\3\u00e3\3\u00e3\5\u00e3\u07cc"+ - "\n\u00e3\3\u00e4\3\u00e4\3\u00e4\3\u00e4\3\u00e4\3\u00e4\3\u00e4\5\u00e4"+ - "\u07d5\n\u00e4\3\u00e5\3\u00e5\5\u00e5\u07d9\n\u00e5\3\u00e6\3\u00e6\5"+ - "\u00e6\u07dd\n\u00e6\3\u00e7\3\u00e7\3\u00e7\5\u00e7\u07e2\n\u00e7\3\u00e8"+ - "\3\u00e8\5\u00e8\u07e6\n\u00e8\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9"+ - "\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9"+ - "\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\3\u00e9\5\u00e9\u07fc\n\u00e9"+ - "\3\u00ea\5\u00ea\u07ff\n\u00ea\3\u00eb\3\u00eb\3\u00ec\3\u00ec\3\u00ed"+ - "\3\u00ed\3\u00ee\3\u00ee\3\u00ef\3\u00ef\3\u00f0\3\u00f0\3\u00f1\3\u00f1"+ - "\3\u00f2\3\u00f2\3\u00f3\3\u00f3\3\u00f4\3\u00f4\3\u00f5\3\u00f5\4\u020f"+ - "\u0228\2\u00f6\7\3\t\4\13\5\r\6\17\7\21\b\23\t\25\n\27\13\31\f\33\r\35"+ - "\16\37\17!\20#\21%\22\'\23)\24+\25-\26/\27\61\30\63\31\65\32\67\339\34"+ - ";\35=\36?\37A C!E\"G#I$K%M&O\'Q(S)U*W+Y,[-]._/a\60c\61e\62g\63i\64k\65"+ - "m\66o\67q8s9u:w;y<{=}>\177?\u0081@\u0083A\u0085B\u0087C\u0089D\u008bE"+ - "\u008dF\u008fG\u0091H\u0093I\u0095J\u0097K\u0099L\u009bM\u009dN\u009f"+ - "O\u00a1P\u00a3Q\u00a5R\u00a7S\u00a9T\u00abU\u00adV\u00afW\u00b1X\u00b3"+ - "Y\u00b5Z\u00b7[\u00b9\\\u00bb]\u00bd^\u00bf_\u00c1`\u00c3a\u00c5b\u00c7"+ - "c\u00c9d\u00cbe\u00cdf\u00cfg\u00d1h\u00d3i\u00d5j\u00d7k\u00d9l\u00db"+ - "m\u00ddn\u00dfo\u00e1p\u00e3q\u00e5r\u00e7s\u00e9t\u00ebu\u00edv\u00ef"+ - "w\u00f1x\u00f3y\u00f5z\u00f7{\u00f9|\u00fb}\u00fd~\u00ff\177\u0101\u0080"+ - "\u0103\u0081\u0105\u0082\u0107\u0083\u0109\u0084\u010b\u0085\u010d\u0086"+ - "\u010f\u0087\u0111\u0088\u0113\u0089\u0115\u008a\u0117\u008b\u0119\u008c"+ - "\u011b\u008d\u011d\u008e\u011f\u008f\u0121\u0090\u0123\u0091\u0125\u0092"+ - "\u0127\u0093\u0129\u0094\u012b\u0095\u012d\u0096\u012f\u0097\u0131\u0098"+ - "\u0133\u0099\u0135\u009a\u0137\u009b\u0139\u009c\u013b\u009d\u013d\u009e"+ - "\u013f\u009f\u0141\u00a0\u0143\u00a1\u0145\u00a2\u0147\u00a3\u0149\u00a4"+ - "\u014b\u00a5\u014d\u00a6\u014f\u00a7\u0151\u00a8\u0153\u00a9\u0155\u00aa"+ - "\u0157\u00ab\u0159\u00ac\u015b\u00ad\u015d\u00ae\u015f\u00af\u0161\u00b0"+ - "\u0163\u00b1\u0165\u00b2\u0167\u00b3\u0169\u00b4\u016b\u00c8\u016d\u00b5"+ - "\u016f\u00b6\u0171\u00b7\u0173\u00b8\u0175\2\u0177\2\u0179\u00b9\u017b"+ - "\u00ba\u017d\2\u017f\u00bb\u0181\2\u0183\u00bc\u0185\u00bd\u0187\u00be"+ - "\u0189\u00bf\u018b\u00c0\u018d\u00c1\u018f\u00c2\u0191\u00c3\u0193\2\u0195"+ - "\u00c4\u0197\2\u0199\2\u019b\2\u019d\2\u019f\2\u01a1\2\u01a3\2\u01a5\2"+ - "\u01a7\u00c5\u01a9\2\u01ab\u00c6\u01ad\u00c7\u01af\2\u01b1\2\u01b3\2\u01b5"+ - "\2\u01b7\2\u01b9\2\u01bb\2\u01bd\2\u01bf\2\u01c1\2\u01c3\2\u01c5\2\u01c7"+ - "\2\u01c9\2\u01cb\2\u01cd\2\u01cf\2\u01d1\2\u01d3\2\u01d5\2\u01d7\2\u01d9"+ - "\2\u01db\2\u01dd\2\u01df\2\u01e1\2\u01e3\2\u01e5\2\u01e7\2\u01e9\2\u01eb"+ - "\2\u01ed\2\7\2\3\4\5\6!\3\2\61\61\3\2\62;\4\2ZZzz\4\2DDdd\3\2\62\63\b"+ - "\2FFHHOOffhhoo\b\2\f\f\17\17))^^\u0087\u0087\u202a\u202b\b\2\f\f\17\17"+ - "$$^^\u0087\u0087\u202a\u202b\3\2$$\5\2$$^^}}\4\2$$}}\3\2\177\177\7\2\f"+ - "\f\17\17$$\u0087\u0087\u202a\u202b\6\2\f\f\17\17\u0087\u0087\u202a\u202b"+ - "\4\2NNnn\4\2WWww\4\2GGgg\4\2--//\4\2\13\13\r\16\13\2\"\"\u00a2\u00a2\u1682"+ - "\u1682\u1810\u1810\u2002\u2008\u200a\u200c\u2031\u2031\u2061\u2061\u3002"+ - "\u3002\5\2\62;CHchT\2C\\\u00c2\u00d8\u00da\u00e0\u0102\u0138\u013b\u0149"+ - "\u014c\u017f\u0183\u0184\u0186\u018d\u0190\u0193\u0195\u0196\u0198\u019a"+ - "\u019e\u019f\u01a1\u01a2\u01a4\u01ab\u01ae\u01b5\u01b7\u01be\u01c6\u01cf"+ - "\u01d1\u01dd\u01e0\u01f0\u01f3\u01f6\u01f8\u01fa\u01fc\u0234\u023c\u023d"+ - "\u023f\u0240\u0243\u0248\u024a\u0250\u0372\u0374\u0378\u0381\u0388\u038c"+ - "\u038e\u03a3\u03a5\u03ad\u03d1\u03d6\u03da\u03f0\u03f6\u03f9\u03fb\u03fc"+ - "\u03ff\u0431\u0462\u0482\u048c\u04cf\u04d2\u0530\u0533\u0558\u10a2\u10c7"+ - "\u10c9\u10cf\u1e02\u1e96\u1ea0\u1f00\u1f0a\u1f11\u1f1a\u1f1f\u1f2a\u1f31"+ - "\u1f3a\u1f41\u1f4a\u1f4f\u1f5b\u1f61\u1f6a\u1f71\u1fba\u1fbd\u1fca\u1fcd"+ - "\u1fda\u1fdd\u1fea\u1fee\u1ffa\u1ffd\u2104\u2109\u210d\u210f\u2112\u2114"+ - "\u2117\u211f\u2126\u212f\u2132\u2135\u2140\u2141\u2147\u2185\u2c02\u2c30"+ - "\u2c62\u2c66\u2c69\u2c72\u2c74\u2c77\u2c80\u2c82\u2c84\u2ce4\u2ced\u2cef"+ - "\u2cf4\ua642\ua644\ua66e\ua682\ua69c\ua724\ua730\ua734\ua770\ua77b\ua788"+ - "\ua78d\ua78f\ua792\ua794\ua798\ua7af\ua7b2\ua7b3\uff23\uff3cS\2c|\u00b7"+ - "\u00f8\u00fa\u0101\u0103\u0179\u017c\u0182\u0185\u0187\u018a\u0194\u0197"+ - "\u019d\u01a0\u01a3\u01a5\u01a7\u01aa\u01af\u01b2\u01b6\u01b8\u01c1\u01c8"+ - "\u01ce\u01d0\u01f5\u01f7\u01fb\u01fd\u023b\u023e\u0244\u0249\u0295\u0297"+ - "\u02b1\u0373\u0375\u0379\u037f\u0392\u03d0\u03d2\u03d3\u03d7\u03d9\u03db"+ - "\u03f5\u03f7\u0461\u0463\u0483\u048d\u04c1\u04c4\u0531\u0563\u0589\u1d02"+ - "\u1d2d\u1d6d\u1d79\u1d7b\u1d9c\u1e03\u1e9f\u1ea1\u1f09\u1f12\u1f17\u1f22"+ - "\u1f29\u1f32\u1f39\u1f42\u1f47\u1f52\u1f59\u1f62\u1f69\u1f72\u1f7f\u1f82"+ - "\u1f89\u1f92\u1f99\u1fa2\u1fa9\u1fb2\u1fb6\u1fb8\u1fb9\u1fc0\u1fc6\u1fc8"+ - "\u1fc9\u1fd2\u1fd5\u1fd8\u1fd9\u1fe2\u1fe9\u1ff4\u1ff6\u1ff8\u1ff9\u210c"+ - "\u2115\u2131\u213b\u213e\u213f\u2148\u214b\u2150\u2186\u2c32\u2c60\u2c63"+ - "\u2c6e\u2c73\u2c7d\u2c83\u2cee\u2cf0\u2cf5\u2d02\u2d27\u2d29\u2d2f\ua643"+ - "\ua66f\ua683\ua69d\ua725\ua733\ua735\ua77a\ua77c\ua77e\ua781\ua789\ua78e"+ - "\ua790\ua793\ua797\ua799\ua7ab\ua7fc\uab5c\uab66\uab67\ufb02\ufb08\ufb15"+ - "\ufb19\uff43\uff5c\b\2\u01c7\u01cd\u01f4\u1f91\u1f9a\u1fa1\u1faa\u1fb1"+ - "\u1fbe\u1fce\u1ffe\u1ffe#\2\u02b2\u02c3\u02c8\u02d3\u02e2\u02e6\u02ee"+ - "\u02f0\u0376\u037c\u055b\u0642\u06e7\u06e8\u07f6\u07f7\u07fc\u081c\u0826"+ - "\u082a\u0973\u0e48\u0ec8\u10fe\u17d9\u1845\u1aa9\u1c7f\u1d2e\u1d6c\u1d7a"+ - "\u1dc1\u2073\u2081\u2092\u209e\u2c7e\u2c7f\u2d71\u2e31\u3007\u3037\u303d"+ - "\u3100\ua017\ua4ff\ua60e\ua681\ua69e\ua69f\ua719\ua721\ua772\ua78a\ua7fa"+ - "\ua7fb\ua9d1\ua9e8\uaa72\uaadf\uaaf5\uaaf6\uab5e\uab61\uff72\uffa1\u00ec"+ - "\2\u00ac\u00bc\u01bd\u01c5\u0296\u05ec\u05f2\u05f4\u0622\u0641\u0643\u064c"+ - "\u0670\u0671\u0673\u06d5\u06d7\u06fe\u0701\u0712\u0714\u0731\u074f\u07a7"+ - "\u07b3\u07ec\u0802\u0817\u0842\u085a\u08a2\u08b4\u0906\u093b\u093f\u0952"+ - "\u095a\u0963\u0974\u0982\u0987\u098e\u0991\u0992\u0995\u09aa\u09ac\u09b2"+ - "\u09b4\u09bb\u09bf\u09d0\u09de\u09df\u09e1\u09e3\u09f2\u09f3\u0a07\u0a0c"+ - "\u0a11\u0a12\u0a15\u0a2a\u0a2c\u0a32\u0a34\u0a35\u0a37\u0a38\u0a3a\u0a3b"+ - "\u0a5b\u0a5e\u0a60\u0a76\u0a87\u0a8f\u0a91\u0a93\u0a95\u0aaa\u0aac\u0ab2"+ - "\u0ab4\u0ab5\u0ab7\u0abb\u0abf\u0ad2\u0ae2\u0ae3\u0b07\u0b0e\u0b11\u0b12"+ - "\u0b15\u0b2a\u0b2c\u0b32\u0b34\u0b35\u0b37\u0b3b\u0b3f\u0b63\u0b73\u0b85"+ - "\u0b87\u0b8c\u0b90\u0b92\u0b94\u0b97\u0b9b\u0b9c\u0b9e\u0bac\u0bb0\u0bbb"+ - "\u0bd2\u0c0e\u0c10\u0c12\u0c14\u0c2a\u0c2c\u0c3b\u0c3f\u0c8e\u0c90\u0c92"+ - "\u0c94\u0caa\u0cac\u0cb5\u0cb7\u0cbb\u0cbf\u0ce0\u0ce2\u0ce3\u0cf3\u0cf4"+ - "\u0d07\u0d0e\u0d10\u0d12\u0d14\u0d3c\u0d3f\u0d50\u0d62\u0d63\u0d7c\u0d81"+ - "\u0d87\u0d98\u0d9c\u0db3\u0db5\u0dbd\u0dbf\u0dc8\u0e03\u0e32\u0e34\u0e35"+ - "\u0e42\u0e47\u0e83\u0e84\u0e86\u0e8c\u0e8f\u0e99\u0e9b\u0ea1\u0ea3\u0ea5"+ - "\u0ea7\u0ea9\u0eac\u0ead\u0eaf\u0eb2\u0eb4\u0eb5\u0ebf\u0ec6\u0ede\u0ee1"+ - "\u0f02\u0f49\u0f4b\u0f6e\u0f8a\u0f8e\u1002\u102c\u1041\u1057\u105c\u105f"+ - "\u1063\u1072\u1077\u1083\u1090\u10fc\u10ff\u124a\u124c\u124f\u1252\u1258"+ - "\u125a\u125f\u1262\u128a\u128c\u128f\u1292\u12b2\u12b4\u12b7\u12ba\u12c0"+ - "\u12c2\u12c7\u12ca\u12d8\u12da\u1312\u1314\u1317\u131a\u135c\u1382\u1391"+ - "\u13a2\u13f6\u1403\u166e\u1671\u1681\u1683\u169c\u16a2\u16ec\u16f3\u16fa"+ - "\u1702\u170e\u1710\u1713\u1722\u1733\u1742\u1753\u1762\u176e\u1770\u1772"+ - "\u1782\u17b5\u17de\u1844\u1846\u1879\u1882\u18aa\u18ac\u18f7\u1902\u1920"+ - "\u1952\u196f\u1972\u1976\u1982\u19ad\u19c3\u19c9\u1a02\u1a18\u1a22\u1a56"+ - "\u1b07\u1b35\u1b47\u1b4d\u1b85\u1ba2\u1bb0\u1bb1\u1bbc\u1be7\u1c02\u1c25"+ - "\u1c4f\u1c51\u1c5c\u1c79\u1ceb\u1cee\u1cf0\u1cf3\u1cf7\u1cf8\u2137\u213a"+ - "\u2d32\u2d69\u2d82\u2d98\u2da2\u2da8\u2daa\u2db0\u2db2\u2db8\u2dba\u2dc0"+ - "\u2dc2\u2dc8\u2dca\u2dd0\u2dd2\u2dd8\u2dda\u2de0\u3008\u303e\u3043\u3098"+ - "\u30a1\u30fc\u3101\u312f\u3133\u3190\u31a2\u31bc\u31f2\u3201\u3402\u4db7"+ - "\u4e02\u9fce\ua002\ua016\ua018\ua48e\ua4d2\ua4f9\ua502\ua60d\ua612\ua621"+ - "\ua62c\ua62d\ua670\ua6e7\ua7f9\ua803\ua805\ua807\ua809\ua80c\ua80e\ua824"+ - "\ua842\ua875\ua884\ua8b5\ua8f4\ua8f9\ua8fd\ua927\ua932\ua948\ua962\ua97e"+ - "\ua986\ua9b4\ua9e2\ua9e6\ua9e9\ua9f1\ua9fc\uaa00\uaa02\uaa2a\uaa42\uaa44"+ - "\uaa46\uaa4d\uaa62\uaa71\uaa73\uaa78\uaa7c\uaab1\uaab3\uaabf\uaac2\uaac4"+ - "\uaadd\uaade\uaae2\uaaec\uaaf4\uab08\uab0b\uab10\uab13\uab18\uab22\uab28"+ - "\uab2a\uab30\uabc2\uabe4\uac02\ud7a5\ud7b2\ud7c8\ud7cd\ud7fd\uf902\ufa6f"+ - "\ufa72\ufadb\ufb1f\ufb2a\ufb2c\ufb38\ufb3a\ufb3e\ufb40\ufbb3\ufbd5\ufd3f"+ - "\ufd52\ufd91\ufd94\ufdc9\ufdf2\ufdfd\ufe72\ufe76\ufe78\ufefe\uff68\uff71"+ - "\uff73\uff9f\uffa2\uffc0\uffc4\uffc9\uffcc\uffd1\uffd4\uffd9\uffdc\uffde"+ - "\4\2\u16f0\u16f2\u2162\u2171\5\2\u0905\u0905\u0940\u0942\u094b\u094e\5"+ - "\2\u00af\u00af\u0602\u0605\u06df\u06df\b\2aa\u2041\u2042\u2056\u2056\ufe35"+ - "\ufe36\ufe4f\ufe51\uff41\uff41\'\2\62;\u0662\u066b\u06f2\u06fb\u07c2\u07cb"+ - "\u0968\u0971\u09e8\u09f1\u0a68\u0a71\u0ae8\u0af1\u0b68\u0b71\u0be8\u0bf1"+ - "\u0c68\u0c71\u0ce8\u0cf1\u0d68\u0d71\u0de8\u0df1\u0e52\u0e5b\u0ed2\u0edb"+ - "\u0f22\u0f2b\u1042\u104b\u1092\u109b\u17e2\u17eb\u1812\u181b\u1948\u1951"+ - "\u19d2\u19db\u1a82\u1a8b\u1a92\u1a9b\u1b52\u1b5b\u1bb2\u1bbb\u1c42\u1c4b"+ - "\u1c52\u1c5b\ua622\ua62b\ua8d2\ua8db\ua902\ua90b\ua9d2\ua9db\ua9f2\ua9fb"+ - "\uaa52\uaa5b\uabf2\uabfb\uff12\uff1b\2\u084e\2\7\3\2\2\2\2\t\3\2\2\2\2"+ - "\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3"+ - "\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2"+ - "\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2"+ - "\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2"+ - "\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2"+ - "\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q"+ - "\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2"+ - "\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2\2\2i\3\2\2\2"+ - "\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2q\3\2\2\2\2s\3\2\2\2\2u\3\2\2\2\2w"+ - "\3\2\2\2\2y\3\2\2\2\2{\3\2\2\2\2}\3\2\2\2\2\177\3\2\2\2\2\u0081\3\2\2"+ - "\2\2\u0083\3\2\2\2\2\u0085\3\2\2\2\2\u0087\3\2\2\2\2\u0089\3\2\2\2\2\u008b"+ - "\3\2\2\2\2\u008d\3\2\2\2\2\u008f\3\2\2\2\2\u0091\3\2\2\2\2\u0093\3\2\2"+ - "\2\2\u0095\3\2\2\2\2\u0097\3\2\2\2\2\u0099\3\2\2\2\2\u009b\3\2\2\2\2\u009d"+ - "\3\2\2\2\2\u009f\3\2\2\2\2\u00a1\3\2\2\2\2\u00a3\3\2\2\2\2\u00a5\3\2\2"+ - "\2\2\u00a7\3\2\2\2\2\u00a9\3\2\2\2\2\u00ab\3\2\2\2\2\u00ad\3\2\2\2\2\u00af"+ - "\3\2\2\2\2\u00b1\3\2\2\2\2\u00b3\3\2\2\2\2\u00b5\3\2\2\2\2\u00b7\3\2\2"+ - "\2\2\u00b9\3\2\2\2\2\u00bb\3\2\2\2\2\u00bd\3\2\2\2\2\u00bf\3\2\2\2\2\u00c1"+ - "\3\2\2\2\2\u00c3\3\2\2\2\2\u00c5\3\2\2\2\2\u00c7\3\2\2\2\2\u00c9\3\2\2"+ - "\2\2\u00cb\3\2\2\2\2\u00cd\3\2\2\2\2\u00cf\3\2\2\2\2\u00d1\3\2\2\2\2\u00d3"+ - "\3\2\2\2\2\u00d5\3\2\2\2\2\u00d7\3\2\2\2\2\u00d9\3\2\2\2\2\u00db\3\2\2"+ - "\2\2\u00dd\3\2\2\2\2\u00df\3\2\2\2\2\u00e1\3\2\2\2\2\u00e3\3\2\2\2\2\u00e5"+ - "\3\2\2\2\2\u00e7\3\2\2\2\2\u00e9\3\2\2\2\2\u00eb\3\2\2\2\2\u00ed\3\2\2"+ - "\2\2\u00ef\3\2\2\2\2\u00f1\3\2\2\2\2\u00f3\3\2\2\2\2\u00f5\3\2\2\2\2\u00f7"+ - "\3\2\2\2\2\u00f9\3\2\2\2\2\u00fb\3\2\2\2\2\u00fd\3\2\2\2\2\u00ff\3\2\2"+ - "\2\2\u0101\3\2\2\2\2\u0103\3\2\2\2\2\u0105\3\2\2\2\2\u0107\3\2\2\2\2\u0109"+ - "\3\2\2\2\2\u010b\3\2\2\2\2\u010d\3\2\2\2\2\u010f\3\2\2\2\2\u0111\3\2\2"+ - "\2\2\u0113\3\2\2\2\2\u0115\3\2\2\2\2\u0117\3\2\2\2\2\u0119\3\2\2\2\2\u011b"+ - "\3\2\2\2\2\u011d\3\2\2\2\2\u011f\3\2\2\2\2\u0121\3\2\2\2\2\u0123\3\2\2"+ - "\2\2\u0125\3\2\2\2\2\u0127\3\2\2\2\2\u0129\3\2\2\2\2\u012b\3\2\2\2\2\u012d"+ - "\3\2\2\2\2\u012f\3\2\2\2\2\u0131\3\2\2\2\2\u0133\3\2\2\2\2\u0135\3\2\2"+ - "\2\2\u0137\3\2\2\2\2\u0139\3\2\2\2\2\u013b\3\2\2\2\2\u013d\3\2\2\2\2\u013f"+ - "\3\2\2\2\2\u0141\3\2\2\2\2\u0143\3\2\2\2\2\u0145\3\2\2\2\2\u0147\3\2\2"+ - "\2\2\u0149\3\2\2\2\2\u014b\3\2\2\2\2\u014d\3\2\2\2\2\u014f\3\2\2\2\2\u0151"+ - "\3\2\2\2\2\u0153\3\2\2\2\2\u0155\3\2\2\2\2\u0157\3\2\2\2\2\u0159\3\2\2"+ - "\2\2\u015b\3\2\2\2\3\u015d\3\2\2\2\3\u015f\3\2\2\2\3\u0161\3\2\2\2\3\u0163"+ - "\3\2\2\2\3\u0165\3\2\2\2\3\u0167\3\2\2\2\3\u0169\3\2\2\2\4\u016b\3\2\2"+ - "\2\4\u016d\3\2\2\2\4\u016f\3\2\2\2\5\u0171\3\2\2\2\5\u0173\3\2\2\2\5\u0175"+ - "\3\2\2\2\5\u0177\3\2\2\2\5\u0179\3\2\2\2\5\u017b\3\2\2\2\5\u017d\3\2\2"+ - "\2\5\u017f\3\2\2\2\5\u0181\3\2\2\2\5\u0183\3\2\2\2\5\u0185\3\2\2\2\5\u0187"+ - "\3\2\2\2\5\u0189\3\2\2\2\5\u018b\3\2\2\2\5\u018d\3\2\2\2\5\u018f\3\2\2"+ - "\2\5\u0191\3\2\2\2\5\u0193\3\2\2\2\5\u0195\3\2\2\2\5\u0197\3\2\2\2\5\u0199"+ - "\3\2\2\2\5\u019b\3\2\2\2\5\u019d\3\2\2\2\5\u019f\3\2\2\2\5\u01a1\3\2\2"+ - "\2\5\u01a3\3\2\2\2\5\u01a5\3\2\2\2\5\u01a7\3\2\2\2\5\u01a9\3\2\2\2\5\u01ab"+ - "\3\2\2\2\6\u01ad\3\2\2\2\6\u01af\3\2\2\2\7\u01ef\3\2\2\2\t\u01f3\3\2\2"+ - "\2\13\u01ff\3\2\2\2\r\u0207\3\2\2\2\17\u0217\3\2\2\2\21\u0222\3\2\2\2"+ - "\23\u0232\3\2\2\2\25\u0238\3\2\2\2\27\u023c\3\2\2\2\31\u0245\3\2\2\2\33"+ - "\u0249\3\2\2\2\35\u024f\3\2\2\2\37\u0259\3\2\2\2!\u025c\3\2\2\2#\u0266"+ - "\3\2\2\2%\u026c\3\2\2\2\'\u0272\3\2\2\2)\u0277\3\2\2\2+\u027c\3\2\2\2"+ - "-\u0282\3\2\2\2/\u0285\3\2\2\2\61\u028a\3\2\2\2\63\u028f\3\2\2\2\65\u0295"+ - "\3\2\2\2\67\u029a\3\2\2\29\u02a2\3\2\2\2;\u02a8\3\2\2\2=\u02ae\3\2\2\2"+ - "?\u02b7\3\2\2\2A\u02bf\3\2\2\2C\u02c7\3\2\2\2E\u02d0\3\2\2\2G\u02db\3"+ - "\2\2\2I\u02de\3\2\2\2K\u02e5\3\2\2\2M\u02ed\3\2\2\2O\u02f2\3\2\2\2Q\u02f7"+ - "\3\2\2\2S\u02fe\3\2\2\2U\u0304\3\2\2\2W\u030d\3\2\2\2Y\u0314\3\2\2\2["+ - "\u031a\3\2\2\2]\u0322\3\2\2\2_\u0328\3\2\2\2a\u032e\3\2\2\2c\u0332\3\2"+ - "\2\2e\u033a\3\2\2\2g\u033f\3\2\2\2i\u0343\3\2\2\2k\u0348\3\2\2\2m\u034e"+ - "\3\2\2\2o\u0351\3\2\2\2q\u035a\3\2\2\2s\u035d\3\2\2\2u\u0361\3\2\2\2w"+ - "\u036b\3\2\2\2y\u0374\3\2\2\2{\u0379\3\2\2\2}\u037c\3\2\2\2\177\u0381"+ - "\3\2\2\2\u0081\u0385\3\2\2\2\u0083\u038a\3\2\2\2\u0085\u038f\3\2\2\2\u0087"+ - "\u0396\3\2\2\2\u0089\u03a0\3\2\2\2\u008b\u03a4\3\2\2\2\u008d\u03a9\3\2"+ - "\2\2\u008f\u03b0\3\2\2\2\u0091\u03b3\3\2\2\2\u0093\u03bc\3\2\2\2\u0095"+ - "\u03c4\3\2\2\2\u0097\u03c8\3\2\2\2\u0099\u03d1\3\2\2\2\u009b\u03d8\3\2"+ - "\2\2\u009d\u03e0\3\2\2\2\u009f\u03e8\3\2\2\2\u00a1\u03f2\3\2\2\2\u00a3"+ - "\u03f9\3\2\2\2\u00a5\u0402\3\2\2\2\u00a7\u0406\3\2\2\2\u00a9\u040d\3\2"+ - "\2\2\u00ab\u0414\3\2\2\2\u00ad\u041a\3\2\2\2\u00af\u0421\3\2\2\2\u00b1"+ - "\u0428\3\2\2\2\u00b3\u042c\3\2\2\2\u00b5\u0432\3\2\2\2\u00b7\u0439\3\2"+ - "\2\2\u00b9\u0444\3\2\2\2\u00bb\u044b\3\2\2\2\u00bd\u0452\3\2\2\2\u00bf"+ - "\u0459\3\2\2\2\u00c1\u0460\3\2\2\2\u00c3\u0465\3\2\2\2\u00c5\u046b\3\2"+ - "\2\2\u00c7\u0470\3\2\2\2\u00c9\u0474\3\2\2\2\u00cb\u047b\3\2\2\2\u00cd"+ - "\u0480\3\2\2\2\u00cf\u0486\3\2\2\2\u00d1\u0490\3\2\2\2\u00d3\u049a\3\2"+ - "\2\2\u00d5\u04a1\3\2\2\2\u00d7\u04a8\3\2\2\2\u00d9\u04ae\3\2\2\2\u00db"+ - "\u04b2\3\2\2\2\u00dd\u04ba\3\2\2\2\u00df\u04bf\3\2\2\2\u00e1\u04c8\3\2"+ - "\2\2\u00e3\u04cd\3\2\2\2\u00e5\u04d3\3\2\2\2\u00e7\u04d9\3\2\2\2\u00e9"+ - "\u04e0\3\2\2\2\u00eb\u04e4\3\2\2\2\u00ed\u04fa\3\2\2\2\u00ef\u050a\3\2"+ - "\2\2\u00f1\u051a\3\2\2\2\u00f3\u0561\3\2\2\2\u00f5\u0563\3\2\2\2\u00f7"+ - "\u056a\3\2\2\2\u00f9\u0574\3\2\2\2\u00fb\u0581\3\2\2\2\u00fd\u0588\3\2"+ - "\2\2\u00ff\u0590\3\2\2\2\u0101\u0593\3\2\2\2\u0103\u0596\3\2\2\2\u0105"+ - "\u0598\3\2\2\2\u0107\u059a\3\2\2\2\u0109\u059c\3\2\2\2\u010b\u059e\3\2"+ - "\2\2\u010d\u05a0\3\2\2\2\u010f\u05a2\3\2\2\2\u0111\u05a5\3\2\2\2\u0113"+ - "\u05a7\3\2\2\2\u0115\u05a9\3\2\2\2\u0117\u05ab\3\2\2\2\u0119\u05ad\3\2"+ - "\2\2\u011b\u05af\3\2\2\2\u011d\u05b1\3\2\2\2\u011f\u05b3\3\2\2\2\u0121"+ - "\u05b5\3\2\2\2\u0123\u05b7\3\2\2\2\u0125\u05b9\3\2\2\2\u0127\u05bb\3\2"+ - "\2\2\u0129\u05bd\3\2\2\2\u012b\u05bf\3\2\2\2\u012d\u05c1\3\2\2\2\u012f"+ - "\u05c3\3\2\2\2\u0131\u05c6\3\2\2\2\u0133\u05c9\3\2\2\2\u0135\u05cc\3\2"+ - "\2\2\u0137\u05cf\3\2\2\2\u0139\u05d2\3\2\2\2\u013b\u05d5\3\2\2\2\u013d"+ - "\u05d8\3\2\2\2\u013f\u05db\3\2\2\2\u0141\u05de\3\2\2\2\u0143\u05e1\3\2"+ - "\2\2\u0145\u05e4\3\2\2\2\u0147\u05e7\3\2\2\2\u0149\u05ea\3\2\2\2\u014b"+ - "\u05ed\3\2\2\2\u014d\u05f0\3\2\2\2\u014f\u05f3\3\2\2\2\u0151\u05f6\3\2"+ - "\2\2\u0153\u05f9\3\2\2\2\u0155\u05fc\3\2\2\2\u0157\u05ff\3\2\2\2\u0159"+ - "\u0603\3\2\2\2\u015b\u0607\3\2\2\2\u015d\u060a\3\2\2\2\u015f\u060d\3\2"+ - "\2\2\u0161\u0613\3\2\2\2\u0163\u0616\3\2\2\2\u0165\u061a\3\2\2\2\u0167"+ - "\u061f\3\2\2\2\u0169\u0625\3\2\2\2\u016b\u062b\3\2\2\2\u016d\u0630\3\2"+ - "\2\2\u016f\u0637\3\2\2\2\u0171\u063c\3\2\2\2\u0173\u0643\3\2\2\2\u0175"+ - "\u0649\3\2\2\2\u0177\u0651\3\2\2\2\u0179\u065a\3\2\2\2\u017b\u0663\3\2"+ - "\2\2\u017d\u066b\3\2\2\2\u017f\u0671\3\2\2\2\u0181\u0678\3\2\2\2\u0183"+ - "\u0680\3\2\2\2\u0185\u0688\3\2\2\2\u0187\u068f\3\2\2\2\u0189\u069d\3\2"+ - "\2\2\u018b\u06ad\3\2\2\2\u018d\u06bd\3\2\2\2\u018f\u06d0\3\2\2\2\u0191"+ - "\u06df\3\2\2\2\u0193\u06f0\3\2\2\2\u0195\u06fb\3\2\2\2\u0197\u0704\3\2"+ - "\2\2\u0199\u0709\3\2\2\2\u019b\u070e\3\2\2\2\u019d\u0713\3\2\2\2\u019f"+ - "\u0719\3\2\2\2\u01a1\u071f\3\2\2\2\u01a3\u0725\3\2\2\2\u01a5\u072b\3\2"+ - "\2\2\u01a7\u0737\3\2\2\2\u01a9\u073b\3\2\2\2\u01ab\u0747\3\2\2\2\u01ad"+ - "\u074d\3\2\2\2\u01af\u0753\3\2\2\2\u01b1\u0759\3\2\2\2\u01b3\u075b\3\2"+ - "\2\2\u01b5\u0765\3\2\2\2\u01b7\u0767\3\2\2\2\u01b9\u077b\3\2\2\2\u01bb"+ - "\u0793\3\2\2\2\u01bd\u07ae\3\2\2\2\u01bf\u07b3\3\2\2\2\u01c1\u07b7\3\2"+ - "\2\2\u01c3\u07b9\3\2\2\2\u01c5\u07bb\3\2\2\2\u01c7\u07c4\3\2\2\2\u01c9"+ - "\u07cb\3\2\2\2\u01cb\u07d4\3\2\2\2\u01cd\u07d8\3\2\2\2\u01cf\u07dc\3\2"+ - "\2\2\u01d1\u07e1\3\2\2\2\u01d3\u07e5\3\2\2\2\u01d5\u07fb\3\2\2\2\u01d7"+ - "\u07fe\3\2\2\2\u01d9\u0800\3\2\2\2\u01db\u0802\3\2\2\2\u01dd\u0804\3\2"+ - "\2\2\u01df\u0806\3\2\2\2\u01e1\u0808\3\2\2\2\u01e3\u080a\3\2\2\2\u01e5"+ - "\u080c\3\2\2\2\u01e7\u080e\3\2\2\2\u01e9\u0810\3\2\2\2\u01eb\u0812\3\2"+ - "\2\2\u01ed\u0814\3\2\2\2\u01ef\u01f0\7\u00f1\2\2\u01f0\u01f1\7\u00bd\2"+ - "\2\u01f1\u01f2\7\u00c1\2\2\u01f2\b\3\2\2\2\u01f3\u01f4\7\61\2\2\u01f4"+ - "\u01f5\7\61\2\2\u01f5\u01f6\7\61\2\2\u01f6\u01fa\3\2\2\2\u01f7\u01f9\5"+ - "\u01b1\u00d7\2\u01f8\u01f7\3\2\2\2\u01f9\u01fc\3\2\2\2\u01fa\u01f8\3\2"+ - "\2\2\u01fa\u01fb\3\2\2\2\u01fb\u01fd\3\2\2\2\u01fc\u01fa\3\2\2\2\u01fd"+ - "\u01fe\b\3\2\2\u01fe\n\3\2\2\2\u01ff\u0200\7\61\2\2\u0200\u0201\7,\2\2"+ - "\u0201\u0202\7,\2\2\u0202\u0203\7,\2\2\u0203\u0204\7\61\2\2\u0204\u0205"+ - "\3\2\2\2\u0205\u0206\b\4\2\2\u0206\f\3\2\2\2\u0207\u0208\7\61\2\2\u0208"+ - "\u0209\7,\2\2\u0209\u020a\7,\2\2\u020a\u020b\3\2\2\2\u020b\u020f\n\2\2"+ - "\2\u020c\u020e\13\2\2\2\u020d\u020c\3\2\2\2\u020e\u0211\3\2\2\2\u020f"+ - "\u0210\3\2\2\2\u020f\u020d\3\2\2\2\u0210\u0212\3\2\2\2\u0211\u020f\3\2"+ - "\2\2\u0212\u0213\7,\2\2\u0213\u0214\7\61\2\2\u0214\u0215\3\2\2\2\u0215"+ - "\u0216\b\5\2\2\u0216\16\3\2\2\2\u0217\u0218\7\61\2\2\u0218\u0219\7\61"+ - "\2\2\u0219\u021d\3\2\2\2\u021a\u021c\5\u01b1\u00d7\2\u021b\u021a\3\2\2"+ - "\2\u021c\u021f\3\2\2\2\u021d\u021b\3\2\2\2\u021d\u021e\3\2\2\2\u021e\u0220"+ - "\3\2\2\2\u021f\u021d\3\2\2\2\u0220\u0221\b\6\2\2\u0221\20\3\2\2\2\u0222"+ - "\u0223\7\61\2\2\u0223\u0224\7,\2\2\u0224\u0228\3\2\2\2\u0225\u0227\13"+ - "\2\2\2\u0226\u0225\3\2\2\2\u0227\u022a\3\2\2\2\u0228\u0229\3\2\2\2\u0228"+ - "\u0226\3\2\2\2\u0229\u022b\3\2\2\2\u022a\u0228\3\2\2\2\u022b\u022c\7,"+ - "\2\2\u022c\u022d\7\61\2\2\u022d\u022e\3\2\2\2\u022e\u022f\b\7\2\2\u022f"+ - "\22\3\2\2\2\u0230\u0233\5\u01c1\u00df\2\u0231\u0233\5\u01bf\u00de\2\u0232"+ - "\u0230\3\2\2\2\u0232\u0231\3\2\2\2\u0233\u0234\3\2\2\2\u0234\u0232\3\2"+ - "\2\2\u0234\u0235\3\2\2\2\u0235\u0236\3\2\2\2\u0236\u0237\b\b\3\2\u0237"+ - "\24\3\2\2\2\u0238\u0239\7%\2\2\u0239\u023a\3\2\2\2\u023a\u023b\b\t\4\2"+ - "\u023b\26\3\2\2\2\u023c\u023d\7c\2\2\u023d\u023e\7d\2\2\u023e\u023f\7"+ - "u\2\2\u023f\u0240\7v\2\2\u0240\u0241\7t\2\2\u0241\u0242\7c\2\2\u0242\u0243"+ - "\7e\2\2\u0243\u0244\7v\2\2\u0244\30\3\2\2\2\u0245\u0246\7c\2\2\u0246\u0247"+ - "\7f\2\2\u0247\u0248\7f\2\2\u0248\32\3\2\2\2\u0249\u024a\7c\2\2\u024a\u024b"+ - "\7n\2\2\u024b\u024c\7k\2\2\u024c\u024d\7c\2\2\u024d\u024e\7u\2\2\u024e"+ - "\34\3\2\2\2\u024f\u0250\7a\2\2\u0250\u0251\7a\2\2\u0251\u0252\7c\2\2\u0252"+ - "\u0253\7t\2\2\u0253\u0254\7i\2\2\u0254\u0255\7n\2\2\u0255\u0256\7k\2\2"+ - "\u0256\u0257\7u\2\2\u0257\u0258\7v\2\2\u0258\36\3\2\2\2\u0259\u025a\7"+ - "c\2\2\u025a\u025b\7u\2\2\u025b \3\2\2\2\u025c\u025d\7c\2\2\u025d\u025e"+ - "\7u\2\2\u025e\u025f\7e\2\2\u025f\u0260\7g\2\2\u0260\u0261\7p\2\2\u0261"+ - "\u0262\7f\2\2\u0262\u0263\7k\2\2\u0263\u0264\7p\2\2\u0264\u0265\7i\2\2"+ - "\u0265\"\3\2\2\2\u0266\u0267\7c\2\2\u0267\u0268\7u\2\2\u0268\u0269\7{"+ - "\2\2\u0269\u026a\7p\2\2\u026a\u026b\7e\2\2\u026b$\3\2\2\2\u026c\u026d"+ - "\7c\2\2\u026d\u026e\7y\2\2\u026e\u026f\7c\2\2\u026f\u0270\7k\2\2\u0270"+ - "\u0271\7v\2\2\u0271&\3\2\2\2\u0272\u0273\7d\2\2\u0273\u0274\7c\2\2\u0274"+ - "\u0275\7u\2\2\u0275\u0276\7g\2\2\u0276(\3\2\2\2\u0277\u0278\7d\2\2\u0278"+ - "\u0279\7q\2\2\u0279\u027a\7q\2\2\u027a\u027b\7n\2\2\u027b*\3\2\2\2\u027c"+ - "\u027d\7d\2\2\u027d\u027e\7t\2\2\u027e\u027f\7g\2\2\u027f\u0280\7c\2\2"+ - "\u0280\u0281\7m\2\2\u0281,\3\2\2\2\u0282\u0283\7d\2\2\u0283\u0284\7{\2"+ - "\2\u0284.\3\2\2\2\u0285\u0286\7d\2\2\u0286\u0287\7{\2\2\u0287\u0288\7"+ - "v\2\2\u0288\u0289\7g\2\2\u0289\60\3\2\2\2\u028a\u028b\7e\2\2\u028b\u028c"+ - "\7c\2\2\u028c\u028d\7u\2\2\u028d\u028e\7g\2\2\u028e\62\3\2\2\2\u028f\u0290"+ - "\7e\2\2\u0290\u0291\7c\2\2\u0291\u0292\7v\2\2\u0292\u0293\7e\2\2\u0293"+ - "\u0294\7j\2\2\u0294\64\3\2\2\2\u0295\u0296\7e\2\2\u0296\u0297\7j\2\2\u0297"+ - "\u0298\7c\2\2\u0298\u0299\7t\2\2\u0299\66\3\2\2\2\u029a\u029b\7e\2\2\u029b"+ - "\u029c\7j\2\2\u029c\u029d\7g\2\2\u029d\u029e\7e\2\2\u029e\u029f\7m\2\2"+ - "\u029f\u02a0\7g\2\2\u02a0\u02a1\7f\2\2\u02a18\3\2\2\2\u02a2\u02a3\7e\2"+ - "\2\u02a3\u02a4\7n\2\2\u02a4\u02a5\7c\2\2\u02a5\u02a6\7u\2\2\u02a6\u02a7"+ - "\7u\2\2\u02a7:\3\2\2\2\u02a8\u02a9\7e\2\2\u02a9\u02aa\7q\2\2\u02aa\u02ab"+ - "\7p\2\2\u02ab\u02ac\7u\2\2\u02ac\u02ad\7v\2\2\u02ad<\3\2\2\2\u02ae\u02af"+ - "\7e\2\2\u02af\u02b0\7q\2\2\u02b0\u02b1\7p\2\2\u02b1\u02b2\7v\2\2\u02b2"+ - "\u02b3\7k\2\2\u02b3\u02b4\7p\2\2\u02b4\u02b5\7w\2\2\u02b5\u02b6\7g\2\2"+ - "\u02b6>\3\2\2\2\u02b7\u02b8\7f\2\2\u02b8\u02b9\7g\2\2\u02b9\u02ba\7e\2"+ - "\2\u02ba\u02bb\7k\2\2\u02bb\u02bc\7o\2\2\u02bc\u02bd\7c\2\2\u02bd\u02be"+ - "\7n\2\2\u02be@\3\2\2\2\u02bf\u02c0\7f\2\2\u02c0\u02c1\7g\2\2\u02c1\u02c2"+ - "\7h\2\2\u02c2\u02c3\7c\2\2\u02c3\u02c4\7w\2\2\u02c4\u02c5\7n\2\2\u02c5"+ - "\u02c6\7v\2\2\u02c6B\3\2\2\2\u02c7\u02c8\7f\2\2\u02c8\u02c9\7g\2\2\u02c9"+ - "\u02ca\7n\2\2\u02ca\u02cb\7g\2\2\u02cb\u02cc\7i\2\2\u02cc\u02cd\7c\2\2"+ - "\u02cd\u02ce\7v\2\2\u02ce\u02cf\7g\2\2\u02cfD\3\2\2\2\u02d0\u02d1\7f\2"+ - "\2\u02d1\u02d2\7g\2\2\u02d2\u02d3\7u\2\2\u02d3\u02d4\7e\2\2\u02d4\u02d5"+ - "\7g\2\2\u02d5\u02d6\7p\2\2\u02d6\u02d7\7f\2\2\u02d7\u02d8\7k\2\2\u02d8"+ - "\u02d9\7p\2\2\u02d9\u02da\7i\2\2\u02daF\3\2\2\2\u02db\u02dc\7f\2\2\u02dc"+ - "\u02dd\7q\2\2\u02ddH\3\2\2\2\u02de\u02df\7f\2\2\u02df\u02e0\7q\2\2\u02e0"+ - "\u02e1\7w\2\2\u02e1\u02e2\7d\2\2\u02e2\u02e3\7n\2\2\u02e3\u02e4\7g\2\2"+ - "\u02e4J\3\2\2\2\u02e5\u02e6\7f\2\2\u02e6\u02e7\7{\2\2\u02e7\u02e8\7p\2"+ - "\2\u02e8\u02e9\7c\2\2\u02e9\u02ea\7o\2\2\u02ea\u02eb\7k\2\2\u02eb\u02ec"+ - "\7e\2\2\u02ecL\3\2\2\2\u02ed\u02ee\7g\2\2\u02ee\u02ef\7n\2\2\u02ef\u02f0"+ - "\7u\2\2\u02f0\u02f1\7g\2\2\u02f1N\3\2\2\2\u02f2\u02f3\7g\2\2\u02f3\u02f4"+ - "\7p\2\2\u02f4\u02f5\7w\2\2\u02f5\u02f6\7o\2\2\u02f6P\3\2\2\2\u02f7\u02f8"+ - "\7g\2\2\u02f8\u02f9\7s\2\2\u02f9\u02fa\7w\2\2\u02fa\u02fb\7c\2\2\u02fb"+ - "\u02fc\7n\2\2\u02fc\u02fd\7u\2\2\u02fdR\3\2\2\2\u02fe\u02ff\7g\2\2\u02ff"+ - "\u0300\7x\2\2\u0300\u0301\7g\2\2\u0301\u0302\7p\2\2\u0302\u0303\7v\2\2"+ - "\u0303T\3\2\2\2\u0304\u0305\7g\2\2\u0305\u0306\7z\2\2\u0306\u0307\7r\2"+ - "\2\u0307\u0308\7n\2\2\u0308\u0309\7k\2\2\u0309\u030a\7e\2\2\u030a\u030b"+ - "\7k\2\2\u030b\u030c\7v\2\2\u030cV\3\2\2\2\u030d\u030e\7g\2\2\u030e\u030f"+ - "\7z\2\2\u030f\u0310\7v\2\2\u0310\u0311\7g\2\2\u0311\u0312\7t\2\2\u0312"+ - "\u0313\7p\2\2\u0313X\3\2\2\2\u0314\u0315\7h\2\2\u0315\u0316\7c\2\2\u0316"+ - "\u0317\7n\2\2\u0317\u0318\7u\2\2\u0318\u0319\7g\2\2\u0319Z\3\2\2\2\u031a"+ - "\u031b\7h\2\2\u031b\u031c\7k\2\2\u031c\u031d\7p\2\2\u031d\u031e\7c\2\2"+ - "\u031e\u031f\7n\2\2\u031f\u0320\7n\2\2\u0320\u0321\7{\2\2\u0321\\\3\2"+ - "\2\2\u0322\u0323\7h\2\2\u0323\u0324\7k\2\2\u0324\u0325\7z\2\2\u0325\u0326"+ - "\7g\2\2\u0326\u0327\7f\2\2\u0327^\3\2\2\2\u0328\u0329\7h\2\2\u0329\u032a"+ - "\7n\2\2\u032a\u032b\7q\2\2\u032b\u032c\7c\2\2\u032c\u032d\7v\2\2\u032d"+ - "`\3\2\2\2\u032e\u032f\7h\2\2\u032f\u0330\7q\2\2\u0330\u0331\7t\2\2\u0331"+ - "b\3\2\2\2\u0332\u0333\7h\2\2\u0333\u0334\7q\2\2\u0334\u0335\7t\2\2\u0335"+ - "\u0336\7g\2\2\u0336\u0337\7c\2\2\u0337\u0338\7e\2\2\u0338\u0339\7j\2\2"+ - "\u0339d\3\2\2\2\u033a\u033b\7h\2\2\u033b\u033c\7t\2\2\u033c\u033d\7q\2"+ - "\2\u033d\u033e\7o\2\2\u033ef\3\2\2\2\u033f\u0340\7i\2\2\u0340\u0341\7"+ - "g\2\2\u0341\u0342\7v\2\2\u0342h\3\2\2\2\u0343\u0344\7i\2\2\u0344\u0345"+ - "\7q\2\2\u0345\u0346\7v\2\2\u0346\u0347\7q\2\2\u0347j\3\2\2\2\u0348\u0349"+ - "\7i\2\2\u0349\u034a\7t\2\2\u034a\u034b\7q\2\2\u034b\u034c\7w\2\2\u034c"+ - "\u034d\7r\2\2\u034dl\3\2\2\2\u034e\u034f\7k\2\2\u034f\u0350\7h\2\2\u0350"+ - "n\3\2\2\2\u0351\u0352\7k\2\2\u0352\u0353\7o\2\2\u0353\u0354\7r\2\2\u0354"+ - "\u0355\7n\2\2\u0355\u0356\7k\2\2\u0356\u0357\7e\2\2\u0357\u0358\7k\2\2"+ - "\u0358\u0359\7v\2\2\u0359p\3\2\2\2\u035a\u035b\7k\2\2\u035b\u035c\7p\2"+ - "\2\u035cr\3\2\2\2\u035d\u035e\7k\2\2\u035e\u035f\7p\2\2\u035f\u0360\7"+ - "v\2\2\u0360t\3\2\2\2\u0361\u0362\7k\2\2\u0362\u0363\7p\2\2\u0363\u0364"+ - "\7v\2\2\u0364\u0365\7g\2\2\u0365\u0366\7t\2\2\u0366\u0367\7h\2\2\u0367"+ - "\u0368\7c\2\2\u0368\u0369\7e\2\2\u0369\u036a\7g\2\2\u036av\3\2\2\2\u036b"+ - "\u036c\7k\2\2\u036c\u036d\7p\2\2\u036d\u036e\7v\2\2\u036e\u036f\7g\2\2"+ - "\u036f\u0370\7t\2\2\u0370\u0371\7p\2\2\u0371\u0372\7c\2\2\u0372\u0373"+ - "\7n\2\2\u0373x\3\2\2\2\u0374\u0375\7k\2\2\u0375\u0376\7p\2\2\u0376\u0377"+ - "\7v\2\2\u0377\u0378\7q\2\2\u0378z\3\2\2\2\u0379\u037a\7k\2\2\u037a\u037b"+ - "\7u\2\2\u037b|\3\2\2\2\u037c\u037d\7l\2\2\u037d\u037e\7q\2\2\u037e\u037f"+ - "\7k\2\2\u037f\u0380\7p\2\2\u0380~\3\2\2\2\u0381\u0382\7n\2\2\u0382\u0383"+ - "\7g\2\2\u0383\u0384\7v\2\2\u0384\u0080\3\2\2\2\u0385\u0386\7n\2\2\u0386"+ - "\u0387\7q\2\2\u0387\u0388\7e\2\2\u0388\u0389\7m\2\2\u0389\u0082\3\2\2"+ - "\2\u038a\u038b\7n\2\2\u038b\u038c\7q\2\2\u038c\u038d\7p\2\2\u038d\u038e"+ - "\7i\2\2\u038e\u0084\3\2\2\2\u038f\u0390\7p\2\2\u0390\u0391\7c\2\2\u0391"+ - "\u0392\7o\2\2\u0392\u0393\7g\2\2\u0393\u0394\7q\2\2\u0394\u0395\7h\2\2"+ - "\u0395\u0086\3\2\2\2\u0396\u0397\7p\2\2\u0397\u0398\7c\2\2\u0398\u0399"+ - "\7o\2\2\u0399\u039a\7g\2\2\u039a\u039b\7u\2\2\u039b\u039c\7r\2\2\u039c"+ - "\u039d\7c\2\2\u039d\u039e\7e\2\2\u039e\u039f\7g\2\2\u039f\u0088\3\2\2"+ - "\2\u03a0\u03a1\7p\2\2\u03a1\u03a2\7g\2\2\u03a2\u03a3\7y\2\2\u03a3\u008a"+ - "\3\2\2\2\u03a4\u03a5\7p\2\2\u03a5\u03a6\7w\2\2\u03a6\u03a7\7n\2\2\u03a7"+ - "\u03a8\7n\2\2\u03a8\u008c\3\2\2\2\u03a9\u03aa\7q\2\2\u03aa\u03ab\7d\2"+ - "\2\u03ab\u03ac\7l\2\2\u03ac\u03ad\7g\2\2\u03ad\u03ae\7e\2\2\u03ae\u03af"+ - "\7v\2\2\u03af\u008e\3\2\2\2\u03b0\u03b1\7q\2\2\u03b1\u03b2\7p\2\2\u03b2"+ - "\u0090\3\2\2\2\u03b3\u03b4\7q\2\2\u03b4\u03b5\7r\2\2\u03b5\u03b6\7g\2"+ - "\2\u03b6\u03b7\7t\2\2\u03b7\u03b8\7c\2\2\u03b8\u03b9\7v\2\2\u03b9\u03ba"+ - "\7q\2\2\u03ba\u03bb\7t\2\2\u03bb\u0092\3\2\2\2\u03bc\u03bd\7q\2\2\u03bd"+ - "\u03be\7t\2\2\u03be\u03bf\7f\2\2\u03bf\u03c0\7g\2\2\u03c0\u03c1\7t\2\2"+ - "\u03c1\u03c2\7d\2\2\u03c2\u03c3\7{\2\2\u03c3\u0094\3\2\2\2\u03c4\u03c5"+ - "\7q\2\2\u03c5\u03c6\7w\2\2\u03c6\u03c7\7v\2\2\u03c7\u0096\3\2\2\2\u03c8"+ - "\u03c9\7q\2\2\u03c9\u03ca\7x\2\2\u03ca\u03cb\7g\2\2\u03cb\u03cc\7t\2\2"+ - "\u03cc\u03cd\7t\2\2\u03cd\u03ce\7k\2\2\u03ce\u03cf\7f\2\2\u03cf\u03d0"+ - "\7g\2\2\u03d0\u0098\3\2\2\2\u03d1\u03d2\7r\2\2\u03d2\u03d3\7c\2\2\u03d3"+ - "\u03d4\7t\2\2\u03d4\u03d5\7c\2\2\u03d5\u03d6\7o\2\2\u03d6\u03d7\7u\2\2"+ - "\u03d7\u009a\3\2\2\2\u03d8\u03d9\7r\2\2\u03d9\u03da\7c\2\2\u03da\u03db"+ - "\7t\2\2\u03db\u03dc\7v\2\2\u03dc\u03dd\7k\2\2\u03dd\u03de\7c\2\2\u03de"+ - "\u03df\7n\2\2\u03df\u009c\3\2\2\2\u03e0\u03e1\7r\2\2\u03e1\u03e2\7t\2"+ - "\2\u03e2\u03e3\7k\2\2\u03e3\u03e4\7x\2\2\u03e4\u03e5\7c\2\2\u03e5\u03e6"+ - "\7v\2\2\u03e6\u03e7\7g\2\2\u03e7\u009e\3\2\2\2\u03e8\u03e9\7r\2\2\u03e9"+ - "\u03ea\7t\2\2\u03ea\u03eb\7q\2\2\u03eb\u03ec\7v\2\2\u03ec\u03ed\7g\2\2"+ - "\u03ed\u03ee\7e\2\2\u03ee\u03ef\7v\2\2\u03ef\u03f0\7g\2\2\u03f0\u03f1"+ - "\7f\2\2\u03f1\u00a0\3\2\2\2\u03f2\u03f3\7r\2\2\u03f3\u03f4\7w\2\2\u03f4"+ - "\u03f5\7d\2\2\u03f5\u03f6\7n\2\2\u03f6\u03f7\7k\2\2\u03f7\u03f8\7e\2\2"+ - "\u03f8\u00a2\3\2\2\2\u03f9\u03fa\7t\2\2\u03fa\u03fb\7g\2\2\u03fb\u03fc"+ - "\7c\2\2\u03fc\u03fd\7f\2\2\u03fd\u03fe\7q\2\2\u03fe\u03ff\7p\2\2\u03ff"+ - "\u0400\7n\2\2\u0400\u0401\7{\2\2\u0401\u00a4\3\2\2\2\u0402\u0403\7t\2"+ - "\2\u0403\u0404\7g\2\2\u0404\u0405\7h\2\2\u0405\u00a6\3\2\2\2\u0406\u0407"+ - "\7t\2\2\u0407\u0408\7g\2\2\u0408\u0409\7o\2\2\u0409\u040a\7q\2\2\u040a"+ - "\u040b\7x\2\2\u040b\u040c\7g\2\2\u040c\u00a8\3\2\2\2\u040d\u040e\7t\2"+ - "\2\u040e\u040f\7g\2\2\u040f\u0410\7v\2\2\u0410\u0411\7w\2\2\u0411\u0412"+ - "\7t\2\2\u0412\u0413\7p\2\2\u0413\u00aa\3\2\2\2\u0414\u0415\7u\2\2\u0415"+ - "\u0416\7d\2\2\u0416\u0417\7{\2\2\u0417\u0418\7v\2\2\u0418\u0419\7g\2\2"+ - "\u0419\u00ac\3\2\2\2\u041a\u041b\7u\2\2\u041b\u041c\7g\2\2\u041c\u041d"+ - "\7c\2\2\u041d\u041e\7n\2\2\u041e\u041f\7g\2\2\u041f\u0420\7f\2\2\u0420"+ - "\u00ae\3\2\2\2\u0421\u0422\7u\2\2\u0422\u0423\7g\2\2\u0423\u0424\7n\2"+ - "\2\u0424\u0425\7g\2\2\u0425\u0426\7e\2\2\u0426\u0427\7v\2\2\u0427\u00b0"+ - "\3\2\2\2\u0428\u0429\7u\2\2\u0429\u042a\7g\2\2\u042a\u042b\7v\2\2\u042b"+ - "\u00b2\3\2\2\2\u042c\u042d\7u\2\2\u042d\u042e\7j\2\2\u042e\u042f\7q\2"+ - "\2\u042f\u0430\7t\2\2\u0430\u0431\7v\2\2\u0431\u00b4\3\2\2\2\u0432\u0433"+ - "\7u\2\2\u0433\u0434\7k\2\2\u0434\u0435\7|\2\2\u0435\u0436\7g\2\2\u0436"+ - "\u0437\7q\2\2\u0437\u0438\7h\2\2\u0438\u00b6\3\2\2\2\u0439\u043a\7u\2"+ - "\2\u043a\u043b\7v\2\2\u043b\u043c\7c\2\2\u043c\u043d\7e\2\2\u043d\u043e"+ - "\7m\2\2\u043e\u043f\7c\2\2\u043f\u0440\7n\2\2\u0440\u0441\7n\2\2\u0441"+ - "\u0442\7q\2\2\u0442\u0443\7e\2\2\u0443\u00b8\3\2\2\2\u0444\u0445\7u\2"+ - "\2\u0445\u0446\7v\2\2\u0446\u0447\7c\2\2\u0447\u0448\7v\2\2\u0448\u0449"+ - "\7k\2\2\u0449\u044a\7e\2\2\u044a\u00ba\3\2\2\2\u044b\u044c\7u\2\2\u044c"+ - "\u044d\7v\2\2\u044d\u044e\7t\2\2\u044e\u044f\7k\2\2\u044f\u0450\7p\2\2"+ - "\u0450\u0451\7i\2\2\u0451\u00bc\3\2\2\2\u0452\u0453\7u\2\2\u0453\u0454"+ - "\7v\2\2\u0454\u0455\7t\2\2\u0455\u0456\7w\2\2\u0456\u0457\7e\2\2\u0457"+ - "\u0458\7v\2\2\u0458\u00be\3\2\2\2\u0459\u045a\7u\2\2\u045a\u045b\7y\2"+ - "\2\u045b\u045c\7k\2\2\u045c\u045d\7v\2\2\u045d\u045e\7e\2\2\u045e\u045f"+ - "\7j\2\2\u045f\u00c0\3\2\2\2\u0460\u0461\7v\2\2\u0461\u0462\7j\2\2\u0462"+ - "\u0463\7k\2\2\u0463\u0464\7u\2\2\u0464\u00c2\3\2\2\2\u0465\u0466\7v\2"+ - "\2\u0466\u0467\7j\2\2\u0467\u0468\7t\2\2\u0468\u0469\7q\2\2\u0469\u046a"+ - "\7y\2\2\u046a\u00c4\3\2\2\2\u046b\u046c\7v\2\2\u046c\u046d\7t\2\2\u046d"+ - "\u046e\7w\2\2\u046e\u046f\7g\2\2\u046f\u00c6\3\2\2\2\u0470\u0471\7v\2"+ - "\2\u0471\u0472\7t\2\2\u0472\u0473\7{\2\2\u0473\u00c8\3\2\2\2\u0474\u0475"+ - "\7v\2\2\u0475\u0476\7{\2\2\u0476\u0477\7r\2\2\u0477\u0478\7g\2\2\u0478"+ - "\u0479\7q\2\2\u0479\u047a\7h\2\2\u047a\u00ca\3\2\2\2\u047b\u047c\7w\2"+ - "\2\u047c\u047d\7k\2\2\u047d\u047e\7p\2\2\u047e\u047f\7v\2\2\u047f\u00cc"+ - "\3\2\2\2\u0480\u0481\7w\2\2\u0481\u0482\7n\2\2\u0482\u0483\7q\2\2\u0483"+ - "\u0484\7p\2\2\u0484\u0485\7i\2\2\u0485\u00ce\3\2\2\2\u0486\u0487\7w\2"+ - "\2\u0487\u0488\7p\2\2\u0488\u0489\7e\2\2\u0489\u048a\7j\2\2\u048a\u048b"+ - "\7g\2\2\u048b\u048c\7e\2\2\u048c\u048d\7m\2\2\u048d\u048e\7g\2\2\u048e"+ - "\u048f\7f\2\2\u048f\u00d0\3\2\2\2\u0490\u0491\7w\2\2\u0491\u0492\7p\2"+ - "\2\u0492\u0493\7o\2\2\u0493\u0494\7c\2\2\u0494\u0495\7p\2\2\u0495\u0496"+ - "\7c\2\2\u0496\u0497\7i\2\2\u0497\u0498\7g\2\2\u0498\u0499\7f\2\2\u0499"+ - "\u00d2\3\2\2\2\u049a\u049b\7w\2\2\u049b\u049c\7p\2\2\u049c\u049d\7u\2"+ - "\2\u049d\u049e\7c\2\2\u049e\u049f\7h\2\2\u049f\u04a0\7g\2\2\u04a0\u00d4"+ - "\3\2\2\2\u04a1\u04a2\7w\2\2\u04a2\u04a3\7u\2\2\u04a3\u04a4\7j\2\2\u04a4"+ - "\u04a5\7q\2\2\u04a5\u04a6\7t\2\2\u04a6\u04a7\7v\2\2\u04a7\u00d6\3\2\2"+ - "\2\u04a8\u04a9\7w\2\2\u04a9\u04aa\7u\2\2\u04aa\u04ab\7k\2\2\u04ab\u04ac"+ - "\7p\2\2\u04ac\u04ad\7i\2\2\u04ad\u00d8\3\2\2\2\u04ae\u04af\7x\2\2\u04af"+ - "\u04b0\7c\2\2\u04b0\u04b1\7t\2\2\u04b1\u00da\3\2\2\2\u04b2\u04b3\7x\2"+ - "\2\u04b3\u04b4\7k\2\2\u04b4\u04b5\7t\2\2\u04b5\u04b6\7v\2\2\u04b6\u04b7"+ - "\7w\2\2\u04b7\u04b8\7c\2\2\u04b8\u04b9\7n\2\2\u04b9\u00dc\3\2\2\2\u04ba"+ - "\u04bb\7x\2\2\u04bb\u04bc\7q\2\2\u04bc\u04bd\7k\2\2\u04bd\u04be\7f\2\2"+ - "\u04be\u00de\3\2\2\2\u04bf\u04c0\7x\2\2\u04c0\u04c1\7q\2\2\u04c1\u04c2"+ - "\7n\2\2\u04c2\u04c3\7c\2\2\u04c3\u04c4\7v\2\2\u04c4\u04c5\7k\2\2\u04c5"+ - "\u04c6\7n\2\2\u04c6\u04c7\7g\2\2\u04c7\u00e0\3\2\2\2\u04c8\u04c9\7y\2"+ - "\2\u04c9\u04ca\7j\2\2\u04ca\u04cb\7g\2\2\u04cb\u04cc\7p\2\2\u04cc\u00e2"+ - "\3\2\2\2\u04cd\u04ce\7y\2\2\u04ce\u04cf\7j\2\2\u04cf\u04d0\7g\2\2\u04d0"+ - "\u04d1\7t\2\2\u04d1\u04d2\7g\2\2\u04d2\u00e4\3\2\2\2\u04d3\u04d4\7y\2"+ - "\2\u04d4\u04d5\7j\2\2\u04d5\u04d6\7k\2\2\u04d6\u04d7\7n\2\2\u04d7\u04d8"+ - "\7g\2\2\u04d8\u00e6\3\2\2\2\u04d9\u04da\7{\2\2\u04da\u04db\7k\2\2\u04db"+ - "\u04dc\7g\2\2\u04dc\u04dd\7n\2\2\u04dd\u04de\7f\2\2\u04de\u00e8\3\2\2"+ - "\2\u04df\u04e1\7B\2\2\u04e0\u04df\3\2\2\2\u04e0\u04e1\3\2\2\2\u04e1\u04e2"+ - "\3\2\2\2\u04e2\u04e3\5\u01c5\u00e1\2\u04e3\u00ea\3\2\2\2\u04e4\u04ee\t"+ - "\3\2\2\u04e5\u04e7\7a\2\2\u04e6\u04e5\3\2\2\2\u04e7\u04ea\3\2\2\2\u04e8"+ - "\u04e6\3\2\2\2\u04e8\u04e9\3\2\2\2\u04e9\u04eb\3\2\2\2\u04ea\u04e8\3\2"+ - "\2\2\u04eb\u04ed\t\3\2\2\u04ec\u04e8\3\2\2\2\u04ed\u04f0\3\2\2\2\u04ee"+ - "\u04ec\3\2\2\2\u04ee\u04ef\3\2\2\2\u04ef\u04f2\3\2\2\2\u04f0\u04ee\3\2"+ - "\2\2\u04f1\u04f3\5\u01b5\u00d9\2\u04f2\u04f1\3\2\2\2\u04f2\u04f3\3\2\2"+ - "\2\u04f3\u04f4\3\2\2\2\u04f4\u04f6\7\60\2\2\u04f5\u04f7\7B\2\2\u04f6\u04f5"+ - "\3\2\2\2\u04f6\u04f7\3\2\2\2\u04f7\u04f8\3\2\2\2\u04f8\u04f9\5\u01c5\u00e1"+ - "\2\u04f9\u00ec\3\2\2\2\u04fa\u0504\t\3\2\2\u04fb\u04fd\7a\2\2\u04fc\u04fb"+ - "\3\2\2\2\u04fd\u0500\3\2\2\2\u04fe\u04fc\3\2\2\2\u04fe\u04ff\3\2\2\2\u04ff"+ - "\u0501\3\2\2\2\u0500\u04fe\3\2\2\2\u0501\u0503\t\3\2\2\u0502\u04fe\3\2"+ - "\2\2\u0503\u0506\3\2\2\2\u0504\u0502\3\2\2\2\u0504\u0505\3\2\2\2\u0505"+ - "\u0508\3\2\2\2\u0506\u0504\3\2\2\2\u0507\u0509\5\u01b5\u00d9\2\u0508\u0507"+ - "\3\2\2\2\u0508\u0509\3\2\2\2\u0509\u00ee\3\2\2\2\u050a\u050b\7\62\2\2"+ - "\u050b\u0513\t\4\2\2\u050c\u050e\7a\2\2\u050d\u050c\3\2\2\2\u050e\u0511"+ - "\3\2\2\2\u050f\u050d\3\2\2\2\u050f\u0510\3\2\2\2\u0510\u0512\3\2\2\2\u0511"+ - "\u050f\3\2\2\2\u0512\u0514\5\u01d7\u00ea\2\u0513\u050f\3\2\2\2\u0514\u0515"+ - "\3\2\2\2\u0515\u0513\3\2\2\2\u0515\u0516\3\2\2\2\u0516\u0518\3\2\2\2\u0517"+ - "\u0519\5\u01b5\u00d9\2\u0518\u0517\3\2\2\2\u0518\u0519\3\2\2\2\u0519\u00f0"+ - "\3\2\2\2\u051a\u051b\7\62\2\2\u051b\u0523\t\5\2\2\u051c\u051e\7a\2\2\u051d"+ - "\u051c\3\2\2\2\u051e\u0521\3\2\2\2\u051f\u051d\3\2\2\2\u051f\u0520\3\2"+ - "\2\2\u0520\u0522\3\2\2\2\u0521\u051f\3\2\2\2\u0522\u0524\t\6\2\2\u0523"+ - "\u051f\3\2\2\2\u0524\u0525\3\2\2\2\u0525\u0523\3\2\2\2\u0525\u0526\3\2"+ - "\2\2\u0526\u0528\3\2\2\2\u0527\u0529\5\u01b5\u00d9\2\u0528\u0527\3\2\2"+ - "\2\u0528\u0529\3\2\2\2\u0529\u00f2\3\2\2\2\u052a\u0534\t\3\2\2\u052b\u052d"+ - "\7a\2\2\u052c\u052b\3\2\2\2\u052d\u0530\3\2\2\2\u052e\u052c\3\2\2\2\u052e"+ - "\u052f\3\2\2\2\u052f\u0531\3\2\2\2\u0530\u052e\3\2\2\2\u0531\u0533\t\3"+ - "\2\2\u0532\u052e\3\2\2\2\u0533\u0536\3\2\2\2\u0534\u0532\3\2\2\2\u0534"+ - "\u0535\3\2\2\2\u0535\u0538\3\2\2\2\u0536\u0534\3\2\2\2\u0537\u052a\3\2"+ - "\2\2\u0537\u0538\3\2\2\2\u0538\u0539\3\2\2\2\u0539\u053a\7\60\2\2\u053a"+ - "\u0544\t\3\2\2\u053b\u053d\7a\2\2\u053c\u053b\3\2\2\2\u053d\u0540\3\2"+ - "\2\2\u053e\u053c\3\2\2\2\u053e\u053f\3\2\2\2\u053f\u0541\3\2\2\2\u0540"+ - "\u053e\3\2\2\2\u0541\u0543\t\3\2\2\u0542\u053e\3\2\2\2\u0543\u0546\3\2"+ - "\2\2\u0544\u0542\3\2\2\2\u0544\u0545\3\2\2\2\u0545\u0548\3\2\2\2\u0546"+ - "\u0544\3\2\2\2\u0547\u0549\5\u01b7\u00da\2\u0548\u0547\3\2\2\2\u0548\u0549"+ - "\3\2\2\2\u0549\u054b\3\2\2\2\u054a\u054c\t\7\2\2\u054b\u054a\3\2\2\2\u054b"+ - "\u054c\3\2\2\2\u054c\u0562\3\2\2\2\u054d\u0557\t\3\2\2\u054e\u0550\7a"+ - "\2\2\u054f\u054e\3\2\2\2\u0550\u0553\3\2\2\2\u0551\u054f\3\2\2\2\u0551"+ - "\u0552\3\2\2\2\u0552\u0554\3\2\2\2\u0553\u0551\3\2\2\2\u0554\u0556\t\3"+ - "\2\2\u0555\u0551\3\2\2\2\u0556\u0559\3\2\2\2\u0557\u0555\3\2\2\2\u0557"+ - "\u0558\3\2\2\2\u0558\u055f\3\2\2\2\u0559\u0557\3\2\2\2\u055a\u0560\t\7"+ - "\2\2\u055b\u055d\5\u01b7\u00da\2\u055c\u055e\t\7\2\2\u055d\u055c\3\2\2"+ - "\2\u055d\u055e\3\2\2\2\u055e\u0560\3\2\2\2\u055f\u055a\3\2\2\2\u055f\u055b"+ - "\3\2\2\2\u0560\u0562\3\2\2\2\u0561\u0537\3\2\2\2\u0561\u054d\3\2\2\2\u0562"+ - "\u00f4\3\2\2\2\u0563\u0566\7)\2\2\u0564\u0567\n\b\2\2\u0565\u0567\5\u01b9"+ - "\u00db\2\u0566\u0564\3\2\2\2\u0566\u0565\3\2\2\2\u0567\u0568\3\2\2\2\u0568"+ - "\u0569\7)\2\2\u0569\u00f6\3\2\2\2\u056a\u056f\7$\2\2\u056b\u056e\n\t\2"+ - "\2\u056c\u056e\5\u01b9\u00db\2\u056d\u056b\3\2\2\2\u056d\u056c\3\2\2\2"+ - "\u056e\u0571\3\2\2\2\u056f\u056d\3\2\2\2\u056f\u0570\3\2\2\2\u0570\u0572"+ - "\3\2\2\2\u0571\u056f\3\2\2\2\u0572\u0573\7$\2\2\u0573\u00f8\3\2\2\2\u0574"+ - "\u0575\7B\2\2\u0575\u0576\7$\2\2\u0576\u057c\3\2\2\2\u0577\u057b\n\n\2"+ - "\2\u0578\u0579\7$\2\2\u0579\u057b\7$\2\2\u057a\u0577\3\2\2\2\u057a\u0578"+ - "\3\2\2\2\u057b\u057e\3\2\2\2\u057c\u057a\3\2\2\2\u057c\u057d\3\2\2\2\u057d"+ - "\u057f\3\2\2\2\u057e\u057c\3\2\2\2\u057f\u0580\7$\2\2\u0580\u00fa\3\2"+ - "\2\2\u0581\u0582\7&\2\2\u0582\u0583\7$\2\2\u0583\u0584\3\2\2\2\u0584\u0585"+ - "\b|\5\2\u0585\u0586\3\2\2\2\u0586\u0587\b|\6\2\u0587\u00fc\3\2\2\2\u0588"+ - "\u0589\7&\2\2\u0589\u058a\7B\2\2\u058a\u058b\7$\2\2\u058b\u058c\3\2\2"+ - "\2\u058c\u058d\b}\7\2\u058d\u058e\3\2\2\2\u058e\u058f\b}\6\2\u058f\u00fe"+ - "\3\2\2\2\u0590\u0591\7}\2\2\u0591\u0592\b~\b\2\u0592\u0100\3\2\2\2\u0593"+ - "\u0594\7\177\2\2\u0594\u0595\b\177\t\2\u0595\u0102\3\2\2\2\u0596\u0597"+ - "\7]\2\2\u0597\u0104\3\2\2\2\u0598\u0599\7_\2\2\u0599\u0106\3\2\2\2\u059a"+ - "\u059b\7*\2\2\u059b\u0108\3\2\2\2\u059c\u059d\7+\2\2\u059d\u010a\3\2\2"+ - "\2\u059e\u059f\7\60\2\2\u059f\u010c\3\2\2\2\u05a0\u05a1\7.\2\2\u05a1\u010e"+ - "\3\2\2\2\u05a2\u05a3\7<\2\2\u05a3\u05a4\b\u0086\n\2\u05a4\u0110\3\2\2"+ - "\2\u05a5\u05a6\7=\2\2\u05a6\u0112\3\2\2\2\u05a7\u05a8\7-\2\2\u05a8\u0114"+ - "\3\2\2\2\u05a9\u05aa\7/\2\2\u05aa\u0116\3\2\2\2\u05ab\u05ac\7,\2\2\u05ac"+ - "\u0118\3\2\2\2\u05ad\u05ae\7\61\2\2\u05ae\u011a\3\2\2\2\u05af\u05b0\7"+ - "\'\2\2\u05b0\u011c\3\2\2\2\u05b1\u05b2\7(\2\2\u05b2\u011e\3\2\2\2\u05b3"+ - "\u05b4\7~\2\2\u05b4\u0120\3\2\2\2\u05b5\u05b6\7`\2\2\u05b6\u0122\3\2\2"+ - "\2\u05b7\u05b8\7#\2\2\u05b8\u0124\3\2\2\2\u05b9\u05ba\7\u0080\2\2\u05ba"+ - "\u0126\3\2\2\2\u05bb\u05bc\7?\2\2\u05bc\u0128\3\2\2\2\u05bd\u05be\7>\2"+ - "\2\u05be\u012a\3\2\2\2\u05bf\u05c0\7@\2\2\u05c0\u012c\3\2\2\2\u05c1\u05c2"+ - "\7A\2\2\u05c2\u012e\3\2\2\2\u05c3\u05c4\7<\2\2\u05c4\u05c5\7<\2\2\u05c5"+ - "\u0130\3\2\2\2\u05c6\u05c7\7A\2\2\u05c7\u05c8\7A\2\2\u05c8\u0132\3\2\2"+ - "\2\u05c9\u05ca\7-\2\2\u05ca\u05cb\7-\2\2\u05cb\u0134\3\2\2\2\u05cc\u05cd"+ - "\7/\2\2\u05cd\u05ce\7/\2\2\u05ce\u0136\3\2\2\2\u05cf\u05d0\7(\2\2\u05d0"+ - "\u05d1\7(\2\2\u05d1\u0138\3\2\2\2\u05d2\u05d3\7~\2\2\u05d3\u05d4\7~\2"+ - "\2\u05d4\u013a\3\2\2\2\u05d5\u05d6\7/\2\2\u05d6\u05d7\7@\2\2\u05d7\u013c"+ - "\3\2\2\2\u05d8\u05d9\7?\2\2\u05d9\u05da\7?\2\2\u05da\u013e\3\2\2\2\u05db"+ - "\u05dc\7#\2\2\u05dc\u05dd\7?\2\2\u05dd\u0140\3\2\2\2\u05de\u05df\7>\2"+ - "\2\u05df\u05e0\7?\2\2\u05e0\u0142\3\2\2\2\u05e1\u05e2\7@\2\2\u05e2\u05e3"+ - "\7?\2\2\u05e3\u0144\3\2\2\2\u05e4\u05e5\7-\2\2\u05e5\u05e6\7?\2\2\u05e6"+ - "\u0146\3\2\2\2\u05e7\u05e8\7/\2\2\u05e8\u05e9\7?\2\2\u05e9\u0148\3\2\2"+ - "\2\u05ea\u05eb\7,\2\2\u05eb\u05ec\7?\2\2\u05ec\u014a\3\2\2\2\u05ed\u05ee"+ - "\7\61\2\2\u05ee\u05ef\7?\2\2\u05ef\u014c\3\2\2\2\u05f0\u05f1\7\'\2\2\u05f1"+ - "\u05f2\7?\2\2\u05f2\u014e\3\2\2\2\u05f3\u05f4\7(\2\2\u05f4\u05f5\7?\2"+ - "\2\u05f5\u0150\3\2\2\2\u05f6\u05f7\7~\2\2\u05f7\u05f8\7?\2\2\u05f8\u0152"+ - "\3\2\2\2\u05f9\u05fa\7`\2\2\u05fa\u05fb\7?\2\2\u05fb\u0154\3\2\2\2\u05fc"+ - "\u05fd\7>\2\2\u05fd\u05fe\7>\2\2\u05fe\u0156\3\2\2\2\u05ff\u0600\7>\2"+ - "\2\u0600\u0601\7>\2\2\u0601\u0602\7?\2\2\u0602\u0158\3\2\2\2\u0603\u0604"+ - "\7A\2\2\u0604\u0605\7A\2\2\u0605\u0606\7?\2\2\u0606\u015a\3\2\2\2\u0607"+ - "\u0608\7\60\2\2\u0608\u0609\7\60\2\2\u0609\u015c\3\2\2\2\u060a\u060b\7"+ - "}\2\2\u060b\u060c\7}\2\2\u060c\u015e\3\2\2\2\u060d\u060e\7}\2\2\u060e"+ - "\u060f\b\u00ae\13\2\u060f\u0610\3\2\2\2\u0610\u0611\b\u00ae\f\2\u0611"+ - "\u0612\b\u00ae\r\2\u0612\u0160\3\2\2\2\u0613\u0614\6\u00af\2\2\u0614\u0615"+ - "\5\u01bb\u00dc\2\u0615\u0162\3\2\2\2\u0616\u0617\6\u00b0\3\2\u0617\u0618"+ - "\7$\2\2\u0618\u0619\7$\2\2\u0619\u0164\3\2\2\2\u061a\u061b\7$\2\2\u061b"+ - "\u061c\b\u00b1\16\2\u061c\u061d\3\2\2\2\u061d\u061e\b\u00b1\17\2\u061e"+ - "\u0166\3\2\2\2\u061f\u0621\6\u00b2\4\2\u0620\u0622\n\13\2\2\u0621\u0620"+ - "\3\2\2\2\u0622\u0623\3\2\2\2\u0623\u0621\3\2\2\2\u0623\u0624\3\2\2\2\u0624"+ - "\u0168\3\2\2\2\u0625\u0627\6\u00b3\5\2\u0626\u0628\n\f\2\2\u0627\u0626"+ - "\3\2\2\2\u0628\u0629\3\2\2\2\u0629\u0627\3\2\2\2\u0629\u062a\3\2\2\2\u062a"+ - "\u016a\3\2\2\2\u062b\u062c\7\177\2\2\u062c\u062d\7\177\2\2\u062d\u062e"+ - "\3\2\2\2\u062e\u062f\b\u00b4\20\2\u062f\u016c\3\2\2\2\u0630\u0631\7\177"+ - "\2\2\u0631\u0632\b\u00b5\21\2\u0632\u0633\3\2\2\2\u0633\u0634\b\u00b5"+ - "\f\2\u0634\u0635\b\u00b5\17\2\u0635\u016e\3\2\2\2\u0636\u0638\n\r\2\2"+ - "\u0637\u0636\3\2\2\2\u0638\u0639\3\2\2\2\u0639\u0637\3\2\2\2\u0639\u063a"+ - "\3\2\2\2\u063a\u0170\3\2\2\2\u063b\u063d\5\u01c1\u00df\2\u063c\u063b\3"+ - "\2\2\2\u063d\u063e\3\2\2\2\u063e\u063c\3\2\2\2\u063e\u063f\3\2\2\2\u063f"+ - "\u0640\3\2\2\2\u0640\u0641\b\u00b7\3\2\u0641\u0172\3\2\2\2\u0642\u0644"+ - "\t\3\2\2\u0643\u0642\3\2\2\2\u0644\u0645\3\2\2\2\u0645\u0643\3\2\2\2\u0645"+ - "\u0646\3\2\2\2\u0646\u0647\3\2\2\2\u0647\u0648\b\u00b8\22\2\u0648\u0174"+ - "\3\2\2\2\u0649\u064a\7v\2\2\u064a\u064b\7t\2\2\u064b\u064c\7w\2\2\u064c"+ - "\u064d\7g\2\2\u064d\u064e\3\2\2\2\u064e\u064f\b\u00b9\22\2\u064f\u0650"+ - "\b\u00b9\23\2\u0650\u0176\3\2\2\2\u0651\u0652\7h\2\2\u0652\u0653\7c\2"+ - "\2\u0653\u0654\7n\2\2\u0654\u0655\7u\2\2\u0655\u0656\7g\2\2\u0656\u0657"+ - "\3\2\2\2\u0657\u0658\b\u00ba\22\2\u0658\u0659\b\u00ba\24\2\u0659\u0178"+ - "\3\2\2\2\u065a\u065b\7f\2\2\u065b\u065c\7g\2\2\u065c\u065d\7h\2\2\u065d"+ - "\u065e\7k\2\2\u065e\u065f\7p\2\2\u065f\u0660\7g\2\2\u0660\u0661\3\2\2"+ - "\2\u0661\u0662\b\u00bb\22\2\u0662\u017a\3\2\2\2\u0663\u0664\7w\2\2\u0664"+ - "\u0665\7p\2\2\u0665\u0666\7f\2\2\u0666\u0667\7g\2\2\u0667\u0668\7h\2\2"+ - "\u0668\u0669\3\2\2\2\u0669\u066a\b\u00bc\22\2\u066a\u017c\3\2\2\2\u066b"+ - "\u066c\7k\2\2\u066c\u066d\7h\2\2\u066d\u066e\3\2\2\2\u066e\u066f\b\u00bd"+ - "\22\2\u066f\u0670\b\u00bd\25\2\u0670\u017e\3\2\2\2\u0671\u0672\7g\2\2"+ - "\u0672\u0673\7n\2\2\u0673\u0674\7k\2\2\u0674\u0675\7h\2\2\u0675\u0676"+ - "\3\2\2\2\u0676\u0677\b\u00be\22\2\u0677\u0180\3\2\2\2\u0678\u0679\7g\2"+ - "\2\u0679\u067a\7n\2\2\u067a\u067b\7u\2\2\u067b\u067c\7g\2\2\u067c\u067d"+ - "\3\2\2\2\u067d\u067e\b\u00bf\22\2\u067e\u067f\b\u00bf\26\2\u067f\u0182"+ - "\3\2\2\2\u0680\u0681\7g\2\2\u0681\u0682\7p\2\2\u0682\u0683\7f\2\2\u0683"+ - "\u0684\7k\2\2\u0684\u0685\7h\2\2\u0685\u0686\3\2\2\2\u0686\u0687\b\u00c0"+ - "\22\2\u0687\u0184\3\2\2\2\u0688\u0689\7n\2\2\u0689\u068a\7k\2\2\u068a"+ - "\u068b\7p\2\2\u068b\u068c\7g\2\2\u068c\u068d\3\2\2\2\u068d\u068e\b\u00c1"+ - "\22\2\u068e\u0186\3\2\2\2\u068f\u0690\7g\2\2\u0690\u0691\7t\2\2\u0691"+ - "\u0692\7t\2\2\u0692\u0693\7q\2\2\u0693\u0694\7t\2\2\u0694\u0696\3\2\2"+ - "\2\u0695\u0697\5\u01c1\u00df\2\u0696\u0695\3\2\2\2\u0697\u0698\3\2\2\2"+ - "\u0698\u0696\3\2\2\2\u0698\u0699\3\2\2\2\u0699\u069a\3\2\2\2\u069a\u069b"+ - "\b\u00c2\22\2\u069b\u069c\b\u00c2\27\2\u069c\u0188\3\2\2\2\u069d\u069e"+ - "\7y\2\2\u069e\u069f\7c\2\2\u069f\u06a0\7t\2\2\u06a0\u06a1\7p\2\2\u06a1"+ - "\u06a2\7k\2\2\u06a2\u06a3\7p\2\2\u06a3\u06a4\7i\2\2\u06a4\u06a6\3\2\2"+ - "\2\u06a5\u06a7\5\u01c1\u00df\2\u06a6\u06a5\3\2\2\2\u06a7\u06a8\3\2\2\2"+ - "\u06a8\u06a6\3\2\2\2\u06a8\u06a9\3\2\2\2\u06a9\u06aa\3\2\2\2\u06aa\u06ab"+ - "\b\u00c3\22\2\u06ab\u06ac\b\u00c3\27\2\u06ac\u018a\3\2\2\2\u06ad\u06ae"+ - "\7t\2\2\u06ae\u06af\7g\2\2\u06af\u06b0\7i\2\2\u06b0\u06b1\7k\2\2\u06b1"+ - "\u06b2\7q\2\2\u06b2\u06b3\7p\2\2\u06b3\u06b7\3\2\2\2\u06b4\u06b6\5\u01c1"+ - "\u00df\2\u06b5\u06b4\3\2\2\2\u06b6\u06b9\3\2\2\2\u06b7\u06b5\3\2\2\2\u06b7"+ - "\u06b8\3\2\2\2\u06b8\u06ba\3\2\2\2\u06b9\u06b7\3\2\2\2\u06ba\u06bb\b\u00c4"+ - "\22\2\u06bb\u06bc\b\u00c4\27\2\u06bc\u018c\3\2\2\2\u06bd\u06be\7g\2\2"+ - "\u06be\u06bf\7p\2\2\u06bf\u06c0\7f\2\2\u06c0\u06c1\7t\2\2\u06c1\u06c2"+ - "\7g\2\2\u06c2\u06c3\7i\2\2\u06c3\u06c4\7k\2\2\u06c4\u06c5\7q\2\2\u06c5"+ - "\u06c6\7p\2\2\u06c6\u06ca\3\2\2\2\u06c7\u06c9\5\u01c1\u00df\2\u06c8\u06c7"+ - "\3\2\2\2\u06c9\u06cc\3\2\2\2\u06ca\u06c8\3\2\2\2\u06ca\u06cb\3\2\2\2\u06cb"+ - "\u06cd\3\2\2\2\u06cc\u06ca\3\2\2\2\u06cd\u06ce\b\u00c5\22\2\u06ce\u06cf"+ - "\b\u00c5\27\2\u06cf\u018e\3\2\2\2\u06d0\u06d1\7r\2\2\u06d1\u06d2\7t\2"+ - "\2\u06d2\u06d3\7c\2\2\u06d3\u06d4\7i\2\2\u06d4\u06d5\7o\2\2\u06d5\u06d6"+ - "\7c\2\2\u06d6\u06d8\3\2\2\2\u06d7\u06d9\5\u01c1\u00df\2\u06d8\u06d7\3"+ - "\2\2\2\u06d9\u06da\3\2\2\2\u06da\u06d8\3\2\2\2\u06da\u06db\3\2\2\2\u06db"+ - "\u06dc\3\2\2\2\u06dc\u06dd\b\u00c6\22\2\u06dd\u06de\b\u00c6\27\2\u06de"+ - "\u0190\3\2\2\2\u06df\u06e0\7p\2\2\u06e0\u06e1\7w\2\2\u06e1\u06e2\7n\2"+ - "\2\u06e2\u06e3\7n\2\2\u06e3\u06e4\7c\2\2\u06e4\u06e5\7d\2\2\u06e5\u06e6"+ - "\7n\2\2\u06e6\u06e7\7g\2\2\u06e7\u06e9\3\2\2\2\u06e8\u06ea\5\u01c1\u00df"+ - "\2\u06e9\u06e8\3\2\2\2\u06ea\u06eb\3\2\2\2\u06eb\u06e9\3\2\2\2\u06eb\u06ec"+ - "\3\2\2\2\u06ec\u06ed\3\2\2\2\u06ed\u06ee\b\u00c7\22\2\u06ee\u06ef\b\u00c7"+ - "\27\2\u06ef\u0192\3\2\2\2\u06f0\u06f1\7f\2\2\u06f1\u06f2\7g\2\2\u06f2"+ - "\u06f3\7h\2\2\u06f3\u06f4\7c\2\2\u06f4\u06f5\7w\2\2\u06f5\u06f6\7n\2\2"+ - "\u06f6\u06f7\7v\2\2\u06f7\u06f8\3\2\2\2\u06f8\u06f9\b\u00c8\22\2\u06f9"+ - "\u06fa\b\u00c8\30\2\u06fa\u0194\3\2\2\2\u06fb\u06fc\7j\2\2\u06fc\u06fd"+ - "\7k\2\2\u06fd\u06fe\7f\2\2\u06fe\u06ff\7f\2\2\u06ff\u0700\7g\2\2\u0700"+ - "\u0701\7p\2\2\u0701\u0702\3\2\2\2\u0702\u0703\b\u00c9\22\2\u0703\u0196"+ - "\3\2\2\2\u0704\u0705\7*\2\2\u0705\u0706\3\2\2\2\u0706\u0707\b\u00ca\22"+ - "\2\u0707\u0708\b\u00ca\31\2\u0708\u0198\3\2\2\2\u0709\u070a\7+\2\2\u070a"+ - "\u070b\3\2\2\2\u070b\u070c\b\u00cb\22\2\u070c\u070d\b\u00cb\32\2\u070d"+ - "\u019a\3\2\2\2\u070e\u070f\7#\2\2\u070f\u0710\3\2\2\2\u0710\u0711\b\u00cc"+ - "\22\2\u0711\u0712\b\u00cc\33\2\u0712\u019c\3\2\2\2\u0713\u0714\7?\2\2"+ - "\u0714\u0715\7?\2\2\u0715\u0716\3\2\2\2\u0716\u0717\b\u00cd\22\2\u0717"+ - "\u0718\b\u00cd\34\2\u0718\u019e\3\2\2\2\u0719\u071a\7#\2\2\u071a\u071b"+ - "\7?\2\2\u071b\u071c\3\2\2\2\u071c\u071d\b\u00ce\22\2\u071d\u071e\b\u00ce"+ - "\35\2\u071e\u01a0\3\2\2\2\u071f\u0720\7(\2\2\u0720\u0721\7(\2\2\u0721"+ - "\u0722\3\2\2\2\u0722\u0723\b\u00cf\22\2\u0723\u0724\b\u00cf\36\2\u0724"+ - "\u01a2\3\2\2\2\u0725\u0726\7~\2\2\u0726\u0727\7~\2\2\u0727\u0728\3\2\2"+ - "\2\u0728\u0729\b\u00d0\22\2\u0729\u072a\b\u00d0\37\2\u072a\u01a4\3\2\2"+ - "\2\u072b\u072f\7$\2\2\u072c\u072e\n\16\2\2\u072d\u072c\3\2\2\2\u072e\u0731"+ - "\3\2\2\2\u072f\u072d\3\2\2\2\u072f\u0730\3\2\2\2\u0730\u0732\3\2\2\2\u0731"+ - "\u072f\3\2\2\2\u0732\u0733\7$\2\2\u0733\u0734\3\2\2\2\u0734\u0735\b\u00d1"+ - "\22\2\u0735\u0736\b\u00d1 \2\u0736\u01a6\3\2\2\2\u0737\u0738\5\u01c5\u00e1"+ - "\2\u0738\u0739\3\2\2\2\u0739\u073a\b\u00d2\22\2\u073a\u01a8\3\2\2\2\u073b"+ - "\u073c\7\61\2\2\u073c\u073d\7\61\2\2\u073d\u0741\3\2\2\2\u073e\u0740\n"+ - "\17\2\2\u073f\u073e\3\2\2\2\u0740\u0743\3\2\2\2\u0741\u073f\3\2\2\2\u0741"+ - "\u0742\3\2\2\2\u0742\u0744\3\2\2\2\u0743\u0741\3\2\2\2\u0744\u0745\b\u00d3"+ - "\2\2\u0745\u0746\b\u00d3!\2\u0746\u01aa\3\2\2\2\u0747\u0748\5\u01bf\u00de"+ - "\2\u0748\u0749\3\2\2\2\u0749\u074a\b\u00d4\22\2\u074a\u074b\b\u00d4\""+ - "\2\u074b\u01ac\3\2\2\2\u074c\u074e\n\17\2\2\u074d\u074c\3\2\2\2\u074e"+ - "\u074f\3\2\2\2\u074f\u074d\3\2\2\2\u074f\u0750\3\2\2\2\u0750\u0751\3\2"+ - "\2\2\u0751\u0752\b\u00d5\22\2\u0752\u01ae\3\2\2\2\u0753\u0754\5\u01bf"+ - "\u00de\2\u0754\u0755\3\2\2\2\u0755\u0756\b\u00d6\22\2\u0756\u0757\b\u00d6"+ - "#\2\u0757\u0758\b\u00d6\"\2\u0758\u01b0\3\2\2\2\u0759\u075a\n\17\2\2\u075a"+ - "\u01b2\3\2\2\2\u075b\u075c\t\17\2\2\u075c\u01b4\3\2\2\2\u075d\u075f\t"+ - "\20\2\2\u075e\u075d\3\2\2\2\u075e\u075f\3\2\2\2\u075f\u0760\3\2\2\2\u0760"+ - "\u0766\t\21\2\2\u0761\u0763\t\21\2\2\u0762\u0761\3\2\2\2\u0762\u0763\3"+ - "\2\2\2\u0763\u0764\3\2\2\2\u0764\u0766\t\20\2\2\u0765\u075e\3\2\2\2\u0765"+ - "\u0762\3\2\2\2\u0766\u01b6\3\2\2\2\u0767\u0769\t\22\2\2\u0768\u076a\t"+ - "\23\2\2\u0769\u0768\3\2\2\2\u0769\u076a\3\2\2\2\u076a\u076b\3\2\2\2\u076b"+ - "\u0775\t\3\2\2\u076c\u076e\7a\2\2\u076d\u076c\3\2\2\2\u076e\u0771\3\2"+ - "\2\2\u076f\u076d\3\2\2\2\u076f\u0770\3\2\2\2\u0770\u0772\3\2\2\2\u0771"+ - "\u076f\3\2\2\2\u0772\u0774\t\3\2\2\u0773\u076f\3\2\2\2\u0774\u0777\3\2"+ - "\2\2\u0775\u0773\3\2\2\2\u0775\u0776\3\2\2\2\u0776\u01b8\3\2\2\2\u0777"+ - "\u0775\3\2\2\2\u0778\u077c\5\u01bb\u00dc\2\u0779\u077c\5\u01bd\u00dd\2"+ - "\u077a\u077c\5\u01d5\u00e9\2\u077b\u0778\3\2\2\2\u077b\u0779\3\2\2\2\u077b"+ - "\u077a\3\2\2\2\u077c\u01ba\3\2\2\2\u077d\u077e\7^\2\2\u077e\u0794\7)\2"+ - "\2\u077f\u0780\7^\2\2\u0780\u0794\7$\2\2\u0781\u0782\7^\2\2\u0782\u0794"+ - "\7^\2\2\u0783\u0784\7^\2\2\u0784\u0794\7\62\2\2\u0785\u0786\7^\2\2\u0786"+ - "\u0794\7c\2\2\u0787\u0788\7^\2\2\u0788\u0794\7d\2\2\u0789\u078a\7^\2\2"+ - "\u078a\u0794\7h\2\2\u078b\u078c\7^\2\2\u078c\u0794\7p\2\2\u078d\u078e"+ - "\7^\2\2\u078e\u0794\7t\2\2\u078f\u0790\7^\2\2\u0790\u0794\7v\2\2\u0791"+ - "\u0792\7^\2\2\u0792\u0794\7x\2\2\u0793\u077d\3\2\2\2\u0793\u077f\3\2\2"+ - "\2\u0793\u0781\3\2\2\2\u0793\u0783\3\2\2\2\u0793\u0785\3\2\2\2\u0793\u0787"+ - "\3\2\2\2\u0793\u0789\3\2\2\2\u0793\u078b\3\2\2\2\u0793\u078d\3\2\2\2\u0793"+ - "\u078f\3\2\2\2\u0793\u0791\3\2\2\2\u0794\u01bc\3\2\2\2\u0795\u0796\7^"+ - "\2\2\u0796\u0797\7z\2\2\u0797\u0798\3\2\2\2\u0798\u07af\5\u01d7\u00ea"+ - "\2\u0799\u079a\7^\2\2\u079a\u079b\7z\2\2\u079b\u079c\3\2\2\2\u079c\u079d"+ - "\5\u01d7\u00ea\2\u079d\u079e\5\u01d7\u00ea\2\u079e\u07af\3\2\2\2\u079f"+ - "\u07a0\7^\2\2\u07a0\u07a1\7z\2\2\u07a1\u07a2\3\2\2\2\u07a2\u07a3\5\u01d7"+ - "\u00ea\2\u07a3\u07a4\5\u01d7\u00ea\2\u07a4\u07a5\5\u01d7\u00ea\2\u07a5"+ - "\u07af\3\2\2\2\u07a6\u07a7\7^\2\2\u07a7\u07a8\7z\2\2\u07a8\u07a9\3\2\2"+ - "\2\u07a9\u07aa\5\u01d7\u00ea\2\u07aa\u07ab\5\u01d7\u00ea\2\u07ab\u07ac"+ - "\5\u01d7\u00ea\2\u07ac\u07ad\5\u01d7\u00ea\2\u07ad\u07af\3\2\2\2\u07ae"+ - "\u0795\3\2\2\2\u07ae\u0799\3\2\2\2\u07ae\u079f\3\2\2\2\u07ae\u07a6\3\2"+ - "\2\2\u07af\u01be\3\2\2\2\u07b0\u07b1\7\17\2\2\u07b1\u07b4\7\f\2\2\u07b2"+ - "\u07b4\t\17\2\2\u07b3\u07b0\3\2\2\2\u07b3\u07b2\3\2\2\2\u07b4\u01c0\3"+ - "\2\2\2\u07b5\u07b8\5\u01c3\u00e0\2\u07b6\u07b8\t\24\2\2\u07b7\u07b5\3"+ - "\2\2\2\u07b7\u07b6\3\2\2\2\u07b8\u01c2\3\2\2\2\u07b9\u07ba\t\25\2\2\u07ba"+ - "\u01c4\3\2\2\2\u07bb\u07bf\5\u01c7\u00e2\2\u07bc\u07be\5\u01c9\u00e3\2"+ - "\u07bd\u07bc\3\2\2\2\u07be\u07c1\3\2\2\2\u07bf\u07bd\3\2\2\2\u07bf\u07c0"+ - "\3\2\2\2\u07c0\u01c6\3\2\2\2\u07c1\u07bf\3\2\2\2\u07c2\u07c5\5\u01cb\u00e4"+ - "\2\u07c3\u07c5\7a\2\2\u07c4\u07c2\3\2\2\2\u07c4\u07c3\3\2\2\2\u07c5\u01c8"+ - "\3\2\2\2\u07c6\u07cc\5\u01cb\u00e4\2\u07c7\u07cc\5\u01cd\u00e5\2\u07c8"+ - "\u07cc\5\u01cf\u00e6\2\u07c9\u07cc\5\u01d1\u00e7\2\u07ca\u07cc\5\u01d3"+ - "\u00e8\2\u07cb\u07c6\3\2\2\2\u07cb\u07c7\3\2\2\2\u07cb\u07c8\3\2\2\2\u07cb"+ - "\u07c9\3\2\2\2\u07cb\u07ca\3\2\2\2\u07cc\u01ca\3\2\2\2\u07cd\u07d5\5\u01d9"+ - "\u00eb\2\u07ce\u07d5\5\u01db\u00ec\2\u07cf\u07d5\5\u01dd\u00ed\2\u07d0"+ - "\u07d5\5\u01df\u00ee\2\u07d1\u07d5\5\u01e1\u00ef\2\u07d2\u07d5\5\u01e3"+ - "\u00f0\2\u07d3\u07d5\5\u01d5\u00e9\2\u07d4\u07cd\3\2\2\2\u07d4\u07ce\3"+ - "\2\2\2\u07d4\u07cf\3\2\2\2\u07d4\u07d0\3\2\2\2\u07d4\u07d1\3\2\2\2\u07d4"+ - "\u07d2\3\2\2\2\u07d4\u07d3\3\2\2\2\u07d5\u01cc\3\2\2\2\u07d6\u07d9\5\u01ed"+ - "\u00f5\2\u07d7\u07d9\5\u01d5\u00e9\2\u07d8\u07d6\3\2\2\2\u07d8\u07d7\3"+ - "\2\2\2\u07d9\u01ce\3\2\2\2\u07da\u07dd\5\u01eb\u00f4\2\u07db\u07dd\5\u01d5"+ - "\u00e9\2\u07dc\u07da\3\2\2\2\u07dc\u07db\3\2\2\2\u07dd\u01d0\3\2\2\2\u07de"+ - "\u07e2\5\u01e5\u00f1\2\u07df\u07e2\5\u01e7\u00f2\2\u07e0\u07e2\5\u01d5"+ - "\u00e9\2\u07e1\u07de\3\2\2\2\u07e1\u07df\3\2\2\2\u07e1\u07e0\3\2\2\2\u07e2"+ - "\u01d2\3\2\2\2\u07e3\u07e6\5\u01e9\u00f3\2\u07e4\u07e6\5\u01d5\u00e9\2"+ - "\u07e5\u07e3\3\2\2\2\u07e5\u07e4\3\2\2\2\u07e6\u01d4\3\2\2\2\u07e7\u07e8"+ - "\7^\2\2\u07e8\u07e9\7w\2\2\u07e9\u07ea\3\2\2\2\u07ea\u07eb\5\u01d7\u00ea"+ - "\2\u07eb\u07ec\5\u01d7\u00ea\2\u07ec\u07ed\5\u01d7\u00ea\2\u07ed\u07ee"+ - "\5\u01d7\u00ea\2\u07ee\u07fc\3\2\2\2\u07ef\u07f0\7^\2\2\u07f0\u07f1\7"+ - "W\2\2\u07f1\u07f2\3\2\2\2\u07f2\u07f3\5\u01d7\u00ea\2\u07f3\u07f4\5\u01d7"+ - "\u00ea\2\u07f4\u07f5\5\u01d7\u00ea\2\u07f5\u07f6\5\u01d7\u00ea\2\u07f6"+ - "\u07f7\5\u01d7\u00ea\2\u07f7\u07f8\5\u01d7\u00ea\2\u07f8\u07f9\5\u01d7"+ - "\u00ea\2\u07f9\u07fa\5\u01d7\u00ea\2\u07fa\u07fc\3\2\2\2\u07fb\u07e7\3"+ - "\2\2\2\u07fb\u07ef\3\2\2\2\u07fc\u01d6\3\2\2\2\u07fd\u07ff\t\26\2\2\u07fe"+ - "\u07fd\3\2\2\2\u07ff\u01d8\3\2\2\2\u0800\u0801\t\27\2\2\u0801\u01da\3"+ - "\2\2\2\u0802\u0803\t\30\2\2\u0803\u01dc\3\2\2\2\u0804\u0805\t\31\2\2\u0805"+ - "\u01de\3\2\2\2\u0806\u0807\t\32\2\2\u0807\u01e0\3\2\2\2\u0808\u0809\t"+ - "\33\2\2\u0809\u01e2\3\2\2\2\u080a\u080b\t\34\2\2\u080b\u01e4\3\2\2\2\u080c"+ - "\u080d\4\u0302\u0312\2\u080d\u01e6\3\2\2\2\u080e\u080f\t\35\2\2\u080f"+ - "\u01e8\3\2\2\2\u0810\u0811\t\36\2\2\u0811\u01ea\3\2\2\2\u0812\u0813\t"+ - "\37\2\2\u0813\u01ec\3\2\2\2\u0814\u0815\t \2\2\u0815\u01ee\3\2\2\2O\2"+ - "\3\4\5\6\u01fa\u020f\u021d\u0228\u0232\u0234\u04e0\u04e8\u04ee\u04f2\u04f6"+ - "\u04fe\u0504\u0508\u050f\u0515\u0518\u051f\u0525\u0528\u052e\u0534\u0537"+ - "\u053e\u0544\u0548\u054b\u0551\u0557\u055d\u055f\u0561\u0566\u056d\u056f"+ - "\u057a\u057c\u0623\u0629\u0639\u063e\u0645\u0698\u06a8\u06b7\u06ca\u06da"+ - "\u06eb\u072f\u0741\u074f\u075e\u0762\u0765\u0769\u076f\u0775\u077b\u0793"+ - "\u07ae\u07b3\u07b7\u07bf\u07c4\u07cb\u07d4\u07d8\u07dc\u07e1\u07e5\u07fb"+ - "\u07fe$\2\4\2\2\3\2\4\5\2\3|\2\7\3\2\3}\3\3~\4\3\177\5\3\u0086\6\3\u00ae"+ - "\7\b\2\2\7\2\2\3\u00b1\b\6\2\2\t\u00b6\2\3\u00b5\t\2\5\2\tb\2\t,\2\t\66"+ - "\2\t&\2\4\6\2\t \2\t\u0083\2\t\u0084\2\t\u0091\2\t\u009e\2\t\u009f\2\t"+ - "\u009b\2\t\u009c\2\t]\2\t\7\2\4\2\2\t\u00c6\2"; - public static final ATN _ATN = - new ATNDeserializer().deserialize(_serializedATN.toCharArray()); - static { - _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; - for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { - _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); - } - } + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParser.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParser.java index 045878f51b..d57539c62d 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParser.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParser.java @@ -3,20405 +3,30168 @@ package software.amazon.polymorph.antlr; +import java.util.List; +import org.antlr.v4.runtime.*; // Generated from CSharpParser.g4 by ANTLR 4.9.2 import org.antlr.v4.runtime.atn.*; import org.antlr.v4.runtime.dfa.DFA; -import org.antlr.v4.runtime.*; import org.antlr.v4.runtime.misc.*; import org.antlr.v4.runtime.tree.*; -import java.util.List; -@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) +@SuppressWarnings({ "all", "warnings", "unchecked", "unused", "cast" }) public class CSharpParser extends Parser { - static { RuntimeMetaData.checkVersion("4.9.2", RuntimeMetaData.VERSION); } - - protected static final DFA[] _decisionToDFA; - protected static final PredictionContextCache _sharedContextCache = - new PredictionContextCache(); - public static final int - BYTE_ORDER_MARK=1, SINGLE_LINE_DOC_COMMENT=2, EMPTY_DELIMITED_DOC_COMMENT=3, - DELIMITED_DOC_COMMENT=4, SINGLE_LINE_COMMENT=5, DELIMITED_COMMENT=6, WHITESPACES=7, - SHARP=8, ABSTRACT=9, ADD=10, ALIAS=11, ARGLIST=12, AS=13, ASCENDING=14, - ASYNC=15, AWAIT=16, BASE=17, BOOL=18, BREAK=19, BY=20, BYTE=21, CASE=22, - CATCH=23, CHAR=24, CHECKED=25, CLASS=26, CONST=27, CONTINUE=28, DECIMAL=29, - DEFAULT=30, DELEGATE=31, DESCENDING=32, DO=33, DOUBLE=34, DYNAMIC=35, - ELSE=36, ENUM=37, EQUALS=38, EVENT=39, EXPLICIT=40, EXTERN=41, FALSE=42, - FINALLY=43, FIXED=44, FLOAT=45, FOR=46, FOREACH=47, FROM=48, GET=49, GOTO=50, - GROUP=51, IF=52, IMPLICIT=53, IN=54, INT=55, INTERFACE=56, INTERNAL=57, - INTO=58, IS=59, JOIN=60, LET=61, LOCK=62, LONG=63, NAMEOF=64, NAMESPACE=65, - NEW=66, NULL_=67, OBJECT=68, ON=69, OPERATOR=70, ORDERBY=71, OUT=72, OVERRIDE=73, - PARAMS=74, PARTIAL=75, PRIVATE=76, PROTECTED=77, PUBLIC=78, READONLY=79, - REF=80, REMOVE=81, RETURN=82, SBYTE=83, SEALED=84, SELECT=85, SET=86, - SHORT=87, SIZEOF=88, STACKALLOC=89, STATIC=90, STRING=91, STRUCT=92, SWITCH=93, - THIS=94, THROW=95, TRUE=96, TRY=97, TYPEOF=98, UINT=99, ULONG=100, UNCHECKED=101, - UNMANAGED=102, UNSAFE=103, USHORT=104, USING=105, VAR=106, VIRTUAL=107, - VOID=108, VOLATILE=109, WHEN=110, WHERE=111, WHILE=112, YIELD=113, IDENTIFIER=114, - LITERAL_ACCESS=115, INTEGER_LITERAL=116, HEX_INTEGER_LITERAL=117, BIN_INTEGER_LITERAL=118, - REAL_LITERAL=119, CHARACTER_LITERAL=120, REGULAR_STRING=121, VERBATIUM_STRING=122, - INTERPOLATED_REGULAR_STRING_START=123, INTERPOLATED_VERBATIUM_STRING_START=124, - OPEN_BRACE=125, CLOSE_BRACE=126, OPEN_BRACKET=127, CLOSE_BRACKET=128, - OPEN_PARENS=129, CLOSE_PARENS=130, DOT=131, COMMA=132, COLON=133, SEMICOLON=134, - PLUS=135, MINUS=136, STAR=137, DIV=138, PERCENT=139, AMP=140, BITWISE_OR=141, - CARET=142, BANG=143, TILDE=144, ASSIGNMENT=145, LT=146, GT=147, INTERR=148, - DOUBLE_COLON=149, OP_COALESCING=150, OP_INC=151, OP_DEC=152, OP_AND=153, - OP_OR=154, OP_PTR=155, OP_EQ=156, OP_NE=157, OP_LE=158, OP_GE=159, OP_ADD_ASSIGNMENT=160, - OP_SUB_ASSIGNMENT=161, OP_MULT_ASSIGNMENT=162, OP_DIV_ASSIGNMENT=163, - OP_MOD_ASSIGNMENT=164, OP_AND_ASSIGNMENT=165, OP_OR_ASSIGNMENT=166, OP_XOR_ASSIGNMENT=167, - OP_LEFT_SHIFT=168, OP_LEFT_SHIFT_ASSIGNMENT=169, OP_COALESCING_ASSIGNMENT=170, - OP_RANGE=171, DOUBLE_CURLY_INSIDE=172, OPEN_BRACE_INSIDE=173, REGULAR_CHAR_INSIDE=174, - VERBATIUM_DOUBLE_QUOTE_INSIDE=175, DOUBLE_QUOTE_INSIDE=176, REGULAR_STRING_INSIDE=177, - VERBATIUM_INSIDE_STRING=178, CLOSE_BRACE_INSIDE=179, FORMAT_STRING=180, - DIRECTIVE_WHITESPACES=181, DIGITS=182, DEFINE=183, UNDEF=184, ELIF=185, - ENDIF=186, LINE=187, ERROR=188, WARNING=189, REGION=190, ENDREGION=191, - PRAGMA=192, NULLABLE=193, DIRECTIVE_HIDDEN=194, CONDITIONAL_SYMBOL=195, - DIRECTIVE_NEW_LINE=196, TEXT=197, DOUBLE_CURLY_CLOSE_INSIDE=198; - public static final int - RULE_compilation_unit = 0, RULE_namespace_or_type_name = 1, RULE_type_ = 2, - RULE_base_type = 3, RULE_tuple_type = 4, RULE_tuple_element = 5, RULE_simple_type = 6, - RULE_numeric_type = 7, RULE_integral_type = 8, RULE_floating_point_type = 9, - RULE_class_type = 10, RULE_type_argument_list = 11, RULE_argument_list = 12, - RULE_argument = 13, RULE_expression = 14, RULE_non_assignment_expression = 15, - RULE_assignment = 16, RULE_assignment_operator = 17, RULE_conditional_expression = 18, - RULE_null_coalescing_expression = 19, RULE_conditional_or_expression = 20, - RULE_conditional_and_expression = 21, RULE_inclusive_or_expression = 22, - RULE_exclusive_or_expression = 23, RULE_and_expression = 24, RULE_equality_expression = 25, - RULE_relational_expression = 26, RULE_shift_expression = 27, RULE_additive_expression = 28, - RULE_multiplicative_expression = 29, RULE_switch_expression = 30, RULE_switch_expression_arms = 31, - RULE_switch_expression_arm = 32, RULE_range_expression = 33, RULE_unary_expression = 34, - RULE_primary_expression = 35, RULE_primary_expression_start = 36, RULE_throwable_expression = 37, - RULE_throw_expression = 38, RULE_member_access = 39, RULE_bracket_expression = 40, - RULE_indexer_argument = 41, RULE_predefined_type = 42, RULE_expression_list = 43, - RULE_object_or_collection_initializer = 44, RULE_object_initializer = 45, - RULE_member_initializer_list = 46, RULE_member_initializer = 47, RULE_initializer_value = 48, - RULE_collection_initializer = 49, RULE_element_initializer = 50, RULE_anonymous_object_initializer = 51, - RULE_member_declarator_list = 52, RULE_member_declarator = 53, RULE_unbound_type_name = 54, - RULE_generic_dimension_specifier = 55, RULE_isType = 56, RULE_isTypePatternArms = 57, - RULE_isTypePatternArm = 58, RULE_lambda_expression = 59, RULE_anonymous_function_signature = 60, - RULE_explicit_anonymous_function_parameter_list = 61, RULE_explicit_anonymous_function_parameter = 62, - RULE_implicit_anonymous_function_parameter_list = 63, RULE_anonymous_function_body = 64, - RULE_query_expression = 65, RULE_from_clause = 66, RULE_query_body = 67, - RULE_query_body_clause = 68, RULE_let_clause = 69, RULE_where_clause = 70, - RULE_combined_join_clause = 71, RULE_orderby_clause = 72, RULE_ordering = 73, - RULE_select_or_group_clause = 74, RULE_query_continuation = 75, RULE_statement = 76, - RULE_declarationStatement = 77, RULE_local_function_declaration = 78, - RULE_local_function_header = 79, RULE_local_function_modifiers = 80, RULE_local_function_body = 81, - RULE_labeled_Statement = 82, RULE_embedded_statement = 83, RULE_simple_embedded_statement = 84, - RULE_block = 85, RULE_local_variable_declaration = 86, RULE_local_variable_type = 87, - RULE_local_variable_declarator = 88, RULE_local_variable_initializer = 89, - RULE_local_constant_declaration = 90, RULE_if_body = 91, RULE_switch_section = 92, - RULE_switch_label = 93, RULE_case_guard = 94, RULE_statement_list = 95, - RULE_for_initializer = 96, RULE_for_iterator = 97, RULE_catch_clauses = 98, - RULE_specific_catch_clause = 99, RULE_general_catch_clause = 100, RULE_exception_filter = 101, - RULE_finally_clause = 102, RULE_resource_acquisition = 103, RULE_namespace_declaration = 104, - RULE_qualified_identifier = 105, RULE_namespace_body = 106, RULE_extern_alias_directives = 107, - RULE_extern_alias_directive = 108, RULE_using_directives = 109, RULE_using_directive = 110, - RULE_namespace_member_declarations = 111, RULE_namespace_member_declaration = 112, - RULE_type_declaration = 113, RULE_qualified_alias_member = 114, RULE_type_parameter_list = 115, - RULE_type_parameter = 116, RULE_class_base = 117, RULE_interface_type_list = 118, - RULE_type_parameter_constraints_clauses = 119, RULE_type_parameter_constraints_clause = 120, - RULE_type_parameter_constraints = 121, RULE_primary_constraint = 122, - RULE_secondary_constraints = 123, RULE_constructor_constraint = 124, RULE_class_body = 125, - RULE_class_member_declarations = 126, RULE_class_member_declaration = 127, - RULE_all_member_modifiers = 128, RULE_all_member_modifier = 129, RULE_common_member_declaration = 130, - RULE_typed_member_declaration = 131, RULE_constant_declarators = 132, - RULE_constant_declarator = 133, RULE_variable_declarators = 134, RULE_variable_declarator = 135, - RULE_variable_initializer = 136, RULE_return_type = 137, RULE_member_name = 138, - RULE_method_body = 139, RULE_formal_parameter_list = 140, RULE_fixed_parameters = 141, - RULE_fixed_parameter = 142, RULE_parameter_modifier = 143, RULE_parameter_array = 144, - RULE_accessor_declarations = 145, RULE_get_accessor_declaration = 146, - RULE_set_accessor_declaration = 147, RULE_accessor_modifier = 148, RULE_accessor_body = 149, - RULE_event_accessor_declarations = 150, RULE_add_accessor_declaration = 151, - RULE_remove_accessor_declaration = 152, RULE_overloadable_operator = 153, - RULE_conversion_operator_declarator = 154, RULE_constructor_initializer = 155, - RULE_body = 156, RULE_struct_interfaces = 157, RULE_struct_body = 158, - RULE_struct_member_declaration = 159, RULE_array_type = 160, RULE_rank_specifier = 161, - RULE_array_initializer = 162, RULE_variant_type_parameter_list = 163, - RULE_variant_type_parameter = 164, RULE_variance_annotation = 165, RULE_interface_base = 166, - RULE_interface_body = 167, RULE_interface_member_declaration = 168, RULE_interface_accessors = 169, - RULE_enum_base = 170, RULE_enum_body = 171, RULE_enum_member_declaration = 172, - RULE_global_attribute_section = 173, RULE_global_attribute_target = 174, - RULE_attributes = 175, RULE_attribute_section = 176, RULE_attribute_target = 177, - RULE_attribute_list = 178, RULE_attribute = 179, RULE_attribute_argument = 180, - RULE_pointer_type = 181, RULE_fixed_pointer_declarators = 182, RULE_fixed_pointer_declarator = 183, - RULE_fixed_pointer_initializer = 184, RULE_fixed_size_buffer_declarator = 185, - RULE_stackalloc_initializer = 186, RULE_right_arrow = 187, RULE_right_shift = 188, - RULE_right_shift_assignment = 189, RULE_literal = 190, RULE_boolean_literal = 191, - RULE_string_literal = 192, RULE_interpolated_regular_string = 193, RULE_interpolated_verbatium_string = 194, - RULE_interpolated_regular_string_part = 195, RULE_interpolated_verbatium_string_part = 196, - RULE_interpolated_string_expression = 197, RULE_keyword = 198, RULE_class_definition = 199, - RULE_struct_definition = 200, RULE_interface_definition = 201, RULE_enum_definition = 202, - RULE_delegate_definition = 203, RULE_event_declaration = 204, RULE_field_declaration = 205, - RULE_property_declaration = 206, RULE_constant_declaration = 207, RULE_indexer_declaration = 208, - RULE_destructor_definition = 209, RULE_constructor_declaration = 210, - RULE_method_declaration = 211, RULE_method_member_name = 212, RULE_operator_declaration = 213, - RULE_arg_declaration = 214, RULE_method_invocation = 215, RULE_object_creation_expression = 216, - RULE_identifier = 217; - private static String[] makeRuleNames() { - return new String[] { - "compilation_unit", "namespace_or_type_name", "type_", "base_type", "tuple_type", - "tuple_element", "simple_type", "numeric_type", "integral_type", "floating_point_type", - "class_type", "type_argument_list", "argument_list", "argument", "expression", - "non_assignment_expression", "assignment", "assignment_operator", "conditional_expression", - "null_coalescing_expression", "conditional_or_expression", "conditional_and_expression", - "inclusive_or_expression", "exclusive_or_expression", "and_expression", - "equality_expression", "relational_expression", "shift_expression", "additive_expression", - "multiplicative_expression", "switch_expression", "switch_expression_arms", - "switch_expression_arm", "range_expression", "unary_expression", "primary_expression", - "primary_expression_start", "throwable_expression", "throw_expression", - "member_access", "bracket_expression", "indexer_argument", "predefined_type", - "expression_list", "object_or_collection_initializer", "object_initializer", - "member_initializer_list", "member_initializer", "initializer_value", - "collection_initializer", "element_initializer", "anonymous_object_initializer", - "member_declarator_list", "member_declarator", "unbound_type_name", "generic_dimension_specifier", - "isType", "isTypePatternArms", "isTypePatternArm", "lambda_expression", - "anonymous_function_signature", "explicit_anonymous_function_parameter_list", - "explicit_anonymous_function_parameter", "implicit_anonymous_function_parameter_list", - "anonymous_function_body", "query_expression", "from_clause", "query_body", - "query_body_clause", "let_clause", "where_clause", "combined_join_clause", - "orderby_clause", "ordering", "select_or_group_clause", "query_continuation", - "statement", "declarationStatement", "local_function_declaration", "local_function_header", - "local_function_modifiers", "local_function_body", "labeled_Statement", - "embedded_statement", "simple_embedded_statement", "block", "local_variable_declaration", - "local_variable_type", "local_variable_declarator", "local_variable_initializer", - "local_constant_declaration", "if_body", "switch_section", "switch_label", - "case_guard", "statement_list", "for_initializer", "for_iterator", "catch_clauses", - "specific_catch_clause", "general_catch_clause", "exception_filter", - "finally_clause", "resource_acquisition", "namespace_declaration", "qualified_identifier", - "namespace_body", "extern_alias_directives", "extern_alias_directive", - "using_directives", "using_directive", "namespace_member_declarations", - "namespace_member_declaration", "type_declaration", "qualified_alias_member", - "type_parameter_list", "type_parameter", "class_base", "interface_type_list", - "type_parameter_constraints_clauses", "type_parameter_constraints_clause", - "type_parameter_constraints", "primary_constraint", "secondary_constraints", - "constructor_constraint", "class_body", "class_member_declarations", - "class_member_declaration", "all_member_modifiers", "all_member_modifier", - "common_member_declaration", "typed_member_declaration", "constant_declarators", - "constant_declarator", "variable_declarators", "variable_declarator", - "variable_initializer", "return_type", "member_name", "method_body", - "formal_parameter_list", "fixed_parameters", "fixed_parameter", "parameter_modifier", - "parameter_array", "accessor_declarations", "get_accessor_declaration", - "set_accessor_declaration", "accessor_modifier", "accessor_body", "event_accessor_declarations", - "add_accessor_declaration", "remove_accessor_declaration", "overloadable_operator", - "conversion_operator_declarator", "constructor_initializer", "body", - "struct_interfaces", "struct_body", "struct_member_declaration", "array_type", - "rank_specifier", "array_initializer", "variant_type_parameter_list", - "variant_type_parameter", "variance_annotation", "interface_base", "interface_body", - "interface_member_declaration", "interface_accessors", "enum_base", "enum_body", - "enum_member_declaration", "global_attribute_section", "global_attribute_target", - "attributes", "attribute_section", "attribute_target", "attribute_list", - "attribute", "attribute_argument", "pointer_type", "fixed_pointer_declarators", - "fixed_pointer_declarator", "fixed_pointer_initializer", "fixed_size_buffer_declarator", - "stackalloc_initializer", "right_arrow", "right_shift", "right_shift_assignment", - "literal", "boolean_literal", "string_literal", "interpolated_regular_string", - "interpolated_verbatium_string", "interpolated_regular_string_part", - "interpolated_verbatium_string_part", "interpolated_string_expression", - "keyword", "class_definition", "struct_definition", "interface_definition", - "enum_definition", "delegate_definition", "event_declaration", "field_declaration", - "property_declaration", "constant_declaration", "indexer_declaration", - "destructor_definition", "constructor_declaration", "method_declaration", - "method_member_name", "operator_declaration", "arg_declaration", "method_invocation", - "object_creation_expression", "identifier" - }; - } - public static final String[] ruleNames = makeRuleNames(); - - private static String[] makeLiteralNames() { - return new String[] { - null, "'\u00EF\u00BB\u00BF'", null, "'/***/'", null, null, null, null, - "'#'", "'abstract'", "'add'", "'alias'", "'__arglist'", "'as'", "'ascending'", - "'async'", "'await'", "'base'", "'bool'", "'break'", "'by'", "'byte'", - "'case'", "'catch'", "'char'", "'checked'", "'class'", "'const'", "'continue'", - "'decimal'", "'default'", "'delegate'", "'descending'", "'do'", "'double'", - "'dynamic'", "'else'", "'enum'", "'equals'", "'event'", "'explicit'", - "'extern'", "'false'", "'finally'", "'fixed'", "'float'", "'for'", "'foreach'", - "'from'", "'get'", "'goto'", "'group'", "'if'", "'implicit'", "'in'", - "'int'", "'interface'", "'internal'", "'into'", "'is'", "'join'", "'let'", - "'lock'", "'long'", "'nameof'", "'namespace'", "'new'", "'null'", "'object'", - "'on'", "'operator'", "'orderby'", "'out'", "'override'", "'params'", - "'partial'", "'private'", "'protected'", "'public'", "'readonly'", "'ref'", - "'remove'", "'return'", "'sbyte'", "'sealed'", "'select'", "'set'", "'short'", - "'sizeof'", "'stackalloc'", "'static'", "'string'", "'struct'", "'switch'", - "'this'", "'throw'", "'true'", "'try'", "'typeof'", "'uint'", "'ulong'", - "'unchecked'", "'unmanaged'", "'unsafe'", "'ushort'", "'using'", "'var'", - "'virtual'", "'void'", "'volatile'", "'when'", "'where'", "'while'", - "'yield'", null, null, null, null, null, null, null, null, null, null, - null, "'{'", "'}'", "'['", "']'", "'('", "')'", "'.'", "','", "':'", - "';'", "'+'", "'-'", "'*'", "'/'", "'%'", "'&'", "'|'", "'^'", "'!'", - "'~'", "'='", "'<'", "'>'", "'?'", "'::'", "'??'", "'++'", "'--'", "'&&'", - "'||'", "'->'", "'=='", "'!='", "'<='", "'>='", "'+='", "'-='", "'*='", - "'/='", "'%='", "'&='", "'|='", "'^='", "'<<'", "'<<='", "'??='", "'..'", - "'{{'", null, null, null, null, null, null, null, null, null, null, "'define'", - "'undef'", "'elif'", "'endif'", "'line'", null, null, null, null, null, - null, "'hidden'", null, null, null, "'}}'" - }; - } - private static final String[] _LITERAL_NAMES = makeLiteralNames(); - private static String[] makeSymbolicNames() { - return new String[] { - null, "BYTE_ORDER_MARK", "SINGLE_LINE_DOC_COMMENT", "EMPTY_DELIMITED_DOC_COMMENT", - "DELIMITED_DOC_COMMENT", "SINGLE_LINE_COMMENT", "DELIMITED_COMMENT", - "WHITESPACES", "SHARP", "ABSTRACT", "ADD", "ALIAS", "ARGLIST", "AS", - "ASCENDING", "ASYNC", "AWAIT", "BASE", "BOOL", "BREAK", "BY", "BYTE", - "CASE", "CATCH", "CHAR", "CHECKED", "CLASS", "CONST", "CONTINUE", "DECIMAL", - "DEFAULT", "DELEGATE", "DESCENDING", "DO", "DOUBLE", "DYNAMIC", "ELSE", - "ENUM", "EQUALS", "EVENT", "EXPLICIT", "EXTERN", "FALSE", "FINALLY", - "FIXED", "FLOAT", "FOR", "FOREACH", "FROM", "GET", "GOTO", "GROUP", "IF", - "IMPLICIT", "IN", "INT", "INTERFACE", "INTERNAL", "INTO", "IS", "JOIN", - "LET", "LOCK", "LONG", "NAMEOF", "NAMESPACE", "NEW", "NULL_", "OBJECT", - "ON", "OPERATOR", "ORDERBY", "OUT", "OVERRIDE", "PARAMS", "PARTIAL", - "PRIVATE", "PROTECTED", "PUBLIC", "READONLY", "REF", "REMOVE", "RETURN", - "SBYTE", "SEALED", "SELECT", "SET", "SHORT", "SIZEOF", "STACKALLOC", - "STATIC", "STRING", "STRUCT", "SWITCH", "THIS", "THROW", "TRUE", "TRY", - "TYPEOF", "UINT", "ULONG", "UNCHECKED", "UNMANAGED", "UNSAFE", "USHORT", - "USING", "VAR", "VIRTUAL", "VOID", "VOLATILE", "WHEN", "WHERE", "WHILE", - "YIELD", "IDENTIFIER", "LITERAL_ACCESS", "INTEGER_LITERAL", "HEX_INTEGER_LITERAL", - "BIN_INTEGER_LITERAL", "REAL_LITERAL", "CHARACTER_LITERAL", "REGULAR_STRING", - "VERBATIUM_STRING", "INTERPOLATED_REGULAR_STRING_START", "INTERPOLATED_VERBATIUM_STRING_START", - "OPEN_BRACE", "CLOSE_BRACE", "OPEN_BRACKET", "CLOSE_BRACKET", "OPEN_PARENS", - "CLOSE_PARENS", "DOT", "COMMA", "COLON", "SEMICOLON", "PLUS", "MINUS", - "STAR", "DIV", "PERCENT", "AMP", "BITWISE_OR", "CARET", "BANG", "TILDE", - "ASSIGNMENT", "LT", "GT", "INTERR", "DOUBLE_COLON", "OP_COALESCING", - "OP_INC", "OP_DEC", "OP_AND", "OP_OR", "OP_PTR", "OP_EQ", "OP_NE", "OP_LE", - "OP_GE", "OP_ADD_ASSIGNMENT", "OP_SUB_ASSIGNMENT", "OP_MULT_ASSIGNMENT", - "OP_DIV_ASSIGNMENT", "OP_MOD_ASSIGNMENT", "OP_AND_ASSIGNMENT", "OP_OR_ASSIGNMENT", - "OP_XOR_ASSIGNMENT", "OP_LEFT_SHIFT", "OP_LEFT_SHIFT_ASSIGNMENT", "OP_COALESCING_ASSIGNMENT", - "OP_RANGE", "DOUBLE_CURLY_INSIDE", "OPEN_BRACE_INSIDE", "REGULAR_CHAR_INSIDE", - "VERBATIUM_DOUBLE_QUOTE_INSIDE", "DOUBLE_QUOTE_INSIDE", "REGULAR_STRING_INSIDE", - "VERBATIUM_INSIDE_STRING", "CLOSE_BRACE_INSIDE", "FORMAT_STRING", "DIRECTIVE_WHITESPACES", - "DIGITS", "DEFINE", "UNDEF", "ELIF", "ENDIF", "LINE", "ERROR", "WARNING", - "REGION", "ENDREGION", "PRAGMA", "NULLABLE", "DIRECTIVE_HIDDEN", "CONDITIONAL_SYMBOL", - "DIRECTIVE_NEW_LINE", "TEXT", "DOUBLE_CURLY_CLOSE_INSIDE" - }; - } - private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); - public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); - - /** - * @deprecated Use {@link #VOCABULARY} instead. - */ - @Deprecated - public static final String[] tokenNames; - static { - tokenNames = new String[_SYMBOLIC_NAMES.length]; - for (int i = 0; i < tokenNames.length; i++) { - tokenNames[i] = VOCABULARY.getLiteralName(i); - if (tokenNames[i] == null) { - tokenNames[i] = VOCABULARY.getSymbolicName(i); - } - - if (tokenNames[i] == null) { - tokenNames[i] = ""; - } - } - } - - @Override - @Deprecated - public String[] getTokenNames() { - return tokenNames; - } - - @Override - - public Vocabulary getVocabulary() { - return VOCABULARY; - } - - @Override - public String getGrammarFileName() { return "CSharpParser.g4"; } - - @Override - public String[] getRuleNames() { return ruleNames; } - - @Override - public String getSerializedATN() { return _serializedATN; } - - @Override - public ATN getATN() { return _ATN; } - - public CSharpParser(TokenStream input) { - super(input); - _interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache); - } - - public static class Compilation_unitContext extends ParserRuleContext { - public TerminalNode EOF() { return getToken(CSharpParser.EOF, 0); } - public TerminalNode BYTE_ORDER_MARK() { return getToken(CSharpParser.BYTE_ORDER_MARK, 0); } - public Extern_alias_directivesContext extern_alias_directives() { - return getRuleContext(Extern_alias_directivesContext.class,0); - } - public Using_directivesContext using_directives() { - return getRuleContext(Using_directivesContext.class,0); - } - public List global_attribute_section() { - return getRuleContexts(Global_attribute_sectionContext.class); - } - public Global_attribute_sectionContext global_attribute_section(int i) { - return getRuleContext(Global_attribute_sectionContext.class,i); - } - public Namespace_member_declarationsContext namespace_member_declarations() { - return getRuleContext(Namespace_member_declarationsContext.class,0); - } - public Compilation_unitContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_compilation_unit; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterCompilation_unit(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitCompilation_unit(this); - } - } - - public final Compilation_unitContext compilation_unit() throws RecognitionException { - Compilation_unitContext _localctx = new Compilation_unitContext(_ctx, getState()); - enterRule(_localctx, 0, RULE_compilation_unit); - int _la; - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(437); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==BYTE_ORDER_MARK) { - { - setState(436); - match(BYTE_ORDER_MARK); - } - } - - setState(440); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) { - case 1: - { - setState(439); - extern_alias_directives(); - } - break; - } - setState(443); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==USING) { - { - setState(442); - using_directives(); - } - } - - setState(448); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,3,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(445); - global_attribute_section(); - } - } - } - setState(450); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,3,_ctx); - } - setState(452); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ABSTRACT) | (1L << ASYNC) | (1L << CLASS) | (1L << DELEGATE) | (1L << ENUM) | (1L << EXTERN) | (1L << INTERFACE) | (1L << INTERNAL))) != 0) || ((((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & ((1L << (NAMESPACE - 65)) | (1L << (NEW - 65)) | (1L << (OVERRIDE - 65)) | (1L << (PARTIAL - 65)) | (1L << (PRIVATE - 65)) | (1L << (PROTECTED - 65)) | (1L << (PUBLIC - 65)) | (1L << (READONLY - 65)) | (1L << (REF - 65)) | (1L << (SEALED - 65)) | (1L << (STATIC - 65)) | (1L << (STRUCT - 65)) | (1L << (UNSAFE - 65)) | (1L << (VIRTUAL - 65)) | (1L << (VOLATILE - 65)) | (1L << (OPEN_BRACKET - 65)))) != 0)) { - { - setState(451); - namespace_member_declarations(); - } - } - - setState(454); - match(Recognizer.EOF); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Namespace_or_type_nameContext extends ParserRuleContext { - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public Qualified_alias_memberContext qualified_alias_member() { - return getRuleContext(Qualified_alias_memberContext.class,0); - } - public List DOT() { return getTokens(CSharpParser.DOT); } - public TerminalNode DOT(int i) { - return getToken(CSharpParser.DOT, i); - } - public List type_argument_list() { - return getRuleContexts(Type_argument_listContext.class); - } - public Type_argument_listContext type_argument_list(int i) { - return getRuleContext(Type_argument_listContext.class,i); - } - public Namespace_or_type_nameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_namespace_or_type_name; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterNamespace_or_type_name(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitNamespace_or_type_name(this); - } - } - - public final Namespace_or_type_nameContext namespace_or_type_name() throws RecognitionException { - Namespace_or_type_nameContext _localctx = new Namespace_or_type_nameContext(_ctx, getState()); - enterRule(_localctx, 2, RULE_namespace_or_type_name); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(461); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,6,_ctx) ) { - case 1: - { - setState(456); - identifier(); - setState(458); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) { - case 1: - { - setState(457); - type_argument_list(); - } - break; - } - } - break; - case 2: - { - setState(460); - qualified_alias_member(); - } - break; - } - setState(470); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,8,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(463); - match(DOT); - setState(464); - identifier(); - setState(466); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,7,_ctx) ) { - case 1: - { - setState(465); - type_argument_list(); - } - break; - } - } - } - } - setState(472); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,8,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Type_Context extends ParserRuleContext { - public Base_typeContext base_type() { - return getRuleContext(Base_typeContext.class,0); - } - public List INTERR() { return getTokens(CSharpParser.INTERR); } - public TerminalNode INTERR(int i) { - return getToken(CSharpParser.INTERR, i); - } - public List rank_specifier() { - return getRuleContexts(Rank_specifierContext.class); - } - public Rank_specifierContext rank_specifier(int i) { - return getRuleContext(Rank_specifierContext.class,i); - } - public List STAR() { return getTokens(CSharpParser.STAR); } - public TerminalNode STAR(int i) { - return getToken(CSharpParser.STAR, i); - } - public Type_Context(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_type_; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterType_(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitType_(this); - } - } - - public final Type_Context type_() throws RecognitionException { - Type_Context _localctx = new Type_Context(_ctx, getState()); - enterRule(_localctx, 4, RULE_type_); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(473); - base_type(); - setState(479); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,10,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - setState(477); - _errHandler.sync(this); - switch (_input.LA(1)) { - case INTERR: - { - setState(474); - match(INTERR); - } - break; - case OPEN_BRACKET: - { - setState(475); - rank_specifier(); - } - break; - case STAR: - { - setState(476); - match(STAR); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - setState(481); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,10,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Base_typeContext extends ParserRuleContext { - public Simple_typeContext simple_type() { - return getRuleContext(Simple_typeContext.class,0); - } - public Class_typeContext class_type() { - return getRuleContext(Class_typeContext.class,0); - } - public TerminalNode VOID() { return getToken(CSharpParser.VOID, 0); } - public TerminalNode STAR() { return getToken(CSharpParser.STAR, 0); } - public Tuple_typeContext tuple_type() { - return getRuleContext(Tuple_typeContext.class,0); - } - public Base_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_base_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterBase_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitBase_type(this); - } - } - - public final Base_typeContext base_type() throws RecognitionException { - Base_typeContext _localctx = new Base_typeContext(_ctx, getState()); - enterRule(_localctx, 6, RULE_base_type); - try { - setState(487); - _errHandler.sync(this); - switch (_input.LA(1)) { - case BOOL: - case BYTE: - case CHAR: - case DECIMAL: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SBYTE: - case SHORT: - case UINT: - case ULONG: - case USHORT: - enterOuterAlt(_localctx, 1); - { - setState(482); - simple_type(); - } - break; - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BY: - case DESCENDING: - case DYNAMIC: - case EQUALS: - case FROM: - case GET: - case GROUP: - case INTO: - case JOIN: - case LET: - case NAMEOF: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REMOVE: - case SELECT: - case SET: - case STRING: - case UNMANAGED: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - enterOuterAlt(_localctx, 2); - { - setState(483); - class_type(); - } - break; - case VOID: - enterOuterAlt(_localctx, 3); - { - setState(484); - match(VOID); - setState(485); - match(STAR); - } - break; - case OPEN_PARENS: - enterOuterAlt(_localctx, 4); - { - setState(486); - tuple_type(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Tuple_typeContext extends ParserRuleContext { - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public List tuple_element() { - return getRuleContexts(Tuple_elementContext.class); - } - public Tuple_elementContext tuple_element(int i) { - return getRuleContext(Tuple_elementContext.class,i); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Tuple_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_tuple_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterTuple_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitTuple_type(this); - } - } - - public final Tuple_typeContext tuple_type() throws RecognitionException { - Tuple_typeContext _localctx = new Tuple_typeContext(_ctx, getState()); - enterRule(_localctx, 8, RULE_tuple_type); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(489); - match(OPEN_PARENS); - setState(490); - tuple_element(); - setState(493); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(491); - match(COMMA); - setState(492); - tuple_element(); - } - } - setState(495); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( _la==COMMA ); - setState(497); - match(CLOSE_PARENS); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Tuple_elementContext extends ParserRuleContext { - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Tuple_elementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_tuple_element; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterTuple_element(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitTuple_element(this); - } - } - - public final Tuple_elementContext tuple_element() throws RecognitionException { - Tuple_elementContext _localctx = new Tuple_elementContext(_ctx, getState()); - enterRule(_localctx, 10, RULE_tuple_element); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(499); - type_(); - setState(501); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BY) | (1L << DESCENDING) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INTO) | (1L << JOIN) | (1L << LET))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REMOVE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (UNMANAGED - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)))) != 0)) { - { - setState(500); - identifier(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Simple_typeContext extends ParserRuleContext { - public Numeric_typeContext numeric_type() { - return getRuleContext(Numeric_typeContext.class,0); - } - public TerminalNode BOOL() { return getToken(CSharpParser.BOOL, 0); } - public Simple_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_simple_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSimple_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSimple_type(this); - } - } - - public final Simple_typeContext simple_type() throws RecognitionException { - Simple_typeContext _localctx = new Simple_typeContext(_ctx, getState()); - enterRule(_localctx, 12, RULE_simple_type); - try { - setState(505); - _errHandler.sync(this); - switch (_input.LA(1)) { - case BYTE: - case CHAR: - case DECIMAL: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SBYTE: - case SHORT: - case UINT: - case ULONG: - case USHORT: - enterOuterAlt(_localctx, 1); - { - setState(503); - numeric_type(); - } - break; - case BOOL: - enterOuterAlt(_localctx, 2); - { - setState(504); - match(BOOL); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Numeric_typeContext extends ParserRuleContext { - public Integral_typeContext integral_type() { - return getRuleContext(Integral_typeContext.class,0); - } - public Floating_point_typeContext floating_point_type() { - return getRuleContext(Floating_point_typeContext.class,0); - } - public TerminalNode DECIMAL() { return getToken(CSharpParser.DECIMAL, 0); } - public Numeric_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_numeric_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterNumeric_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitNumeric_type(this); - } - } - - public final Numeric_typeContext numeric_type() throws RecognitionException { - Numeric_typeContext _localctx = new Numeric_typeContext(_ctx, getState()); - enterRule(_localctx, 14, RULE_numeric_type); - try { - setState(510); - _errHandler.sync(this); - switch (_input.LA(1)) { - case BYTE: - case CHAR: - case INT: - case LONG: - case SBYTE: - case SHORT: - case UINT: - case ULONG: - case USHORT: - enterOuterAlt(_localctx, 1); - { - setState(507); - integral_type(); - } - break; - case DOUBLE: - case FLOAT: - enterOuterAlt(_localctx, 2); - { - setState(508); - floating_point_type(); - } - break; - case DECIMAL: - enterOuterAlt(_localctx, 3); - { - setState(509); - match(DECIMAL); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Integral_typeContext extends ParserRuleContext { - public TerminalNode SBYTE() { return getToken(CSharpParser.SBYTE, 0); } - public TerminalNode BYTE() { return getToken(CSharpParser.BYTE, 0); } - public TerminalNode SHORT() { return getToken(CSharpParser.SHORT, 0); } - public TerminalNode USHORT() { return getToken(CSharpParser.USHORT, 0); } - public TerminalNode INT() { return getToken(CSharpParser.INT, 0); } - public TerminalNode UINT() { return getToken(CSharpParser.UINT, 0); } - public TerminalNode LONG() { return getToken(CSharpParser.LONG, 0); } - public TerminalNode ULONG() { return getToken(CSharpParser.ULONG, 0); } - public TerminalNode CHAR() { return getToken(CSharpParser.CHAR, 0); } - public Integral_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_integral_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterIntegral_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitIntegral_type(this); - } - } - - public final Integral_typeContext integral_type() throws RecognitionException { - Integral_typeContext _localctx = new Integral_typeContext(_ctx, getState()); - enterRule(_localctx, 16, RULE_integral_type); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(512); - _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << BYTE) | (1L << CHAR) | (1L << INT) | (1L << LONG))) != 0) || ((((_la - 83)) & ~0x3f) == 0 && ((1L << (_la - 83)) & ((1L << (SBYTE - 83)) | (1L << (SHORT - 83)) | (1L << (UINT - 83)) | (1L << (ULONG - 83)) | (1L << (USHORT - 83)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Floating_point_typeContext extends ParserRuleContext { - public TerminalNode FLOAT() { return getToken(CSharpParser.FLOAT, 0); } - public TerminalNode DOUBLE() { return getToken(CSharpParser.DOUBLE, 0); } - public Floating_point_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_floating_point_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFloating_point_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFloating_point_type(this); - } - } - - public final Floating_point_typeContext floating_point_type() throws RecognitionException { - Floating_point_typeContext _localctx = new Floating_point_typeContext(_ctx, getState()); - enterRule(_localctx, 18, RULE_floating_point_type); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(514); - _la = _input.LA(1); - if ( !(_la==DOUBLE || _la==FLOAT) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Class_typeContext extends ParserRuleContext { - public Namespace_or_type_nameContext namespace_or_type_name() { - return getRuleContext(Namespace_or_type_nameContext.class,0); - } - public TerminalNode OBJECT() { return getToken(CSharpParser.OBJECT, 0); } - public TerminalNode DYNAMIC() { return getToken(CSharpParser.DYNAMIC, 0); } - public TerminalNode STRING() { return getToken(CSharpParser.STRING, 0); } - public Class_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_class_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterClass_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitClass_type(this); - } - } - - public final Class_typeContext class_type() throws RecognitionException { - Class_typeContext _localctx = new Class_typeContext(_ctx, getState()); - enterRule(_localctx, 20, RULE_class_type); - try { - setState(520); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,16,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(516); - namespace_or_type_name(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(517); - match(OBJECT); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(518); - match(DYNAMIC); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(519); - match(STRING); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Type_argument_listContext extends ParserRuleContext { - public TerminalNode LT() { return getToken(CSharpParser.LT, 0); } - public List type_() { - return getRuleContexts(Type_Context.class); - } - public Type_Context type_(int i) { - return getRuleContext(Type_Context.class,i); - } - public TerminalNode GT() { return getToken(CSharpParser.GT, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Type_argument_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_type_argument_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterType_argument_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitType_argument_list(this); - } - } - - public final Type_argument_listContext type_argument_list() throws RecognitionException { - Type_argument_listContext _localctx = new Type_argument_listContext(_ctx, getState()); - enterRule(_localctx, 22, RULE_type_argument_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(522); - match(LT); - setState(523); - type_(); - setState(528); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(524); - match(COMMA); - setState(525); - type_(); - } - } - setState(530); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(531); - match(GT); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Argument_listContext extends ParserRuleContext { - public List argument() { - return getRuleContexts(ArgumentContext.class); - } - public ArgumentContext argument(int i) { - return getRuleContext(ArgumentContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Argument_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_argument_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterArgument_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitArgument_list(this); - } - } - - public final Argument_listContext argument_list() throws RecognitionException { - Argument_listContext _localctx = new Argument_listContext(_ctx, getState()); - enterRule(_localctx, 24, RULE_argument_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(533); - argument(); - setState(538); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(534); - match(COMMA); - setState(535); - argument(); - } - } - setState(540); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class ArgumentContext extends ParserRuleContext { - public Token refout; - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public TerminalNode VAR() { return getToken(CSharpParser.VAR, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public TerminalNode REF() { return getToken(CSharpParser.REF, 0); } - public TerminalNode OUT() { return getToken(CSharpParser.OUT, 0); } - public TerminalNode IN() { return getToken(CSharpParser.IN, 0); } - public ArgumentContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_argument; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterArgument(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitArgument(this); - } - } - - public final ArgumentContext argument() throws RecognitionException { - ArgumentContext _localctx = new ArgumentContext(_ctx, getState()); - enterRule(_localctx, 26, RULE_argument); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(544); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,19,_ctx) ) { - case 1: - { - setState(541); - identifier(); - setState(542); - match(COLON); - } - break; - } - setState(547); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,20,_ctx) ) { - case 1: - { - setState(546); - ((ArgumentContext)_localctx).refout = _input.LT(1); - _la = _input.LA(1); - if ( !(((((_la - 54)) & ~0x3f) == 0 && ((1L << (_la - 54)) & ((1L << (IN - 54)) | (1L << (OUT - 54)) | (1L << (REF - 54)))) != 0)) ) { - ((ArgumentContext)_localctx).refout = (Token)_errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - break; - } - setState(551); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,21,_ctx) ) { - case 1: - { - setState(549); - match(VAR); - } - break; - case 2: - { - setState(550); - type_(); - } - break; - } - setState(553); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class ExpressionContext extends ParserRuleContext { - public AssignmentContext assignment() { - return getRuleContext(AssignmentContext.class,0); - } - public Non_assignment_expressionContext non_assignment_expression() { - return getRuleContext(Non_assignment_expressionContext.class,0); - } - public TerminalNode REF() { return getToken(CSharpParser.REF, 0); } - public ExpressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitExpression(this); - } - } - - public final ExpressionContext expression() throws RecognitionException { - ExpressionContext _localctx = new ExpressionContext(_ctx, getState()); - enterRule(_localctx, 28, RULE_expression); - try { - setState(559); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,22,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(555); - assignment(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(556); - non_assignment_expression(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(557); - match(REF); - setState(558); - non_assignment_expression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Non_assignment_expressionContext extends ParserRuleContext { - public Lambda_expressionContext lambda_expression() { - return getRuleContext(Lambda_expressionContext.class,0); - } - public Query_expressionContext query_expression() { - return getRuleContext(Query_expressionContext.class,0); - } - public Conditional_expressionContext conditional_expression() { - return getRuleContext(Conditional_expressionContext.class,0); - } - public Non_assignment_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_non_assignment_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterNon_assignment_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitNon_assignment_expression(this); - } - } - - public final Non_assignment_expressionContext non_assignment_expression() throws RecognitionException { - Non_assignment_expressionContext _localctx = new Non_assignment_expressionContext(_ctx, getState()); - enterRule(_localctx, 30, RULE_non_assignment_expression); - try { - setState(564); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,23,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(561); - lambda_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(562); - query_expression(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(563); - conditional_expression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class AssignmentContext extends ParserRuleContext { - public Unary_expressionContext unary_expression() { - return getRuleContext(Unary_expressionContext.class,0); - } - public Assignment_operatorContext assignment_operator() { - return getRuleContext(Assignment_operatorContext.class,0); - } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode OP_COALESCING_ASSIGNMENT() { return getToken(CSharpParser.OP_COALESCING_ASSIGNMENT, 0); } - public Throwable_expressionContext throwable_expression() { - return getRuleContext(Throwable_expressionContext.class,0); - } - public AssignmentContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_assignment; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAssignment(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAssignment(this); - } - } - - public final AssignmentContext assignment() throws RecognitionException { - AssignmentContext _localctx = new AssignmentContext(_ctx, getState()); - enterRule(_localctx, 32, RULE_assignment); - try { - setState(574); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,24,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(566); - unary_expression(); - setState(567); - assignment_operator(); - setState(568); - expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(570); - unary_expression(); - setState(571); - match(OP_COALESCING_ASSIGNMENT); - setState(572); - throwable_expression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Assignment_operatorContext extends ParserRuleContext { - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public TerminalNode OP_ADD_ASSIGNMENT() { return getToken(CSharpParser.OP_ADD_ASSIGNMENT, 0); } - public TerminalNode OP_SUB_ASSIGNMENT() { return getToken(CSharpParser.OP_SUB_ASSIGNMENT, 0); } - public TerminalNode OP_MULT_ASSIGNMENT() { return getToken(CSharpParser.OP_MULT_ASSIGNMENT, 0); } - public TerminalNode OP_DIV_ASSIGNMENT() { return getToken(CSharpParser.OP_DIV_ASSIGNMENT, 0); } - public TerminalNode OP_MOD_ASSIGNMENT() { return getToken(CSharpParser.OP_MOD_ASSIGNMENT, 0); } - public TerminalNode OP_AND_ASSIGNMENT() { return getToken(CSharpParser.OP_AND_ASSIGNMENT, 0); } - public TerminalNode OP_OR_ASSIGNMENT() { return getToken(CSharpParser.OP_OR_ASSIGNMENT, 0); } - public TerminalNode OP_XOR_ASSIGNMENT() { return getToken(CSharpParser.OP_XOR_ASSIGNMENT, 0); } - public TerminalNode OP_LEFT_SHIFT_ASSIGNMENT() { return getToken(CSharpParser.OP_LEFT_SHIFT_ASSIGNMENT, 0); } - public Right_shift_assignmentContext right_shift_assignment() { - return getRuleContext(Right_shift_assignmentContext.class,0); - } - public Assignment_operatorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_assignment_operator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAssignment_operator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAssignment_operator(this); - } - } - - public final Assignment_operatorContext assignment_operator() throws RecognitionException { - Assignment_operatorContext _localctx = new Assignment_operatorContext(_ctx, getState()); - enterRule(_localctx, 34, RULE_assignment_operator); - try { - setState(587); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ASSIGNMENT: - enterOuterAlt(_localctx, 1); - { - setState(576); - match(ASSIGNMENT); - } - break; - case OP_ADD_ASSIGNMENT: - enterOuterAlt(_localctx, 2); - { - setState(577); - match(OP_ADD_ASSIGNMENT); - } - break; - case OP_SUB_ASSIGNMENT: - enterOuterAlt(_localctx, 3); - { - setState(578); - match(OP_SUB_ASSIGNMENT); - } - break; - case OP_MULT_ASSIGNMENT: - enterOuterAlt(_localctx, 4); - { - setState(579); - match(OP_MULT_ASSIGNMENT); - } - break; - case OP_DIV_ASSIGNMENT: - enterOuterAlt(_localctx, 5); - { - setState(580); - match(OP_DIV_ASSIGNMENT); - } - break; - case OP_MOD_ASSIGNMENT: - enterOuterAlt(_localctx, 6); - { - setState(581); - match(OP_MOD_ASSIGNMENT); - } - break; - case OP_AND_ASSIGNMENT: - enterOuterAlt(_localctx, 7); - { - setState(582); - match(OP_AND_ASSIGNMENT); - } - break; - case OP_OR_ASSIGNMENT: - enterOuterAlt(_localctx, 8); - { - setState(583); - match(OP_OR_ASSIGNMENT); - } - break; - case OP_XOR_ASSIGNMENT: - enterOuterAlt(_localctx, 9); - { - setState(584); - match(OP_XOR_ASSIGNMENT); - } - break; - case OP_LEFT_SHIFT_ASSIGNMENT: - enterOuterAlt(_localctx, 10); - { - setState(585); - match(OP_LEFT_SHIFT_ASSIGNMENT); - } - break; - case GT: - enterOuterAlt(_localctx, 11); - { - setState(586); - right_shift_assignment(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Conditional_expressionContext extends ParserRuleContext { - public Null_coalescing_expressionContext null_coalescing_expression() { - return getRuleContext(Null_coalescing_expressionContext.class,0); - } - public TerminalNode INTERR() { return getToken(CSharpParser.INTERR, 0); } - public List throwable_expression() { - return getRuleContexts(Throwable_expressionContext.class); - } - public Throwable_expressionContext throwable_expression(int i) { - return getRuleContext(Throwable_expressionContext.class,i); - } - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public Conditional_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_conditional_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterConditional_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitConditional_expression(this); - } - } - - public final Conditional_expressionContext conditional_expression() throws RecognitionException { - Conditional_expressionContext _localctx = new Conditional_expressionContext(_ctx, getState()); - enterRule(_localctx, 36, RULE_conditional_expression); - try { - enterOuterAlt(_localctx, 1); - { - setState(589); - null_coalescing_expression(); - setState(595); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,26,_ctx) ) { - case 1: - { - setState(590); - match(INTERR); - setState(591); - throwable_expression(); - setState(592); - match(COLON); - setState(593); - throwable_expression(); - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Null_coalescing_expressionContext extends ParserRuleContext { - public Conditional_or_expressionContext conditional_or_expression() { - return getRuleContext(Conditional_or_expressionContext.class,0); - } - public TerminalNode OP_COALESCING() { return getToken(CSharpParser.OP_COALESCING, 0); } - public Null_coalescing_expressionContext null_coalescing_expression() { - return getRuleContext(Null_coalescing_expressionContext.class,0); - } - public Throw_expressionContext throw_expression() { - return getRuleContext(Throw_expressionContext.class,0); - } - public Null_coalescing_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_null_coalescing_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterNull_coalescing_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitNull_coalescing_expression(this); - } - } - - public final Null_coalescing_expressionContext null_coalescing_expression() throws RecognitionException { - Null_coalescing_expressionContext _localctx = new Null_coalescing_expressionContext(_ctx, getState()); - enterRule(_localctx, 38, RULE_null_coalescing_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(597); - conditional_or_expression(); - setState(603); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OP_COALESCING) { - { - setState(598); - match(OP_COALESCING); - setState(601); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case THIS: - case TRUE: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case USHORT: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - { - setState(599); - null_coalescing_expression(); - } - break; - case THROW: - { - setState(600); - throw_expression(); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Conditional_or_expressionContext extends ParserRuleContext { - public List conditional_and_expression() { - return getRuleContexts(Conditional_and_expressionContext.class); - } - public Conditional_and_expressionContext conditional_and_expression(int i) { - return getRuleContext(Conditional_and_expressionContext.class,i); - } - public List OP_OR() { return getTokens(CSharpParser.OP_OR); } - public TerminalNode OP_OR(int i) { - return getToken(CSharpParser.OP_OR, i); - } - public Conditional_or_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_conditional_or_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterConditional_or_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitConditional_or_expression(this); - } - } - - public final Conditional_or_expressionContext conditional_or_expression() throws RecognitionException { - Conditional_or_expressionContext _localctx = new Conditional_or_expressionContext(_ctx, getState()); - enterRule(_localctx, 40, RULE_conditional_or_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(605); - conditional_and_expression(); - setState(610); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==OP_OR) { - { - { - setState(606); - match(OP_OR); - setState(607); - conditional_and_expression(); - } - } - setState(612); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Conditional_and_expressionContext extends ParserRuleContext { - public List inclusive_or_expression() { - return getRuleContexts(Inclusive_or_expressionContext.class); - } - public Inclusive_or_expressionContext inclusive_or_expression(int i) { - return getRuleContext(Inclusive_or_expressionContext.class,i); - } - public List OP_AND() { return getTokens(CSharpParser.OP_AND); } - public TerminalNode OP_AND(int i) { - return getToken(CSharpParser.OP_AND, i); - } - public Conditional_and_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_conditional_and_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterConditional_and_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitConditional_and_expression(this); - } - } - - public final Conditional_and_expressionContext conditional_and_expression() throws RecognitionException { - Conditional_and_expressionContext _localctx = new Conditional_and_expressionContext(_ctx, getState()); - enterRule(_localctx, 42, RULE_conditional_and_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(613); - inclusive_or_expression(); - setState(618); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==OP_AND) { - { - { - setState(614); - match(OP_AND); - setState(615); - inclusive_or_expression(); - } - } - setState(620); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Inclusive_or_expressionContext extends ParserRuleContext { - public List exclusive_or_expression() { - return getRuleContexts(Exclusive_or_expressionContext.class); - } - public Exclusive_or_expressionContext exclusive_or_expression(int i) { - return getRuleContext(Exclusive_or_expressionContext.class,i); - } - public List BITWISE_OR() { return getTokens(CSharpParser.BITWISE_OR); } - public TerminalNode BITWISE_OR(int i) { - return getToken(CSharpParser.BITWISE_OR, i); - } - public Inclusive_or_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_inclusive_or_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInclusive_or_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInclusive_or_expression(this); - } - } - - public final Inclusive_or_expressionContext inclusive_or_expression() throws RecognitionException { - Inclusive_or_expressionContext _localctx = new Inclusive_or_expressionContext(_ctx, getState()); - enterRule(_localctx, 44, RULE_inclusive_or_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(621); - exclusive_or_expression(); - setState(626); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==BITWISE_OR) { - { - { - setState(622); - match(BITWISE_OR); - setState(623); - exclusive_or_expression(); - } - } - setState(628); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Exclusive_or_expressionContext extends ParserRuleContext { - public List and_expression() { - return getRuleContexts(And_expressionContext.class); - } - public And_expressionContext and_expression(int i) { - return getRuleContext(And_expressionContext.class,i); - } - public List CARET() { return getTokens(CSharpParser.CARET); } - public TerminalNode CARET(int i) { - return getToken(CSharpParser.CARET, i); - } - public Exclusive_or_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_exclusive_or_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterExclusive_or_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitExclusive_or_expression(this); - } - } - - public final Exclusive_or_expressionContext exclusive_or_expression() throws RecognitionException { - Exclusive_or_expressionContext _localctx = new Exclusive_or_expressionContext(_ctx, getState()); - enterRule(_localctx, 46, RULE_exclusive_or_expression); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(629); - and_expression(); - setState(634); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,32,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(630); - match(CARET); - setState(631); - and_expression(); - } - } - } - setState(636); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,32,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class And_expressionContext extends ParserRuleContext { - public List equality_expression() { - return getRuleContexts(Equality_expressionContext.class); - } - public Equality_expressionContext equality_expression(int i) { - return getRuleContext(Equality_expressionContext.class,i); - } - public List AMP() { return getTokens(CSharpParser.AMP); } - public TerminalNode AMP(int i) { - return getToken(CSharpParser.AMP, i); - } - public And_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_and_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAnd_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAnd_expression(this); - } - } - - public final And_expressionContext and_expression() throws RecognitionException { - And_expressionContext _localctx = new And_expressionContext(_ctx, getState()); - enterRule(_localctx, 48, RULE_and_expression); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(637); - equality_expression(); - setState(642); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,33,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(638); - match(AMP); - setState(639); - equality_expression(); - } - } - } - setState(644); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,33,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Equality_expressionContext extends ParserRuleContext { - public List relational_expression() { - return getRuleContexts(Relational_expressionContext.class); - } - public Relational_expressionContext relational_expression(int i) { - return getRuleContext(Relational_expressionContext.class,i); - } - public List OP_EQ() { return getTokens(CSharpParser.OP_EQ); } - public TerminalNode OP_EQ(int i) { - return getToken(CSharpParser.OP_EQ, i); - } - public List OP_NE() { return getTokens(CSharpParser.OP_NE); } - public TerminalNode OP_NE(int i) { - return getToken(CSharpParser.OP_NE, i); - } - public Equality_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_equality_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterEquality_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitEquality_expression(this); - } - } - - public final Equality_expressionContext equality_expression() throws RecognitionException { - Equality_expressionContext _localctx = new Equality_expressionContext(_ctx, getState()); - enterRule(_localctx, 50, RULE_equality_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(645); - relational_expression(); - setState(650); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==OP_EQ || _la==OP_NE) { - { - { - setState(646); - _la = _input.LA(1); - if ( !(_la==OP_EQ || _la==OP_NE) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(647); - relational_expression(); - } - } - setState(652); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Relational_expressionContext extends ParserRuleContext { - public List shift_expression() { - return getRuleContexts(Shift_expressionContext.class); - } - public Shift_expressionContext shift_expression(int i) { - return getRuleContext(Shift_expressionContext.class,i); - } - public List IS() { return getTokens(CSharpParser.IS); } - public TerminalNode IS(int i) { - return getToken(CSharpParser.IS, i); - } - public List isType() { - return getRuleContexts(IsTypeContext.class); - } - public IsTypeContext isType(int i) { - return getRuleContext(IsTypeContext.class,i); - } - public List AS() { return getTokens(CSharpParser.AS); } - public TerminalNode AS(int i) { - return getToken(CSharpParser.AS, i); - } - public List type_() { - return getRuleContexts(Type_Context.class); - } - public Type_Context type_(int i) { - return getRuleContext(Type_Context.class,i); - } - public List LT() { return getTokens(CSharpParser.LT); } - public TerminalNode LT(int i) { - return getToken(CSharpParser.LT, i); - } - public List GT() { return getTokens(CSharpParser.GT); } - public TerminalNode GT(int i) { - return getToken(CSharpParser.GT, i); - } - public List OP_LE() { return getTokens(CSharpParser.OP_LE); } - public TerminalNode OP_LE(int i) { - return getToken(CSharpParser.OP_LE, i); - } - public List OP_GE() { return getTokens(CSharpParser.OP_GE); } - public TerminalNode OP_GE(int i) { - return getToken(CSharpParser.OP_GE, i); - } - public Relational_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_relational_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterRelational_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitRelational_expression(this); - } - } - - public final Relational_expressionContext relational_expression() throws RecognitionException { - Relational_expressionContext _localctx = new Relational_expressionContext(_ctx, getState()); - enterRule(_localctx, 52, RULE_relational_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(653); - shift_expression(); - setState(662); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==AS || _la==IS || ((((_la - 146)) & ~0x3f) == 0 && ((1L << (_la - 146)) & ((1L << (LT - 146)) | (1L << (GT - 146)) | (1L << (OP_LE - 146)) | (1L << (OP_GE - 146)))) != 0)) { - { - setState(660); - _errHandler.sync(this); - switch (_input.LA(1)) { - case LT: - case GT: - case OP_LE: - case OP_GE: - { - setState(654); - _la = _input.LA(1); - if ( !(((((_la - 146)) & ~0x3f) == 0 && ((1L << (_la - 146)) & ((1L << (LT - 146)) | (1L << (GT - 146)) | (1L << (OP_LE - 146)) | (1L << (OP_GE - 146)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(655); - shift_expression(); - } - break; - case IS: - { - setState(656); - match(IS); - setState(657); - isType(); - } - break; - case AS: - { - setState(658); - match(AS); - setState(659); - type_(); - } - break; - default: - throw new NoViableAltException(this); - } - } - setState(664); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Shift_expressionContext extends ParserRuleContext { - public List additive_expression() { - return getRuleContexts(Additive_expressionContext.class); - } - public Additive_expressionContext additive_expression(int i) { - return getRuleContext(Additive_expressionContext.class,i); - } - public List OP_LEFT_SHIFT() { return getTokens(CSharpParser.OP_LEFT_SHIFT); } - public TerminalNode OP_LEFT_SHIFT(int i) { - return getToken(CSharpParser.OP_LEFT_SHIFT, i); - } - public List right_shift() { - return getRuleContexts(Right_shiftContext.class); - } - public Right_shiftContext right_shift(int i) { - return getRuleContext(Right_shiftContext.class,i); - } - public Shift_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_shift_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterShift_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitShift_expression(this); - } - } - - public final Shift_expressionContext shift_expression() throws RecognitionException { - Shift_expressionContext _localctx = new Shift_expressionContext(_ctx, getState()); - enterRule(_localctx, 54, RULE_shift_expression); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(665); - additive_expression(); - setState(673); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,38,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(668); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OP_LEFT_SHIFT: - { - setState(666); - match(OP_LEFT_SHIFT); - } - break; - case GT: - { - setState(667); - right_shift(); - } - break; - default: - throw new NoViableAltException(this); - } - setState(670); - additive_expression(); - } - } - } - setState(675); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,38,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Additive_expressionContext extends ParserRuleContext { - public List multiplicative_expression() { - return getRuleContexts(Multiplicative_expressionContext.class); - } - public Multiplicative_expressionContext multiplicative_expression(int i) { - return getRuleContext(Multiplicative_expressionContext.class,i); - } - public List PLUS() { return getTokens(CSharpParser.PLUS); } - public TerminalNode PLUS(int i) { - return getToken(CSharpParser.PLUS, i); - } - public List MINUS() { return getTokens(CSharpParser.MINUS); } - public TerminalNode MINUS(int i) { - return getToken(CSharpParser.MINUS, i); - } - public Additive_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_additive_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAdditive_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAdditive_expression(this); - } - } - - public final Additive_expressionContext additive_expression() throws RecognitionException { - Additive_expressionContext _localctx = new Additive_expressionContext(_ctx, getState()); - enterRule(_localctx, 56, RULE_additive_expression); - int _la; - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(676); - multiplicative_expression(); - setState(681); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,39,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(677); - _la = _input.LA(1); - if ( !(_la==PLUS || _la==MINUS) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(678); - multiplicative_expression(); - } - } - } - setState(683); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,39,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Multiplicative_expressionContext extends ParserRuleContext { - public List switch_expression() { - return getRuleContexts(Switch_expressionContext.class); - } - public Switch_expressionContext switch_expression(int i) { - return getRuleContext(Switch_expressionContext.class,i); - } - public List STAR() { return getTokens(CSharpParser.STAR); } - public TerminalNode STAR(int i) { - return getToken(CSharpParser.STAR, i); - } - public List DIV() { return getTokens(CSharpParser.DIV); } - public TerminalNode DIV(int i) { - return getToken(CSharpParser.DIV, i); - } - public List PERCENT() { return getTokens(CSharpParser.PERCENT); } - public TerminalNode PERCENT(int i) { - return getToken(CSharpParser.PERCENT, i); - } - public Multiplicative_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_multiplicative_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMultiplicative_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMultiplicative_expression(this); - } - } - - public final Multiplicative_expressionContext multiplicative_expression() throws RecognitionException { - Multiplicative_expressionContext _localctx = new Multiplicative_expressionContext(_ctx, getState()); - enterRule(_localctx, 58, RULE_multiplicative_expression); - int _la; - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(684); - switch_expression(); - setState(689); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,40,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(685); - _la = _input.LA(1); - if ( !(((((_la - 137)) & ~0x3f) == 0 && ((1L << (_la - 137)) & ((1L << (STAR - 137)) | (1L << (DIV - 137)) | (1L << (PERCENT - 137)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(686); - switch_expression(); - } - } - } - setState(691); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,40,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Switch_expressionContext extends ParserRuleContext { - public Range_expressionContext range_expression() { - return getRuleContext(Range_expressionContext.class,0); - } - public TerminalNode SWITCH() { return getToken(CSharpParser.SWITCH, 0); } - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public Switch_expression_armsContext switch_expression_arms() { - return getRuleContext(Switch_expression_armsContext.class,0); - } - public TerminalNode COMMA() { return getToken(CSharpParser.COMMA, 0); } - public Switch_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_switch_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSwitch_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSwitch_expression(this); - } - } - - public final Switch_expressionContext switch_expression() throws RecognitionException { - Switch_expressionContext _localctx = new Switch_expressionContext(_ctx, getState()); - enterRule(_localctx, 60, RULE_switch_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(692); - range_expression(); - setState(702); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==SWITCH) { - { - setState(693); - match(SWITCH); - setState(694); - match(OPEN_BRACE); - setState(699); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(695); - switch_expression_arms(); - setState(697); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(696); - match(COMMA); - } - } - - } - } - - setState(701); - match(CLOSE_BRACE); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Switch_expression_armsContext extends ParserRuleContext { - public List switch_expression_arm() { - return getRuleContexts(Switch_expression_armContext.class); - } - public Switch_expression_armContext switch_expression_arm(int i) { - return getRuleContext(Switch_expression_armContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Switch_expression_armsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_switch_expression_arms; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSwitch_expression_arms(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSwitch_expression_arms(this); - } - } - - public final Switch_expression_armsContext switch_expression_arms() throws RecognitionException { - Switch_expression_armsContext _localctx = new Switch_expression_armsContext(_ctx, getState()); - enterRule(_localctx, 62, RULE_switch_expression_arms); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(704); - switch_expression_arm(); - setState(709); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,44,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(705); - match(COMMA); - setState(706); - switch_expression_arm(); - } - } - } - setState(711); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,44,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Switch_expression_armContext extends ParserRuleContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Right_arrowContext right_arrow() { - return getRuleContext(Right_arrowContext.class,0); - } - public Throwable_expressionContext throwable_expression() { - return getRuleContext(Throwable_expressionContext.class,0); - } - public Case_guardContext case_guard() { - return getRuleContext(Case_guardContext.class,0); - } - public Switch_expression_armContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_switch_expression_arm; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSwitch_expression_arm(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSwitch_expression_arm(this); - } - } - - public final Switch_expression_armContext switch_expression_arm() throws RecognitionException { - Switch_expression_armContext _localctx = new Switch_expression_armContext(_ctx, getState()); - enterRule(_localctx, 64, RULE_switch_expression_arm); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(712); - expression(); - setState(714); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHEN) { - { - setState(713); - case_guard(); - } - } - - setState(716); - right_arrow(); - setState(717); - throwable_expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Range_expressionContext extends ParserRuleContext { - public List unary_expression() { - return getRuleContexts(Unary_expressionContext.class); - } - public Unary_expressionContext unary_expression(int i) { - return getRuleContext(Unary_expressionContext.class,i); - } - public TerminalNode OP_RANGE() { return getToken(CSharpParser.OP_RANGE, 0); } - public Range_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_range_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterRange_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitRange_expression(this); - } - } - - public final Range_expressionContext range_expression() throws RecognitionException { - Range_expressionContext _localctx = new Range_expressionContext(_ctx, getState()); - enterRule(_localctx, 66, RULE_range_expression); - int _la; - try { - setState(727); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,48,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(719); - unary_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(721); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)))) != 0)) { - { - setState(720); - unary_expression(); - } - } - - setState(723); - match(OP_RANGE); - setState(725); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,47,_ctx) ) { - case 1: - { - setState(724); - unary_expression(); - } - break; - } - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Unary_expressionContext extends ParserRuleContext { - public Primary_expressionContext primary_expression() { - return getRuleContext(Primary_expressionContext.class,0); - } - public TerminalNode PLUS() { return getToken(CSharpParser.PLUS, 0); } - public Unary_expressionContext unary_expression() { - return getRuleContext(Unary_expressionContext.class,0); - } - public TerminalNode MINUS() { return getToken(CSharpParser.MINUS, 0); } - public TerminalNode BANG() { return getToken(CSharpParser.BANG, 0); } - public TerminalNode TILDE() { return getToken(CSharpParser.TILDE, 0); } - public TerminalNode OP_INC() { return getToken(CSharpParser.OP_INC, 0); } - public TerminalNode OP_DEC() { return getToken(CSharpParser.OP_DEC, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public TerminalNode AWAIT() { return getToken(CSharpParser.AWAIT, 0); } - public TerminalNode AMP() { return getToken(CSharpParser.AMP, 0); } - public TerminalNode STAR() { return getToken(CSharpParser.STAR, 0); } - public TerminalNode CARET() { return getToken(CSharpParser.CARET, 0); } - public Unary_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unary_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterUnary_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitUnary_expression(this); - } - } - - public final Unary_expressionContext unary_expression() throws RecognitionException { - Unary_expressionContext _localctx = new Unary_expressionContext(_ctx, getState()); - enterRule(_localctx, 68, RULE_unary_expression); - try { - setState(755); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,49,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(729); - primary_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(730); - match(PLUS); - setState(731); - unary_expression(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(732); - match(MINUS); - setState(733); - unary_expression(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(734); - match(BANG); - setState(735); - unary_expression(); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(736); - match(TILDE); - setState(737); - unary_expression(); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(738); - match(OP_INC); - setState(739); - unary_expression(); - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(740); - match(OP_DEC); - setState(741); - unary_expression(); - } - break; - case 8: - enterOuterAlt(_localctx, 8); - { - setState(742); - match(OPEN_PARENS); - setState(743); - type_(); - setState(744); - match(CLOSE_PARENS); - setState(745); - unary_expression(); - } - break; - case 9: - enterOuterAlt(_localctx, 9); - { - setState(747); - match(AWAIT); - setState(748); - unary_expression(); - } - break; - case 10: - enterOuterAlt(_localctx, 10); - { - setState(749); - match(AMP); - setState(750); - unary_expression(); - } - break; - case 11: - enterOuterAlt(_localctx, 11); - { - setState(751); - match(STAR); - setState(752); - unary_expression(); - } - break; - case 12: - enterOuterAlt(_localctx, 12); - { - setState(753); - match(CARET); - setState(754); - unary_expression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Primary_expressionContext extends ParserRuleContext { - public Primary_expression_startContext pe; - public Primary_expression_startContext primary_expression_start() { - return getRuleContext(Primary_expression_startContext.class,0); - } - public List BANG() { return getTokens(CSharpParser.BANG); } - public TerminalNode BANG(int i) { - return getToken(CSharpParser.BANG, i); - } - public List bracket_expression() { - return getRuleContexts(Bracket_expressionContext.class); - } - public Bracket_expressionContext bracket_expression(int i) { - return getRuleContext(Bracket_expressionContext.class,i); - } - public List member_access() { - return getRuleContexts(Member_accessContext.class); - } - public Member_accessContext member_access(int i) { - return getRuleContext(Member_accessContext.class,i); - } - public List method_invocation() { - return getRuleContexts(Method_invocationContext.class); - } - public Method_invocationContext method_invocation(int i) { - return getRuleContext(Method_invocationContext.class,i); - } - public List OP_INC() { return getTokens(CSharpParser.OP_INC); } - public TerminalNode OP_INC(int i) { - return getToken(CSharpParser.OP_INC, i); - } - public List OP_DEC() { return getTokens(CSharpParser.OP_DEC); } - public TerminalNode OP_DEC(int i) { - return getToken(CSharpParser.OP_DEC, i); - } - public List OP_PTR() { return getTokens(CSharpParser.OP_PTR); } - public TerminalNode OP_PTR(int i) { - return getToken(CSharpParser.OP_PTR, i); - } - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public Primary_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primary_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterPrimary_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitPrimary_expression(this); - } - } - - public final Primary_expressionContext primary_expression() throws RecognitionException { - Primary_expressionContext _localctx = new Primary_expressionContext(_ctx, getState()); - enterRule(_localctx, 70, RULE_primary_expression); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(757); - ((Primary_expressionContext)_localctx).pe = primary_expression_start(); - setState(759); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,50,_ctx) ) { - case 1: - { - setState(758); - match(BANG); - } - break; - } - setState(764); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,51,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(761); - bracket_expression(); - } - } - } - setState(766); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,51,_ctx); - } - setState(768); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,52,_ctx) ) { - case 1: - { - setState(767); - match(BANG); - } - break; - } - setState(792); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,57,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - { - setState(776); - _errHandler.sync(this); - switch (_input.LA(1)) { - case DOT: - case INTERR: - { - setState(770); - member_access(); - } - break; - case OPEN_PARENS: - { - setState(771); - method_invocation(); - } - break; - case OP_INC: - { - setState(772); - match(OP_INC); - } - break; - case OP_DEC: - { - setState(773); - match(OP_DEC); - } - break; - case OP_PTR: - { - setState(774); - match(OP_PTR); - setState(775); - identifier(); - } - break; - default: - throw new NoViableAltException(this); - } - setState(779); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,54,_ctx) ) { - case 1: - { - setState(778); - match(BANG); - } - break; - } - } - setState(784); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,55,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(781); - bracket_expression(); - } - } - } - setState(786); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,55,_ctx); - } - setState(788); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,56,_ctx) ) { - case 1: - { - setState(787); - match(BANG); - } - break; - } - } - } - } - setState(794); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,57,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Primary_expression_startContext extends ParserRuleContext { - public Primary_expression_startContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primary_expression_start; } - - public Primary_expression_startContext() { } - public void copyFrom(Primary_expression_startContext ctx) { - super.copyFrom(ctx); - } - } - public static class LiteralAccessExpressionContext extends Primary_expression_startContext { - public TerminalNode LITERAL_ACCESS() { return getToken(CSharpParser.LITERAL_ACCESS, 0); } - public LiteralAccessExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLiteralAccessExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLiteralAccessExpression(this); - } - } - public static class DefaultValueExpressionContext extends Primary_expression_startContext { - public TerminalNode DEFAULT() { return getToken(CSharpParser.DEFAULT, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public DefaultValueExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterDefaultValueExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitDefaultValueExpression(this); - } - } - public static class BaseAccessExpressionContext extends Primary_expression_startContext { - public TerminalNode BASE() { return getToken(CSharpParser.BASE, 0); } - public TerminalNode DOT() { return getToken(CSharpParser.DOT, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode OPEN_BRACKET() { return getToken(CSharpParser.OPEN_BRACKET, 0); } - public Expression_listContext expression_list() { - return getRuleContext(Expression_listContext.class,0); - } - public TerminalNode CLOSE_BRACKET() { return getToken(CSharpParser.CLOSE_BRACKET, 0); } - public Type_argument_listContext type_argument_list() { - return getRuleContext(Type_argument_listContext.class,0); - } - public BaseAccessExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterBaseAccessExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitBaseAccessExpression(this); - } - } - public static class SizeofExpressionContext extends Primary_expression_startContext { - public TerminalNode SIZEOF() { return getToken(CSharpParser.SIZEOF, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public SizeofExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSizeofExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSizeofExpression(this); - } - } - public static class ParenthesisExpressionsContext extends Primary_expression_startContext { - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public ParenthesisExpressionsContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterParenthesisExpressions(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitParenthesisExpressions(this); - } - } - public static class ThisReferenceExpressionContext extends Primary_expression_startContext { - public TerminalNode THIS() { return getToken(CSharpParser.THIS, 0); } - public ThisReferenceExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterThisReferenceExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitThisReferenceExpression(this); - } - } - public static class ObjectCreationExpressionContext extends Primary_expression_startContext { - public TerminalNode NEW() { return getToken(CSharpParser.NEW, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public Anonymous_object_initializerContext anonymous_object_initializer() { - return getRuleContext(Anonymous_object_initializerContext.class,0); - } - public List rank_specifier() { - return getRuleContexts(Rank_specifierContext.class); - } - public Rank_specifierContext rank_specifier(int i) { - return getRuleContext(Rank_specifierContext.class,i); - } - public Array_initializerContext array_initializer() { - return getRuleContext(Array_initializerContext.class,0); - } - public Object_creation_expressionContext object_creation_expression() { - return getRuleContext(Object_creation_expressionContext.class,0); - } - public Object_or_collection_initializerContext object_or_collection_initializer() { - return getRuleContext(Object_or_collection_initializerContext.class,0); - } - public TerminalNode OPEN_BRACKET() { return getToken(CSharpParser.OPEN_BRACKET, 0); } - public Expression_listContext expression_list() { - return getRuleContext(Expression_listContext.class,0); - } - public TerminalNode CLOSE_BRACKET() { return getToken(CSharpParser.CLOSE_BRACKET, 0); } - public ObjectCreationExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterObjectCreationExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitObjectCreationExpression(this); - } - } - public static class AnonymousMethodExpressionContext extends Primary_expression_startContext { - public TerminalNode DELEGATE() { return getToken(CSharpParser.DELEGATE, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public TerminalNode ASYNC() { return getToken(CSharpParser.ASYNC, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Explicit_anonymous_function_parameter_listContext explicit_anonymous_function_parameter_list() { - return getRuleContext(Explicit_anonymous_function_parameter_listContext.class,0); - } - public AnonymousMethodExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAnonymousMethodExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAnonymousMethodExpression(this); - } - } - public static class TypeofExpressionContext extends Primary_expression_startContext { - public TerminalNode TYPEOF() { return getToken(CSharpParser.TYPEOF, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Unbound_type_nameContext unbound_type_name() { - return getRuleContext(Unbound_type_nameContext.class,0); - } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public TerminalNode VOID() { return getToken(CSharpParser.VOID, 0); } - public TypeofExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterTypeofExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitTypeofExpression(this); - } - } - public static class TupleExpressionContext extends Primary_expression_startContext { - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public List argument() { - return getRuleContexts(ArgumentContext.class); - } - public ArgumentContext argument(int i) { - return getRuleContext(ArgumentContext.class,i); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public TupleExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterTupleExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitTupleExpression(this); - } - } - public static class UncheckedExpressionContext extends Primary_expression_startContext { - public TerminalNode UNCHECKED() { return getToken(CSharpParser.UNCHECKED, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public UncheckedExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterUncheckedExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitUncheckedExpression(this); - } - } - public static class SimpleNameExpressionContext extends Primary_expression_startContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Type_argument_listContext type_argument_list() { - return getRuleContext(Type_argument_listContext.class,0); - } - public SimpleNameExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSimpleNameExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSimpleNameExpression(this); - } - } - public static class MemberAccessExpressionContext extends Primary_expression_startContext { - public Predefined_typeContext predefined_type() { - return getRuleContext(Predefined_typeContext.class,0); - } - public Qualified_alias_memberContext qualified_alias_member() { - return getRuleContext(Qualified_alias_memberContext.class,0); - } - public MemberAccessExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMemberAccessExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMemberAccessExpression(this); - } - } - public static class CheckedExpressionContext extends Primary_expression_startContext { - public TerminalNode CHECKED() { return getToken(CSharpParser.CHECKED, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public CheckedExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterCheckedExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitCheckedExpression(this); - } - } - public static class LiteralExpressionContext extends Primary_expression_startContext { - public LiteralContext literal() { - return getRuleContext(LiteralContext.class,0); - } - public LiteralExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLiteralExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLiteralExpression(this); - } - } - public static class NameofExpressionContext extends Primary_expression_startContext { - public TerminalNode NAMEOF() { return getToken(CSharpParser.NAMEOF, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public List DOT() { return getTokens(CSharpParser.DOT); } - public TerminalNode DOT(int i) { - return getToken(CSharpParser.DOT, i); - } - public NameofExpressionContext(Primary_expression_startContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterNameofExpression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitNameofExpression(this); - } - } - - public final Primary_expression_startContext primary_expression_start() throws RecognitionException { - Primary_expression_startContext _localctx = new Primary_expression_startContext(_ctx, getState()); - enterRule(_localctx, 72, RULE_primary_expression_start); - int _la; - try { - int _alt; - setState(916); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,73,_ctx) ) { - case 1: - _localctx = new LiteralExpressionContext(_localctx); - enterOuterAlt(_localctx, 1); - { - setState(795); - literal(); - } - break; - case 2: - _localctx = new SimpleNameExpressionContext(_localctx); - enterOuterAlt(_localctx, 2); - { - setState(796); - identifier(); - setState(798); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,58,_ctx) ) { - case 1: - { - setState(797); - type_argument_list(); - } - break; - } - } - break; - case 3: - _localctx = new ParenthesisExpressionsContext(_localctx); - enterOuterAlt(_localctx, 3); - { - setState(800); - match(OPEN_PARENS); - setState(801); - expression(); - setState(802); - match(CLOSE_PARENS); - } - break; - case 4: - _localctx = new MemberAccessExpressionContext(_localctx); - enterOuterAlt(_localctx, 4); - { - setState(804); - predefined_type(); - } - break; - case 5: - _localctx = new MemberAccessExpressionContext(_localctx); - enterOuterAlt(_localctx, 5); - { - setState(805); - qualified_alias_member(); - } - break; - case 6: - _localctx = new LiteralAccessExpressionContext(_localctx); - enterOuterAlt(_localctx, 6); - { - setState(806); - match(LITERAL_ACCESS); - } - break; - case 7: - _localctx = new ThisReferenceExpressionContext(_localctx); - enterOuterAlt(_localctx, 7); - { - setState(807); - match(THIS); - } - break; - case 8: - _localctx = new BaseAccessExpressionContext(_localctx); - enterOuterAlt(_localctx, 8); - { - setState(808); - match(BASE); - setState(818); - _errHandler.sync(this); - switch (_input.LA(1)) { - case DOT: - { - setState(809); - match(DOT); - setState(810); - identifier(); - setState(812); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,59,_ctx) ) { - case 1: - { - setState(811); - type_argument_list(); - } - break; - } - } - break; - case OPEN_BRACKET: - { - setState(814); - match(OPEN_BRACKET); - setState(815); - expression_list(); - setState(816); - match(CLOSE_BRACKET); - } - break; - default: - throw new NoViableAltException(this); - } - } - break; - case 9: - _localctx = new ObjectCreationExpressionContext(_localctx); - enterOuterAlt(_localctx, 9); - { - setState(820); - match(NEW); - setState(849); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BOOL: - case BY: - case BYTE: - case CHAR: - case DECIMAL: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case STRING: - case UINT: - case ULONG: - case UNMANAGED: - case USHORT: - case VAR: - case VOID: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case OPEN_PARENS: - { - setState(821); - type_(); - setState(843); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,64,_ctx) ) { - case 1: - { - setState(822); - object_creation_expression(); - } - break; - case 2: - { - setState(823); - object_or_collection_initializer(); - } - break; - case 3: - { - setState(824); - match(OPEN_BRACKET); - setState(825); - expression_list(); - setState(826); - match(CLOSE_BRACKET); - setState(830); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,61,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(827); - rank_specifier(); - } - } - } - setState(832); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,61,_ctx); - } - setState(834); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACE) { - { - setState(833); - array_initializer(); - } - } - - } - break; - case 4: - { - setState(837); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(836); - rank_specifier(); - } - } - setState(839); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( _la==OPEN_BRACKET ); - setState(841); - array_initializer(); - } - break; - } - } - break; - case OPEN_BRACE: - { - setState(845); - anonymous_object_initializer(); - } - break; - case OPEN_BRACKET: - { - setState(846); - rank_specifier(); - setState(847); - array_initializer(); - } - break; - default: - throw new NoViableAltException(this); - } - } - break; - case 10: - _localctx = new TupleExpressionContext(_localctx); - enterOuterAlt(_localctx, 10); - { - setState(851); - match(OPEN_PARENS); - setState(852); - argument(); - setState(855); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(853); - match(COMMA); - setState(854); - argument(); - } - } - setState(857); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( _la==COMMA ); - setState(859); - match(CLOSE_PARENS); - } - break; - case 11: - _localctx = new TypeofExpressionContext(_localctx); - enterOuterAlt(_localctx, 11); - { - setState(861); - match(TYPEOF); - setState(862); - match(OPEN_PARENS); - setState(866); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,67,_ctx) ) { - case 1: - { - setState(863); - unbound_type_name(); - } - break; - case 2: - { - setState(864); - type_(); - } - break; - case 3: - { - setState(865); - match(VOID); - } - break; - } - setState(868); - match(CLOSE_PARENS); - } - break; - case 12: - _localctx = new CheckedExpressionContext(_localctx); - enterOuterAlt(_localctx, 12); - { - setState(869); - match(CHECKED); - setState(870); - match(OPEN_PARENS); - setState(871); - expression(); - setState(872); - match(CLOSE_PARENS); - } - break; - case 13: - _localctx = new UncheckedExpressionContext(_localctx); - enterOuterAlt(_localctx, 13); - { - setState(874); - match(UNCHECKED); - setState(875); - match(OPEN_PARENS); - setState(876); - expression(); - setState(877); - match(CLOSE_PARENS); - } - break; - case 14: - _localctx = new DefaultValueExpressionContext(_localctx); - enterOuterAlt(_localctx, 14); - { - setState(879); - match(DEFAULT); - setState(884); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,68,_ctx) ) { - case 1: - { - setState(880); - match(OPEN_PARENS); - setState(881); - type_(); - setState(882); - match(CLOSE_PARENS); - } - break; - } - } - break; - case 15: - _localctx = new AnonymousMethodExpressionContext(_localctx); - enterOuterAlt(_localctx, 15); - { - setState(887); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ASYNC) { - { - setState(886); - match(ASYNC); - } - } - - setState(889); - match(DELEGATE); - setState(895); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_PARENS) { - { - setState(890); - match(OPEN_PARENS); - setState(892); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 10)) & ~0x3f) == 0 && ((1L << (_la - 10)) & ((1L << (ADD - 10)) | (1L << (ALIAS - 10)) | (1L << (ARGLIST - 10)) | (1L << (ASCENDING - 10)) | (1L << (ASYNC - 10)) | (1L << (AWAIT - 10)) | (1L << (BOOL - 10)) | (1L << (BY - 10)) | (1L << (BYTE - 10)) | (1L << (CHAR - 10)) | (1L << (DECIMAL - 10)) | (1L << (DESCENDING - 10)) | (1L << (DOUBLE - 10)) | (1L << (DYNAMIC - 10)) | (1L << (EQUALS - 10)) | (1L << (FLOAT - 10)) | (1L << (FROM - 10)) | (1L << (GET - 10)) | (1L << (GROUP - 10)) | (1L << (IN - 10)) | (1L << (INT - 10)) | (1L << (INTO - 10)) | (1L << (JOIN - 10)) | (1L << (LET - 10)) | (1L << (LONG - 10)) | (1L << (NAMEOF - 10)) | (1L << (OBJECT - 10)) | (1L << (ON - 10)) | (1L << (ORDERBY - 10)) | (1L << (OUT - 10)))) != 0) || ((((_la - 75)) & ~0x3f) == 0 && ((1L << (_la - 75)) & ((1L << (PARTIAL - 75)) | (1L << (REF - 75)) | (1L << (REMOVE - 75)) | (1L << (SBYTE - 75)) | (1L << (SELECT - 75)) | (1L << (SET - 75)) | (1L << (SHORT - 75)) | (1L << (STRING - 75)) | (1L << (UINT - 75)) | (1L << (ULONG - 75)) | (1L << (UNMANAGED - 75)) | (1L << (USHORT - 75)) | (1L << (VAR - 75)) | (1L << (VOID - 75)) | (1L << (WHEN - 75)) | (1L << (WHERE - 75)) | (1L << (YIELD - 75)) | (1L << (IDENTIFIER - 75)) | (1L << (OPEN_PARENS - 75)))) != 0)) { - { - setState(891); - explicit_anonymous_function_parameter_list(); - } - } - - setState(894); - match(CLOSE_PARENS); - } - } - - setState(897); - block(); - } - break; - case 16: - _localctx = new SizeofExpressionContext(_localctx); - enterOuterAlt(_localctx, 16); - { - setState(898); - match(SIZEOF); - setState(899); - match(OPEN_PARENS); - setState(900); - type_(); - setState(901); - match(CLOSE_PARENS); - } - break; - case 17: - _localctx = new NameofExpressionContext(_localctx); - enterOuterAlt(_localctx, 17); - { - setState(903); - match(NAMEOF); - setState(904); - match(OPEN_PARENS); - setState(910); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,72,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(905); - identifier(); - setState(906); - match(DOT); - } - } - } - setState(912); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,72,_ctx); - } - setState(913); - identifier(); - setState(914); - match(CLOSE_PARENS); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Throwable_expressionContext extends ParserRuleContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Throw_expressionContext throw_expression() { - return getRuleContext(Throw_expressionContext.class,0); - } - public Throwable_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_throwable_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterThrowable_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitThrowable_expression(this); - } - } - - public final Throwable_expressionContext throwable_expression() throws RecognitionException { - Throwable_expressionContext _localctx = new Throwable_expressionContext(_ctx, getState()); - enterRule(_localctx, 74, RULE_throwable_expression); - try { - setState(920); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REF: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case THIS: - case TRUE: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case USHORT: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - enterOuterAlt(_localctx, 1); - { - setState(918); - expression(); - } - break; - case THROW: - enterOuterAlt(_localctx, 2); - { - setState(919); - throw_expression(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Throw_expressionContext extends ParserRuleContext { - public TerminalNode THROW() { return getToken(CSharpParser.THROW, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Throw_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_throw_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterThrow_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitThrow_expression(this); - } - } - - public final Throw_expressionContext throw_expression() throws RecognitionException { - Throw_expressionContext _localctx = new Throw_expressionContext(_ctx, getState()); - enterRule(_localctx, 76, RULE_throw_expression); - try { - enterOuterAlt(_localctx, 1); - { - setState(922); - match(THROW); - setState(923); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Member_accessContext extends ParserRuleContext { - public TerminalNode DOT() { return getToken(CSharpParser.DOT, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode INTERR() { return getToken(CSharpParser.INTERR, 0); } - public Type_argument_listContext type_argument_list() { - return getRuleContext(Type_argument_listContext.class,0); - } - public Member_accessContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_member_access; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMember_access(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMember_access(this); - } - } - - public final Member_accessContext member_access() throws RecognitionException { - Member_accessContext _localctx = new Member_accessContext(_ctx, getState()); - enterRule(_localctx, 78, RULE_member_access); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(926); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==INTERR) { - { - setState(925); - match(INTERR); - } - } - - setState(928); - match(DOT); - setState(929); - identifier(); - setState(931); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,76,_ctx) ) { - case 1: - { - setState(930); - type_argument_list(); - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Bracket_expressionContext extends ParserRuleContext { - public TerminalNode OPEN_BRACKET() { return getToken(CSharpParser.OPEN_BRACKET, 0); } - public List indexer_argument() { - return getRuleContexts(Indexer_argumentContext.class); - } - public Indexer_argumentContext indexer_argument(int i) { - return getRuleContext(Indexer_argumentContext.class,i); - } - public TerminalNode CLOSE_BRACKET() { return getToken(CSharpParser.CLOSE_BRACKET, 0); } - public TerminalNode INTERR() { return getToken(CSharpParser.INTERR, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Bracket_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_bracket_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterBracket_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitBracket_expression(this); - } - } - - public final Bracket_expressionContext bracket_expression() throws RecognitionException { - Bracket_expressionContext _localctx = new Bracket_expressionContext(_ctx, getState()); - enterRule(_localctx, 80, RULE_bracket_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(934); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==INTERR) { - { - setState(933); - match(INTERR); - } - } - - setState(936); - match(OPEN_BRACKET); - setState(937); - indexer_argument(); - setState(942); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(938); - match(COMMA); - setState(939); - indexer_argument(); - } - } - setState(944); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(945); - match(CLOSE_BRACKET); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Indexer_argumentContext extends ParserRuleContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public Indexer_argumentContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_indexer_argument; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterIndexer_argument(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitIndexer_argument(this); - } - } - - public final Indexer_argumentContext indexer_argument() throws RecognitionException { - Indexer_argumentContext _localctx = new Indexer_argumentContext(_ctx, getState()); - enterRule(_localctx, 82, RULE_indexer_argument); - try { - enterOuterAlt(_localctx, 1); - { - setState(950); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,79,_ctx) ) { - case 1: - { - setState(947); - identifier(); - setState(948); - match(COLON); - } - break; - } - setState(952); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Predefined_typeContext extends ParserRuleContext { - public TerminalNode BOOL() { return getToken(CSharpParser.BOOL, 0); } - public TerminalNode BYTE() { return getToken(CSharpParser.BYTE, 0); } - public TerminalNode CHAR() { return getToken(CSharpParser.CHAR, 0); } - public TerminalNode DECIMAL() { return getToken(CSharpParser.DECIMAL, 0); } - public TerminalNode DOUBLE() { return getToken(CSharpParser.DOUBLE, 0); } - public TerminalNode FLOAT() { return getToken(CSharpParser.FLOAT, 0); } - public TerminalNode INT() { return getToken(CSharpParser.INT, 0); } - public TerminalNode LONG() { return getToken(CSharpParser.LONG, 0); } - public TerminalNode OBJECT() { return getToken(CSharpParser.OBJECT, 0); } - public TerminalNode SBYTE() { return getToken(CSharpParser.SBYTE, 0); } - public TerminalNode SHORT() { return getToken(CSharpParser.SHORT, 0); } - public TerminalNode STRING() { return getToken(CSharpParser.STRING, 0); } - public TerminalNode UINT() { return getToken(CSharpParser.UINT, 0); } - public TerminalNode ULONG() { return getToken(CSharpParser.ULONG, 0); } - public TerminalNode USHORT() { return getToken(CSharpParser.USHORT, 0); } - public Predefined_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_predefined_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterPredefined_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitPredefined_type(this); - } - } - - public final Predefined_typeContext predefined_type() throws RecognitionException { - Predefined_typeContext _localctx = new Predefined_typeContext(_ctx, getState()); - enterRule(_localctx, 84, RULE_predefined_type); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(954); - _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << BOOL) | (1L << BYTE) | (1L << CHAR) | (1L << DECIMAL) | (1L << DOUBLE) | (1L << FLOAT) | (1L << INT) | (1L << LONG))) != 0) || ((((_la - 68)) & ~0x3f) == 0 && ((1L << (_la - 68)) & ((1L << (OBJECT - 68)) | (1L << (SBYTE - 68)) | (1L << (SHORT - 68)) | (1L << (STRING - 68)) | (1L << (UINT - 68)) | (1L << (ULONG - 68)) | (1L << (USHORT - 68)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Expression_listContext extends ParserRuleContext { - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Expression_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_expression_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterExpression_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitExpression_list(this); - } - } - - public final Expression_listContext expression_list() throws RecognitionException { - Expression_listContext _localctx = new Expression_listContext(_ctx, getState()); - enterRule(_localctx, 86, RULE_expression_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(956); - expression(); - setState(961); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(957); - match(COMMA); - setState(958); - expression(); - } - } - setState(963); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Object_or_collection_initializerContext extends ParserRuleContext { - public Object_initializerContext object_initializer() { - return getRuleContext(Object_initializerContext.class,0); - } - public Collection_initializerContext collection_initializer() { - return getRuleContext(Collection_initializerContext.class,0); - } - public Object_or_collection_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_object_or_collection_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterObject_or_collection_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitObject_or_collection_initializer(this); - } - } - - public final Object_or_collection_initializerContext object_or_collection_initializer() throws RecognitionException { - Object_or_collection_initializerContext _localctx = new Object_or_collection_initializerContext(_ctx, getState()); - enterRule(_localctx, 88, RULE_object_or_collection_initializer); - try { - setState(966); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,81,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(964); - object_initializer(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(965); - collection_initializer(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Object_initializerContext extends ParserRuleContext { - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public Member_initializer_listContext member_initializer_list() { - return getRuleContext(Member_initializer_listContext.class,0); - } - public TerminalNode COMMA() { return getToken(CSharpParser.COMMA, 0); } - public Object_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_object_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterObject_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitObject_initializer(this); - } - } - - public final Object_initializerContext object_initializer() throws RecognitionException { - Object_initializerContext _localctx = new Object_initializerContext(_ctx, getState()); - enterRule(_localctx, 90, RULE_object_initializer); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(968); - match(OPEN_BRACE); - setState(973); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BY) | (1L << DESCENDING) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INTO) | (1L << JOIN) | (1L << LET))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REMOVE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (UNMANAGED - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (OPEN_BRACKET - 64)))) != 0)) { - { - setState(969); - member_initializer_list(); - setState(971); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(970); - match(COMMA); - } - } - - } - } - - setState(975); - match(CLOSE_BRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Member_initializer_listContext extends ParserRuleContext { - public List member_initializer() { - return getRuleContexts(Member_initializerContext.class); - } - public Member_initializerContext member_initializer(int i) { - return getRuleContext(Member_initializerContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Member_initializer_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_member_initializer_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMember_initializer_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMember_initializer_list(this); - } - } - - public final Member_initializer_listContext member_initializer_list() throws RecognitionException { - Member_initializer_listContext _localctx = new Member_initializer_listContext(_ctx, getState()); - enterRule(_localctx, 92, RULE_member_initializer_list); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(977); - member_initializer(); - setState(982); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,84,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(978); - match(COMMA); - setState(979); - member_initializer(); - } - } - } - setState(984); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,84,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Member_initializerContext extends ParserRuleContext { - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public Initializer_valueContext initializer_value() { - return getRuleContext(Initializer_valueContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode OPEN_BRACKET() { return getToken(CSharpParser.OPEN_BRACKET, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_BRACKET() { return getToken(CSharpParser.CLOSE_BRACKET, 0); } - public Member_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_member_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMember_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMember_initializer(this); - } - } - - public final Member_initializerContext member_initializer() throws RecognitionException { - Member_initializerContext _localctx = new Member_initializerContext(_ctx, getState()); - enterRule(_localctx, 94, RULE_member_initializer); - try { - enterOuterAlt(_localctx, 1); - { - setState(990); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BY: - case DESCENDING: - case DYNAMIC: - case EQUALS: - case FROM: - case GET: - case GROUP: - case INTO: - case JOIN: - case LET: - case NAMEOF: - case ON: - case ORDERBY: - case PARTIAL: - case REMOVE: - case SELECT: - case SET: - case UNMANAGED: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - { - setState(985); - identifier(); - } - break; - case OPEN_BRACKET: - { - setState(986); - match(OPEN_BRACKET); - setState(987); - expression(); - setState(988); - match(CLOSE_BRACKET); - } - break; - default: - throw new NoViableAltException(this); - } - setState(992); - match(ASSIGNMENT); - setState(993); - initializer_value(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Initializer_valueContext extends ParserRuleContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Object_or_collection_initializerContext object_or_collection_initializer() { - return getRuleContext(Object_or_collection_initializerContext.class,0); - } - public Initializer_valueContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_initializer_value; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInitializer_value(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInitializer_value(this); - } - } - - public final Initializer_valueContext initializer_value() throws RecognitionException { - Initializer_valueContext _localctx = new Initializer_valueContext(_ctx, getState()); - enterRule(_localctx, 96, RULE_initializer_value); - try { - setState(997); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REF: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case THIS: - case TRUE: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case USHORT: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - enterOuterAlt(_localctx, 1); - { - setState(995); - expression(); - } - break; - case OPEN_BRACE: - enterOuterAlt(_localctx, 2); - { - setState(996); - object_or_collection_initializer(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Collection_initializerContext extends ParserRuleContext { - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public List element_initializer() { - return getRuleContexts(Element_initializerContext.class); - } - public Element_initializerContext element_initializer(int i) { - return getRuleContext(Element_initializerContext.class,i); - } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Collection_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_collection_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterCollection_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitCollection_initializer(this); - } - } - - public final Collection_initializerContext collection_initializer() throws RecognitionException { - Collection_initializerContext _localctx = new Collection_initializerContext(_ctx, getState()); - enterRule(_localctx, 98, RULE_collection_initializer); - int _la; - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(999); - match(OPEN_BRACE); - setState(1000); - element_initializer(); - setState(1005); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,87,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1001); - match(COMMA); - setState(1002); - element_initializer(); - } - } - } - setState(1007); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,87,_ctx); - } - setState(1009); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(1008); - match(COMMA); - } - } - - setState(1011); - match(CLOSE_BRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Element_initializerContext extends ParserRuleContext { - public Non_assignment_expressionContext non_assignment_expression() { - return getRuleContext(Non_assignment_expressionContext.class,0); - } - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public Expression_listContext expression_list() { - return getRuleContext(Expression_listContext.class,0); - } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public Element_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_element_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterElement_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitElement_initializer(this); - } - } - - public final Element_initializerContext element_initializer() throws RecognitionException { - Element_initializerContext _localctx = new Element_initializerContext(_ctx, getState()); - enterRule(_localctx, 100, RULE_element_initializer); - try { - setState(1018); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case THIS: - case TRUE: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case USHORT: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - enterOuterAlt(_localctx, 1); - { - setState(1013); - non_assignment_expression(); - } - break; - case OPEN_BRACE: - enterOuterAlt(_localctx, 2); - { - setState(1014); - match(OPEN_BRACE); - setState(1015); - expression_list(); - setState(1016); - match(CLOSE_BRACE); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Anonymous_object_initializerContext extends ParserRuleContext { - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public Member_declarator_listContext member_declarator_list() { - return getRuleContext(Member_declarator_listContext.class,0); - } - public TerminalNode COMMA() { return getToken(CSharpParser.COMMA, 0); } - public Anonymous_object_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_anonymous_object_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAnonymous_object_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAnonymous_object_initializer(this); - } - } - - public final Anonymous_object_initializerContext anonymous_object_initializer() throws RecognitionException { - Anonymous_object_initializerContext _localctx = new Anonymous_object_initializerContext(_ctx, getState()); - enterRule(_localctx, 102, RULE_anonymous_object_initializer); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1020); - match(OPEN_BRACE); - setState(1025); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 10)) & ~0x3f) == 0 && ((1L << (_la - 10)) & ((1L << (ADD - 10)) | (1L << (ALIAS - 10)) | (1L << (ARGLIST - 10)) | (1L << (ASCENDING - 10)) | (1L << (ASYNC - 10)) | (1L << (AWAIT - 10)) | (1L << (BASE - 10)) | (1L << (BOOL - 10)) | (1L << (BY - 10)) | (1L << (BYTE - 10)) | (1L << (CHAR - 10)) | (1L << (CHECKED - 10)) | (1L << (DECIMAL - 10)) | (1L << (DEFAULT - 10)) | (1L << (DELEGATE - 10)) | (1L << (DESCENDING - 10)) | (1L << (DOUBLE - 10)) | (1L << (DYNAMIC - 10)) | (1L << (EQUALS - 10)) | (1L << (FALSE - 10)) | (1L << (FLOAT - 10)) | (1L << (FROM - 10)) | (1L << (GET - 10)) | (1L << (GROUP - 10)) | (1L << (INT - 10)) | (1L << (INTO - 10)) | (1L << (JOIN - 10)) | (1L << (LET - 10)) | (1L << (LONG - 10)) | (1L << (NAMEOF - 10)) | (1L << (NEW - 10)) | (1L << (NULL_ - 10)) | (1L << (OBJECT - 10)) | (1L << (ON - 10)) | (1L << (ORDERBY - 10)))) != 0) || ((((_la - 75)) & ~0x3f) == 0 && ((1L << (_la - 75)) & ((1L << (PARTIAL - 75)) | (1L << (REMOVE - 75)) | (1L << (SBYTE - 75)) | (1L << (SELECT - 75)) | (1L << (SET - 75)) | (1L << (SHORT - 75)) | (1L << (SIZEOF - 75)) | (1L << (STRING - 75)) | (1L << (THIS - 75)) | (1L << (TRUE - 75)) | (1L << (TYPEOF - 75)) | (1L << (UINT - 75)) | (1L << (ULONG - 75)) | (1L << (UNCHECKED - 75)) | (1L << (UNMANAGED - 75)) | (1L << (USHORT - 75)) | (1L << (VAR - 75)) | (1L << (WHEN - 75)) | (1L << (WHERE - 75)) | (1L << (YIELD - 75)) | (1L << (IDENTIFIER - 75)) | (1L << (LITERAL_ACCESS - 75)) | (1L << (INTEGER_LITERAL - 75)) | (1L << (HEX_INTEGER_LITERAL - 75)) | (1L << (BIN_INTEGER_LITERAL - 75)) | (1L << (REAL_LITERAL - 75)) | (1L << (CHARACTER_LITERAL - 75)) | (1L << (REGULAR_STRING - 75)) | (1L << (VERBATIUM_STRING - 75)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 75)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 75)) | (1L << (OPEN_PARENS - 75)))) != 0)) { - { - setState(1021); - member_declarator_list(); - setState(1023); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(1022); - match(COMMA); - } - } - - } - } - - setState(1027); - match(CLOSE_BRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Member_declarator_listContext extends ParserRuleContext { - public List member_declarator() { - return getRuleContexts(Member_declaratorContext.class); - } - public Member_declaratorContext member_declarator(int i) { - return getRuleContext(Member_declaratorContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Member_declarator_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_member_declarator_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMember_declarator_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMember_declarator_list(this); - } - } - - public final Member_declarator_listContext member_declarator_list() throws RecognitionException { - Member_declarator_listContext _localctx = new Member_declarator_listContext(_ctx, getState()); - enterRule(_localctx, 104, RULE_member_declarator_list); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1029); - member_declarator(); - setState(1034); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,92,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1030); - match(COMMA); - setState(1031); - member_declarator(); - } - } - } - setState(1036); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,92,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Member_declaratorContext extends ParserRuleContext { - public Primary_expressionContext primary_expression() { - return getRuleContext(Primary_expressionContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Member_declaratorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_member_declarator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMember_declarator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMember_declarator(this); - } - } - - public final Member_declaratorContext member_declarator() throws RecognitionException { - Member_declaratorContext _localctx = new Member_declaratorContext(_ctx, getState()); - enterRule(_localctx, 106, RULE_member_declarator); - try { - setState(1042); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,93,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1037); - primary_expression(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1038); - identifier(); - setState(1039); - match(ASSIGNMENT); - setState(1040); - expression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Unbound_type_nameContext extends ParserRuleContext { - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public TerminalNode DOUBLE_COLON() { return getToken(CSharpParser.DOUBLE_COLON, 0); } - public List DOT() { return getTokens(CSharpParser.DOT); } - public TerminalNode DOT(int i) { - return getToken(CSharpParser.DOT, i); - } - public List generic_dimension_specifier() { - return getRuleContexts(Generic_dimension_specifierContext.class); - } - public Generic_dimension_specifierContext generic_dimension_specifier(int i) { - return getRuleContext(Generic_dimension_specifierContext.class,i); - } - public Unbound_type_nameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_unbound_type_name; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterUnbound_type_name(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitUnbound_type_name(this); - } - } - - public final Unbound_type_nameContext unbound_type_name() throws RecognitionException { - Unbound_type_nameContext _localctx = new Unbound_type_nameContext(_ctx, getState()); - enterRule(_localctx, 108, RULE_unbound_type_name); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1044); - identifier(); - setState(1053); - _errHandler.sync(this); - switch (_input.LA(1)) { - case CLOSE_PARENS: - case DOT: - case LT: - { - setState(1046); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(1045); - generic_dimension_specifier(); - } - } - - } - break; - case DOUBLE_COLON: - { - setState(1048); - match(DOUBLE_COLON); - setState(1049); - identifier(); - setState(1051); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(1050); - generic_dimension_specifier(); - } - } - - } - break; - default: - throw new NoViableAltException(this); - } - setState(1062); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==DOT) { - { - { - setState(1055); - match(DOT); - setState(1056); - identifier(); - setState(1058); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(1057); - generic_dimension_specifier(); - } - } - - } - } - setState(1064); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Generic_dimension_specifierContext extends ParserRuleContext { - public TerminalNode LT() { return getToken(CSharpParser.LT, 0); } - public TerminalNode GT() { return getToken(CSharpParser.GT, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Generic_dimension_specifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_generic_dimension_specifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterGeneric_dimension_specifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitGeneric_dimension_specifier(this); - } - } - - public final Generic_dimension_specifierContext generic_dimension_specifier() throws RecognitionException { - Generic_dimension_specifierContext _localctx = new Generic_dimension_specifierContext(_ctx, getState()); - enterRule(_localctx, 110, RULE_generic_dimension_specifier); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1065); - match(LT); - setState(1069); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1066); - match(COMMA); - } - } - setState(1071); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1072); - match(GT); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class IsTypeContext extends ParserRuleContext { - public Base_typeContext base_type() { - return getRuleContext(Base_typeContext.class,0); - } - public List rank_specifier() { - return getRuleContexts(Rank_specifierContext.class); - } - public Rank_specifierContext rank_specifier(int i) { - return getRuleContext(Rank_specifierContext.class,i); - } - public List STAR() { return getTokens(CSharpParser.STAR); } - public TerminalNode STAR(int i) { - return getToken(CSharpParser.STAR, i); - } - public TerminalNode INTERR() { return getToken(CSharpParser.INTERR, 0); } - public IsTypePatternArmsContext isTypePatternArms() { - return getRuleContext(IsTypePatternArmsContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public IsTypeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_isType; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterIsType(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitIsType(this); - } - } - - public final IsTypeContext isType() throws RecognitionException { - IsTypeContext _localctx = new IsTypeContext(_ctx, getState()); - enterRule(_localctx, 112, RULE_isType); - int _la; - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1074); - base_type(); - setState(1079); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,101,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - setState(1077); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACKET: - { - setState(1075); - rank_specifier(); - } - break; - case STAR: - { - setState(1076); - match(STAR); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - setState(1081); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,101,_ctx); - } - setState(1083); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,102,_ctx) ) { - case 1: - { - setState(1082); - match(INTERR); - } - break; - } - setState(1086); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACE) { - { - setState(1085); - isTypePatternArms(); - } - } - - setState(1089); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,104,_ctx) ) { - case 1: - { - setState(1088); - identifier(); - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class IsTypePatternArmsContext extends ParserRuleContext { - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public List isTypePatternArm() { - return getRuleContexts(IsTypePatternArmContext.class); - } - public IsTypePatternArmContext isTypePatternArm(int i) { - return getRuleContext(IsTypePatternArmContext.class,i); - } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public IsTypePatternArmsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_isTypePatternArms; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterIsTypePatternArms(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitIsTypePatternArms(this); - } - } - - public final IsTypePatternArmsContext isTypePatternArms() throws RecognitionException { - IsTypePatternArmsContext _localctx = new IsTypePatternArmsContext(_ctx, getState()); - enterRule(_localctx, 114, RULE_isTypePatternArms); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1091); - match(OPEN_BRACE); - setState(1092); - isTypePatternArm(); - setState(1097); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1093); - match(COMMA); - setState(1094); - isTypePatternArm(); - } - } - setState(1099); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1100); - match(CLOSE_BRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class IsTypePatternArmContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public IsTypePatternArmContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_isTypePatternArm; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterIsTypePatternArm(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitIsTypePatternArm(this); - } - } - - public final IsTypePatternArmContext isTypePatternArm() throws RecognitionException { - IsTypePatternArmContext _localctx = new IsTypePatternArmContext(_ctx, getState()); - enterRule(_localctx, 116, RULE_isTypePatternArm); - try { - enterOuterAlt(_localctx, 1); - { - setState(1102); - identifier(); - setState(1103); - match(COLON); - setState(1104); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Lambda_expressionContext extends ParserRuleContext { - public Anonymous_function_signatureContext anonymous_function_signature() { - return getRuleContext(Anonymous_function_signatureContext.class,0); - } - public Right_arrowContext right_arrow() { - return getRuleContext(Right_arrowContext.class,0); - } - public Anonymous_function_bodyContext anonymous_function_body() { - return getRuleContext(Anonymous_function_bodyContext.class,0); - } - public TerminalNode ASYNC() { return getToken(CSharpParser.ASYNC, 0); } - public Lambda_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_lambda_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLambda_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLambda_expression(this); - } - } - - public final Lambda_expressionContext lambda_expression() throws RecognitionException { - Lambda_expressionContext _localctx = new Lambda_expressionContext(_ctx, getState()); - enterRule(_localctx, 118, RULE_lambda_expression); - try { - enterOuterAlt(_localctx, 1); - { - setState(1107); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,106,_ctx) ) { - case 1: - { - setState(1106); - match(ASYNC); - } - break; - } - setState(1109); - anonymous_function_signature(); - setState(1110); - right_arrow(); - setState(1111); - anonymous_function_body(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Anonymous_function_signatureContext extends ParserRuleContext { - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Explicit_anonymous_function_parameter_listContext explicit_anonymous_function_parameter_list() { - return getRuleContext(Explicit_anonymous_function_parameter_listContext.class,0); - } - public Implicit_anonymous_function_parameter_listContext implicit_anonymous_function_parameter_list() { - return getRuleContext(Implicit_anonymous_function_parameter_listContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Anonymous_function_signatureContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_anonymous_function_signature; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAnonymous_function_signature(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAnonymous_function_signature(this); - } - } - - public final Anonymous_function_signatureContext anonymous_function_signature() throws RecognitionException { - Anonymous_function_signatureContext _localctx = new Anonymous_function_signatureContext(_ctx, getState()); - enterRule(_localctx, 120, RULE_anonymous_function_signature); - try { - setState(1124); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,107,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1113); - match(OPEN_PARENS); - setState(1114); - match(CLOSE_PARENS); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1115); - match(OPEN_PARENS); - setState(1116); - explicit_anonymous_function_parameter_list(); - setState(1117); - match(CLOSE_PARENS); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1119); - match(OPEN_PARENS); - setState(1120); - implicit_anonymous_function_parameter_list(); - setState(1121); - match(CLOSE_PARENS); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1123); - identifier(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Explicit_anonymous_function_parameter_listContext extends ParserRuleContext { - public List explicit_anonymous_function_parameter() { - return getRuleContexts(Explicit_anonymous_function_parameterContext.class); - } - public Explicit_anonymous_function_parameterContext explicit_anonymous_function_parameter(int i) { - return getRuleContext(Explicit_anonymous_function_parameterContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Explicit_anonymous_function_parameter_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_explicit_anonymous_function_parameter_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterExplicit_anonymous_function_parameter_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitExplicit_anonymous_function_parameter_list(this); - } - } - - public final Explicit_anonymous_function_parameter_listContext explicit_anonymous_function_parameter_list() throws RecognitionException { - Explicit_anonymous_function_parameter_listContext _localctx = new Explicit_anonymous_function_parameter_listContext(_ctx, getState()); - enterRule(_localctx, 122, RULE_explicit_anonymous_function_parameter_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1126); - explicit_anonymous_function_parameter(); - setState(1131); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1127); - match(COMMA); - setState(1128); - explicit_anonymous_function_parameter(); - } - } - setState(1133); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Explicit_anonymous_function_parameterContext extends ParserRuleContext { - public Token refout; - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode REF() { return getToken(CSharpParser.REF, 0); } - public TerminalNode OUT() { return getToken(CSharpParser.OUT, 0); } - public TerminalNode IN() { return getToken(CSharpParser.IN, 0); } - public Explicit_anonymous_function_parameterContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_explicit_anonymous_function_parameter; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterExplicit_anonymous_function_parameter(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitExplicit_anonymous_function_parameter(this); - } - } - - public final Explicit_anonymous_function_parameterContext explicit_anonymous_function_parameter() throws RecognitionException { - Explicit_anonymous_function_parameterContext _localctx = new Explicit_anonymous_function_parameterContext(_ctx, getState()); - enterRule(_localctx, 124, RULE_explicit_anonymous_function_parameter); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1135); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 54)) & ~0x3f) == 0 && ((1L << (_la - 54)) & ((1L << (IN - 54)) | (1L << (OUT - 54)) | (1L << (REF - 54)))) != 0)) { - { - setState(1134); - ((Explicit_anonymous_function_parameterContext)_localctx).refout = _input.LT(1); - _la = _input.LA(1); - if ( !(((((_la - 54)) & ~0x3f) == 0 && ((1L << (_la - 54)) & ((1L << (IN - 54)) | (1L << (OUT - 54)) | (1L << (REF - 54)))) != 0)) ) { - ((Explicit_anonymous_function_parameterContext)_localctx).refout = (Token)_errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - - setState(1137); - type_(); - setState(1138); - identifier(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Implicit_anonymous_function_parameter_listContext extends ParserRuleContext { - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Implicit_anonymous_function_parameter_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_implicit_anonymous_function_parameter_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterImplicit_anonymous_function_parameter_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitImplicit_anonymous_function_parameter_list(this); - } - } - - public final Implicit_anonymous_function_parameter_listContext implicit_anonymous_function_parameter_list() throws RecognitionException { - Implicit_anonymous_function_parameter_listContext _localctx = new Implicit_anonymous_function_parameter_listContext(_ctx, getState()); - enterRule(_localctx, 126, RULE_implicit_anonymous_function_parameter_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1140); - identifier(); - setState(1145); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1141); - match(COMMA); - setState(1142); - identifier(); - } - } - setState(1147); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Anonymous_function_bodyContext extends ParserRuleContext { - public Throwable_expressionContext throwable_expression() { - return getRuleContext(Throwable_expressionContext.class,0); - } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public Anonymous_function_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_anonymous_function_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAnonymous_function_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAnonymous_function_body(this); - } - } - - public final Anonymous_function_bodyContext anonymous_function_body() throws RecognitionException { - Anonymous_function_bodyContext _localctx = new Anonymous_function_bodyContext(_ctx, getState()); - enterRule(_localctx, 128, RULE_anonymous_function_body); - try { - setState(1150); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REF: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case THIS: - case THROW: - case TRUE: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case USHORT: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - enterOuterAlt(_localctx, 1); - { - setState(1148); - throwable_expression(); - } - break; - case OPEN_BRACE: - enterOuterAlt(_localctx, 2); - { - setState(1149); - block(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Query_expressionContext extends ParserRuleContext { - public From_clauseContext from_clause() { - return getRuleContext(From_clauseContext.class,0); - } - public Query_bodyContext query_body() { - return getRuleContext(Query_bodyContext.class,0); - } - public Query_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_query_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterQuery_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitQuery_expression(this); - } - } - - public final Query_expressionContext query_expression() throws RecognitionException { - Query_expressionContext _localctx = new Query_expressionContext(_ctx, getState()); - enterRule(_localctx, 130, RULE_query_expression); - try { - enterOuterAlt(_localctx, 1); - { - setState(1152); - from_clause(); - setState(1153); - query_body(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class From_clauseContext extends ParserRuleContext { - public TerminalNode FROM() { return getToken(CSharpParser.FROM, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode IN() { return getToken(CSharpParser.IN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public From_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_from_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFrom_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFrom_clause(this); - } - } - - public final From_clauseContext from_clause() throws RecognitionException { - From_clauseContext _localctx = new From_clauseContext(_ctx, getState()); - enterRule(_localctx, 132, RULE_from_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1155); - match(FROM); - setState(1157); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,112,_ctx) ) { - case 1: - { - setState(1156); - type_(); - } - break; - } - setState(1159); - identifier(); - setState(1160); - match(IN); - setState(1161); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Query_bodyContext extends ParserRuleContext { - public Select_or_group_clauseContext select_or_group_clause() { - return getRuleContext(Select_or_group_clauseContext.class,0); - } - public List query_body_clause() { - return getRuleContexts(Query_body_clauseContext.class); - } - public Query_body_clauseContext query_body_clause(int i) { - return getRuleContext(Query_body_clauseContext.class,i); - } - public Query_continuationContext query_continuation() { - return getRuleContext(Query_continuationContext.class,0); - } - public Query_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_query_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterQuery_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitQuery_body(this); - } - } - - public final Query_bodyContext query_body() throws RecognitionException { - Query_bodyContext _localctx = new Query_bodyContext(_ctx, getState()); - enterRule(_localctx, 134, RULE_query_body); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1166); - _errHandler.sync(this); - _la = _input.LA(1); - while (((((_la - 48)) & ~0x3f) == 0 && ((1L << (_la - 48)) & ((1L << (FROM - 48)) | (1L << (JOIN - 48)) | (1L << (LET - 48)) | (1L << (ORDERBY - 48)) | (1L << (WHERE - 48)))) != 0)) { - { - { - setState(1163); - query_body_clause(); - } - } - setState(1168); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1169); - select_or_group_clause(); - setState(1171); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,114,_ctx) ) { - case 1: - { - setState(1170); - query_continuation(); - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Query_body_clauseContext extends ParserRuleContext { - public From_clauseContext from_clause() { - return getRuleContext(From_clauseContext.class,0); - } - public Let_clauseContext let_clause() { - return getRuleContext(Let_clauseContext.class,0); - } - public Where_clauseContext where_clause() { - return getRuleContext(Where_clauseContext.class,0); - } - public Combined_join_clauseContext combined_join_clause() { - return getRuleContext(Combined_join_clauseContext.class,0); - } - public Orderby_clauseContext orderby_clause() { - return getRuleContext(Orderby_clauseContext.class,0); - } - public Query_body_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_query_body_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterQuery_body_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitQuery_body_clause(this); - } - } - - public final Query_body_clauseContext query_body_clause() throws RecognitionException { - Query_body_clauseContext _localctx = new Query_body_clauseContext(_ctx, getState()); - enterRule(_localctx, 136, RULE_query_body_clause); - try { - setState(1178); - _errHandler.sync(this); - switch (_input.LA(1)) { - case FROM: - enterOuterAlt(_localctx, 1); - { - setState(1173); - from_clause(); - } - break; - case LET: - enterOuterAlt(_localctx, 2); - { - setState(1174); - let_clause(); - } - break; - case WHERE: - enterOuterAlt(_localctx, 3); - { - setState(1175); - where_clause(); - } - break; - case JOIN: - enterOuterAlt(_localctx, 4); - { - setState(1176); - combined_join_clause(); - } - break; - case ORDERBY: - enterOuterAlt(_localctx, 5); - { - setState(1177); - orderby_clause(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Let_clauseContext extends ParserRuleContext { - public TerminalNode LET() { return getToken(CSharpParser.LET, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Let_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_let_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLet_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLet_clause(this); - } - } - - public final Let_clauseContext let_clause() throws RecognitionException { - Let_clauseContext _localctx = new Let_clauseContext(_ctx, getState()); - enterRule(_localctx, 138, RULE_let_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1180); - match(LET); - setState(1181); - identifier(); - setState(1182); - match(ASSIGNMENT); - setState(1183); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Where_clauseContext extends ParserRuleContext { - public TerminalNode WHERE() { return getToken(CSharpParser.WHERE, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Where_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_where_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterWhere_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitWhere_clause(this); - } - } - - public final Where_clauseContext where_clause() throws RecognitionException { - Where_clauseContext _localctx = new Where_clauseContext(_ctx, getState()); - enterRule(_localctx, 140, RULE_where_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1185); - match(WHERE); - setState(1186); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Combined_join_clauseContext extends ParserRuleContext { - public TerminalNode JOIN() { return getToken(CSharpParser.JOIN, 0); } - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public TerminalNode IN() { return getToken(CSharpParser.IN, 0); } - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public TerminalNode ON() { return getToken(CSharpParser.ON, 0); } - public TerminalNode EQUALS() { return getToken(CSharpParser.EQUALS, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public TerminalNode INTO() { return getToken(CSharpParser.INTO, 0); } - public Combined_join_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_combined_join_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterCombined_join_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitCombined_join_clause(this); - } - } - - public final Combined_join_clauseContext combined_join_clause() throws RecognitionException { - Combined_join_clauseContext _localctx = new Combined_join_clauseContext(_ctx, getState()); - enterRule(_localctx, 142, RULE_combined_join_clause); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1188); - match(JOIN); - setState(1190); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,116,_ctx) ) { - case 1: - { - setState(1189); - type_(); - } - break; - } - setState(1192); - identifier(); - setState(1193); - match(IN); - setState(1194); - expression(); - setState(1195); - match(ON); - setState(1196); - expression(); - setState(1197); - match(EQUALS); - setState(1198); - expression(); - setState(1201); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==INTO) { - { - setState(1199); - match(INTO); - setState(1200); - identifier(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Orderby_clauseContext extends ParserRuleContext { - public TerminalNode ORDERBY() { return getToken(CSharpParser.ORDERBY, 0); } - public List ordering() { - return getRuleContexts(OrderingContext.class); - } - public OrderingContext ordering(int i) { - return getRuleContext(OrderingContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Orderby_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_orderby_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterOrderby_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitOrderby_clause(this); - } - } - - public final Orderby_clauseContext orderby_clause() throws RecognitionException { - Orderby_clauseContext _localctx = new Orderby_clauseContext(_ctx, getState()); - enterRule(_localctx, 144, RULE_orderby_clause); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1203); - match(ORDERBY); - setState(1204); - ordering(); - setState(1209); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1205); - match(COMMA); - setState(1206); - ordering(); - } - } - setState(1211); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class OrderingContext extends ParserRuleContext { - public Token dir; - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode ASCENDING() { return getToken(CSharpParser.ASCENDING, 0); } - public TerminalNode DESCENDING() { return getToken(CSharpParser.DESCENDING, 0); } - public OrderingContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_ordering; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterOrdering(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitOrdering(this); - } - } - - public final OrderingContext ordering() throws RecognitionException { - OrderingContext _localctx = new OrderingContext(_ctx, getState()); - enterRule(_localctx, 146, RULE_ordering); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1212); - expression(); - setState(1214); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ASCENDING || _la==DESCENDING) { - { - setState(1213); - ((OrderingContext)_localctx).dir = _input.LT(1); - _la = _input.LA(1); - if ( !(_la==ASCENDING || _la==DESCENDING) ) { - ((OrderingContext)_localctx).dir = (Token)_errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Select_or_group_clauseContext extends ParserRuleContext { - public TerminalNode SELECT() { return getToken(CSharpParser.SELECT, 0); } - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public TerminalNode GROUP() { return getToken(CSharpParser.GROUP, 0); } - public TerminalNode BY() { return getToken(CSharpParser.BY, 0); } - public Select_or_group_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_select_or_group_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSelect_or_group_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSelect_or_group_clause(this); - } - } - - public final Select_or_group_clauseContext select_or_group_clause() throws RecognitionException { - Select_or_group_clauseContext _localctx = new Select_or_group_clauseContext(_ctx, getState()); - enterRule(_localctx, 148, RULE_select_or_group_clause); - try { - setState(1223); - _errHandler.sync(this); - switch (_input.LA(1)) { - case SELECT: - enterOuterAlt(_localctx, 1); - { - setState(1216); - match(SELECT); - setState(1217); - expression(); - } - break; - case GROUP: - enterOuterAlt(_localctx, 2); - { - setState(1218); - match(GROUP); - setState(1219); - expression(); - setState(1220); - match(BY); - setState(1221); - expression(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Query_continuationContext extends ParserRuleContext { - public TerminalNode INTO() { return getToken(CSharpParser.INTO, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Query_bodyContext query_body() { - return getRuleContext(Query_bodyContext.class,0); - } - public Query_continuationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_query_continuation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterQuery_continuation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitQuery_continuation(this); - } - } - - public final Query_continuationContext query_continuation() throws RecognitionException { - Query_continuationContext _localctx = new Query_continuationContext(_ctx, getState()); - enterRule(_localctx, 150, RULE_query_continuation); - try { - enterOuterAlt(_localctx, 1); - { - setState(1225); - match(INTO); - setState(1226); - identifier(); - setState(1227); - query_body(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class StatementContext extends ParserRuleContext { - public Labeled_StatementContext labeled_Statement() { - return getRuleContext(Labeled_StatementContext.class,0); - } - public DeclarationStatementContext declarationStatement() { - return getRuleContext(DeclarationStatementContext.class,0); - } - public Embedded_statementContext embedded_statement() { - return getRuleContext(Embedded_statementContext.class,0); - } - public StatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitStatement(this); - } - } - - public final StatementContext statement() throws RecognitionException { - StatementContext _localctx = new StatementContext(_ctx, getState()); - enterRule(_localctx, 152, RULE_statement); - try { - setState(1232); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,121,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1229); - labeled_Statement(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1230); - declarationStatement(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1231); - embedded_statement(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class DeclarationStatementContext extends ParserRuleContext { - public Local_variable_declarationContext local_variable_declaration() { - return getRuleContext(Local_variable_declarationContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Local_constant_declarationContext local_constant_declaration() { - return getRuleContext(Local_constant_declarationContext.class,0); - } - public Local_function_declarationContext local_function_declaration() { - return getRuleContext(Local_function_declarationContext.class,0); - } - public DeclarationStatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_declarationStatement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterDeclarationStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitDeclarationStatement(this); - } - } - - public final DeclarationStatementContext declarationStatement() throws RecognitionException { - DeclarationStatementContext _localctx = new DeclarationStatementContext(_ctx, getState()); - enterRule(_localctx, 154, RULE_declarationStatement); - try { - setState(1241); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,122,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1234); - local_variable_declaration(); - setState(1235); - match(SEMICOLON); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1237); - local_constant_declaration(); - setState(1238); - match(SEMICOLON); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1240); - local_function_declaration(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Local_function_declarationContext extends ParserRuleContext { - public Local_function_headerContext local_function_header() { - return getRuleContext(Local_function_headerContext.class,0); - } - public Local_function_bodyContext local_function_body() { - return getRuleContext(Local_function_bodyContext.class,0); - } - public Local_function_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_local_function_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLocal_function_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLocal_function_declaration(this); - } - } - - public final Local_function_declarationContext local_function_declaration() throws RecognitionException { - Local_function_declarationContext _localctx = new Local_function_declarationContext(_ctx, getState()); - enterRule(_localctx, 156, RULE_local_function_declaration); - try { - enterOuterAlt(_localctx, 1); - { - setState(1243); - local_function_header(); - setState(1244); - local_function_body(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Local_function_headerContext extends ParserRuleContext { - public Return_typeContext return_type() { - return getRuleContext(Return_typeContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Local_function_modifiersContext local_function_modifiers() { - return getRuleContext(Local_function_modifiersContext.class,0); - } - public Type_parameter_listContext type_parameter_list() { - return getRuleContext(Type_parameter_listContext.class,0); - } - public Formal_parameter_listContext formal_parameter_list() { - return getRuleContext(Formal_parameter_listContext.class,0); - } - public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { - return getRuleContext(Type_parameter_constraints_clausesContext.class,0); - } - public Local_function_headerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_local_function_header; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLocal_function_header(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLocal_function_header(this); - } - } - - public final Local_function_headerContext local_function_header() throws RecognitionException { - Local_function_headerContext _localctx = new Local_function_headerContext(_ctx, getState()); - enterRule(_localctx, 158, RULE_local_function_header); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1247); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,123,_ctx) ) { - case 1: - { - setState(1246); - local_function_modifiers(); - } - break; - } - setState(1249); - return_type(); - setState(1250); - identifier(); - setState(1252); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(1251); - type_parameter_list(); - } - } - - setState(1254); - match(OPEN_PARENS); - setState(1256); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 10)) & ~0x3f) == 0 && ((1L << (_la - 10)) & ((1L << (ADD - 10)) | (1L << (ALIAS - 10)) | (1L << (ARGLIST - 10)) | (1L << (ASCENDING - 10)) | (1L << (ASYNC - 10)) | (1L << (AWAIT - 10)) | (1L << (BOOL - 10)) | (1L << (BY - 10)) | (1L << (BYTE - 10)) | (1L << (CHAR - 10)) | (1L << (DECIMAL - 10)) | (1L << (DESCENDING - 10)) | (1L << (DOUBLE - 10)) | (1L << (DYNAMIC - 10)) | (1L << (EQUALS - 10)) | (1L << (FLOAT - 10)) | (1L << (FROM - 10)) | (1L << (GET - 10)) | (1L << (GROUP - 10)) | (1L << (IN - 10)) | (1L << (INT - 10)) | (1L << (INTO - 10)) | (1L << (JOIN - 10)) | (1L << (LET - 10)) | (1L << (LONG - 10)) | (1L << (NAMEOF - 10)) | (1L << (OBJECT - 10)) | (1L << (ON - 10)) | (1L << (ORDERBY - 10)) | (1L << (OUT - 10)))) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & ((1L << (PARAMS - 74)) | (1L << (PARTIAL - 74)) | (1L << (REF - 74)) | (1L << (REMOVE - 74)) | (1L << (SBYTE - 74)) | (1L << (SELECT - 74)) | (1L << (SET - 74)) | (1L << (SHORT - 74)) | (1L << (STRING - 74)) | (1L << (THIS - 74)) | (1L << (UINT - 74)) | (1L << (ULONG - 74)) | (1L << (UNMANAGED - 74)) | (1L << (USHORT - 74)) | (1L << (VAR - 74)) | (1L << (VOID - 74)) | (1L << (WHEN - 74)) | (1L << (WHERE - 74)) | (1L << (YIELD - 74)) | (1L << (IDENTIFIER - 74)) | (1L << (OPEN_BRACKET - 74)) | (1L << (OPEN_PARENS - 74)))) != 0)) { - { - setState(1255); - formal_parameter_list(); - } - } - - setState(1258); - match(CLOSE_PARENS); - setState(1260); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHERE) { - { - setState(1259); - type_parameter_constraints_clauses(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Local_function_modifiersContext extends ParserRuleContext { - public TerminalNode ASYNC() { return getToken(CSharpParser.ASYNC, 0); } - public TerminalNode UNSAFE() { return getToken(CSharpParser.UNSAFE, 0); } - public TerminalNode STATIC() { return getToken(CSharpParser.STATIC, 0); } - public Local_function_modifiersContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_local_function_modifiers; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLocal_function_modifiers(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLocal_function_modifiers(this); - } - } - - public final Local_function_modifiersContext local_function_modifiers() throws RecognitionException { - Local_function_modifiersContext _localctx = new Local_function_modifiersContext(_ctx, getState()); - enterRule(_localctx, 160, RULE_local_function_modifiers); - int _la; - try { - setState(1268); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ASYNC: - case UNSAFE: - enterOuterAlt(_localctx, 1); - { - setState(1262); - _la = _input.LA(1); - if ( !(_la==ASYNC || _la==UNSAFE) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(1264); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==STATIC) { - { - setState(1263); - match(STATIC); - } - } - - } - break; - case STATIC: - enterOuterAlt(_localctx, 2); - { - setState(1266); - match(STATIC); - setState(1267); - _la = _input.LA(1); - if ( !(_la==ASYNC || _la==UNSAFE) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Local_function_bodyContext extends ParserRuleContext { - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public Right_arrowContext right_arrow() { - return getRuleContext(Right_arrowContext.class,0); - } - public Throwable_expressionContext throwable_expression() { - return getRuleContext(Throwable_expressionContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Local_function_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_local_function_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLocal_function_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLocal_function_body(this); - } - } - - public final Local_function_bodyContext local_function_body() throws RecognitionException { - Local_function_bodyContext _localctx = new Local_function_bodyContext(_ctx, getState()); - enterRule(_localctx, 162, RULE_local_function_body); - try { - setState(1275); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACE: - enterOuterAlt(_localctx, 1); - { - setState(1270); - block(); - } - break; - case ASSIGNMENT: - enterOuterAlt(_localctx, 2); - { - setState(1271); - right_arrow(); - setState(1272); - throwable_expression(); - setState(1273); - match(SEMICOLON); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Labeled_StatementContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public StatementContext statement() { - return getRuleContext(StatementContext.class,0); - } - public Labeled_StatementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_labeled_Statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLabeled_Statement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLabeled_Statement(this); - } - } - - public final Labeled_StatementContext labeled_Statement() throws RecognitionException { - Labeled_StatementContext _localctx = new Labeled_StatementContext(_ctx, getState()); - enterRule(_localctx, 164, RULE_labeled_Statement); - try { - enterOuterAlt(_localctx, 1); - { - setState(1277); - identifier(); - setState(1278); - match(COLON); - setState(1279); - statement(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Embedded_statementContext extends ParserRuleContext { - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public Simple_embedded_statementContext simple_embedded_statement() { - return getRuleContext(Simple_embedded_statementContext.class,0); - } - public Embedded_statementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_embedded_statement; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterEmbedded_statement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitEmbedded_statement(this); - } - } - - public final Embedded_statementContext embedded_statement() throws RecognitionException { - Embedded_statementContext _localctx = new Embedded_statementContext(_ctx, getState()); - enterRule(_localctx, 166, RULE_embedded_statement); - try { - setState(1283); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACE: - enterOuterAlt(_localctx, 1); - { - setState(1281); - block(); - } - break; - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BREAK: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case CONTINUE: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DO: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FIXED: - case FLOAT: - case FOR: - case FOREACH: - case FROM: - case GET: - case GOTO: - case GROUP: - case IF: - case INT: - case INTO: - case JOIN: - case LET: - case LOCK: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REF: - case REMOVE: - case RETURN: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case SWITCH: - case THIS: - case THROW: - case TRUE: - case TRY: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case UNSAFE: - case USHORT: - case USING: - case VAR: - case WHEN: - case WHERE: - case WHILE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case SEMICOLON: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - enterOuterAlt(_localctx, 2); - { - setState(1282); - simple_embedded_statement(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Simple_embedded_statementContext extends ParserRuleContext { - public Simple_embedded_statementContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_simple_embedded_statement; } - - public Simple_embedded_statementContext() { } - public void copyFrom(Simple_embedded_statementContext ctx) { - super.copyFrom(ctx); - } - } - public static class TryStatementContext extends Simple_embedded_statementContext { - public TerminalNode TRY() { return getToken(CSharpParser.TRY, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public Catch_clausesContext catch_clauses() { - return getRuleContext(Catch_clausesContext.class,0); - } - public Finally_clauseContext finally_clause() { - return getRuleContext(Finally_clauseContext.class,0); - } - public TryStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterTryStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitTryStatement(this); - } - } - public static class CheckedStatementContext extends Simple_embedded_statementContext { - public TerminalNode CHECKED() { return getToken(CSharpParser.CHECKED, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public CheckedStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterCheckedStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitCheckedStatement(this); - } - } - public static class ThrowStatementContext extends Simple_embedded_statementContext { - public TerminalNode THROW() { return getToken(CSharpParser.THROW, 0); } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public ThrowStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterThrowStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitThrowStatement(this); - } - } - public static class TheEmptyStatementContext extends Simple_embedded_statementContext { - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public TheEmptyStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterTheEmptyStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitTheEmptyStatement(this); - } - } - public static class UnsafeStatementContext extends Simple_embedded_statementContext { - public TerminalNode UNSAFE() { return getToken(CSharpParser.UNSAFE, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public UnsafeStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterUnsafeStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitUnsafeStatement(this); - } - } - public static class ForStatementContext extends Simple_embedded_statementContext { - public TerminalNode FOR() { return getToken(CSharpParser.FOR, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public List SEMICOLON() { return getTokens(CSharpParser.SEMICOLON); } - public TerminalNode SEMICOLON(int i) { - return getToken(CSharpParser.SEMICOLON, i); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Embedded_statementContext embedded_statement() { - return getRuleContext(Embedded_statementContext.class,0); - } - public For_initializerContext for_initializer() { - return getRuleContext(For_initializerContext.class,0); - } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public For_iteratorContext for_iterator() { - return getRuleContext(For_iteratorContext.class,0); - } - public ForStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterForStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitForStatement(this); - } - } - public static class BreakStatementContext extends Simple_embedded_statementContext { - public TerminalNode BREAK() { return getToken(CSharpParser.BREAK, 0); } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public BreakStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterBreakStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitBreakStatement(this); - } - } - public static class IfStatementContext extends Simple_embedded_statementContext { - public TerminalNode IF() { return getToken(CSharpParser.IF, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public List if_body() { - return getRuleContexts(If_bodyContext.class); - } - public If_bodyContext if_body(int i) { - return getRuleContext(If_bodyContext.class,i); - } - public TerminalNode ELSE() { return getToken(CSharpParser.ELSE, 0); } - public IfStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterIfStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitIfStatement(this); - } - } - public static class ReturnStatementContext extends Simple_embedded_statementContext { - public TerminalNode RETURN() { return getToken(CSharpParser.RETURN, 0); } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public ReturnStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterReturnStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitReturnStatement(this); - } - } - public static class GotoStatementContext extends Simple_embedded_statementContext { - public TerminalNode GOTO() { return getToken(CSharpParser.GOTO, 0); } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode CASE() { return getToken(CSharpParser.CASE, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode DEFAULT() { return getToken(CSharpParser.DEFAULT, 0); } - public GotoStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterGotoStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitGotoStatement(this); - } - } - public static class SwitchStatementContext extends Simple_embedded_statementContext { - public TerminalNode SWITCH() { return getToken(CSharpParser.SWITCH, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public List switch_section() { - return getRuleContexts(Switch_sectionContext.class); - } - public Switch_sectionContext switch_section(int i) { - return getRuleContext(Switch_sectionContext.class,i); - } - public SwitchStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSwitchStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSwitchStatement(this); - } - } - public static class FixedStatementContext extends Simple_embedded_statementContext { - public TerminalNode FIXED() { return getToken(CSharpParser.FIXED, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public Pointer_typeContext pointer_type() { - return getRuleContext(Pointer_typeContext.class,0); - } - public Fixed_pointer_declaratorsContext fixed_pointer_declarators() { - return getRuleContext(Fixed_pointer_declaratorsContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Embedded_statementContext embedded_statement() { - return getRuleContext(Embedded_statementContext.class,0); - } - public FixedStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFixedStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFixedStatement(this); - } - } - public static class WhileStatementContext extends Simple_embedded_statementContext { - public TerminalNode WHILE() { return getToken(CSharpParser.WHILE, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Embedded_statementContext embedded_statement() { - return getRuleContext(Embedded_statementContext.class,0); - } - public WhileStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterWhileStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitWhileStatement(this); - } - } - public static class DoStatementContext extends Simple_embedded_statementContext { - public TerminalNode DO() { return getToken(CSharpParser.DO, 0); } - public Embedded_statementContext embedded_statement() { - return getRuleContext(Embedded_statementContext.class,0); - } - public TerminalNode WHILE() { return getToken(CSharpParser.WHILE, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public DoStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterDoStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitDoStatement(this); - } - } - public static class ForeachStatementContext extends Simple_embedded_statementContext { - public TerminalNode FOREACH() { return getToken(CSharpParser.FOREACH, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public Local_variable_typeContext local_variable_type() { - return getRuleContext(Local_variable_typeContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode IN() { return getToken(CSharpParser.IN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Embedded_statementContext embedded_statement() { - return getRuleContext(Embedded_statementContext.class,0); - } - public TerminalNode AWAIT() { return getToken(CSharpParser.AWAIT, 0); } - public ForeachStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterForeachStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitForeachStatement(this); - } - } - public static class UncheckedStatementContext extends Simple_embedded_statementContext { - public TerminalNode UNCHECKED() { return getToken(CSharpParser.UNCHECKED, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public UncheckedStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterUncheckedStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitUncheckedStatement(this); - } - } - public static class ExpressionStatementContext extends Simple_embedded_statementContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public ExpressionStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterExpressionStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitExpressionStatement(this); - } - } - public static class ContinueStatementContext extends Simple_embedded_statementContext { - public TerminalNode CONTINUE() { return getToken(CSharpParser.CONTINUE, 0); } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public ContinueStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterContinueStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitContinueStatement(this); - } - } - public static class UsingStatementContext extends Simple_embedded_statementContext { - public TerminalNode USING() { return getToken(CSharpParser.USING, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public Resource_acquisitionContext resource_acquisition() { - return getRuleContext(Resource_acquisitionContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Embedded_statementContext embedded_statement() { - return getRuleContext(Embedded_statementContext.class,0); - } - public UsingStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterUsingStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitUsingStatement(this); - } - } - public static class LockStatementContext extends Simple_embedded_statementContext { - public TerminalNode LOCK() { return getToken(CSharpParser.LOCK, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Embedded_statementContext embedded_statement() { - return getRuleContext(Embedded_statementContext.class,0); - } - public LockStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLockStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLockStatement(this); - } - } - public static class YieldStatementContext extends Simple_embedded_statementContext { - public TerminalNode YIELD() { return getToken(CSharpParser.YIELD, 0); } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public TerminalNode RETURN() { return getToken(CSharpParser.RETURN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode BREAK() { return getToken(CSharpParser.BREAK, 0); } - public YieldStatementContext(Simple_embedded_statementContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterYieldStatement(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitYieldStatement(this); - } - } - - public final Simple_embedded_statementContext simple_embedded_statement() throws RecognitionException { - Simple_embedded_statementContext _localctx = new Simple_embedded_statementContext(_ctx, getState()); - enterRule(_localctx, 168, RULE_simple_embedded_statement); - int _la; - try { - setState(1415); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,143,_ctx) ) { - case 1: - _localctx = new TheEmptyStatementContext(_localctx); - enterOuterAlt(_localctx, 1); - { - setState(1285); - match(SEMICOLON); - } - break; - case 2: - _localctx = new ExpressionStatementContext(_localctx); - enterOuterAlt(_localctx, 2); - { - setState(1286); - expression(); - setState(1287); - match(SEMICOLON); - } - break; - case 3: - _localctx = new IfStatementContext(_localctx); - enterOuterAlt(_localctx, 3); - { - setState(1289); - match(IF); - setState(1290); - match(OPEN_PARENS); - setState(1291); - expression(); - setState(1292); - match(CLOSE_PARENS); - setState(1293); - if_body(); - setState(1296); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,131,_ctx) ) { - case 1: - { - setState(1294); - match(ELSE); - setState(1295); - if_body(); - } - break; - } - } - break; - case 4: - _localctx = new SwitchStatementContext(_localctx); - enterOuterAlt(_localctx, 4); - { - setState(1298); - match(SWITCH); - setState(1299); - match(OPEN_PARENS); - setState(1300); - expression(); - setState(1301); - match(CLOSE_PARENS); - setState(1302); - match(OPEN_BRACE); - setState(1306); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==CASE || _la==DEFAULT) { - { - { - setState(1303); - switch_section(); - } - } - setState(1308); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1309); - match(CLOSE_BRACE); - } - break; - case 5: - _localctx = new WhileStatementContext(_localctx); - enterOuterAlt(_localctx, 5); - { - setState(1311); - match(WHILE); - setState(1312); - match(OPEN_PARENS); - setState(1313); - expression(); - setState(1314); - match(CLOSE_PARENS); - setState(1315); - embedded_statement(); - } - break; - case 6: - _localctx = new DoStatementContext(_localctx); - enterOuterAlt(_localctx, 6); - { - setState(1317); - match(DO); - setState(1318); - embedded_statement(); - setState(1319); - match(WHILE); - setState(1320); - match(OPEN_PARENS); - setState(1321); - expression(); - setState(1322); - match(CLOSE_PARENS); - setState(1323); - match(SEMICOLON); - } - break; - case 7: - _localctx = new ForStatementContext(_localctx); - enterOuterAlt(_localctx, 7); - { - setState(1325); - match(FOR); - setState(1326); - match(OPEN_PARENS); - setState(1328); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FIXED) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (USING - 64)) | (1L << (VAR - 64)) | (1L << (VOID - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(1327); - for_initializer(); - } - } - - setState(1330); - match(SEMICOLON); - setState(1332); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(1331); - expression(); - } - } - - setState(1334); - match(SEMICOLON); - setState(1336); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(1335); - for_iterator(); - } - } - - setState(1338); - match(CLOSE_PARENS); - setState(1339); - embedded_statement(); - } - break; - case 8: - _localctx = new ForeachStatementContext(_localctx); - enterOuterAlt(_localctx, 8); - { - setState(1341); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==AWAIT) { - { - setState(1340); - match(AWAIT); - } - } - - setState(1343); - match(FOREACH); - setState(1344); - match(OPEN_PARENS); - setState(1345); - local_variable_type(); - setState(1346); - identifier(); - setState(1347); - match(IN); - setState(1348); - expression(); - setState(1349); - match(CLOSE_PARENS); - setState(1350); - embedded_statement(); - } - break; - case 9: - _localctx = new BreakStatementContext(_localctx); - enterOuterAlt(_localctx, 9); - { - setState(1352); - match(BREAK); - setState(1353); - match(SEMICOLON); - } - break; - case 10: - _localctx = new ContinueStatementContext(_localctx); - enterOuterAlt(_localctx, 10); - { - setState(1354); - match(CONTINUE); - setState(1355); - match(SEMICOLON); - } - break; - case 11: - _localctx = new GotoStatementContext(_localctx); - enterOuterAlt(_localctx, 11); - { - setState(1356); - match(GOTO); - setState(1361); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BY: - case DESCENDING: - case DYNAMIC: - case EQUALS: - case FROM: - case GET: - case GROUP: - case INTO: - case JOIN: - case LET: - case NAMEOF: - case ON: - case ORDERBY: - case PARTIAL: - case REMOVE: - case SELECT: - case SET: - case UNMANAGED: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - { - setState(1357); - identifier(); - } - break; - case CASE: - { - setState(1358); - match(CASE); - setState(1359); - expression(); - } - break; - case DEFAULT: - { - setState(1360); - match(DEFAULT); - } - break; - default: - throw new NoViableAltException(this); - } - setState(1363); - match(SEMICOLON); - } - break; - case 12: - _localctx = new ReturnStatementContext(_localctx); - enterOuterAlt(_localctx, 12); - { - setState(1364); - match(RETURN); - setState(1366); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(1365); - expression(); - } - } - - setState(1368); - match(SEMICOLON); - } - break; - case 13: - _localctx = new ThrowStatementContext(_localctx); - enterOuterAlt(_localctx, 13); - { - setState(1369); - match(THROW); - setState(1371); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(1370); - expression(); - } - } - - setState(1373); - match(SEMICOLON); - } - break; - case 14: - _localctx = new TryStatementContext(_localctx); - enterOuterAlt(_localctx, 14); - { - setState(1374); - match(TRY); - setState(1375); - block(); - setState(1381); - _errHandler.sync(this); - switch (_input.LA(1)) { - case CATCH: - { - setState(1376); - catch_clauses(); - setState(1378); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==FINALLY) { - { - setState(1377); - finally_clause(); - } - } - - } - break; - case FINALLY: - { - setState(1380); - finally_clause(); - } - break; - default: - throw new NoViableAltException(this); - } - } - break; - case 15: - _localctx = new CheckedStatementContext(_localctx); - enterOuterAlt(_localctx, 15); - { - setState(1383); - match(CHECKED); - setState(1384); - block(); - } - break; - case 16: - _localctx = new UncheckedStatementContext(_localctx); - enterOuterAlt(_localctx, 16); - { - setState(1385); - match(UNCHECKED); - setState(1386); - block(); - } - break; - case 17: - _localctx = new LockStatementContext(_localctx); - enterOuterAlt(_localctx, 17); - { - setState(1387); - match(LOCK); - setState(1388); - match(OPEN_PARENS); - setState(1389); - expression(); - setState(1390); - match(CLOSE_PARENS); - setState(1391); - embedded_statement(); - } - break; - case 18: - _localctx = new UsingStatementContext(_localctx); - enterOuterAlt(_localctx, 18); - { - setState(1393); - match(USING); - setState(1394); - match(OPEN_PARENS); - setState(1395); - resource_acquisition(); - setState(1396); - match(CLOSE_PARENS); - setState(1397); - embedded_statement(); - } - break; - case 19: - _localctx = new YieldStatementContext(_localctx); - enterOuterAlt(_localctx, 19); - { - setState(1399); - match(YIELD); - setState(1403); - _errHandler.sync(this); - switch (_input.LA(1)) { - case RETURN: - { - setState(1400); - match(RETURN); - setState(1401); - expression(); - } - break; - case BREAK: - { - setState(1402); - match(BREAK); - } - break; - default: - throw new NoViableAltException(this); - } - setState(1405); - match(SEMICOLON); - } - break; - case 20: - _localctx = new UnsafeStatementContext(_localctx); - enterOuterAlt(_localctx, 20); - { - setState(1406); - match(UNSAFE); - setState(1407); - block(); - } - break; - case 21: - _localctx = new FixedStatementContext(_localctx); - enterOuterAlt(_localctx, 21); - { - setState(1408); - match(FIXED); - setState(1409); - match(OPEN_PARENS); - setState(1410); - pointer_type(); - setState(1411); - fixed_pointer_declarators(); - setState(1412); - match(CLOSE_PARENS); - setState(1413); - embedded_statement(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class BlockContext extends ParserRuleContext { - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public Statement_listContext statement_list() { - return getRuleContext(Statement_listContext.class,0); - } - public BlockContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_block; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterBlock(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitBlock(this); - } - } - - public final BlockContext block() throws RecognitionException { - BlockContext _localctx = new BlockContext(_ctx, getState()); - enterRule(_localctx, 170, RULE_block); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1417); - match(OPEN_BRACE); - setState(1419); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BREAK) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << CONST) | (1L << CONTINUE) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DO) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FIXED) | (1L << FLOAT) | (1L << FOR) | (1L << FOREACH) | (1L << FROM) | (1L << GET) | (1L << GOTO) | (1L << GROUP) | (1L << IF) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LOCK) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (RETURN - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STATIC - 64)) | (1L << (STRING - 64)) | (1L << (SWITCH - 64)) | (1L << (THIS - 64)) | (1L << (THROW - 64)) | (1L << (TRUE - 64)) | (1L << (TRY - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (UNSAFE - 64)) | (1L << (USHORT - 64)) | (1L << (USING - 64)) | (1L << (VAR - 64)) | (1L << (VOID - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (WHILE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)) | (1L << (OPEN_BRACE - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (SEMICOLON - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(1418); - statement_list(); - } - } - - setState(1421); - match(CLOSE_BRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Local_variable_declarationContext extends ParserRuleContext { - public Local_variable_typeContext local_variable_type() { - return getRuleContext(Local_variable_typeContext.class,0); - } - public List local_variable_declarator() { - return getRuleContexts(Local_variable_declaratorContext.class); - } - public Local_variable_declaratorContext local_variable_declarator(int i) { - return getRuleContext(Local_variable_declaratorContext.class,i); - } - public TerminalNode USING() { return getToken(CSharpParser.USING, 0); } - public TerminalNode REF() { return getToken(CSharpParser.REF, 0); } - public TerminalNode READONLY() { return getToken(CSharpParser.READONLY, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public TerminalNode FIXED() { return getToken(CSharpParser.FIXED, 0); } - public Pointer_typeContext pointer_type() { - return getRuleContext(Pointer_typeContext.class,0); - } - public Fixed_pointer_declaratorsContext fixed_pointer_declarators() { - return getRuleContext(Fixed_pointer_declaratorsContext.class,0); - } - public Local_variable_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_local_variable_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLocal_variable_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLocal_variable_declaration(this); - } - } - - public final Local_variable_declarationContext local_variable_declaration() throws RecognitionException { - Local_variable_declarationContext _localctx = new Local_variable_declarationContext(_ctx, getState()); - enterRule(_localctx, 172, RULE_local_variable_declaration); - int _la; - try { - setState(1442); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BOOL: - case BY: - case BYTE: - case CHAR: - case DECIMAL: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REF: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case STRING: - case UINT: - case ULONG: - case UNMANAGED: - case USHORT: - case USING: - case VAR: - case VOID: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case OPEN_PARENS: - enterOuterAlt(_localctx, 1); - { - setState(1427); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,145,_ctx) ) { - case 1: - { - setState(1423); - match(USING); - } - break; - case 2: - { - setState(1424); - match(REF); - } - break; - case 3: - { - setState(1425); - match(REF); - setState(1426); - match(READONLY); - } - break; - } - setState(1429); - local_variable_type(); - setState(1430); - local_variable_declarator(); - setState(1435); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1431); - match(COMMA); - setState(1432); - local_variable_declarator(); - } - } - setState(1437); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - break; - case FIXED: - enterOuterAlt(_localctx, 2); - { - setState(1438); - match(FIXED); - setState(1439); - pointer_type(); - setState(1440); - fixed_pointer_declarators(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Local_variable_typeContext extends ParserRuleContext { - public TerminalNode VAR() { return getToken(CSharpParser.VAR, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public Local_variable_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_local_variable_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLocal_variable_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLocal_variable_type(this); - } - } - - public final Local_variable_typeContext local_variable_type() throws RecognitionException { - Local_variable_typeContext _localctx = new Local_variable_typeContext(_ctx, getState()); - enterRule(_localctx, 174, RULE_local_variable_type); - try { - setState(1446); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,148,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1444); - match(VAR); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1445); - type_(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Local_variable_declaratorContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public Local_variable_initializerContext local_variable_initializer() { - return getRuleContext(Local_variable_initializerContext.class,0); - } - public TerminalNode REF() { return getToken(CSharpParser.REF, 0); } - public Local_variable_declaratorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_local_variable_declarator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLocal_variable_declarator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLocal_variable_declarator(this); - } - } - - public final Local_variable_declaratorContext local_variable_declarator() throws RecognitionException { - Local_variable_declaratorContext _localctx = new Local_variable_declaratorContext(_ctx, getState()); - enterRule(_localctx, 176, RULE_local_variable_declarator); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1448); - identifier(); - setState(1454); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ASSIGNMENT) { - { - setState(1449); - match(ASSIGNMENT); - setState(1451); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,149,_ctx) ) { - case 1: - { - setState(1450); - match(REF); - } - break; - } - setState(1453); - local_variable_initializer(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Local_variable_initializerContext extends ParserRuleContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Array_initializerContext array_initializer() { - return getRuleContext(Array_initializerContext.class,0); - } - public Stackalloc_initializerContext stackalloc_initializer() { - return getRuleContext(Stackalloc_initializerContext.class,0); - } - public Local_variable_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_local_variable_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLocal_variable_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLocal_variable_initializer(this); - } - } - - public final Local_variable_initializerContext local_variable_initializer() throws RecognitionException { - Local_variable_initializerContext _localctx = new Local_variable_initializerContext(_ctx, getState()); - enterRule(_localctx, 178, RULE_local_variable_initializer); - try { - setState(1459); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REF: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case THIS: - case TRUE: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case USHORT: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - enterOuterAlt(_localctx, 1); - { - setState(1456); - expression(); - } - break; - case OPEN_BRACE: - enterOuterAlt(_localctx, 2); - { - setState(1457); - array_initializer(); - } - break; - case STACKALLOC: - enterOuterAlt(_localctx, 3); - { - setState(1458); - stackalloc_initializer(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Local_constant_declarationContext extends ParserRuleContext { - public TerminalNode CONST() { return getToken(CSharpParser.CONST, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public Constant_declaratorsContext constant_declarators() { - return getRuleContext(Constant_declaratorsContext.class,0); - } - public Local_constant_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_local_constant_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLocal_constant_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLocal_constant_declaration(this); - } - } - - public final Local_constant_declarationContext local_constant_declaration() throws RecognitionException { - Local_constant_declarationContext _localctx = new Local_constant_declarationContext(_ctx, getState()); - enterRule(_localctx, 180, RULE_local_constant_declaration); - try { - enterOuterAlt(_localctx, 1); - { - setState(1461); - match(CONST); - setState(1462); - type_(); - setState(1463); - constant_declarators(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class If_bodyContext extends ParserRuleContext { - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public Simple_embedded_statementContext simple_embedded_statement() { - return getRuleContext(Simple_embedded_statementContext.class,0); - } - public If_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_if_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterIf_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitIf_body(this); - } - } - - public final If_bodyContext if_body() throws RecognitionException { - If_bodyContext _localctx = new If_bodyContext(_ctx, getState()); - enterRule(_localctx, 182, RULE_if_body); - try { - setState(1467); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACE: - enterOuterAlt(_localctx, 1); - { - setState(1465); - block(); - } - break; - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BREAK: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case CONTINUE: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DO: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FIXED: - case FLOAT: - case FOR: - case FOREACH: - case FROM: - case GET: - case GOTO: - case GROUP: - case IF: - case INT: - case INTO: - case JOIN: - case LET: - case LOCK: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REF: - case REMOVE: - case RETURN: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case SWITCH: - case THIS: - case THROW: - case TRUE: - case TRY: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case UNSAFE: - case USHORT: - case USING: - case VAR: - case WHEN: - case WHERE: - case WHILE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case SEMICOLON: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - enterOuterAlt(_localctx, 2); - { - setState(1466); - simple_embedded_statement(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Switch_sectionContext extends ParserRuleContext { - public Statement_listContext statement_list() { - return getRuleContext(Statement_listContext.class,0); - } - public List switch_label() { - return getRuleContexts(Switch_labelContext.class); - } - public Switch_labelContext switch_label(int i) { - return getRuleContext(Switch_labelContext.class,i); - } - public Switch_sectionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_switch_section; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSwitch_section(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSwitch_section(this); - } - } - - public final Switch_sectionContext switch_section() throws RecognitionException { - Switch_sectionContext _localctx = new Switch_sectionContext(_ctx, getState()); - enterRule(_localctx, 184, RULE_switch_section); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1470); - _errHandler.sync(this); - _alt = 1; - do { - switch (_alt) { - case 1: - { - { - setState(1469); - switch_label(); - } - } - break; - default: - throw new NoViableAltException(this); - } - setState(1472); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,153,_ctx); - } while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ); - setState(1474); - statement_list(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Switch_labelContext extends ParserRuleContext { - public TerminalNode CASE() { return getToken(CSharpParser.CASE, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public Case_guardContext case_guard() { - return getRuleContext(Case_guardContext.class,0); - } - public TerminalNode DEFAULT() { return getToken(CSharpParser.DEFAULT, 0); } - public Switch_labelContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_switch_label; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSwitch_label(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSwitch_label(this); - } - } - - public final Switch_labelContext switch_label() throws RecognitionException { - Switch_labelContext _localctx = new Switch_labelContext(_ctx, getState()); - enterRule(_localctx, 186, RULE_switch_label); - int _la; - try { - setState(1485); - _errHandler.sync(this); - switch (_input.LA(1)) { - case CASE: - enterOuterAlt(_localctx, 1); - { - setState(1476); - match(CASE); - setState(1477); - expression(); - setState(1479); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHEN) { - { - setState(1478); - case_guard(); - } - } - - setState(1481); - match(COLON); - } - break; - case DEFAULT: - enterOuterAlt(_localctx, 2); - { - setState(1483); - match(DEFAULT); - setState(1484); - match(COLON); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Case_guardContext extends ParserRuleContext { - public TerminalNode WHEN() { return getToken(CSharpParser.WHEN, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Case_guardContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_case_guard; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterCase_guard(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitCase_guard(this); - } - } - - public final Case_guardContext case_guard() throws RecognitionException { - Case_guardContext _localctx = new Case_guardContext(_ctx, getState()); - enterRule(_localctx, 188, RULE_case_guard); - try { - enterOuterAlt(_localctx, 1); - { - setState(1487); - match(WHEN); - setState(1488); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Statement_listContext extends ParserRuleContext { - public List statement() { - return getRuleContexts(StatementContext.class); - } - public StatementContext statement(int i) { - return getRuleContext(StatementContext.class,i); - } - public Statement_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_statement_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterStatement_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitStatement_list(this); - } - } - - public final Statement_listContext statement_list() throws RecognitionException { - Statement_listContext _localctx = new Statement_listContext(_ctx, getState()); - enterRule(_localctx, 190, RULE_statement_list); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1491); - _errHandler.sync(this); - _alt = 1; - do { - switch (_alt) { - case 1: - { - { - setState(1490); - statement(); - } - } - break; - default: - throw new NoViableAltException(this); - } - setState(1493); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,156,_ctx); - } while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class For_initializerContext extends ParserRuleContext { - public Local_variable_declarationContext local_variable_declaration() { - return getRuleContext(Local_variable_declarationContext.class,0); - } - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public For_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_for_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFor_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFor_initializer(this); - } - } - - public final For_initializerContext for_initializer() throws RecognitionException { - For_initializerContext _localctx = new For_initializerContext(_ctx, getState()); - enterRule(_localctx, 192, RULE_for_initializer); - int _la; - try { - setState(1504); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,158,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1495); - local_variable_declaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1496); - expression(); - setState(1501); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1497); - match(COMMA); - setState(1498); - expression(); - } - } - setState(1503); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class For_iteratorContext extends ParserRuleContext { - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public For_iteratorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_for_iterator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFor_iterator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFor_iterator(this); - } - } - - public final For_iteratorContext for_iterator() throws RecognitionException { - For_iteratorContext _localctx = new For_iteratorContext(_ctx, getState()); - enterRule(_localctx, 194, RULE_for_iterator); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1506); - expression(); - setState(1511); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1507); - match(COMMA); - setState(1508); - expression(); - } - } - setState(1513); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Catch_clausesContext extends ParserRuleContext { - public List specific_catch_clause() { - return getRuleContexts(Specific_catch_clauseContext.class); - } - public Specific_catch_clauseContext specific_catch_clause(int i) { - return getRuleContext(Specific_catch_clauseContext.class,i); - } - public General_catch_clauseContext general_catch_clause() { - return getRuleContext(General_catch_clauseContext.class,0); - } - public Catch_clausesContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_catch_clauses; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterCatch_clauses(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitCatch_clauses(this); - } - } - - public final Catch_clausesContext catch_clauses() throws RecognitionException { - Catch_clausesContext _localctx = new Catch_clausesContext(_ctx, getState()); - enterRule(_localctx, 196, RULE_catch_clauses); - int _la; - try { - int _alt; - setState(1525); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,162,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1514); - specific_catch_clause(); - setState(1518); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,160,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1515); - specific_catch_clause(); - } - } - } - setState(1520); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,160,_ctx); - } - setState(1522); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==CATCH) { - { - setState(1521); - general_catch_clause(); - } - } - - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1524); - general_catch_clause(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Specific_catch_clauseContext extends ParserRuleContext { - public TerminalNode CATCH() { return getToken(CSharpParser.CATCH, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public Class_typeContext class_type() { - return getRuleContext(Class_typeContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Exception_filterContext exception_filter() { - return getRuleContext(Exception_filterContext.class,0); - } - public Specific_catch_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_specific_catch_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSpecific_catch_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSpecific_catch_clause(this); - } - } - - public final Specific_catch_clauseContext specific_catch_clause() throws RecognitionException { - Specific_catch_clauseContext _localctx = new Specific_catch_clauseContext(_ctx, getState()); - enterRule(_localctx, 198, RULE_specific_catch_clause); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1527); - match(CATCH); - setState(1528); - match(OPEN_PARENS); - setState(1529); - class_type(); - setState(1531); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BY) | (1L << DESCENDING) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INTO) | (1L << JOIN) | (1L << LET))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REMOVE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (UNMANAGED - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)))) != 0)) { - { - setState(1530); - identifier(); - } - } - - setState(1533); - match(CLOSE_PARENS); - setState(1535); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHEN) { - { - setState(1534); - exception_filter(); - } - } - - setState(1537); - block(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class General_catch_clauseContext extends ParserRuleContext { - public TerminalNode CATCH() { return getToken(CSharpParser.CATCH, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public Exception_filterContext exception_filter() { - return getRuleContext(Exception_filterContext.class,0); - } - public General_catch_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_general_catch_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterGeneral_catch_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitGeneral_catch_clause(this); - } - } - - public final General_catch_clauseContext general_catch_clause() throws RecognitionException { - General_catch_clauseContext _localctx = new General_catch_clauseContext(_ctx, getState()); - enterRule(_localctx, 200, RULE_general_catch_clause); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1539); - match(CATCH); - setState(1541); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHEN) { - { - setState(1540); - exception_filter(); - } - } - - setState(1543); - block(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Exception_filterContext extends ParserRuleContext { - public TerminalNode WHEN() { return getToken(CSharpParser.WHEN, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Exception_filterContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_exception_filter; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterException_filter(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitException_filter(this); - } - } - - public final Exception_filterContext exception_filter() throws RecognitionException { - Exception_filterContext _localctx = new Exception_filterContext(_ctx, getState()); - enterRule(_localctx, 202, RULE_exception_filter); - try { - enterOuterAlt(_localctx, 1); - { - setState(1545); - match(WHEN); - setState(1546); - match(OPEN_PARENS); - setState(1547); - expression(); - setState(1548); - match(CLOSE_PARENS); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Finally_clauseContext extends ParserRuleContext { - public TerminalNode FINALLY() { return getToken(CSharpParser.FINALLY, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public Finally_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_finally_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFinally_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFinally_clause(this); - } - } - - public final Finally_clauseContext finally_clause() throws RecognitionException { - Finally_clauseContext _localctx = new Finally_clauseContext(_ctx, getState()); - enterRule(_localctx, 204, RULE_finally_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1550); - match(FINALLY); - setState(1551); - block(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Resource_acquisitionContext extends ParserRuleContext { - public Local_variable_declarationContext local_variable_declaration() { - return getRuleContext(Local_variable_declarationContext.class,0); - } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Resource_acquisitionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_resource_acquisition; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterResource_acquisition(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitResource_acquisition(this); - } - } - - public final Resource_acquisitionContext resource_acquisition() throws RecognitionException { - Resource_acquisitionContext _localctx = new Resource_acquisitionContext(_ctx, getState()); - enterRule(_localctx, 206, RULE_resource_acquisition); - try { - setState(1555); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,166,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1553); - local_variable_declaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1554); - expression(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Namespace_declarationContext extends ParserRuleContext { - public Qualified_identifierContext qi; - public TerminalNode NAMESPACE() { return getToken(CSharpParser.NAMESPACE, 0); } - public Namespace_bodyContext namespace_body() { - return getRuleContext(Namespace_bodyContext.class,0); - } - public Qualified_identifierContext qualified_identifier() { - return getRuleContext(Qualified_identifierContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Namespace_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_namespace_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterNamespace_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitNamespace_declaration(this); - } - } - - public final Namespace_declarationContext namespace_declaration() throws RecognitionException { - Namespace_declarationContext _localctx = new Namespace_declarationContext(_ctx, getState()); - enterRule(_localctx, 208, RULE_namespace_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1557); - match(NAMESPACE); - setState(1558); - ((Namespace_declarationContext)_localctx).qi = qualified_identifier(); - setState(1559); - namespace_body(); - setState(1561); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==SEMICOLON) { - { - setState(1560); - match(SEMICOLON); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Qualified_identifierContext extends ParserRuleContext { - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public List DOT() { return getTokens(CSharpParser.DOT); } - public TerminalNode DOT(int i) { - return getToken(CSharpParser.DOT, i); - } - public Qualified_identifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_qualified_identifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterQualified_identifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitQualified_identifier(this); - } - } - - public final Qualified_identifierContext qualified_identifier() throws RecognitionException { - Qualified_identifierContext _localctx = new Qualified_identifierContext(_ctx, getState()); - enterRule(_localctx, 210, RULE_qualified_identifier); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1563); - identifier(); - setState(1568); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==DOT) { - { - { - setState(1564); - match(DOT); - setState(1565); - identifier(); - } - } - setState(1570); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Namespace_bodyContext extends ParserRuleContext { - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public Extern_alias_directivesContext extern_alias_directives() { - return getRuleContext(Extern_alias_directivesContext.class,0); - } - public Using_directivesContext using_directives() { - return getRuleContext(Using_directivesContext.class,0); - } - public Namespace_member_declarationsContext namespace_member_declarations() { - return getRuleContext(Namespace_member_declarationsContext.class,0); - } - public Namespace_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_namespace_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterNamespace_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitNamespace_body(this); - } - } - - public final Namespace_bodyContext namespace_body() throws RecognitionException { - Namespace_bodyContext _localctx = new Namespace_bodyContext(_ctx, getState()); - enterRule(_localctx, 212, RULE_namespace_body); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1571); - match(OPEN_BRACE); - setState(1573); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,169,_ctx) ) { - case 1: - { - setState(1572); - extern_alias_directives(); - } - break; - } - setState(1576); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==USING) { - { - setState(1575); - using_directives(); - } - } - - setState(1579); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ABSTRACT) | (1L << ASYNC) | (1L << CLASS) | (1L << DELEGATE) | (1L << ENUM) | (1L << EXTERN) | (1L << INTERFACE) | (1L << INTERNAL))) != 0) || ((((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & ((1L << (NAMESPACE - 65)) | (1L << (NEW - 65)) | (1L << (OVERRIDE - 65)) | (1L << (PARTIAL - 65)) | (1L << (PRIVATE - 65)) | (1L << (PROTECTED - 65)) | (1L << (PUBLIC - 65)) | (1L << (READONLY - 65)) | (1L << (REF - 65)) | (1L << (SEALED - 65)) | (1L << (STATIC - 65)) | (1L << (STRUCT - 65)) | (1L << (UNSAFE - 65)) | (1L << (VIRTUAL - 65)) | (1L << (VOLATILE - 65)) | (1L << (OPEN_BRACKET - 65)))) != 0)) { - { - setState(1578); - namespace_member_declarations(); - } - } - - setState(1581); - match(CLOSE_BRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Extern_alias_directivesContext extends ParserRuleContext { - public List extern_alias_directive() { - return getRuleContexts(Extern_alias_directiveContext.class); - } - public Extern_alias_directiveContext extern_alias_directive(int i) { - return getRuleContext(Extern_alias_directiveContext.class,i); - } - public Extern_alias_directivesContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_extern_alias_directives; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterExtern_alias_directives(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitExtern_alias_directives(this); - } - } - - public final Extern_alias_directivesContext extern_alias_directives() throws RecognitionException { - Extern_alias_directivesContext _localctx = new Extern_alias_directivesContext(_ctx, getState()); - enterRule(_localctx, 214, RULE_extern_alias_directives); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1584); - _errHandler.sync(this); - _alt = 1; - do { - switch (_alt) { - case 1: - { - { - setState(1583); - extern_alias_directive(); - } - } - break; - default: - throw new NoViableAltException(this); - } - setState(1586); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,172,_ctx); - } while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Extern_alias_directiveContext extends ParserRuleContext { - public TerminalNode EXTERN() { return getToken(CSharpParser.EXTERN, 0); } - public TerminalNode ALIAS() { return getToken(CSharpParser.ALIAS, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Extern_alias_directiveContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_extern_alias_directive; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterExtern_alias_directive(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitExtern_alias_directive(this); - } - } - - public final Extern_alias_directiveContext extern_alias_directive() throws RecognitionException { - Extern_alias_directiveContext _localctx = new Extern_alias_directiveContext(_ctx, getState()); - enterRule(_localctx, 216, RULE_extern_alias_directive); - try { - enterOuterAlt(_localctx, 1); - { - setState(1588); - match(EXTERN); - setState(1589); - match(ALIAS); - setState(1590); - identifier(); - setState(1591); - match(SEMICOLON); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Using_directivesContext extends ParserRuleContext { - public List using_directive() { - return getRuleContexts(Using_directiveContext.class); - } - public Using_directiveContext using_directive(int i) { - return getRuleContext(Using_directiveContext.class,i); - } - public Using_directivesContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_using_directives; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterUsing_directives(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitUsing_directives(this); - } - } - - public final Using_directivesContext using_directives() throws RecognitionException { - Using_directivesContext _localctx = new Using_directivesContext(_ctx, getState()); - enterRule(_localctx, 218, RULE_using_directives); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1594); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(1593); - using_directive(); - } - } - setState(1596); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( _la==USING ); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Using_directiveContext extends ParserRuleContext { - public Using_directiveContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_using_directive; } - - public Using_directiveContext() { } - public void copyFrom(Using_directiveContext ctx) { - super.copyFrom(ctx); - } - } - public static class UsingAliasDirectiveContext extends Using_directiveContext { - public TerminalNode USING() { return getToken(CSharpParser.USING, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public Namespace_or_type_nameContext namespace_or_type_name() { - return getRuleContext(Namespace_or_type_nameContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public UsingAliasDirectiveContext(Using_directiveContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterUsingAliasDirective(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitUsingAliasDirective(this); - } - } - public static class UsingNamespaceDirectiveContext extends Using_directiveContext { - public TerminalNode USING() { return getToken(CSharpParser.USING, 0); } - public Namespace_or_type_nameContext namespace_or_type_name() { - return getRuleContext(Namespace_or_type_nameContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public UsingNamespaceDirectiveContext(Using_directiveContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterUsingNamespaceDirective(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitUsingNamespaceDirective(this); - } - } - public static class UsingStaticDirectiveContext extends Using_directiveContext { - public TerminalNode USING() { return getToken(CSharpParser.USING, 0); } - public TerminalNode STATIC() { return getToken(CSharpParser.STATIC, 0); } - public Namespace_or_type_nameContext namespace_or_type_name() { - return getRuleContext(Namespace_or_type_nameContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public UsingStaticDirectiveContext(Using_directiveContext ctx) { copyFrom(ctx); } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterUsingStaticDirective(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitUsingStaticDirective(this); - } - } - - public final Using_directiveContext using_directive() throws RecognitionException { - Using_directiveContext _localctx = new Using_directiveContext(_ctx, getState()); - enterRule(_localctx, 220, RULE_using_directive); - try { - setState(1613); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,174,_ctx) ) { - case 1: - _localctx = new UsingAliasDirectiveContext(_localctx); - enterOuterAlt(_localctx, 1); - { - setState(1598); - match(USING); - setState(1599); - identifier(); - setState(1600); - match(ASSIGNMENT); - setState(1601); - namespace_or_type_name(); - setState(1602); - match(SEMICOLON); - } - break; - case 2: - _localctx = new UsingNamespaceDirectiveContext(_localctx); - enterOuterAlt(_localctx, 2); - { - setState(1604); - match(USING); - setState(1605); - namespace_or_type_name(); - setState(1606); - match(SEMICOLON); - } - break; - case 3: - _localctx = new UsingStaticDirectiveContext(_localctx); - enterOuterAlt(_localctx, 3); - { - setState(1608); - match(USING); - setState(1609); - match(STATIC); - setState(1610); - namespace_or_type_name(); - setState(1611); - match(SEMICOLON); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Namespace_member_declarationsContext extends ParserRuleContext { - public List namespace_member_declaration() { - return getRuleContexts(Namespace_member_declarationContext.class); - } - public Namespace_member_declarationContext namespace_member_declaration(int i) { - return getRuleContext(Namespace_member_declarationContext.class,i); - } - public Namespace_member_declarationsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_namespace_member_declarations; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterNamespace_member_declarations(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitNamespace_member_declarations(this); - } - } - - public final Namespace_member_declarationsContext namespace_member_declarations() throws RecognitionException { - Namespace_member_declarationsContext _localctx = new Namespace_member_declarationsContext(_ctx, getState()); - enterRule(_localctx, 222, RULE_namespace_member_declarations); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1616); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(1615); - namespace_member_declaration(); - } - } - setState(1618); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ABSTRACT) | (1L << ASYNC) | (1L << CLASS) | (1L << DELEGATE) | (1L << ENUM) | (1L << EXTERN) | (1L << INTERFACE) | (1L << INTERNAL))) != 0) || ((((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & ((1L << (NAMESPACE - 65)) | (1L << (NEW - 65)) | (1L << (OVERRIDE - 65)) | (1L << (PARTIAL - 65)) | (1L << (PRIVATE - 65)) | (1L << (PROTECTED - 65)) | (1L << (PUBLIC - 65)) | (1L << (READONLY - 65)) | (1L << (REF - 65)) | (1L << (SEALED - 65)) | (1L << (STATIC - 65)) | (1L << (STRUCT - 65)) | (1L << (UNSAFE - 65)) | (1L << (VIRTUAL - 65)) | (1L << (VOLATILE - 65)) | (1L << (OPEN_BRACKET - 65)))) != 0) ); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Namespace_member_declarationContext extends ParserRuleContext { - public Namespace_declarationContext namespace_declaration() { - return getRuleContext(Namespace_declarationContext.class,0); - } - public Type_declarationContext type_declaration() { - return getRuleContext(Type_declarationContext.class,0); - } - public Namespace_member_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_namespace_member_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterNamespace_member_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitNamespace_member_declaration(this); - } - } - - public final Namespace_member_declarationContext namespace_member_declaration() throws RecognitionException { - Namespace_member_declarationContext _localctx = new Namespace_member_declarationContext(_ctx, getState()); - enterRule(_localctx, 224, RULE_namespace_member_declaration); - try { - setState(1622); - _errHandler.sync(this); - switch (_input.LA(1)) { - case NAMESPACE: - enterOuterAlt(_localctx, 1); - { - setState(1620); - namespace_declaration(); - } - break; - case ABSTRACT: - case ASYNC: - case CLASS: - case DELEGATE: - case ENUM: - case EXTERN: - case INTERFACE: - case INTERNAL: - case NEW: - case OVERRIDE: - case PARTIAL: - case PRIVATE: - case PROTECTED: - case PUBLIC: - case READONLY: - case REF: - case SEALED: - case STATIC: - case STRUCT: - case UNSAFE: - case VIRTUAL: - case VOLATILE: - case OPEN_BRACKET: - enterOuterAlt(_localctx, 2); - { - setState(1621); - type_declaration(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Type_declarationContext extends ParserRuleContext { - public Class_definitionContext class_definition() { - return getRuleContext(Class_definitionContext.class,0); - } - public Struct_definitionContext struct_definition() { - return getRuleContext(Struct_definitionContext.class,0); - } - public Interface_definitionContext interface_definition() { - return getRuleContext(Interface_definitionContext.class,0); - } - public Enum_definitionContext enum_definition() { - return getRuleContext(Enum_definitionContext.class,0); - } - public Delegate_definitionContext delegate_definition() { - return getRuleContext(Delegate_definitionContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public All_member_modifiersContext all_member_modifiers() { - return getRuleContext(All_member_modifiersContext.class,0); - } - public Type_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_type_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterType_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitType_declaration(this); - } - } - - public final Type_declarationContext type_declaration() throws RecognitionException { - Type_declarationContext _localctx = new Type_declarationContext(_ctx, getState()); - enterRule(_localctx, 226, RULE_type_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1625); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1624); - attributes(); - } - } - - setState(1628); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,178,_ctx) ) { - case 1: - { - setState(1627); - all_member_modifiers(); - } - break; - } - setState(1635); - _errHandler.sync(this); - switch (_input.LA(1)) { - case CLASS: - { - setState(1630); - class_definition(); - } - break; - case READONLY: - case REF: - case STRUCT: - { - setState(1631); - struct_definition(); - } - break; - case INTERFACE: - { - setState(1632); - interface_definition(); - } - break; - case ENUM: - { - setState(1633); - enum_definition(); - } - break; - case DELEGATE: - { - setState(1634); - delegate_definition(); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Qualified_alias_memberContext extends ParserRuleContext { - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public TerminalNode DOUBLE_COLON() { return getToken(CSharpParser.DOUBLE_COLON, 0); } - public Type_argument_listContext type_argument_list() { - return getRuleContext(Type_argument_listContext.class,0); - } - public Qualified_alias_memberContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_qualified_alias_member; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterQualified_alias_member(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitQualified_alias_member(this); - } - } - - public final Qualified_alias_memberContext qualified_alias_member() throws RecognitionException { - Qualified_alias_memberContext _localctx = new Qualified_alias_memberContext(_ctx, getState()); - enterRule(_localctx, 228, RULE_qualified_alias_member); - try { - enterOuterAlt(_localctx, 1); - { - setState(1637); - identifier(); - setState(1638); - match(DOUBLE_COLON); - setState(1639); - identifier(); - setState(1641); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,180,_ctx) ) { - case 1: - { - setState(1640); - type_argument_list(); - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Type_parameter_listContext extends ParserRuleContext { - public TerminalNode LT() { return getToken(CSharpParser.LT, 0); } - public List type_parameter() { - return getRuleContexts(Type_parameterContext.class); - } - public Type_parameterContext type_parameter(int i) { - return getRuleContext(Type_parameterContext.class,i); - } - public TerminalNode GT() { return getToken(CSharpParser.GT, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Type_parameter_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_type_parameter_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterType_parameter_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitType_parameter_list(this); - } - } - - public final Type_parameter_listContext type_parameter_list() throws RecognitionException { - Type_parameter_listContext _localctx = new Type_parameter_listContext(_ctx, getState()); - enterRule(_localctx, 230, RULE_type_parameter_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1643); - match(LT); - setState(1644); - type_parameter(); - setState(1649); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1645); - match(COMMA); - setState(1646); - type_parameter(); - } - } - setState(1651); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1652); - match(GT); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Type_parameterContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public Type_parameterContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_type_parameter; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterType_parameter(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitType_parameter(this); - } - } - - public final Type_parameterContext type_parameter() throws RecognitionException { - Type_parameterContext _localctx = new Type_parameterContext(_ctx, getState()); - enterRule(_localctx, 232, RULE_type_parameter); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1655); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1654); - attributes(); - } - } - - setState(1657); - identifier(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Class_baseContext extends ParserRuleContext { - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public Class_typeContext class_type() { - return getRuleContext(Class_typeContext.class,0); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public List namespace_or_type_name() { - return getRuleContexts(Namespace_or_type_nameContext.class); - } - public Namespace_or_type_nameContext namespace_or_type_name(int i) { - return getRuleContext(Namespace_or_type_nameContext.class,i); - } - public Class_baseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_class_base; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterClass_base(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitClass_base(this); - } - } - - public final Class_baseContext class_base() throws RecognitionException { - Class_baseContext _localctx = new Class_baseContext(_ctx, getState()); - enterRule(_localctx, 234, RULE_class_base); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1659); - match(COLON); - setState(1660); - class_type(); - setState(1665); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1661); - match(COMMA); - setState(1662); - namespace_or_type_name(); - } - } - setState(1667); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Interface_type_listContext extends ParserRuleContext { - public List namespace_or_type_name() { - return getRuleContexts(Namespace_or_type_nameContext.class); - } - public Namespace_or_type_nameContext namespace_or_type_name(int i) { - return getRuleContext(Namespace_or_type_nameContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Interface_type_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interface_type_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInterface_type_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInterface_type_list(this); - } - } - - public final Interface_type_listContext interface_type_list() throws RecognitionException { - Interface_type_listContext _localctx = new Interface_type_listContext(_ctx, getState()); - enterRule(_localctx, 236, RULE_interface_type_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1668); - namespace_or_type_name(); - setState(1673); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1669); - match(COMMA); - setState(1670); - namespace_or_type_name(); - } - } - setState(1675); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Type_parameter_constraints_clausesContext extends ParserRuleContext { - public List type_parameter_constraints_clause() { - return getRuleContexts(Type_parameter_constraints_clauseContext.class); - } - public Type_parameter_constraints_clauseContext type_parameter_constraints_clause(int i) { - return getRuleContext(Type_parameter_constraints_clauseContext.class,i); - } - public Type_parameter_constraints_clausesContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_type_parameter_constraints_clauses; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterType_parameter_constraints_clauses(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitType_parameter_constraints_clauses(this); - } - } - - public final Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() throws RecognitionException { - Type_parameter_constraints_clausesContext _localctx = new Type_parameter_constraints_clausesContext(_ctx, getState()); - enterRule(_localctx, 238, RULE_type_parameter_constraints_clauses); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1677); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(1676); - type_parameter_constraints_clause(); - } - } - setState(1679); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( _la==WHERE ); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Type_parameter_constraints_clauseContext extends ParserRuleContext { - public TerminalNode WHERE() { return getToken(CSharpParser.WHERE, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public Type_parameter_constraintsContext type_parameter_constraints() { - return getRuleContext(Type_parameter_constraintsContext.class,0); - } - public Type_parameter_constraints_clauseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_type_parameter_constraints_clause; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterType_parameter_constraints_clause(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitType_parameter_constraints_clause(this); - } - } - - public final Type_parameter_constraints_clauseContext type_parameter_constraints_clause() throws RecognitionException { - Type_parameter_constraints_clauseContext _localctx = new Type_parameter_constraints_clauseContext(_ctx, getState()); - enterRule(_localctx, 240, RULE_type_parameter_constraints_clause); - try { - enterOuterAlt(_localctx, 1); - { - setState(1681); - match(WHERE); - setState(1682); - identifier(); - setState(1683); - match(COLON); - setState(1684); - type_parameter_constraints(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Type_parameter_constraintsContext extends ParserRuleContext { - public Constructor_constraintContext constructor_constraint() { - return getRuleContext(Constructor_constraintContext.class,0); - } - public Primary_constraintContext primary_constraint() { - return getRuleContext(Primary_constraintContext.class,0); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Secondary_constraintsContext secondary_constraints() { - return getRuleContext(Secondary_constraintsContext.class,0); - } - public Type_parameter_constraintsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_type_parameter_constraints; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterType_parameter_constraints(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitType_parameter_constraints(this); - } - } - - public final Type_parameter_constraintsContext type_parameter_constraints() throws RecognitionException { - Type_parameter_constraintsContext _localctx = new Type_parameter_constraintsContext(_ctx, getState()); - enterRule(_localctx, 242, RULE_type_parameter_constraints); - int _la; - try { - setState(1696); - _errHandler.sync(this); - switch (_input.LA(1)) { - case NEW: - enterOuterAlt(_localctx, 1); - { - setState(1686); - constructor_constraint(); - } - break; - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BY: - case CLASS: - case DESCENDING: - case DYNAMIC: - case EQUALS: - case FROM: - case GET: - case GROUP: - case INTO: - case JOIN: - case LET: - case NAMEOF: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REMOVE: - case SELECT: - case SET: - case STRING: - case STRUCT: - case UNMANAGED: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - enterOuterAlt(_localctx, 2); - { - setState(1687); - primary_constraint(); - setState(1690); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,186,_ctx) ) { - case 1: - { - setState(1688); - match(COMMA); - setState(1689); - secondary_constraints(); - } - break; - } - setState(1694); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(1692); - match(COMMA); - setState(1693); - constructor_constraint(); - } - } - - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Primary_constraintContext extends ParserRuleContext { - public Class_typeContext class_type() { - return getRuleContext(Class_typeContext.class,0); - } - public TerminalNode CLASS() { return getToken(CSharpParser.CLASS, 0); } - public TerminalNode INTERR() { return getToken(CSharpParser.INTERR, 0); } - public TerminalNode STRUCT() { return getToken(CSharpParser.STRUCT, 0); } - public TerminalNode UNMANAGED() { return getToken(CSharpParser.UNMANAGED, 0); } - public Primary_constraintContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_primary_constraint; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterPrimary_constraint(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitPrimary_constraint(this); - } - } - - public final Primary_constraintContext primary_constraint() throws RecognitionException { - Primary_constraintContext _localctx = new Primary_constraintContext(_ctx, getState()); - enterRule(_localctx, 244, RULE_primary_constraint); - int _la; - try { - setState(1705); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,190,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1698); - class_type(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1699); - match(CLASS); - setState(1701); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==INTERR) { - { - setState(1700); - match(INTERR); - } - } - - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1703); - match(STRUCT); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1704); - match(UNMANAGED); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Secondary_constraintsContext extends ParserRuleContext { - public List namespace_or_type_name() { - return getRuleContexts(Namespace_or_type_nameContext.class); - } - public Namespace_or_type_nameContext namespace_or_type_name(int i) { - return getRuleContext(Namespace_or_type_nameContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Secondary_constraintsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_secondary_constraints; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSecondary_constraints(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSecondary_constraints(this); - } - } - - public final Secondary_constraintsContext secondary_constraints() throws RecognitionException { - Secondary_constraintsContext _localctx = new Secondary_constraintsContext(_ctx, getState()); - enterRule(_localctx, 246, RULE_secondary_constraints); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1707); - namespace_or_type_name(); - setState(1712); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,191,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1708); - match(COMMA); - setState(1709); - namespace_or_type_name(); - } - } - } - setState(1714); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,191,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Constructor_constraintContext extends ParserRuleContext { - public TerminalNode NEW() { return getToken(CSharpParser.NEW, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Constructor_constraintContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constructor_constraint; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterConstructor_constraint(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitConstructor_constraint(this); - } - } - - public final Constructor_constraintContext constructor_constraint() throws RecognitionException { - Constructor_constraintContext _localctx = new Constructor_constraintContext(_ctx, getState()); - enterRule(_localctx, 248, RULE_constructor_constraint); - try { - enterOuterAlt(_localctx, 1); - { - setState(1715); - match(NEW); - setState(1716); - match(OPEN_PARENS); - setState(1717); - match(CLOSE_PARENS); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Class_bodyContext extends ParserRuleContext { - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public Class_member_declarationsContext class_member_declarations() { - return getRuleContext(Class_member_declarationsContext.class,0); - } - public Class_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_class_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterClass_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitClass_body(this); - } - } - - public final Class_bodyContext class_body() throws RecognitionException { - Class_bodyContext _localctx = new Class_bodyContext(_ctx, getState()); - enterRule(_localctx, 250, RULE_class_body); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1719); - match(OPEN_BRACE); - setState(1721); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ABSTRACT) | (1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CLASS) | (1L << CONST) | (1L << DECIMAL) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << ENUM) | (1L << EQUALS) | (1L << EVENT) | (1L << EXPLICIT) | (1L << EXTERN) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << IMPLICIT) | (1L << INT) | (1L << INTERFACE) | (1L << INTERNAL) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (OVERRIDE - 64)) | (1L << (PARTIAL - 64)) | (1L << (PRIVATE - 64)) | (1L << (PROTECTED - 64)) | (1L << (PUBLIC - 64)) | (1L << (READONLY - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SEALED - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (STATIC - 64)) | (1L << (STRING - 64)) | (1L << (STRUCT - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNMANAGED - 64)) | (1L << (UNSAFE - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (VIRTUAL - 64)) | (1L << (VOID - 64)) | (1L << (VOLATILE - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (OPEN_BRACKET - 64)))) != 0) || _la==OPEN_PARENS || _la==TILDE) { - { - setState(1720); - class_member_declarations(); - } - } - - setState(1723); - match(CLOSE_BRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Class_member_declarationsContext extends ParserRuleContext { - public List class_member_declaration() { - return getRuleContexts(Class_member_declarationContext.class); - } - public Class_member_declarationContext class_member_declaration(int i) { - return getRuleContext(Class_member_declarationContext.class,i); - } - public Class_member_declarationsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_class_member_declarations; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterClass_member_declarations(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitClass_member_declarations(this); - } - } - - public final Class_member_declarationsContext class_member_declarations() throws RecognitionException { - Class_member_declarationsContext _localctx = new Class_member_declarationsContext(_ctx, getState()); - enterRule(_localctx, 252, RULE_class_member_declarations); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1726); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(1725); - class_member_declaration(); - } - } - setState(1728); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ABSTRACT) | (1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CLASS) | (1L << CONST) | (1L << DECIMAL) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << ENUM) | (1L << EQUALS) | (1L << EVENT) | (1L << EXPLICIT) | (1L << EXTERN) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << IMPLICIT) | (1L << INT) | (1L << INTERFACE) | (1L << INTERNAL) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (OVERRIDE - 64)) | (1L << (PARTIAL - 64)) | (1L << (PRIVATE - 64)) | (1L << (PROTECTED - 64)) | (1L << (PUBLIC - 64)) | (1L << (READONLY - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SEALED - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (STATIC - 64)) | (1L << (STRING - 64)) | (1L << (STRUCT - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNMANAGED - 64)) | (1L << (UNSAFE - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (VIRTUAL - 64)) | (1L << (VOID - 64)) | (1L << (VOLATILE - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (OPEN_BRACKET - 64)))) != 0) || _la==OPEN_PARENS || _la==TILDE ); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Class_member_declarationContext extends ParserRuleContext { - public Common_member_declarationContext common_member_declaration() { - return getRuleContext(Common_member_declarationContext.class,0); - } - public Destructor_definitionContext destructor_definition() { - return getRuleContext(Destructor_definitionContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public All_member_modifiersContext all_member_modifiers() { - return getRuleContext(All_member_modifiersContext.class,0); - } - public Class_member_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_class_member_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterClass_member_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitClass_member_declaration(this); - } - } - - public final Class_member_declarationContext class_member_declaration() throws RecognitionException { - Class_member_declarationContext _localctx = new Class_member_declarationContext(_ctx, getState()); - enterRule(_localctx, 254, RULE_class_member_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1731); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1730); - attributes(); - } - } - - setState(1734); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,195,_ctx) ) { - case 1: - { - setState(1733); - all_member_modifiers(); - } - break; - } - setState(1738); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CLASS: - case CONST: - case DECIMAL: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case ENUM: - case EQUALS: - case EVENT: - case EXPLICIT: - case FLOAT: - case FROM: - case GET: - case GROUP: - case IMPLICIT: - case INT: - case INTERFACE: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case READONLY: - case REF: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case STRING: - case STRUCT: - case UINT: - case ULONG: - case UNMANAGED: - case USHORT: - case VAR: - case VOID: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case OPEN_PARENS: - { - setState(1736); - common_member_declaration(); - } - break; - case TILDE: - { - setState(1737); - destructor_definition(); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class All_member_modifiersContext extends ParserRuleContext { - public List all_member_modifier() { - return getRuleContexts(All_member_modifierContext.class); - } - public All_member_modifierContext all_member_modifier(int i) { - return getRuleContext(All_member_modifierContext.class,i); - } - public All_member_modifiersContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_all_member_modifiers; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAll_member_modifiers(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAll_member_modifiers(this); - } - } - - public final All_member_modifiersContext all_member_modifiers() throws RecognitionException { - All_member_modifiersContext _localctx = new All_member_modifiersContext(_ctx, getState()); - enterRule(_localctx, 256, RULE_all_member_modifiers); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1741); - _errHandler.sync(this); - _alt = 1; - do { - switch (_alt) { - case 1: - { - { - setState(1740); - all_member_modifier(); - } - } - break; - default: - throw new NoViableAltException(this); - } - setState(1743); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,197,_ctx); - } while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class All_member_modifierContext extends ParserRuleContext { - public TerminalNode NEW() { return getToken(CSharpParser.NEW, 0); } - public TerminalNode PUBLIC() { return getToken(CSharpParser.PUBLIC, 0); } - public TerminalNode PROTECTED() { return getToken(CSharpParser.PROTECTED, 0); } - public TerminalNode INTERNAL() { return getToken(CSharpParser.INTERNAL, 0); } - public TerminalNode PRIVATE() { return getToken(CSharpParser.PRIVATE, 0); } - public TerminalNode READONLY() { return getToken(CSharpParser.READONLY, 0); } - public TerminalNode VOLATILE() { return getToken(CSharpParser.VOLATILE, 0); } - public TerminalNode VIRTUAL() { return getToken(CSharpParser.VIRTUAL, 0); } - public TerminalNode SEALED() { return getToken(CSharpParser.SEALED, 0); } - public TerminalNode OVERRIDE() { return getToken(CSharpParser.OVERRIDE, 0); } - public TerminalNode ABSTRACT() { return getToken(CSharpParser.ABSTRACT, 0); } - public TerminalNode STATIC() { return getToken(CSharpParser.STATIC, 0); } - public TerminalNode UNSAFE() { return getToken(CSharpParser.UNSAFE, 0); } - public TerminalNode EXTERN() { return getToken(CSharpParser.EXTERN, 0); } - public TerminalNode PARTIAL() { return getToken(CSharpParser.PARTIAL, 0); } - public TerminalNode ASYNC() { return getToken(CSharpParser.ASYNC, 0); } - public All_member_modifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_all_member_modifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAll_member_modifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAll_member_modifier(this); - } - } - - public final All_member_modifierContext all_member_modifier() throws RecognitionException { - All_member_modifierContext _localctx = new All_member_modifierContext(_ctx, getState()); - enterRule(_localctx, 258, RULE_all_member_modifier); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1745); - _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ABSTRACT) | (1L << ASYNC) | (1L << EXTERN) | (1L << INTERNAL))) != 0) || ((((_la - 66)) & ~0x3f) == 0 && ((1L << (_la - 66)) & ((1L << (NEW - 66)) | (1L << (OVERRIDE - 66)) | (1L << (PARTIAL - 66)) | (1L << (PRIVATE - 66)) | (1L << (PROTECTED - 66)) | (1L << (PUBLIC - 66)) | (1L << (READONLY - 66)) | (1L << (SEALED - 66)) | (1L << (STATIC - 66)) | (1L << (UNSAFE - 66)) | (1L << (VIRTUAL - 66)) | (1L << (VOLATILE - 66)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Common_member_declarationContext extends ParserRuleContext { - public Constant_declarationContext constant_declaration() { - return getRuleContext(Constant_declarationContext.class,0); - } - public Typed_member_declarationContext typed_member_declaration() { - return getRuleContext(Typed_member_declarationContext.class,0); - } - public Event_declarationContext event_declaration() { - return getRuleContext(Event_declarationContext.class,0); - } - public Conversion_operator_declaratorContext conversion_operator_declarator() { - return getRuleContext(Conversion_operator_declaratorContext.class,0); - } - public BodyContext body() { - return getRuleContext(BodyContext.class,0); - } - public Right_arrowContext right_arrow() { - return getRuleContext(Right_arrowContext.class,0); - } - public Throwable_expressionContext throwable_expression() { - return getRuleContext(Throwable_expressionContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Constructor_declarationContext constructor_declaration() { - return getRuleContext(Constructor_declarationContext.class,0); - } - public TerminalNode VOID() { return getToken(CSharpParser.VOID, 0); } - public Method_declarationContext method_declaration() { - return getRuleContext(Method_declarationContext.class,0); - } - public Class_definitionContext class_definition() { - return getRuleContext(Class_definitionContext.class,0); - } - public Struct_definitionContext struct_definition() { - return getRuleContext(Struct_definitionContext.class,0); - } - public Interface_definitionContext interface_definition() { - return getRuleContext(Interface_definitionContext.class,0); - } - public Enum_definitionContext enum_definition() { - return getRuleContext(Enum_definitionContext.class,0); - } - public Delegate_definitionContext delegate_definition() { - return getRuleContext(Delegate_definitionContext.class,0); - } - public Common_member_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_common_member_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterCommon_member_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitCommon_member_declaration(this); - } - } - - public final Common_member_declarationContext common_member_declaration() throws RecognitionException { - Common_member_declarationContext _localctx = new Common_member_declarationContext(_ctx, getState()); - enterRule(_localctx, 260, RULE_common_member_declaration); - try { - setState(1766); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,199,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1747); - constant_declaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1748); - typed_member_declaration(); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1749); - event_declaration(); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1750); - conversion_operator_declarator(); - setState(1756); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACE: - case SEMICOLON: - { - setState(1751); - body(); - } - break; - case ASSIGNMENT: - { - setState(1752); - right_arrow(); - setState(1753); - throwable_expression(); - setState(1754); - match(SEMICOLON); - } - break; - default: - throw new NoViableAltException(this); - } - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1758); - constructor_declaration(); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(1759); - match(VOID); - setState(1760); - method_declaration(); - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(1761); - class_definition(); - } - break; - case 8: - enterOuterAlt(_localctx, 8); - { - setState(1762); - struct_definition(); - } - break; - case 9: - enterOuterAlt(_localctx, 9); - { - setState(1763); - interface_definition(); - } - break; - case 10: - enterOuterAlt(_localctx, 10); - { - setState(1764); - enum_definition(); - } - break; - case 11: - enterOuterAlt(_localctx, 11); - { - setState(1765); - delegate_definition(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Typed_member_declarationContext extends ParserRuleContext { - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public Namespace_or_type_nameContext namespace_or_type_name() { - return getRuleContext(Namespace_or_type_nameContext.class,0); - } - public TerminalNode DOT() { return getToken(CSharpParser.DOT, 0); } - public Indexer_declarationContext indexer_declaration() { - return getRuleContext(Indexer_declarationContext.class,0); - } - public Method_declarationContext method_declaration() { - return getRuleContext(Method_declarationContext.class,0); - } - public Property_declarationContext property_declaration() { - return getRuleContext(Property_declarationContext.class,0); - } - public Operator_declarationContext operator_declaration() { - return getRuleContext(Operator_declarationContext.class,0); - } - public Field_declarationContext field_declaration() { - return getRuleContext(Field_declarationContext.class,0); - } - public TerminalNode REF() { return getToken(CSharpParser.REF, 0); } - public TerminalNode READONLY() { return getToken(CSharpParser.READONLY, 0); } - public Typed_member_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_typed_member_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterTyped_member_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitTyped_member_declaration(this); - } - } - - public final Typed_member_declarationContext typed_member_declaration() throws RecognitionException { - Typed_member_declarationContext _localctx = new Typed_member_declarationContext(_ctx, getState()); - enterRule(_localctx, 262, RULE_typed_member_declaration); - try { - enterOuterAlt(_localctx, 1); - { - setState(1773); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,200,_ctx) ) { - case 1: - { - setState(1768); - match(REF); - } - break; - case 2: - { - setState(1769); - match(READONLY); - setState(1770); - match(REF); - } - break; - case 3: - { - setState(1771); - match(REF); - setState(1772); - match(READONLY); - } - break; - } - setState(1775); - type_(); - setState(1785); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,201,_ctx) ) { - case 1: - { - setState(1776); - namespace_or_type_name(); - setState(1777); - match(DOT); - setState(1778); - indexer_declaration(); - } - break; - case 2: - { - setState(1780); - method_declaration(); - } - break; - case 3: - { - setState(1781); - property_declaration(); - } - break; - case 4: - { - setState(1782); - indexer_declaration(); - } - break; - case 5: - { - setState(1783); - operator_declaration(); - } - break; - case 6: - { - setState(1784); - field_declaration(); - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Constant_declaratorsContext extends ParserRuleContext { - public List constant_declarator() { - return getRuleContexts(Constant_declaratorContext.class); - } - public Constant_declaratorContext constant_declarator(int i) { - return getRuleContext(Constant_declaratorContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Constant_declaratorsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constant_declarators; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterConstant_declarators(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitConstant_declarators(this); - } - } - - public final Constant_declaratorsContext constant_declarators() throws RecognitionException { - Constant_declaratorsContext _localctx = new Constant_declaratorsContext(_ctx, getState()); - enterRule(_localctx, 264, RULE_constant_declarators); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1787); - constant_declarator(); - setState(1792); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1788); - match(COMMA); - setState(1789); - constant_declarator(); - } - } - setState(1794); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Constant_declaratorContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Constant_declaratorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constant_declarator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterConstant_declarator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitConstant_declarator(this); - } - } - - public final Constant_declaratorContext constant_declarator() throws RecognitionException { - Constant_declaratorContext _localctx = new Constant_declaratorContext(_ctx, getState()); - enterRule(_localctx, 266, RULE_constant_declarator); - try { - enterOuterAlt(_localctx, 1); - { - setState(1795); - identifier(); - setState(1796); - match(ASSIGNMENT); - setState(1797); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Variable_declaratorsContext extends ParserRuleContext { - public List variable_declarator() { - return getRuleContexts(Variable_declaratorContext.class); - } - public Variable_declaratorContext variable_declarator(int i) { - return getRuleContext(Variable_declaratorContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Variable_declaratorsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variable_declarators; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterVariable_declarators(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitVariable_declarators(this); - } - } - - public final Variable_declaratorsContext variable_declarators() throws RecognitionException { - Variable_declaratorsContext _localctx = new Variable_declaratorsContext(_ctx, getState()); - enterRule(_localctx, 268, RULE_variable_declarators); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1799); - variable_declarator(); - setState(1804); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(1800); - match(COMMA); - setState(1801); - variable_declarator(); - } - } - setState(1806); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Variable_declaratorContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public Variable_initializerContext variable_initializer() { - return getRuleContext(Variable_initializerContext.class,0); - } - public Variable_declaratorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variable_declarator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterVariable_declarator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitVariable_declarator(this); - } - } - - public final Variable_declaratorContext variable_declarator() throws RecognitionException { - Variable_declaratorContext _localctx = new Variable_declaratorContext(_ctx, getState()); - enterRule(_localctx, 270, RULE_variable_declarator); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1807); - identifier(); - setState(1810); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ASSIGNMENT) { - { - setState(1808); - match(ASSIGNMENT); - setState(1809); - variable_initializer(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Variable_initializerContext extends ParserRuleContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Array_initializerContext array_initializer() { - return getRuleContext(Array_initializerContext.class,0); - } - public Variable_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variable_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterVariable_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitVariable_initializer(this); - } - } - - public final Variable_initializerContext variable_initializer() throws RecognitionException { - Variable_initializerContext _localctx = new Variable_initializerContext(_ctx, getState()); - enterRule(_localctx, 272, RULE_variable_initializer); - try { - setState(1814); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REF: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case THIS: - case TRUE: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case USHORT: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - enterOuterAlt(_localctx, 1); - { - setState(1812); - expression(); - } - break; - case OPEN_BRACE: - enterOuterAlt(_localctx, 2); - { - setState(1813); - array_initializer(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Return_typeContext extends ParserRuleContext { - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public TerminalNode VOID() { return getToken(CSharpParser.VOID, 0); } - public Return_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_return_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterReturn_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitReturn_type(this); - } - } - - public final Return_typeContext return_type() throws RecognitionException { - Return_typeContext _localctx = new Return_typeContext(_ctx, getState()); - enterRule(_localctx, 274, RULE_return_type); - try { - setState(1818); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,206,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1816); - type_(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1817); - match(VOID); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Member_nameContext extends ParserRuleContext { - public Namespace_or_type_nameContext namespace_or_type_name() { - return getRuleContext(Namespace_or_type_nameContext.class,0); - } - public Member_nameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_member_name; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMember_name(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMember_name(this); - } - } - - public final Member_nameContext member_name() throws RecognitionException { - Member_nameContext _localctx = new Member_nameContext(_ctx, getState()); - enterRule(_localctx, 276, RULE_member_name); - try { - enterOuterAlt(_localctx, 1); - { - setState(1820); - namespace_or_type_name(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Method_bodyContext extends ParserRuleContext { - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Method_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_method_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMethod_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMethod_body(this); - } - } - - public final Method_bodyContext method_body() throws RecognitionException { - Method_bodyContext _localctx = new Method_bodyContext(_ctx, getState()); - enterRule(_localctx, 278, RULE_method_body); - try { - setState(1824); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACE: - enterOuterAlt(_localctx, 1); - { - setState(1822); - block(); - } - break; - case SEMICOLON: - enterOuterAlt(_localctx, 2); - { - setState(1823); - match(SEMICOLON); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Formal_parameter_listContext extends ParserRuleContext { - public Parameter_arrayContext parameter_array() { - return getRuleContext(Parameter_arrayContext.class,0); - } - public Fixed_parametersContext fixed_parameters() { - return getRuleContext(Fixed_parametersContext.class,0); - } - public TerminalNode COMMA() { return getToken(CSharpParser.COMMA, 0); } - public Formal_parameter_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_formal_parameter_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFormal_parameter_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFormal_parameter_list(this); - } - } - - public final Formal_parameter_listContext formal_parameter_list() throws RecognitionException { - Formal_parameter_listContext _localctx = new Formal_parameter_listContext(_ctx, getState()); - enterRule(_localctx, 280, RULE_formal_parameter_list); - int _la; - try { - setState(1832); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,209,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1826); - parameter_array(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1827); - fixed_parameters(); - setState(1830); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(1828); - match(COMMA); - setState(1829); - parameter_array(); - } - } - - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Fixed_parametersContext extends ParserRuleContext { - public List fixed_parameter() { - return getRuleContexts(Fixed_parameterContext.class); - } - public Fixed_parameterContext fixed_parameter(int i) { - return getRuleContext(Fixed_parameterContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Fixed_parametersContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_fixed_parameters; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFixed_parameters(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFixed_parameters(this); - } - } - - public final Fixed_parametersContext fixed_parameters() throws RecognitionException { - Fixed_parametersContext _localctx = new Fixed_parametersContext(_ctx, getState()); - enterRule(_localctx, 282, RULE_fixed_parameters); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(1834); - fixed_parameter(); - setState(1839); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,210,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(1835); - match(COMMA); - setState(1836); - fixed_parameter(); - } - } - } - setState(1841); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,210,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Fixed_parameterContext extends ParserRuleContext { - public Arg_declarationContext arg_declaration() { - return getRuleContext(Arg_declarationContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public Parameter_modifierContext parameter_modifier() { - return getRuleContext(Parameter_modifierContext.class,0); - } - public TerminalNode ARGLIST() { return getToken(CSharpParser.ARGLIST, 0); } - public Fixed_parameterContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_fixed_parameter; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFixed_parameter(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFixed_parameter(this); - } - } - - public final Fixed_parameterContext fixed_parameter() throws RecognitionException { - Fixed_parameterContext _localctx = new Fixed_parameterContext(_ctx, getState()); - enterRule(_localctx, 284, RULE_fixed_parameter); - int _la; - try { - setState(1850); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,213,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1843); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1842); - attributes(); - } - } - - setState(1846); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 54)) & ~0x3f) == 0 && ((1L << (_la - 54)) & ((1L << (IN - 54)) | (1L << (OUT - 54)) | (1L << (REF - 54)) | (1L << (THIS - 54)))) != 0)) { - { - setState(1845); - parameter_modifier(); - } - } - - setState(1848); - arg_declaration(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1849); - match(ARGLIST); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Parameter_modifierContext extends ParserRuleContext { - public TerminalNode REF() { return getToken(CSharpParser.REF, 0); } - public TerminalNode OUT() { return getToken(CSharpParser.OUT, 0); } - public TerminalNode IN() { return getToken(CSharpParser.IN, 0); } - public TerminalNode THIS() { return getToken(CSharpParser.THIS, 0); } - public Parameter_modifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_parameter_modifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterParameter_modifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitParameter_modifier(this); - } - } - - public final Parameter_modifierContext parameter_modifier() throws RecognitionException { - Parameter_modifierContext _localctx = new Parameter_modifierContext(_ctx, getState()); - enterRule(_localctx, 286, RULE_parameter_modifier); - try { - setState(1860); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,214,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1852); - match(REF); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1853); - match(OUT); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1854); - match(IN); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1855); - match(REF); - setState(1856); - match(THIS); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1857); - match(IN); - setState(1858); - match(THIS); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(1859); - match(THIS); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Parameter_arrayContext extends ParserRuleContext { - public TerminalNode PARAMS() { return getToken(CSharpParser.PARAMS, 0); } - public Array_typeContext array_type() { - return getRuleContext(Array_typeContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public Parameter_arrayContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_parameter_array; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterParameter_array(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitParameter_array(this); - } - } - - public final Parameter_arrayContext parameter_array() throws RecognitionException { - Parameter_arrayContext _localctx = new Parameter_arrayContext(_ctx, getState()); - enterRule(_localctx, 288, RULE_parameter_array); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1863); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1862); - attributes(); - } - } - - setState(1865); - match(PARAMS); - setState(1866); - array_type(); - setState(1867); - identifier(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Accessor_declarationsContext extends ParserRuleContext { - public AttributesContext attrs; - public Accessor_modifierContext mods; - public TerminalNode GET() { return getToken(CSharpParser.GET, 0); } - public Accessor_bodyContext accessor_body() { - return getRuleContext(Accessor_bodyContext.class,0); - } - public TerminalNode SET() { return getToken(CSharpParser.SET, 0); } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public Accessor_modifierContext accessor_modifier() { - return getRuleContext(Accessor_modifierContext.class,0); - } - public Set_accessor_declarationContext set_accessor_declaration() { - return getRuleContext(Set_accessor_declarationContext.class,0); - } - public Get_accessor_declarationContext get_accessor_declaration() { - return getRuleContext(Get_accessor_declarationContext.class,0); - } - public Accessor_declarationsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_accessor_declarations; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAccessor_declarations(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAccessor_declarations(this); - } - } - - public final Accessor_declarationsContext accessor_declarations() throws RecognitionException { - Accessor_declarationsContext _localctx = new Accessor_declarationsContext(_ctx, getState()); - enterRule(_localctx, 290, RULE_accessor_declarations); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1870); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1869); - ((Accessor_declarationsContext)_localctx).attrs = attributes(); - } - } - - setState(1873); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 57)) & ~0x3f) == 0 && ((1L << (_la - 57)) & ((1L << (INTERNAL - 57)) | (1L << (PRIVATE - 57)) | (1L << (PROTECTED - 57)))) != 0)) { - { - setState(1872); - ((Accessor_declarationsContext)_localctx).mods = accessor_modifier(); - } - } - - setState(1885); - _errHandler.sync(this); - switch (_input.LA(1)) { - case GET: - { - setState(1875); - match(GET); - setState(1876); - accessor_body(); - setState(1878); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==INTERNAL || ((((_la - 76)) & ~0x3f) == 0 && ((1L << (_la - 76)) & ((1L << (PRIVATE - 76)) | (1L << (PROTECTED - 76)) | (1L << (SET - 76)) | (1L << (OPEN_BRACKET - 76)))) != 0)) { - { - setState(1877); - set_accessor_declaration(); - } - } - - } - break; - case SET: - { - setState(1880); - match(SET); - setState(1881); - accessor_body(); - setState(1883); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==GET || _la==INTERNAL || ((((_la - 76)) & ~0x3f) == 0 && ((1L << (_la - 76)) & ((1L << (PRIVATE - 76)) | (1L << (PROTECTED - 76)) | (1L << (OPEN_BRACKET - 76)))) != 0)) { - { - setState(1882); - get_accessor_declaration(); - } - } - - } - break; - default: - throw new NoViableAltException(this); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Get_accessor_declarationContext extends ParserRuleContext { - public TerminalNode GET() { return getToken(CSharpParser.GET, 0); } - public Accessor_bodyContext accessor_body() { - return getRuleContext(Accessor_bodyContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public Accessor_modifierContext accessor_modifier() { - return getRuleContext(Accessor_modifierContext.class,0); - } - public Get_accessor_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_get_accessor_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterGet_accessor_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitGet_accessor_declaration(this); - } - } - - public final Get_accessor_declarationContext get_accessor_declaration() throws RecognitionException { - Get_accessor_declarationContext _localctx = new Get_accessor_declarationContext(_ctx, getState()); - enterRule(_localctx, 292, RULE_get_accessor_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1888); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1887); - attributes(); - } - } - - setState(1891); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 57)) & ~0x3f) == 0 && ((1L << (_la - 57)) & ((1L << (INTERNAL - 57)) | (1L << (PRIVATE - 57)) | (1L << (PROTECTED - 57)))) != 0)) { - { - setState(1890); - accessor_modifier(); - } - } - - setState(1893); - match(GET); - setState(1894); - accessor_body(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Set_accessor_declarationContext extends ParserRuleContext { - public TerminalNode SET() { return getToken(CSharpParser.SET, 0); } - public Accessor_bodyContext accessor_body() { - return getRuleContext(Accessor_bodyContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public Accessor_modifierContext accessor_modifier() { - return getRuleContext(Accessor_modifierContext.class,0); - } - public Set_accessor_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_set_accessor_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterSet_accessor_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitSet_accessor_declaration(this); - } - } - - public final Set_accessor_declarationContext set_accessor_declaration() throws RecognitionException { - Set_accessor_declarationContext _localctx = new Set_accessor_declarationContext(_ctx, getState()); - enterRule(_localctx, 294, RULE_set_accessor_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1897); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1896); - attributes(); - } - } - - setState(1900); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 57)) & ~0x3f) == 0 && ((1L << (_la - 57)) & ((1L << (INTERNAL - 57)) | (1L << (PRIVATE - 57)) | (1L << (PROTECTED - 57)))) != 0)) { - { - setState(1899); - accessor_modifier(); - } - } - - setState(1902); - match(SET); - setState(1903); - accessor_body(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Accessor_modifierContext extends ParserRuleContext { - public TerminalNode PROTECTED() { return getToken(CSharpParser.PROTECTED, 0); } - public TerminalNode INTERNAL() { return getToken(CSharpParser.INTERNAL, 0); } - public TerminalNode PRIVATE() { return getToken(CSharpParser.PRIVATE, 0); } - public Accessor_modifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_accessor_modifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAccessor_modifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAccessor_modifier(this); - } - } - - public final Accessor_modifierContext accessor_modifier() throws RecognitionException { - Accessor_modifierContext _localctx = new Accessor_modifierContext(_ctx, getState()); - enterRule(_localctx, 296, RULE_accessor_modifier); - try { - setState(1912); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,225,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1905); - match(PROTECTED); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1906); - match(INTERNAL); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1907); - match(PRIVATE); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1908); - match(PROTECTED); - setState(1909); - match(INTERNAL); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1910); - match(INTERNAL); - setState(1911); - match(PROTECTED); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Accessor_bodyContext extends ParserRuleContext { - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Accessor_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_accessor_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAccessor_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAccessor_body(this); - } - } - - public final Accessor_bodyContext accessor_body() throws RecognitionException { - Accessor_bodyContext _localctx = new Accessor_bodyContext(_ctx, getState()); - enterRule(_localctx, 298, RULE_accessor_body); - try { - setState(1916); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACE: - enterOuterAlt(_localctx, 1); - { - setState(1914); - block(); - } - break; - case SEMICOLON: - enterOuterAlt(_localctx, 2); - { - setState(1915); - match(SEMICOLON); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Event_accessor_declarationsContext extends ParserRuleContext { - public TerminalNode ADD() { return getToken(CSharpParser.ADD, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public Remove_accessor_declarationContext remove_accessor_declaration() { - return getRuleContext(Remove_accessor_declarationContext.class,0); - } - public TerminalNode REMOVE() { return getToken(CSharpParser.REMOVE, 0); } - public Add_accessor_declarationContext add_accessor_declaration() { - return getRuleContext(Add_accessor_declarationContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public Event_accessor_declarationsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_event_accessor_declarations; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterEvent_accessor_declarations(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitEvent_accessor_declarations(this); - } - } - - public final Event_accessor_declarationsContext event_accessor_declarations() throws RecognitionException { - Event_accessor_declarationsContext _localctx = new Event_accessor_declarationsContext(_ctx, getState()); - enterRule(_localctx, 300, RULE_event_accessor_declarations); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1919); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1918); - attributes(); - } - } - - setState(1929); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - { - setState(1921); - match(ADD); - setState(1922); - block(); - setState(1923); - remove_accessor_declaration(); - } - break; - case REMOVE: - { - setState(1925); - match(REMOVE); - setState(1926); - block(); - setState(1927); - add_accessor_declaration(); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Add_accessor_declarationContext extends ParserRuleContext { - public TerminalNode ADD() { return getToken(CSharpParser.ADD, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public Add_accessor_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_add_accessor_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAdd_accessor_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAdd_accessor_declaration(this); - } - } - - public final Add_accessor_declarationContext add_accessor_declaration() throws RecognitionException { - Add_accessor_declarationContext _localctx = new Add_accessor_declarationContext(_ctx, getState()); - enterRule(_localctx, 302, RULE_add_accessor_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1932); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1931); - attributes(); - } - } - - setState(1934); - match(ADD); - setState(1935); - block(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Remove_accessor_declarationContext extends ParserRuleContext { - public TerminalNode REMOVE() { return getToken(CSharpParser.REMOVE, 0); } - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public Remove_accessor_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_remove_accessor_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterRemove_accessor_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitRemove_accessor_declaration(this); - } - } - - public final Remove_accessor_declarationContext remove_accessor_declaration() throws RecognitionException { - Remove_accessor_declarationContext _localctx = new Remove_accessor_declarationContext(_ctx, getState()); - enterRule(_localctx, 304, RULE_remove_accessor_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1938); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1937); - attributes(); - } - } - - setState(1940); - match(REMOVE); - setState(1941); - block(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Overloadable_operatorContext extends ParserRuleContext { - public TerminalNode PLUS() { return getToken(CSharpParser.PLUS, 0); } - public TerminalNode MINUS() { return getToken(CSharpParser.MINUS, 0); } - public TerminalNode BANG() { return getToken(CSharpParser.BANG, 0); } - public TerminalNode TILDE() { return getToken(CSharpParser.TILDE, 0); } - public TerminalNode OP_INC() { return getToken(CSharpParser.OP_INC, 0); } - public TerminalNode OP_DEC() { return getToken(CSharpParser.OP_DEC, 0); } - public TerminalNode TRUE() { return getToken(CSharpParser.TRUE, 0); } - public TerminalNode FALSE() { return getToken(CSharpParser.FALSE, 0); } - public TerminalNode STAR() { return getToken(CSharpParser.STAR, 0); } - public TerminalNode DIV() { return getToken(CSharpParser.DIV, 0); } - public TerminalNode PERCENT() { return getToken(CSharpParser.PERCENT, 0); } - public TerminalNode AMP() { return getToken(CSharpParser.AMP, 0); } - public TerminalNode BITWISE_OR() { return getToken(CSharpParser.BITWISE_OR, 0); } - public TerminalNode CARET() { return getToken(CSharpParser.CARET, 0); } - public TerminalNode OP_LEFT_SHIFT() { return getToken(CSharpParser.OP_LEFT_SHIFT, 0); } - public Right_shiftContext right_shift() { - return getRuleContext(Right_shiftContext.class,0); - } - public TerminalNode OP_EQ() { return getToken(CSharpParser.OP_EQ, 0); } - public TerminalNode OP_NE() { return getToken(CSharpParser.OP_NE, 0); } - public TerminalNode GT() { return getToken(CSharpParser.GT, 0); } - public TerminalNode LT() { return getToken(CSharpParser.LT, 0); } - public TerminalNode OP_GE() { return getToken(CSharpParser.OP_GE, 0); } - public TerminalNode OP_LE() { return getToken(CSharpParser.OP_LE, 0); } - public Overloadable_operatorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_overloadable_operator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterOverloadable_operator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitOverloadable_operator(this); - } - } - - public final Overloadable_operatorContext overloadable_operator() throws RecognitionException { - Overloadable_operatorContext _localctx = new Overloadable_operatorContext(_ctx, getState()); - enterRule(_localctx, 306, RULE_overloadable_operator); - try { - setState(1965); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,231,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(1943); - match(PLUS); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(1944); - match(MINUS); - } - break; - case 3: - enterOuterAlt(_localctx, 3); - { - setState(1945); - match(BANG); - } - break; - case 4: - enterOuterAlt(_localctx, 4); - { - setState(1946); - match(TILDE); - } - break; - case 5: - enterOuterAlt(_localctx, 5); - { - setState(1947); - match(OP_INC); - } - break; - case 6: - enterOuterAlt(_localctx, 6); - { - setState(1948); - match(OP_DEC); - } - break; - case 7: - enterOuterAlt(_localctx, 7); - { - setState(1949); - match(TRUE); - } - break; - case 8: - enterOuterAlt(_localctx, 8); - { - setState(1950); - match(FALSE); - } - break; - case 9: - enterOuterAlt(_localctx, 9); - { - setState(1951); - match(STAR); - } - break; - case 10: - enterOuterAlt(_localctx, 10); - { - setState(1952); - match(DIV); - } - break; - case 11: - enterOuterAlt(_localctx, 11); - { - setState(1953); - match(PERCENT); - } - break; - case 12: - enterOuterAlt(_localctx, 12); - { - setState(1954); - match(AMP); - } - break; - case 13: - enterOuterAlt(_localctx, 13); - { - setState(1955); - match(BITWISE_OR); - } - break; - case 14: - enterOuterAlt(_localctx, 14); - { - setState(1956); - match(CARET); - } - break; - case 15: - enterOuterAlt(_localctx, 15); - { - setState(1957); - match(OP_LEFT_SHIFT); - } - break; - case 16: - enterOuterAlt(_localctx, 16); - { - setState(1958); - right_shift(); - } - break; - case 17: - enterOuterAlt(_localctx, 17); - { - setState(1959); - match(OP_EQ); - } - break; - case 18: - enterOuterAlt(_localctx, 18); - { - setState(1960); - match(OP_NE); - } - break; - case 19: - enterOuterAlt(_localctx, 19); - { - setState(1961); - match(GT); - } - break; - case 20: - enterOuterAlt(_localctx, 20); - { - setState(1962); - match(LT); - } - break; - case 21: - enterOuterAlt(_localctx, 21); - { - setState(1963); - match(OP_GE); - } - break; - case 22: - enterOuterAlt(_localctx, 22); - { - setState(1964); - match(OP_LE); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Conversion_operator_declaratorContext extends ParserRuleContext { - public TerminalNode OPERATOR() { return getToken(CSharpParser.OPERATOR, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public Arg_declarationContext arg_declaration() { - return getRuleContext(Arg_declarationContext.class,0); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public TerminalNode IMPLICIT() { return getToken(CSharpParser.IMPLICIT, 0); } - public TerminalNode EXPLICIT() { return getToken(CSharpParser.EXPLICIT, 0); } - public Conversion_operator_declaratorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_conversion_operator_declarator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterConversion_operator_declarator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitConversion_operator_declarator(this); - } - } - - public final Conversion_operator_declaratorContext conversion_operator_declarator() throws RecognitionException { - Conversion_operator_declaratorContext _localctx = new Conversion_operator_declaratorContext(_ctx, getState()); - enterRule(_localctx, 308, RULE_conversion_operator_declarator); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1967); - _la = _input.LA(1); - if ( !(_la==EXPLICIT || _la==IMPLICIT) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(1968); - match(OPERATOR); - setState(1969); - type_(); - setState(1970); - match(OPEN_PARENS); - setState(1971); - arg_declaration(); - setState(1972); - match(CLOSE_PARENS); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Constructor_initializerContext extends ParserRuleContext { - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public TerminalNode BASE() { return getToken(CSharpParser.BASE, 0); } - public TerminalNode THIS() { return getToken(CSharpParser.THIS, 0); } - public Argument_listContext argument_list() { - return getRuleContext(Argument_listContext.class,0); - } - public Constructor_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constructor_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterConstructor_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitConstructor_initializer(this); - } - } - - public final Constructor_initializerContext constructor_initializer() throws RecognitionException { - Constructor_initializerContext _localctx = new Constructor_initializerContext(_ctx, getState()); - enterRule(_localctx, 310, RULE_constructor_initializer); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1974); - match(COLON); - setState(1975); - _la = _input.LA(1); - if ( !(_la==BASE || _la==THIS) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - setState(1976); - match(OPEN_PARENS); - setState(1978); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << IN) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (OUT - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (VOID - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(1977); - argument_list(); - } - } - - setState(1980); - match(CLOSE_PARENS); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class BodyContext extends ParserRuleContext { - public BlockContext block() { - return getRuleContext(BlockContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public BodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterBody(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitBody(this); - } - } - - public final BodyContext body() throws RecognitionException { - BodyContext _localctx = new BodyContext(_ctx, getState()); - enterRule(_localctx, 312, RULE_body); - try { - setState(1984); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACE: - enterOuterAlt(_localctx, 1); - { - setState(1982); - block(); - } - break; - case SEMICOLON: - enterOuterAlt(_localctx, 2); - { - setState(1983); - match(SEMICOLON); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Struct_interfacesContext extends ParserRuleContext { - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public Interface_type_listContext interface_type_list() { - return getRuleContext(Interface_type_listContext.class,0); - } - public Struct_interfacesContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_struct_interfaces; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterStruct_interfaces(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitStruct_interfaces(this); - } - } - - public final Struct_interfacesContext struct_interfaces() throws RecognitionException { - Struct_interfacesContext _localctx = new Struct_interfacesContext(_ctx, getState()); - enterRule(_localctx, 314, RULE_struct_interfaces); - try { - enterOuterAlt(_localctx, 1); - { - setState(1986); - match(COLON); - setState(1987); - interface_type_list(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Struct_bodyContext extends ParserRuleContext { - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public List struct_member_declaration() { - return getRuleContexts(Struct_member_declarationContext.class); - } - public Struct_member_declarationContext struct_member_declaration(int i) { - return getRuleContext(Struct_member_declarationContext.class,i); - } - public Struct_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_struct_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterStruct_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitStruct_body(this); - } - } - - public final Struct_bodyContext struct_body() throws RecognitionException { - Struct_bodyContext _localctx = new Struct_bodyContext(_ctx, getState()); - enterRule(_localctx, 316, RULE_struct_body); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1989); - match(OPEN_BRACE); - setState(1993); - _errHandler.sync(this); - _la = _input.LA(1); - while (((((_la - 9)) & ~0x3f) == 0 && ((1L << (_la - 9)) & ((1L << (ABSTRACT - 9)) | (1L << (ADD - 9)) | (1L << (ALIAS - 9)) | (1L << (ARGLIST - 9)) | (1L << (ASCENDING - 9)) | (1L << (ASYNC - 9)) | (1L << (AWAIT - 9)) | (1L << (BOOL - 9)) | (1L << (BY - 9)) | (1L << (BYTE - 9)) | (1L << (CHAR - 9)) | (1L << (CLASS - 9)) | (1L << (CONST - 9)) | (1L << (DECIMAL - 9)) | (1L << (DELEGATE - 9)) | (1L << (DESCENDING - 9)) | (1L << (DOUBLE - 9)) | (1L << (DYNAMIC - 9)) | (1L << (ENUM - 9)) | (1L << (EQUALS - 9)) | (1L << (EVENT - 9)) | (1L << (EXPLICIT - 9)) | (1L << (EXTERN - 9)) | (1L << (FIXED - 9)) | (1L << (FLOAT - 9)) | (1L << (FROM - 9)) | (1L << (GET - 9)) | (1L << (GROUP - 9)) | (1L << (IMPLICIT - 9)) | (1L << (INT - 9)) | (1L << (INTERFACE - 9)) | (1L << (INTERNAL - 9)) | (1L << (INTO - 9)) | (1L << (JOIN - 9)) | (1L << (LET - 9)) | (1L << (LONG - 9)) | (1L << (NAMEOF - 9)) | (1L << (NEW - 9)) | (1L << (OBJECT - 9)) | (1L << (ON - 9)) | (1L << (ORDERBY - 9)))) != 0) || ((((_la - 73)) & ~0x3f) == 0 && ((1L << (_la - 73)) & ((1L << (OVERRIDE - 73)) | (1L << (PARTIAL - 73)) | (1L << (PRIVATE - 73)) | (1L << (PROTECTED - 73)) | (1L << (PUBLIC - 73)) | (1L << (READONLY - 73)) | (1L << (REF - 73)) | (1L << (REMOVE - 73)) | (1L << (SBYTE - 73)) | (1L << (SEALED - 73)) | (1L << (SELECT - 73)) | (1L << (SET - 73)) | (1L << (SHORT - 73)) | (1L << (STATIC - 73)) | (1L << (STRING - 73)) | (1L << (STRUCT - 73)) | (1L << (UINT - 73)) | (1L << (ULONG - 73)) | (1L << (UNMANAGED - 73)) | (1L << (UNSAFE - 73)) | (1L << (USHORT - 73)) | (1L << (VAR - 73)) | (1L << (VIRTUAL - 73)) | (1L << (VOID - 73)) | (1L << (VOLATILE - 73)) | (1L << (WHEN - 73)) | (1L << (WHERE - 73)) | (1L << (YIELD - 73)) | (1L << (IDENTIFIER - 73)) | (1L << (OPEN_BRACKET - 73)) | (1L << (OPEN_PARENS - 73)))) != 0)) { - { - { - setState(1990); - struct_member_declaration(); - } - } - setState(1995); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(1996); - match(CLOSE_BRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Struct_member_declarationContext extends ParserRuleContext { - public Common_member_declarationContext common_member_declaration() { - return getRuleContext(Common_member_declarationContext.class,0); - } - public TerminalNode FIXED() { return getToken(CSharpParser.FIXED, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public All_member_modifiersContext all_member_modifiers() { - return getRuleContext(All_member_modifiersContext.class,0); - } - public List fixed_size_buffer_declarator() { - return getRuleContexts(Fixed_size_buffer_declaratorContext.class); - } - public Fixed_size_buffer_declaratorContext fixed_size_buffer_declarator(int i) { - return getRuleContext(Fixed_size_buffer_declaratorContext.class,i); - } - public Struct_member_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_struct_member_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterStruct_member_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitStruct_member_declaration(this); - } - } - - public final Struct_member_declarationContext struct_member_declaration() throws RecognitionException { - Struct_member_declarationContext _localctx = new Struct_member_declarationContext(_ctx, getState()); - enterRule(_localctx, 318, RULE_struct_member_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(1999); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(1998); - attributes(); - } - } - - setState(2002); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,236,_ctx) ) { - case 1: - { - setState(2001); - all_member_modifiers(); - } - break; - } - setState(2014); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CLASS: - case CONST: - case DECIMAL: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case ENUM: - case EQUALS: - case EVENT: - case EXPLICIT: - case FLOAT: - case FROM: - case GET: - case GROUP: - case IMPLICIT: - case INT: - case INTERFACE: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case READONLY: - case REF: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case STRING: - case STRUCT: - case UINT: - case ULONG: - case UNMANAGED: - case USHORT: - case VAR: - case VOID: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case OPEN_PARENS: - { - setState(2004); - common_member_declaration(); - } - break; - case FIXED: - { - setState(2005); - match(FIXED); - setState(2006); - type_(); - setState(2008); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(2007); - fixed_size_buffer_declarator(); - } - } - setState(2010); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( (((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BY) | (1L << DESCENDING) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INTO) | (1L << JOIN) | (1L << LET))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REMOVE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (UNMANAGED - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)))) != 0) ); - setState(2012); - match(SEMICOLON); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Array_typeContext extends ParserRuleContext { - public Base_typeContext base_type() { - return getRuleContext(Base_typeContext.class,0); - } - public List rank_specifier() { - return getRuleContexts(Rank_specifierContext.class); - } - public Rank_specifierContext rank_specifier(int i) { - return getRuleContext(Rank_specifierContext.class,i); - } - public List STAR() { return getTokens(CSharpParser.STAR); } - public TerminalNode STAR(int i) { - return getToken(CSharpParser.STAR, i); - } - public List INTERR() { return getTokens(CSharpParser.INTERR); } - public TerminalNode INTERR(int i) { - return getToken(CSharpParser.INTERR, i); - } - public Array_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_array_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterArray_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitArray_type(this); - } - } - - public final Array_typeContext array_type() throws RecognitionException { - Array_typeContext _localctx = new Array_typeContext(_ctx, getState()); - enterRule(_localctx, 320, RULE_array_type); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2016); - base_type(); - setState(2024); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(2020); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==STAR || _la==INTERR) { - { - { - setState(2017); - _la = _input.LA(1); - if ( !(_la==STAR || _la==INTERR) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - setState(2022); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2023); - rank_specifier(); - } - } - setState(2026); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( ((((_la - 127)) & ~0x3f) == 0 && ((1L << (_la - 127)) & ((1L << (OPEN_BRACKET - 127)) | (1L << (STAR - 127)) | (1L << (INTERR - 127)))) != 0) ); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Rank_specifierContext extends ParserRuleContext { - public TerminalNode OPEN_BRACKET() { return getToken(CSharpParser.OPEN_BRACKET, 0); } - public TerminalNode CLOSE_BRACKET() { return getToken(CSharpParser.CLOSE_BRACKET, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Rank_specifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_rank_specifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterRank_specifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitRank_specifier(this); - } - } - - public final Rank_specifierContext rank_specifier() throws RecognitionException { - Rank_specifierContext _localctx = new Rank_specifierContext(_ctx, getState()); - enterRule(_localctx, 322, RULE_rank_specifier); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2028); - match(OPEN_BRACKET); - setState(2032); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(2029); - match(COMMA); - } - } - setState(2034); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2035); - match(CLOSE_BRACKET); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Array_initializerContext extends ParserRuleContext { - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public List variable_initializer() { - return getRuleContexts(Variable_initializerContext.class); - } - public Variable_initializerContext variable_initializer(int i) { - return getRuleContext(Variable_initializerContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Array_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_array_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterArray_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitArray_initializer(this); - } - } - - public final Array_initializerContext array_initializer() throws RecognitionException { - Array_initializerContext _localctx = new Array_initializerContext(_ctx, getState()); - enterRule(_localctx, 324, RULE_array_initializer); - int _la; - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(2037); - match(OPEN_BRACE); - setState(2049); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)) | (1L << (OPEN_BRACE - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(2038); - variable_initializer(); - setState(2043); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,242,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(2039); - match(COMMA); - setState(2040); - variable_initializer(); - } - } - } - setState(2045); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,242,_ctx); - } - setState(2047); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(2046); - match(COMMA); - } - } - - } - } - - setState(2051); - match(CLOSE_BRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Variant_type_parameter_listContext extends ParserRuleContext { - public TerminalNode LT() { return getToken(CSharpParser.LT, 0); } - public List variant_type_parameter() { - return getRuleContexts(Variant_type_parameterContext.class); - } - public Variant_type_parameterContext variant_type_parameter(int i) { - return getRuleContext(Variant_type_parameterContext.class,i); - } - public TerminalNode GT() { return getToken(CSharpParser.GT, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Variant_type_parameter_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variant_type_parameter_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterVariant_type_parameter_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitVariant_type_parameter_list(this); - } - } - - public final Variant_type_parameter_listContext variant_type_parameter_list() throws RecognitionException { - Variant_type_parameter_listContext _localctx = new Variant_type_parameter_listContext(_ctx, getState()); - enterRule(_localctx, 326, RULE_variant_type_parameter_list); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2053); - match(LT); - setState(2054); - variant_type_parameter(); - setState(2059); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(2055); - match(COMMA); - setState(2056); - variant_type_parameter(); - } - } - setState(2061); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2062); - match(GT); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Variant_type_parameterContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public Variance_annotationContext variance_annotation() { - return getRuleContext(Variance_annotationContext.class,0); - } - public Variant_type_parameterContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variant_type_parameter; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterVariant_type_parameter(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitVariant_type_parameter(this); - } - } - - public final Variant_type_parameterContext variant_type_parameter() throws RecognitionException { - Variant_type_parameterContext _localctx = new Variant_type_parameterContext(_ctx, getState()); - enterRule(_localctx, 328, RULE_variant_type_parameter); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2065); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(2064); - attributes(); - } - } - - setState(2068); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==IN || _la==OUT) { - { - setState(2067); - variance_annotation(); - } - } - - setState(2070); - identifier(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Variance_annotationContext extends ParserRuleContext { - public TerminalNode IN() { return getToken(CSharpParser.IN, 0); } - public TerminalNode OUT() { return getToken(CSharpParser.OUT, 0); } - public Variance_annotationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_variance_annotation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterVariance_annotation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitVariance_annotation(this); - } - } - - public final Variance_annotationContext variance_annotation() throws RecognitionException { - Variance_annotationContext _localctx = new Variance_annotationContext(_ctx, getState()); - enterRule(_localctx, 330, RULE_variance_annotation); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2072); - _la = _input.LA(1); - if ( !(_la==IN || _la==OUT) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Interface_baseContext extends ParserRuleContext { - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public Interface_type_listContext interface_type_list() { - return getRuleContext(Interface_type_listContext.class,0); - } - public Interface_baseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interface_base; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInterface_base(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInterface_base(this); - } - } - - public final Interface_baseContext interface_base() throws RecognitionException { - Interface_baseContext _localctx = new Interface_baseContext(_ctx, getState()); - enterRule(_localctx, 332, RULE_interface_base); - try { - enterOuterAlt(_localctx, 1); - { - setState(2074); - match(COLON); - setState(2075); - interface_type_list(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Interface_bodyContext extends ParserRuleContext { - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public List interface_member_declaration() { - return getRuleContexts(Interface_member_declarationContext.class); - } - public Interface_member_declarationContext interface_member_declaration(int i) { - return getRuleContext(Interface_member_declarationContext.class,i); - } - public Interface_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interface_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInterface_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInterface_body(this); - } - } - - public final Interface_bodyContext interface_body() throws RecognitionException { - Interface_bodyContext _localctx = new Interface_bodyContext(_ctx, getState()); - enterRule(_localctx, 334, RULE_interface_body); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2077); - match(OPEN_BRACE); - setState(2081); - _errHandler.sync(this); - _la = _input.LA(1); - while (((((_la - 10)) & ~0x3f) == 0 && ((1L << (_la - 10)) & ((1L << (ADD - 10)) | (1L << (ALIAS - 10)) | (1L << (ARGLIST - 10)) | (1L << (ASCENDING - 10)) | (1L << (ASYNC - 10)) | (1L << (AWAIT - 10)) | (1L << (BOOL - 10)) | (1L << (BY - 10)) | (1L << (BYTE - 10)) | (1L << (CHAR - 10)) | (1L << (DECIMAL - 10)) | (1L << (DESCENDING - 10)) | (1L << (DOUBLE - 10)) | (1L << (DYNAMIC - 10)) | (1L << (EQUALS - 10)) | (1L << (EVENT - 10)) | (1L << (FLOAT - 10)) | (1L << (FROM - 10)) | (1L << (GET - 10)) | (1L << (GROUP - 10)) | (1L << (INT - 10)) | (1L << (INTO - 10)) | (1L << (JOIN - 10)) | (1L << (LET - 10)) | (1L << (LONG - 10)) | (1L << (NAMEOF - 10)) | (1L << (NEW - 10)) | (1L << (OBJECT - 10)) | (1L << (ON - 10)) | (1L << (ORDERBY - 10)))) != 0) || ((((_la - 75)) & ~0x3f) == 0 && ((1L << (_la - 75)) & ((1L << (PARTIAL - 75)) | (1L << (READONLY - 75)) | (1L << (REF - 75)) | (1L << (REMOVE - 75)) | (1L << (SBYTE - 75)) | (1L << (SELECT - 75)) | (1L << (SET - 75)) | (1L << (SHORT - 75)) | (1L << (STRING - 75)) | (1L << (UINT - 75)) | (1L << (ULONG - 75)) | (1L << (UNMANAGED - 75)) | (1L << (UNSAFE - 75)) | (1L << (USHORT - 75)) | (1L << (VAR - 75)) | (1L << (VOID - 75)) | (1L << (WHEN - 75)) | (1L << (WHERE - 75)) | (1L << (YIELD - 75)) | (1L << (IDENTIFIER - 75)) | (1L << (OPEN_BRACKET - 75)) | (1L << (OPEN_PARENS - 75)))) != 0)) { - { - { - setState(2078); - interface_member_declaration(); - } - } - setState(2083); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2084); - match(CLOSE_BRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Interface_member_declarationContext extends ParserRuleContext { - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public TerminalNode VOID() { return getToken(CSharpParser.VOID, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public TerminalNode EVENT() { return getToken(CSharpParser.EVENT, 0); } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public TerminalNode NEW() { return getToken(CSharpParser.NEW, 0); } - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public Interface_accessorsContext interface_accessors() { - return getRuleContext(Interface_accessorsContext.class,0); - } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public TerminalNode THIS() { return getToken(CSharpParser.THIS, 0); } - public TerminalNode OPEN_BRACKET() { return getToken(CSharpParser.OPEN_BRACKET, 0); } - public Formal_parameter_listContext formal_parameter_list() { - return getRuleContext(Formal_parameter_listContext.class,0); - } - public TerminalNode CLOSE_BRACKET() { return getToken(CSharpParser.CLOSE_BRACKET, 0); } - public TerminalNode UNSAFE() { return getToken(CSharpParser.UNSAFE, 0); } - public TerminalNode REF() { return getToken(CSharpParser.REF, 0); } - public TerminalNode READONLY() { return getToken(CSharpParser.READONLY, 0); } - public Type_parameter_listContext type_parameter_list() { - return getRuleContext(Type_parameter_listContext.class,0); - } - public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { - return getRuleContext(Type_parameter_constraints_clausesContext.class,0); - } - public Interface_member_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interface_member_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInterface_member_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInterface_member_declaration(this); - } - } - - public final Interface_member_declarationContext interface_member_declaration() throws RecognitionException { - Interface_member_declarationContext _localctx = new Interface_member_declarationContext(_ctx, getState()); - enterRule(_localctx, 336, RULE_interface_member_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2087); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(2086); - attributes(); - } - } - - setState(2090); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==NEW) { - { - setState(2089); - match(NEW); - } - } - - setState(2155); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,261,_ctx) ) { - case 1: - { - setState(2093); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==UNSAFE) { - { - setState(2092); - match(UNSAFE); - } - } - - setState(2100); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,252,_ctx) ) { - case 1: - { - setState(2095); - match(REF); - } - break; - case 2: - { - setState(2096); - match(REF); - setState(2097); - match(READONLY); - } - break; - case 3: - { - setState(2098); - match(READONLY); - setState(2099); - match(REF); - } - break; - } - setState(2102); - type_(); - setState(2130); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,256,_ctx) ) { - case 1: - { - setState(2103); - identifier(); - setState(2105); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2104); - type_parameter_list(); - } - } - - setState(2107); - match(OPEN_PARENS); - setState(2109); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 10)) & ~0x3f) == 0 && ((1L << (_la - 10)) & ((1L << (ADD - 10)) | (1L << (ALIAS - 10)) | (1L << (ARGLIST - 10)) | (1L << (ASCENDING - 10)) | (1L << (ASYNC - 10)) | (1L << (AWAIT - 10)) | (1L << (BOOL - 10)) | (1L << (BY - 10)) | (1L << (BYTE - 10)) | (1L << (CHAR - 10)) | (1L << (DECIMAL - 10)) | (1L << (DESCENDING - 10)) | (1L << (DOUBLE - 10)) | (1L << (DYNAMIC - 10)) | (1L << (EQUALS - 10)) | (1L << (FLOAT - 10)) | (1L << (FROM - 10)) | (1L << (GET - 10)) | (1L << (GROUP - 10)) | (1L << (IN - 10)) | (1L << (INT - 10)) | (1L << (INTO - 10)) | (1L << (JOIN - 10)) | (1L << (LET - 10)) | (1L << (LONG - 10)) | (1L << (NAMEOF - 10)) | (1L << (OBJECT - 10)) | (1L << (ON - 10)) | (1L << (ORDERBY - 10)) | (1L << (OUT - 10)))) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & ((1L << (PARAMS - 74)) | (1L << (PARTIAL - 74)) | (1L << (REF - 74)) | (1L << (REMOVE - 74)) | (1L << (SBYTE - 74)) | (1L << (SELECT - 74)) | (1L << (SET - 74)) | (1L << (SHORT - 74)) | (1L << (STRING - 74)) | (1L << (THIS - 74)) | (1L << (UINT - 74)) | (1L << (ULONG - 74)) | (1L << (UNMANAGED - 74)) | (1L << (USHORT - 74)) | (1L << (VAR - 74)) | (1L << (VOID - 74)) | (1L << (WHEN - 74)) | (1L << (WHERE - 74)) | (1L << (YIELD - 74)) | (1L << (IDENTIFIER - 74)) | (1L << (OPEN_BRACKET - 74)) | (1L << (OPEN_PARENS - 74)))) != 0)) { - { - setState(2108); - formal_parameter_list(); - } - } - - setState(2111); - match(CLOSE_PARENS); - setState(2113); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHERE) { - { - setState(2112); - type_parameter_constraints_clauses(); - } - } - - setState(2115); - match(SEMICOLON); - } - break; - case 2: - { - setState(2117); - identifier(); - setState(2118); - match(OPEN_BRACE); - setState(2119); - interface_accessors(); - setState(2120); - match(CLOSE_BRACE); - } - break; - case 3: - { - setState(2122); - match(THIS); - setState(2123); - match(OPEN_BRACKET); - setState(2124); - formal_parameter_list(); - setState(2125); - match(CLOSE_BRACKET); - setState(2126); - match(OPEN_BRACE); - setState(2127); - interface_accessors(); - setState(2128); - match(CLOSE_BRACE); - } - break; - } - } - break; - case 2: - { - setState(2133); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==UNSAFE) { - { - setState(2132); - match(UNSAFE); - } - } - - setState(2135); - match(VOID); - setState(2136); - identifier(); - setState(2138); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2137); - type_parameter_list(); - } - } - - setState(2140); - match(OPEN_PARENS); - setState(2142); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 10)) & ~0x3f) == 0 && ((1L << (_la - 10)) & ((1L << (ADD - 10)) | (1L << (ALIAS - 10)) | (1L << (ARGLIST - 10)) | (1L << (ASCENDING - 10)) | (1L << (ASYNC - 10)) | (1L << (AWAIT - 10)) | (1L << (BOOL - 10)) | (1L << (BY - 10)) | (1L << (BYTE - 10)) | (1L << (CHAR - 10)) | (1L << (DECIMAL - 10)) | (1L << (DESCENDING - 10)) | (1L << (DOUBLE - 10)) | (1L << (DYNAMIC - 10)) | (1L << (EQUALS - 10)) | (1L << (FLOAT - 10)) | (1L << (FROM - 10)) | (1L << (GET - 10)) | (1L << (GROUP - 10)) | (1L << (IN - 10)) | (1L << (INT - 10)) | (1L << (INTO - 10)) | (1L << (JOIN - 10)) | (1L << (LET - 10)) | (1L << (LONG - 10)) | (1L << (NAMEOF - 10)) | (1L << (OBJECT - 10)) | (1L << (ON - 10)) | (1L << (ORDERBY - 10)) | (1L << (OUT - 10)))) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & ((1L << (PARAMS - 74)) | (1L << (PARTIAL - 74)) | (1L << (REF - 74)) | (1L << (REMOVE - 74)) | (1L << (SBYTE - 74)) | (1L << (SELECT - 74)) | (1L << (SET - 74)) | (1L << (SHORT - 74)) | (1L << (STRING - 74)) | (1L << (THIS - 74)) | (1L << (UINT - 74)) | (1L << (ULONG - 74)) | (1L << (UNMANAGED - 74)) | (1L << (USHORT - 74)) | (1L << (VAR - 74)) | (1L << (VOID - 74)) | (1L << (WHEN - 74)) | (1L << (WHERE - 74)) | (1L << (YIELD - 74)) | (1L << (IDENTIFIER - 74)) | (1L << (OPEN_BRACKET - 74)) | (1L << (OPEN_PARENS - 74)))) != 0)) { - { - setState(2141); - formal_parameter_list(); - } - } - - setState(2144); - match(CLOSE_PARENS); - setState(2146); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHERE) { - { - setState(2145); - type_parameter_constraints_clauses(); - } - } - - setState(2148); - match(SEMICOLON); - } - break; - case 3: - { - setState(2150); - match(EVENT); - setState(2151); - type_(); - setState(2152); - identifier(); - setState(2153); - match(SEMICOLON); - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Interface_accessorsContext extends ParserRuleContext { - public TerminalNode GET() { return getToken(CSharpParser.GET, 0); } - public List SEMICOLON() { return getTokens(CSharpParser.SEMICOLON); } - public TerminalNode SEMICOLON(int i) { - return getToken(CSharpParser.SEMICOLON, i); - } - public TerminalNode SET() { return getToken(CSharpParser.SET, 0); } - public List attributes() { - return getRuleContexts(AttributesContext.class); - } - public AttributesContext attributes(int i) { - return getRuleContext(AttributesContext.class,i); - } - public Interface_accessorsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interface_accessors; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInterface_accessors(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInterface_accessors(this); - } - } - - public final Interface_accessorsContext interface_accessors() throws RecognitionException { - Interface_accessorsContext _localctx = new Interface_accessorsContext(_ctx, getState()); - enterRule(_localctx, 338, RULE_interface_accessors); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2158); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(2157); - attributes(); - } - } - - setState(2178); - _errHandler.sync(this); - switch (_input.LA(1)) { - case GET: - { - setState(2160); - match(GET); - setState(2161); - match(SEMICOLON); - setState(2167); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==SET || _la==OPEN_BRACKET) { - { - setState(2163); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(2162); - attributes(); - } - } - - setState(2165); - match(SET); - setState(2166); - match(SEMICOLON); - } - } - - } - break; - case SET: - { - setState(2169); - match(SET); - setState(2170); - match(SEMICOLON); - setState(2176); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==GET || _la==OPEN_BRACKET) { - { - setState(2172); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(2171); - attributes(); - } - } - - setState(2174); - match(GET); - setState(2175); - match(SEMICOLON); - } - } - - } - break; - default: - throw new NoViableAltException(this); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Enum_baseContext extends ParserRuleContext { - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public Enum_baseContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enum_base; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterEnum_base(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitEnum_base(this); - } - } - - public final Enum_baseContext enum_base() throws RecognitionException { - Enum_baseContext _localctx = new Enum_baseContext(_ctx, getState()); - enterRule(_localctx, 340, RULE_enum_base); - try { - enterOuterAlt(_localctx, 1); - { - setState(2180); - match(COLON); - setState(2181); - type_(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Enum_bodyContext extends ParserRuleContext { - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public List enum_member_declaration() { - return getRuleContexts(Enum_member_declarationContext.class); - } - public Enum_member_declarationContext enum_member_declaration(int i) { - return getRuleContext(Enum_member_declarationContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Enum_bodyContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enum_body; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterEnum_body(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitEnum_body(this); - } - } - - public final Enum_bodyContext enum_body() throws RecognitionException { - Enum_bodyContext _localctx = new Enum_bodyContext(_ctx, getState()); - enterRule(_localctx, 342, RULE_enum_body); - int _la; - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(2183); - match(OPEN_BRACE); - setState(2195); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BY) | (1L << DESCENDING) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INTO) | (1L << JOIN) | (1L << LET))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REMOVE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (UNMANAGED - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (OPEN_BRACKET - 64)))) != 0)) { - { - setState(2184); - enum_member_declaration(); - setState(2189); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,268,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(2185); - match(COMMA); - setState(2186); - enum_member_declaration(); - } - } - } - setState(2191); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,268,_ctx); - } - setState(2193); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(2192); - match(COMMA); - } - } - - } - } - - setState(2197); - match(CLOSE_BRACE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Enum_member_declarationContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public AttributesContext attributes() { - return getRuleContext(AttributesContext.class,0); - } - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Enum_member_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enum_member_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterEnum_member_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitEnum_member_declaration(this); - } - } - - public final Enum_member_declarationContext enum_member_declaration() throws RecognitionException { - Enum_member_declarationContext _localctx = new Enum_member_declarationContext(_ctx, getState()); - enterRule(_localctx, 344, RULE_enum_member_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2200); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACKET) { - { - setState(2199); - attributes(); - } - } - - setState(2202); - identifier(); - setState(2205); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ASSIGNMENT) { - { - setState(2203); - match(ASSIGNMENT); - setState(2204); - expression(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Global_attribute_sectionContext extends ParserRuleContext { - public TerminalNode OPEN_BRACKET() { return getToken(CSharpParser.OPEN_BRACKET, 0); } - public Global_attribute_targetContext global_attribute_target() { - return getRuleContext(Global_attribute_targetContext.class,0); - } - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public Attribute_listContext attribute_list() { - return getRuleContext(Attribute_listContext.class,0); - } - public TerminalNode CLOSE_BRACKET() { return getToken(CSharpParser.CLOSE_BRACKET, 0); } - public TerminalNode COMMA() { return getToken(CSharpParser.COMMA, 0); } - public Global_attribute_sectionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_global_attribute_section; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterGlobal_attribute_section(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitGlobal_attribute_section(this); - } - } - - public final Global_attribute_sectionContext global_attribute_section() throws RecognitionException { - Global_attribute_sectionContext _localctx = new Global_attribute_sectionContext(_ctx, getState()); - enterRule(_localctx, 346, RULE_global_attribute_section); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2207); - match(OPEN_BRACKET); - setState(2208); - global_attribute_target(); - setState(2209); - match(COLON); - setState(2210); - attribute_list(); - setState(2212); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(2211); - match(COMMA); - } - } - - setState(2214); - match(CLOSE_BRACKET); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Global_attribute_targetContext extends ParserRuleContext { - public KeywordContext keyword() { - return getRuleContext(KeywordContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Global_attribute_targetContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_global_attribute_target; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterGlobal_attribute_target(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitGlobal_attribute_target(this); - } - } - - public final Global_attribute_targetContext global_attribute_target() throws RecognitionException { - Global_attribute_targetContext _localctx = new Global_attribute_targetContext(_ctx, getState()); - enterRule(_localctx, 348, RULE_global_attribute_target); - try { - setState(2218); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,274,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2216); - keyword(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2217); - identifier(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class AttributesContext extends ParserRuleContext { - public List attribute_section() { - return getRuleContexts(Attribute_sectionContext.class); - } - public Attribute_sectionContext attribute_section(int i) { - return getRuleContext(Attribute_sectionContext.class,i); - } - public AttributesContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_attributes; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAttributes(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAttributes(this); - } - } - - public final AttributesContext attributes() throws RecognitionException { - AttributesContext _localctx = new AttributesContext(_ctx, getState()); - enterRule(_localctx, 350, RULE_attributes); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2221); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(2220); - attribute_section(); - } - } - setState(2223); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( _la==OPEN_BRACKET ); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Attribute_sectionContext extends ParserRuleContext { - public TerminalNode OPEN_BRACKET() { return getToken(CSharpParser.OPEN_BRACKET, 0); } - public Attribute_listContext attribute_list() { - return getRuleContext(Attribute_listContext.class,0); - } - public TerminalNode CLOSE_BRACKET() { return getToken(CSharpParser.CLOSE_BRACKET, 0); } - public Attribute_targetContext attribute_target() { - return getRuleContext(Attribute_targetContext.class,0); - } - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public TerminalNode COMMA() { return getToken(CSharpParser.COMMA, 0); } - public Attribute_sectionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_attribute_section; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAttribute_section(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAttribute_section(this); - } - } - - public final Attribute_sectionContext attribute_section() throws RecognitionException { - Attribute_sectionContext _localctx = new Attribute_sectionContext(_ctx, getState()); - enterRule(_localctx, 352, RULE_attribute_section); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2225); - match(OPEN_BRACKET); - setState(2229); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,276,_ctx) ) { - case 1: - { - setState(2226); - attribute_target(); - setState(2227); - match(COLON); - } - break; - } - setState(2231); - attribute_list(); - setState(2233); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(2232); - match(COMMA); - } - } - - setState(2235); - match(CLOSE_BRACKET); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Attribute_targetContext extends ParserRuleContext { - public KeywordContext keyword() { - return getRuleContext(KeywordContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Attribute_targetContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_attribute_target; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAttribute_target(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAttribute_target(this); - } - } - - public final Attribute_targetContext attribute_target() throws RecognitionException { - Attribute_targetContext _localctx = new Attribute_targetContext(_ctx, getState()); - enterRule(_localctx, 354, RULE_attribute_target); - try { - setState(2239); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,278,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2237); - keyword(); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2238); - identifier(); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Attribute_listContext extends ParserRuleContext { - public List attribute() { - return getRuleContexts(AttributeContext.class); - } - public AttributeContext attribute(int i) { - return getRuleContext(AttributeContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Attribute_listContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_attribute_list; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAttribute_list(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAttribute_list(this); - } - } - - public final Attribute_listContext attribute_list() throws RecognitionException { - Attribute_listContext _localctx = new Attribute_listContext(_ctx, getState()); - enterRule(_localctx, 356, RULE_attribute_list); - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(2241); - attribute(); - setState(2246); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,279,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(2242); - match(COMMA); - setState(2243); - attribute(); - } - } - } - setState(2248); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,279,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class AttributeContext extends ParserRuleContext { - public Namespace_or_type_nameContext namespace_or_type_name() { - return getRuleContext(Namespace_or_type_nameContext.class,0); - } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public List attribute_argument() { - return getRuleContexts(Attribute_argumentContext.class); - } - public Attribute_argumentContext attribute_argument(int i) { - return getRuleContext(Attribute_argumentContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public AttributeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_attribute; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAttribute(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAttribute(this); - } - } - - public final AttributeContext attribute() throws RecognitionException { - AttributeContext _localctx = new AttributeContext(_ctx, getState()); - enterRule(_localctx, 358, RULE_attribute); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2249); - namespace_or_type_name(); - setState(2262); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_PARENS) { - { - setState(2250); - match(OPEN_PARENS); - setState(2259); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(2251); - attribute_argument(); - setState(2256); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(2252); - match(COMMA); - setState(2253); - attribute_argument(); - } - } - setState(2258); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - - setState(2261); - match(CLOSE_PARENS); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Attribute_argumentContext extends ParserRuleContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public Attribute_argumentContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_attribute_argument; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterAttribute_argument(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitAttribute_argument(this); - } - } - - public final Attribute_argumentContext attribute_argument() throws RecognitionException { - Attribute_argumentContext _localctx = new Attribute_argumentContext(_ctx, getState()); - enterRule(_localctx, 360, RULE_attribute_argument); - try { - enterOuterAlt(_localctx, 1); - { - setState(2267); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,283,_ctx) ) { - case 1: - { - setState(2264); - identifier(); - setState(2265); - match(COLON); - } - break; - } - setState(2269); - expression(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Pointer_typeContext extends ParserRuleContext { - public TerminalNode STAR() { return getToken(CSharpParser.STAR, 0); } - public Simple_typeContext simple_type() { - return getRuleContext(Simple_typeContext.class,0); - } - public Class_typeContext class_type() { - return getRuleContext(Class_typeContext.class,0); - } - public List rank_specifier() { - return getRuleContexts(Rank_specifierContext.class); - } - public Rank_specifierContext rank_specifier(int i) { - return getRuleContext(Rank_specifierContext.class,i); - } - public List INTERR() { return getTokens(CSharpParser.INTERR); } - public TerminalNode INTERR(int i) { - return getToken(CSharpParser.INTERR, i); - } - public TerminalNode VOID() { return getToken(CSharpParser.VOID, 0); } - public Pointer_typeContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_pointer_type; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterPointer_type(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitPointer_type(this); - } - } - - public final Pointer_typeContext pointer_type() throws RecognitionException { - Pointer_typeContext _localctx = new Pointer_typeContext(_ctx, getState()); - enterRule(_localctx, 362, RULE_pointer_type); - int _la; - try { - setState(2286); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BOOL: - case BY: - case BYTE: - case CHAR: - case DECIMAL: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case STRING: - case UINT: - case ULONG: - case UNMANAGED: - case USHORT: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - enterOuterAlt(_localctx, 1); - { - setState(2273); - _errHandler.sync(this); - switch (_input.LA(1)) { - case BOOL: - case BYTE: - case CHAR: - case DECIMAL: - case DOUBLE: - case FLOAT: - case INT: - case LONG: - case SBYTE: - case SHORT: - case UINT: - case ULONG: - case USHORT: - { - setState(2271); - simple_type(); - } - break; - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BY: - case DESCENDING: - case DYNAMIC: - case EQUALS: - case FROM: - case GET: - case GROUP: - case INTO: - case JOIN: - case LET: - case NAMEOF: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REMOVE: - case SELECT: - case SET: - case STRING: - case UNMANAGED: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - { - setState(2272); - class_type(); - } - break; - default: - throw new NoViableAltException(this); - } - setState(2279); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==OPEN_BRACKET || _la==INTERR) { - { - setState(2277); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACKET: - { - setState(2275); - rank_specifier(); - } - break; - case INTERR: - { - setState(2276); - match(INTERR); - } - break; - default: - throw new NoViableAltException(this); - } - } - setState(2281); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2282); - match(STAR); - } - break; - case VOID: - enterOuterAlt(_localctx, 2); - { - setState(2284); - match(VOID); - setState(2285); - match(STAR); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Fixed_pointer_declaratorsContext extends ParserRuleContext { - public List fixed_pointer_declarator() { - return getRuleContexts(Fixed_pointer_declaratorContext.class); - } - public Fixed_pointer_declaratorContext fixed_pointer_declarator(int i) { - return getRuleContext(Fixed_pointer_declaratorContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Fixed_pointer_declaratorsContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_fixed_pointer_declarators; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFixed_pointer_declarators(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFixed_pointer_declarators(this); - } - } - - public final Fixed_pointer_declaratorsContext fixed_pointer_declarators() throws RecognitionException { - Fixed_pointer_declaratorsContext _localctx = new Fixed_pointer_declaratorsContext(_ctx, getState()); - enterRule(_localctx, 364, RULE_fixed_pointer_declarators); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2288); - fixed_pointer_declarator(); - setState(2293); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(2289); - match(COMMA); - setState(2290); - fixed_pointer_declarator(); - } - } - setState(2295); - _errHandler.sync(this); - _la = _input.LA(1); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Fixed_pointer_declaratorContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public Fixed_pointer_initializerContext fixed_pointer_initializer() { - return getRuleContext(Fixed_pointer_initializerContext.class,0); - } - public Fixed_pointer_declaratorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_fixed_pointer_declarator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFixed_pointer_declarator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFixed_pointer_declarator(this); - } - } - - public final Fixed_pointer_declaratorContext fixed_pointer_declarator() throws RecognitionException { - Fixed_pointer_declaratorContext _localctx = new Fixed_pointer_declaratorContext(_ctx, getState()); - enterRule(_localctx, 366, RULE_fixed_pointer_declarator); - try { - enterOuterAlt(_localctx, 1); - { - setState(2296); - identifier(); - setState(2297); - match(ASSIGNMENT); - setState(2298); - fixed_pointer_initializer(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Fixed_pointer_initializerContext extends ParserRuleContext { - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode AMP() { return getToken(CSharpParser.AMP, 0); } - public Stackalloc_initializerContext stackalloc_initializer() { - return getRuleContext(Stackalloc_initializerContext.class,0); - } - public Fixed_pointer_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_fixed_pointer_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFixed_pointer_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFixed_pointer_initializer(this); - } - } - - public final Fixed_pointer_initializerContext fixed_pointer_initializer() throws RecognitionException { - Fixed_pointer_initializerContext _localctx = new Fixed_pointer_initializerContext(_ctx, getState()); - enterRule(_localctx, 368, RULE_fixed_pointer_initializer); - try { - setState(2305); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REF: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case THIS: - case TRUE: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case USHORT: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - enterOuterAlt(_localctx, 1); - { - setState(2301); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,289,_ctx) ) { - case 1: - { - setState(2300); - match(AMP); - } - break; - } - setState(2303); - expression(); - } - break; - case STACKALLOC: - enterOuterAlt(_localctx, 2); - { - setState(2304); - stackalloc_initializer(); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Fixed_size_buffer_declaratorContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode OPEN_BRACKET() { return getToken(CSharpParser.OPEN_BRACKET, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public TerminalNode CLOSE_BRACKET() { return getToken(CSharpParser.CLOSE_BRACKET, 0); } - public Fixed_size_buffer_declaratorContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_fixed_size_buffer_declarator; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterFixed_size_buffer_declarator(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitFixed_size_buffer_declarator(this); - } - } - - public final Fixed_size_buffer_declaratorContext fixed_size_buffer_declarator() throws RecognitionException { - Fixed_size_buffer_declaratorContext _localctx = new Fixed_size_buffer_declaratorContext(_ctx, getState()); - enterRule(_localctx, 370, RULE_fixed_size_buffer_declarator); - try { - enterOuterAlt(_localctx, 1); - { - setState(2307); - identifier(); - setState(2308); - match(OPEN_BRACKET); - setState(2309); - expression(); - setState(2310); - match(CLOSE_BRACKET); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Stackalloc_initializerContext extends ParserRuleContext { - public TerminalNode STACKALLOC() { return getToken(CSharpParser.STACKALLOC, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public TerminalNode OPEN_BRACKET() { return getToken(CSharpParser.OPEN_BRACKET, 0); } - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public TerminalNode CLOSE_BRACKET() { return getToken(CSharpParser.CLOSE_BRACKET, 0); } - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public Stackalloc_initializerContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_stackalloc_initializer; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterStackalloc_initializer(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitStackalloc_initializer(this); - } - } - - public final Stackalloc_initializerContext stackalloc_initializer() throws RecognitionException { - Stackalloc_initializerContext _localctx = new Stackalloc_initializerContext(_ctx, getState()); - enterRule(_localctx, 372, RULE_stackalloc_initializer); - int _la; - try { - int _alt; - setState(2341); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,295,_ctx) ) { - case 1: - enterOuterAlt(_localctx, 1); - { - setState(2312); - match(STACKALLOC); - setState(2313); - type_(); - setState(2314); - match(OPEN_BRACKET); - setState(2315); - expression(); - setState(2316); - match(CLOSE_BRACKET); - } - break; - case 2: - enterOuterAlt(_localctx, 2); - { - setState(2318); - match(STACKALLOC); - setState(2320); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 10)) & ~0x3f) == 0 && ((1L << (_la - 10)) & ((1L << (ADD - 10)) | (1L << (ALIAS - 10)) | (1L << (ARGLIST - 10)) | (1L << (ASCENDING - 10)) | (1L << (ASYNC - 10)) | (1L << (AWAIT - 10)) | (1L << (BOOL - 10)) | (1L << (BY - 10)) | (1L << (BYTE - 10)) | (1L << (CHAR - 10)) | (1L << (DECIMAL - 10)) | (1L << (DESCENDING - 10)) | (1L << (DOUBLE - 10)) | (1L << (DYNAMIC - 10)) | (1L << (EQUALS - 10)) | (1L << (FLOAT - 10)) | (1L << (FROM - 10)) | (1L << (GET - 10)) | (1L << (GROUP - 10)) | (1L << (INT - 10)) | (1L << (INTO - 10)) | (1L << (JOIN - 10)) | (1L << (LET - 10)) | (1L << (LONG - 10)) | (1L << (NAMEOF - 10)) | (1L << (OBJECT - 10)) | (1L << (ON - 10)) | (1L << (ORDERBY - 10)))) != 0) || ((((_la - 75)) & ~0x3f) == 0 && ((1L << (_la - 75)) & ((1L << (PARTIAL - 75)) | (1L << (REMOVE - 75)) | (1L << (SBYTE - 75)) | (1L << (SELECT - 75)) | (1L << (SET - 75)) | (1L << (SHORT - 75)) | (1L << (STRING - 75)) | (1L << (UINT - 75)) | (1L << (ULONG - 75)) | (1L << (UNMANAGED - 75)) | (1L << (USHORT - 75)) | (1L << (VAR - 75)) | (1L << (VOID - 75)) | (1L << (WHEN - 75)) | (1L << (WHERE - 75)) | (1L << (YIELD - 75)) | (1L << (IDENTIFIER - 75)) | (1L << (OPEN_PARENS - 75)))) != 0)) { - { - setState(2319); - type_(); - } - } - - setState(2322); - match(OPEN_BRACKET); - setState(2324); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(2323); - expression(); - } - } - - setState(2326); - match(CLOSE_BRACKET); - setState(2327); - match(OPEN_BRACE); - setState(2328); - expression(); - setState(2333); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,293,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(2329); - match(COMMA); - setState(2330); - expression(); - } - } - } - setState(2335); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,293,_ctx); - } - setState(2337); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(2336); - match(COMMA); - } - } - - setState(2339); - match(CLOSE_BRACE); - } - break; - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Right_arrowContext extends ParserRuleContext { - public Token first; - public Token second; - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public TerminalNode GT() { return getToken(CSharpParser.GT, 0); } - public Right_arrowContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_right_arrow; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterRight_arrow(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitRight_arrow(this); - } - } - - public final Right_arrowContext right_arrow() throws RecognitionException { - Right_arrowContext _localctx = new Right_arrowContext(_ctx, getState()); - enterRule(_localctx, 374, RULE_right_arrow); - try { - enterOuterAlt(_localctx, 1); - { - setState(2343); - ((Right_arrowContext)_localctx).first = match(ASSIGNMENT); - setState(2344); - ((Right_arrowContext)_localctx).second = match(GT); - setState(2345); - if (!((((Right_arrowContext)_localctx).first!=null?((Right_arrowContext)_localctx).first.getTokenIndex():0) + 1 == (((Right_arrowContext)_localctx).second!=null?((Right_arrowContext)_localctx).second.getTokenIndex():0))) throw new FailedPredicateException(this, "$first.index + 1 == $second.index"); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Right_shiftContext extends ParserRuleContext { - public Token first; - public Token second; - public List GT() { return getTokens(CSharpParser.GT); } - public TerminalNode GT(int i) { - return getToken(CSharpParser.GT, i); - } - public Right_shiftContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_right_shift; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterRight_shift(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitRight_shift(this); - } - } - - public final Right_shiftContext right_shift() throws RecognitionException { - Right_shiftContext _localctx = new Right_shiftContext(_ctx, getState()); - enterRule(_localctx, 376, RULE_right_shift); - try { - enterOuterAlt(_localctx, 1); - { - setState(2347); - ((Right_shiftContext)_localctx).first = match(GT); - setState(2348); - ((Right_shiftContext)_localctx).second = match(GT); - setState(2349); - if (!((((Right_shiftContext)_localctx).first!=null?((Right_shiftContext)_localctx).first.getTokenIndex():0) + 1 == (((Right_shiftContext)_localctx).second!=null?((Right_shiftContext)_localctx).second.getTokenIndex():0))) throw new FailedPredicateException(this, "$first.index + 1 == $second.index"); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Right_shift_assignmentContext extends ParserRuleContext { - public Token first; - public Token second; - public TerminalNode GT() { return getToken(CSharpParser.GT, 0); } - public TerminalNode OP_GE() { return getToken(CSharpParser.OP_GE, 0); } - public Right_shift_assignmentContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_right_shift_assignment; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterRight_shift_assignment(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitRight_shift_assignment(this); - } - } - - public final Right_shift_assignmentContext right_shift_assignment() throws RecognitionException { - Right_shift_assignmentContext _localctx = new Right_shift_assignmentContext(_ctx, getState()); - enterRule(_localctx, 378, RULE_right_shift_assignment); - try { - enterOuterAlt(_localctx, 1); - { - setState(2351); - ((Right_shift_assignmentContext)_localctx).first = match(GT); - setState(2352); - ((Right_shift_assignmentContext)_localctx).second = match(OP_GE); - setState(2353); - if (!((((Right_shift_assignmentContext)_localctx).first!=null?((Right_shift_assignmentContext)_localctx).first.getTokenIndex():0) + 1 == (((Right_shift_assignmentContext)_localctx).second!=null?((Right_shift_assignmentContext)_localctx).second.getTokenIndex():0))) throw new FailedPredicateException(this, "$first.index + 1 == $second.index"); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class LiteralContext extends ParserRuleContext { - public Boolean_literalContext boolean_literal() { - return getRuleContext(Boolean_literalContext.class,0); - } - public String_literalContext string_literal() { - return getRuleContext(String_literalContext.class,0); - } - public TerminalNode INTEGER_LITERAL() { return getToken(CSharpParser.INTEGER_LITERAL, 0); } - public TerminalNode HEX_INTEGER_LITERAL() { return getToken(CSharpParser.HEX_INTEGER_LITERAL, 0); } - public TerminalNode BIN_INTEGER_LITERAL() { return getToken(CSharpParser.BIN_INTEGER_LITERAL, 0); } - public TerminalNode REAL_LITERAL() { return getToken(CSharpParser.REAL_LITERAL, 0); } - public TerminalNode CHARACTER_LITERAL() { return getToken(CSharpParser.CHARACTER_LITERAL, 0); } - public TerminalNode NULL_() { return getToken(CSharpParser.NULL_, 0); } - public LiteralContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterLiteral(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitLiteral(this); - } - } - - public final LiteralContext literal() throws RecognitionException { - LiteralContext _localctx = new LiteralContext(_ctx, getState()); - enterRule(_localctx, 380, RULE_literal); - try { - setState(2363); - _errHandler.sync(this); - switch (_input.LA(1)) { - case FALSE: - case TRUE: - enterOuterAlt(_localctx, 1); - { - setState(2355); - boolean_literal(); - } - break; - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - enterOuterAlt(_localctx, 2); - { - setState(2356); - string_literal(); - } - break; - case INTEGER_LITERAL: - enterOuterAlt(_localctx, 3); - { - setState(2357); - match(INTEGER_LITERAL); - } - break; - case HEX_INTEGER_LITERAL: - enterOuterAlt(_localctx, 4); - { - setState(2358); - match(HEX_INTEGER_LITERAL); - } - break; - case BIN_INTEGER_LITERAL: - enterOuterAlt(_localctx, 5); - { - setState(2359); - match(BIN_INTEGER_LITERAL); - } - break; - case REAL_LITERAL: - enterOuterAlt(_localctx, 6); - { - setState(2360); - match(REAL_LITERAL); - } - break; - case CHARACTER_LITERAL: - enterOuterAlt(_localctx, 7); - { - setState(2361); - match(CHARACTER_LITERAL); - } - break; - case NULL_: - enterOuterAlt(_localctx, 8); - { - setState(2362); - match(NULL_); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Boolean_literalContext extends ParserRuleContext { - public TerminalNode TRUE() { return getToken(CSharpParser.TRUE, 0); } - public TerminalNode FALSE() { return getToken(CSharpParser.FALSE, 0); } - public Boolean_literalContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_boolean_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterBoolean_literal(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitBoolean_literal(this); - } - } - - public final Boolean_literalContext boolean_literal() throws RecognitionException { - Boolean_literalContext _localctx = new Boolean_literalContext(_ctx, getState()); - enterRule(_localctx, 382, RULE_boolean_literal); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2365); - _la = _input.LA(1); - if ( !(_la==FALSE || _la==TRUE) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class String_literalContext extends ParserRuleContext { - public Interpolated_regular_stringContext interpolated_regular_string() { - return getRuleContext(Interpolated_regular_stringContext.class,0); - } - public Interpolated_verbatium_stringContext interpolated_verbatium_string() { - return getRuleContext(Interpolated_verbatium_stringContext.class,0); - } - public TerminalNode REGULAR_STRING() { return getToken(CSharpParser.REGULAR_STRING, 0); } - public TerminalNode VERBATIUM_STRING() { return getToken(CSharpParser.VERBATIUM_STRING, 0); } - public String_literalContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_string_literal; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterString_literal(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitString_literal(this); - } - } - - public final String_literalContext string_literal() throws RecognitionException { - String_literalContext _localctx = new String_literalContext(_ctx, getState()); - enterRule(_localctx, 384, RULE_string_literal); - try { - setState(2371); - _errHandler.sync(this); - switch (_input.LA(1)) { - case INTERPOLATED_REGULAR_STRING_START: - enterOuterAlt(_localctx, 1); - { - setState(2367); - interpolated_regular_string(); - } - break; - case INTERPOLATED_VERBATIUM_STRING_START: - enterOuterAlt(_localctx, 2); - { - setState(2368); - interpolated_verbatium_string(); - } - break; - case REGULAR_STRING: - enterOuterAlt(_localctx, 3); - { - setState(2369); - match(REGULAR_STRING); - } - break; - case VERBATIUM_STRING: - enterOuterAlt(_localctx, 4); - { - setState(2370); - match(VERBATIUM_STRING); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Interpolated_regular_stringContext extends ParserRuleContext { - public TerminalNode INTERPOLATED_REGULAR_STRING_START() { return getToken(CSharpParser.INTERPOLATED_REGULAR_STRING_START, 0); } - public TerminalNode DOUBLE_QUOTE_INSIDE() { return getToken(CSharpParser.DOUBLE_QUOTE_INSIDE, 0); } - public List interpolated_regular_string_part() { - return getRuleContexts(Interpolated_regular_string_partContext.class); - } - public Interpolated_regular_string_partContext interpolated_regular_string_part(int i) { - return getRuleContext(Interpolated_regular_string_partContext.class,i); - } - public Interpolated_regular_stringContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interpolated_regular_string; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInterpolated_regular_string(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInterpolated_regular_string(this); - } - } - - public final Interpolated_regular_stringContext interpolated_regular_string() throws RecognitionException { - Interpolated_regular_stringContext _localctx = new Interpolated_regular_stringContext(_ctx, getState()); - enterRule(_localctx, 386, RULE_interpolated_regular_string); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2373); - match(INTERPOLATED_REGULAR_STRING_START); - setState(2377); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)) | (1L << (DOUBLE_CURLY_INSIDE - 129)) | (1L << (REGULAR_CHAR_INSIDE - 129)) | (1L << (REGULAR_STRING_INSIDE - 129)))) != 0)) { - { - { - setState(2374); - interpolated_regular_string_part(); - } - } - setState(2379); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2380); - match(DOUBLE_QUOTE_INSIDE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Interpolated_verbatium_stringContext extends ParserRuleContext { - public TerminalNode INTERPOLATED_VERBATIUM_STRING_START() { return getToken(CSharpParser.INTERPOLATED_VERBATIUM_STRING_START, 0); } - public TerminalNode DOUBLE_QUOTE_INSIDE() { return getToken(CSharpParser.DOUBLE_QUOTE_INSIDE, 0); } - public List interpolated_verbatium_string_part() { - return getRuleContexts(Interpolated_verbatium_string_partContext.class); - } - public Interpolated_verbatium_string_partContext interpolated_verbatium_string_part(int i) { - return getRuleContext(Interpolated_verbatium_string_partContext.class,i); - } - public Interpolated_verbatium_stringContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interpolated_verbatium_string; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInterpolated_verbatium_string(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInterpolated_verbatium_string(this); - } - } - - public final Interpolated_verbatium_stringContext interpolated_verbatium_string() throws RecognitionException { - Interpolated_verbatium_stringContext _localctx = new Interpolated_verbatium_stringContext(_ctx, getState()); - enterRule(_localctx, 388, RULE_interpolated_verbatium_string); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2382); - match(INTERPOLATED_VERBATIUM_STRING_START); - setState(2386); - _errHandler.sync(this); - _la = _input.LA(1); - while ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)) | (1L << (DOUBLE_CURLY_INSIDE - 129)) | (1L << (VERBATIUM_DOUBLE_QUOTE_INSIDE - 129)) | (1L << (VERBATIUM_INSIDE_STRING - 129)))) != 0)) { - { - { - setState(2383); - interpolated_verbatium_string_part(); - } - } - setState(2388); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2389); - match(DOUBLE_QUOTE_INSIDE); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Interpolated_regular_string_partContext extends ParserRuleContext { - public Interpolated_string_expressionContext interpolated_string_expression() { - return getRuleContext(Interpolated_string_expressionContext.class,0); - } - public TerminalNode DOUBLE_CURLY_INSIDE() { return getToken(CSharpParser.DOUBLE_CURLY_INSIDE, 0); } - public TerminalNode REGULAR_CHAR_INSIDE() { return getToken(CSharpParser.REGULAR_CHAR_INSIDE, 0); } - public TerminalNode REGULAR_STRING_INSIDE() { return getToken(CSharpParser.REGULAR_STRING_INSIDE, 0); } - public Interpolated_regular_string_partContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interpolated_regular_string_part; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInterpolated_regular_string_part(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInterpolated_regular_string_part(this); - } - } - - public final Interpolated_regular_string_partContext interpolated_regular_string_part() throws RecognitionException { - Interpolated_regular_string_partContext _localctx = new Interpolated_regular_string_partContext(_ctx, getState()); - enterRule(_localctx, 390, RULE_interpolated_regular_string_part); - try { - setState(2395); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REF: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case THIS: - case TRUE: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case USHORT: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - enterOuterAlt(_localctx, 1); - { - setState(2391); - interpolated_string_expression(); - } - break; - case DOUBLE_CURLY_INSIDE: - enterOuterAlt(_localctx, 2); - { - setState(2392); - match(DOUBLE_CURLY_INSIDE); - } - break; - case REGULAR_CHAR_INSIDE: - enterOuterAlt(_localctx, 3); - { - setState(2393); - match(REGULAR_CHAR_INSIDE); - } - break; - case REGULAR_STRING_INSIDE: - enterOuterAlt(_localctx, 4); - { - setState(2394); - match(REGULAR_STRING_INSIDE); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Interpolated_verbatium_string_partContext extends ParserRuleContext { - public Interpolated_string_expressionContext interpolated_string_expression() { - return getRuleContext(Interpolated_string_expressionContext.class,0); - } - public TerminalNode DOUBLE_CURLY_INSIDE() { return getToken(CSharpParser.DOUBLE_CURLY_INSIDE, 0); } - public TerminalNode VERBATIUM_DOUBLE_QUOTE_INSIDE() { return getToken(CSharpParser.VERBATIUM_DOUBLE_QUOTE_INSIDE, 0); } - public TerminalNode VERBATIUM_INSIDE_STRING() { return getToken(CSharpParser.VERBATIUM_INSIDE_STRING, 0); } - public Interpolated_verbatium_string_partContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interpolated_verbatium_string_part; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInterpolated_verbatium_string_part(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInterpolated_verbatium_string_part(this); - } - } - - public final Interpolated_verbatium_string_partContext interpolated_verbatium_string_part() throws RecognitionException { - Interpolated_verbatium_string_partContext _localctx = new Interpolated_verbatium_string_partContext(_ctx, getState()); - enterRule(_localctx, 392, RULE_interpolated_verbatium_string_part); - try { - setState(2401); - _errHandler.sync(this); - switch (_input.LA(1)) { - case ADD: - case ALIAS: - case ARGLIST: - case ASCENDING: - case ASYNC: - case AWAIT: - case BASE: - case BOOL: - case BY: - case BYTE: - case CHAR: - case CHECKED: - case DECIMAL: - case DEFAULT: - case DELEGATE: - case DESCENDING: - case DOUBLE: - case DYNAMIC: - case EQUALS: - case FALSE: - case FLOAT: - case FROM: - case GET: - case GROUP: - case INT: - case INTO: - case JOIN: - case LET: - case LONG: - case NAMEOF: - case NEW: - case NULL_: - case OBJECT: - case ON: - case ORDERBY: - case PARTIAL: - case REF: - case REMOVE: - case SBYTE: - case SELECT: - case SET: - case SHORT: - case SIZEOF: - case STRING: - case THIS: - case TRUE: - case TYPEOF: - case UINT: - case ULONG: - case UNCHECKED: - case UNMANAGED: - case USHORT: - case VAR: - case WHEN: - case WHERE: - case YIELD: - case IDENTIFIER: - case LITERAL_ACCESS: - case INTEGER_LITERAL: - case HEX_INTEGER_LITERAL: - case BIN_INTEGER_LITERAL: - case REAL_LITERAL: - case CHARACTER_LITERAL: - case REGULAR_STRING: - case VERBATIUM_STRING: - case INTERPOLATED_REGULAR_STRING_START: - case INTERPOLATED_VERBATIUM_STRING_START: - case OPEN_PARENS: - case PLUS: - case MINUS: - case STAR: - case AMP: - case CARET: - case BANG: - case TILDE: - case OP_INC: - case OP_DEC: - case OP_RANGE: - enterOuterAlt(_localctx, 1); - { - setState(2397); - interpolated_string_expression(); - } - break; - case DOUBLE_CURLY_INSIDE: - enterOuterAlt(_localctx, 2); - { - setState(2398); - match(DOUBLE_CURLY_INSIDE); - } - break; - case VERBATIUM_DOUBLE_QUOTE_INSIDE: - enterOuterAlt(_localctx, 3); - { - setState(2399); - match(VERBATIUM_DOUBLE_QUOTE_INSIDE); - } - break; - case VERBATIUM_INSIDE_STRING: - enterOuterAlt(_localctx, 4); - { - setState(2400); - match(VERBATIUM_INSIDE_STRING); - } - break; - default: - throw new NoViableAltException(this); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Interpolated_string_expressionContext extends ParserRuleContext { - public List expression() { - return getRuleContexts(ExpressionContext.class); - } - public ExpressionContext expression(int i) { - return getRuleContext(ExpressionContext.class,i); - } - public List COMMA() { return getTokens(CSharpParser.COMMA); } - public TerminalNode COMMA(int i) { - return getToken(CSharpParser.COMMA, i); - } - public TerminalNode COLON() { return getToken(CSharpParser.COLON, 0); } - public List FORMAT_STRING() { return getTokens(CSharpParser.FORMAT_STRING); } - public TerminalNode FORMAT_STRING(int i) { - return getToken(CSharpParser.FORMAT_STRING, i); - } - public Interpolated_string_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interpolated_string_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInterpolated_string_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInterpolated_string_expression(this); - } - } - - public final Interpolated_string_expressionContext interpolated_string_expression() throws RecognitionException { - Interpolated_string_expressionContext _localctx = new Interpolated_string_expressionContext(_ctx, getState()); - enterRule(_localctx, 394, RULE_interpolated_string_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2403); - expression(); - setState(2408); - _errHandler.sync(this); - _la = _input.LA(1); - while (_la==COMMA) { - { - { - setState(2404); - match(COMMA); - setState(2405); - expression(); - } - } - setState(2410); - _errHandler.sync(this); - _la = _input.LA(1); - } - setState(2417); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COLON) { - { - setState(2411); - match(COLON); - setState(2413); - _errHandler.sync(this); - _la = _input.LA(1); - do { - { - { - setState(2412); - match(FORMAT_STRING); - } - } - setState(2415); - _errHandler.sync(this); - _la = _input.LA(1); - } while ( _la==FORMAT_STRING ); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class KeywordContext extends ParserRuleContext { - public TerminalNode ABSTRACT() { return getToken(CSharpParser.ABSTRACT, 0); } - public TerminalNode AS() { return getToken(CSharpParser.AS, 0); } - public TerminalNode BASE() { return getToken(CSharpParser.BASE, 0); } - public TerminalNode BOOL() { return getToken(CSharpParser.BOOL, 0); } - public TerminalNode BREAK() { return getToken(CSharpParser.BREAK, 0); } - public TerminalNode BYTE() { return getToken(CSharpParser.BYTE, 0); } - public TerminalNode CASE() { return getToken(CSharpParser.CASE, 0); } - public TerminalNode CATCH() { return getToken(CSharpParser.CATCH, 0); } - public TerminalNode CHAR() { return getToken(CSharpParser.CHAR, 0); } - public TerminalNode CHECKED() { return getToken(CSharpParser.CHECKED, 0); } - public TerminalNode CLASS() { return getToken(CSharpParser.CLASS, 0); } - public TerminalNode CONST() { return getToken(CSharpParser.CONST, 0); } - public TerminalNode CONTINUE() { return getToken(CSharpParser.CONTINUE, 0); } - public TerminalNode DECIMAL() { return getToken(CSharpParser.DECIMAL, 0); } - public TerminalNode DEFAULT() { return getToken(CSharpParser.DEFAULT, 0); } - public TerminalNode DELEGATE() { return getToken(CSharpParser.DELEGATE, 0); } - public TerminalNode DO() { return getToken(CSharpParser.DO, 0); } - public TerminalNode DOUBLE() { return getToken(CSharpParser.DOUBLE, 0); } - public TerminalNode ELSE() { return getToken(CSharpParser.ELSE, 0); } - public TerminalNode ENUM() { return getToken(CSharpParser.ENUM, 0); } - public TerminalNode EVENT() { return getToken(CSharpParser.EVENT, 0); } - public TerminalNode EXPLICIT() { return getToken(CSharpParser.EXPLICIT, 0); } - public TerminalNode EXTERN() { return getToken(CSharpParser.EXTERN, 0); } - public TerminalNode FALSE() { return getToken(CSharpParser.FALSE, 0); } - public TerminalNode FINALLY() { return getToken(CSharpParser.FINALLY, 0); } - public TerminalNode FIXED() { return getToken(CSharpParser.FIXED, 0); } - public TerminalNode FLOAT() { return getToken(CSharpParser.FLOAT, 0); } - public TerminalNode FOR() { return getToken(CSharpParser.FOR, 0); } - public TerminalNode FOREACH() { return getToken(CSharpParser.FOREACH, 0); } - public TerminalNode GOTO() { return getToken(CSharpParser.GOTO, 0); } - public TerminalNode IF() { return getToken(CSharpParser.IF, 0); } - public TerminalNode IMPLICIT() { return getToken(CSharpParser.IMPLICIT, 0); } - public TerminalNode IN() { return getToken(CSharpParser.IN, 0); } - public TerminalNode INT() { return getToken(CSharpParser.INT, 0); } - public TerminalNode INTERFACE() { return getToken(CSharpParser.INTERFACE, 0); } - public TerminalNode INTERNAL() { return getToken(CSharpParser.INTERNAL, 0); } - public TerminalNode IS() { return getToken(CSharpParser.IS, 0); } - public TerminalNode LOCK() { return getToken(CSharpParser.LOCK, 0); } - public TerminalNode LONG() { return getToken(CSharpParser.LONG, 0); } - public TerminalNode NAMESPACE() { return getToken(CSharpParser.NAMESPACE, 0); } - public TerminalNode NEW() { return getToken(CSharpParser.NEW, 0); } - public TerminalNode NULL_() { return getToken(CSharpParser.NULL_, 0); } - public TerminalNode OBJECT() { return getToken(CSharpParser.OBJECT, 0); } - public TerminalNode OPERATOR() { return getToken(CSharpParser.OPERATOR, 0); } - public TerminalNode OUT() { return getToken(CSharpParser.OUT, 0); } - public TerminalNode OVERRIDE() { return getToken(CSharpParser.OVERRIDE, 0); } - public TerminalNode PARAMS() { return getToken(CSharpParser.PARAMS, 0); } - public TerminalNode PRIVATE() { return getToken(CSharpParser.PRIVATE, 0); } - public TerminalNode PROTECTED() { return getToken(CSharpParser.PROTECTED, 0); } - public TerminalNode PUBLIC() { return getToken(CSharpParser.PUBLIC, 0); } - public TerminalNode READONLY() { return getToken(CSharpParser.READONLY, 0); } - public TerminalNode REF() { return getToken(CSharpParser.REF, 0); } - public TerminalNode RETURN() { return getToken(CSharpParser.RETURN, 0); } - public TerminalNode SBYTE() { return getToken(CSharpParser.SBYTE, 0); } - public TerminalNode SEALED() { return getToken(CSharpParser.SEALED, 0); } - public TerminalNode SHORT() { return getToken(CSharpParser.SHORT, 0); } - public TerminalNode SIZEOF() { return getToken(CSharpParser.SIZEOF, 0); } - public TerminalNode STACKALLOC() { return getToken(CSharpParser.STACKALLOC, 0); } - public TerminalNode STATIC() { return getToken(CSharpParser.STATIC, 0); } - public TerminalNode STRING() { return getToken(CSharpParser.STRING, 0); } - public TerminalNode STRUCT() { return getToken(CSharpParser.STRUCT, 0); } - public TerminalNode SWITCH() { return getToken(CSharpParser.SWITCH, 0); } - public TerminalNode THIS() { return getToken(CSharpParser.THIS, 0); } - public TerminalNode THROW() { return getToken(CSharpParser.THROW, 0); } - public TerminalNode TRUE() { return getToken(CSharpParser.TRUE, 0); } - public TerminalNode TRY() { return getToken(CSharpParser.TRY, 0); } - public TerminalNode TYPEOF() { return getToken(CSharpParser.TYPEOF, 0); } - public TerminalNode UINT() { return getToken(CSharpParser.UINT, 0); } - public TerminalNode ULONG() { return getToken(CSharpParser.ULONG, 0); } - public TerminalNode UNCHECKED() { return getToken(CSharpParser.UNCHECKED, 0); } - public TerminalNode UNMANAGED() { return getToken(CSharpParser.UNMANAGED, 0); } - public TerminalNode UNSAFE() { return getToken(CSharpParser.UNSAFE, 0); } - public TerminalNode USHORT() { return getToken(CSharpParser.USHORT, 0); } - public TerminalNode USING() { return getToken(CSharpParser.USING, 0); } - public TerminalNode VIRTUAL() { return getToken(CSharpParser.VIRTUAL, 0); } - public TerminalNode VOID() { return getToken(CSharpParser.VOID, 0); } - public TerminalNode VOLATILE() { return getToken(CSharpParser.VOLATILE, 0); } - public TerminalNode WHILE() { return getToken(CSharpParser.WHILE, 0); } - public KeywordContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_keyword; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterKeyword(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitKeyword(this); - } - } - - public final KeywordContext keyword() throws RecognitionException { - KeywordContext _localctx = new KeywordContext(_ctx, getState()); - enterRule(_localctx, 396, RULE_keyword); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2419); - _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ABSTRACT) | (1L << AS) | (1L << BASE) | (1L << BOOL) | (1L << BREAK) | (1L << BYTE) | (1L << CASE) | (1L << CATCH) | (1L << CHAR) | (1L << CHECKED) | (1L << CLASS) | (1L << CONST) | (1L << CONTINUE) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DO) | (1L << DOUBLE) | (1L << ELSE) | (1L << ENUM) | (1L << EVENT) | (1L << EXPLICIT) | (1L << EXTERN) | (1L << FALSE) | (1L << FINALLY) | (1L << FIXED) | (1L << FLOAT) | (1L << FOR) | (1L << FOREACH) | (1L << GOTO) | (1L << IF) | (1L << IMPLICIT) | (1L << IN) | (1L << INT) | (1L << INTERFACE) | (1L << INTERNAL) | (1L << IS) | (1L << LOCK) | (1L << LONG))) != 0) || ((((_la - 65)) & ~0x3f) == 0 && ((1L << (_la - 65)) & ((1L << (NAMESPACE - 65)) | (1L << (NEW - 65)) | (1L << (NULL_ - 65)) | (1L << (OBJECT - 65)) | (1L << (OPERATOR - 65)) | (1L << (OUT - 65)) | (1L << (OVERRIDE - 65)) | (1L << (PARAMS - 65)) | (1L << (PRIVATE - 65)) | (1L << (PROTECTED - 65)) | (1L << (PUBLIC - 65)) | (1L << (READONLY - 65)) | (1L << (REF - 65)) | (1L << (RETURN - 65)) | (1L << (SBYTE - 65)) | (1L << (SEALED - 65)) | (1L << (SHORT - 65)) | (1L << (SIZEOF - 65)) | (1L << (STACKALLOC - 65)) | (1L << (STATIC - 65)) | (1L << (STRING - 65)) | (1L << (STRUCT - 65)) | (1L << (SWITCH - 65)) | (1L << (THIS - 65)) | (1L << (THROW - 65)) | (1L << (TRUE - 65)) | (1L << (TRY - 65)) | (1L << (TYPEOF - 65)) | (1L << (UINT - 65)) | (1L << (ULONG - 65)) | (1L << (UNCHECKED - 65)) | (1L << (UNMANAGED - 65)) | (1L << (UNSAFE - 65)) | (1L << (USHORT - 65)) | (1L << (USING - 65)) | (1L << (VIRTUAL - 65)) | (1L << (VOID - 65)) | (1L << (VOLATILE - 65)) | (1L << (WHILE - 65)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Class_definitionContext extends ParserRuleContext { - public TerminalNode CLASS() { return getToken(CSharpParser.CLASS, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Class_bodyContext class_body() { - return getRuleContext(Class_bodyContext.class,0); - } - public Type_parameter_listContext type_parameter_list() { - return getRuleContext(Type_parameter_listContext.class,0); - } - public Class_baseContext class_base() { - return getRuleContext(Class_baseContext.class,0); - } - public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { - return getRuleContext(Type_parameter_constraints_clausesContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Class_definitionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_class_definition; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterClass_definition(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitClass_definition(this); - } - } - - public final Class_definitionContext class_definition() throws RecognitionException { - Class_definitionContext _localctx = new Class_definitionContext(_ctx, getState()); - enterRule(_localctx, 398, RULE_class_definition); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2421); - match(CLASS); - setState(2422); - identifier(); - setState(2424); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2423); - type_parameter_list(); - } - } - - setState(2427); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COLON) { - { - setState(2426); - class_base(); - } - } - - setState(2430); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHERE) { - { - setState(2429); - type_parameter_constraints_clauses(); - } - } - - setState(2432); - class_body(); - setState(2434); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==SEMICOLON) { - { - setState(2433); - match(SEMICOLON); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Struct_definitionContext extends ParserRuleContext { - public TerminalNode STRUCT() { return getToken(CSharpParser.STRUCT, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Struct_bodyContext struct_body() { - return getRuleContext(Struct_bodyContext.class,0); - } - public Type_parameter_listContext type_parameter_list() { - return getRuleContext(Type_parameter_listContext.class,0); - } - public Struct_interfacesContext struct_interfaces() { - return getRuleContext(Struct_interfacesContext.class,0); - } - public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { - return getRuleContext(Type_parameter_constraints_clausesContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public TerminalNode READONLY() { return getToken(CSharpParser.READONLY, 0); } - public TerminalNode REF() { return getToken(CSharpParser.REF, 0); } - public Struct_definitionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_struct_definition; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterStruct_definition(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitStruct_definition(this); - } - } - - public final Struct_definitionContext struct_definition() throws RecognitionException { - Struct_definitionContext _localctx = new Struct_definitionContext(_ctx, getState()); - enterRule(_localctx, 400, RULE_struct_definition); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2437); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==READONLY || _la==REF) { - { - setState(2436); - _la = _input.LA(1); - if ( !(_la==READONLY || _la==REF) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - - setState(2439); - match(STRUCT); - setState(2440); - identifier(); - setState(2442); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2441); - type_parameter_list(); - } - } - - setState(2445); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COLON) { - { - setState(2444); - struct_interfaces(); - } - } - - setState(2448); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHERE) { - { - setState(2447); - type_parameter_constraints_clauses(); - } - } - - setState(2450); - struct_body(); - setState(2452); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==SEMICOLON) { - { - setState(2451); - match(SEMICOLON); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Interface_definitionContext extends ParserRuleContext { - public TerminalNode INTERFACE() { return getToken(CSharpParser.INTERFACE, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Class_bodyContext class_body() { - return getRuleContext(Class_bodyContext.class,0); - } - public Variant_type_parameter_listContext variant_type_parameter_list() { - return getRuleContext(Variant_type_parameter_listContext.class,0); - } - public Interface_baseContext interface_base() { - return getRuleContext(Interface_baseContext.class,0); - } - public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { - return getRuleContext(Type_parameter_constraints_clausesContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Interface_definitionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_interface_definition; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterInterface_definition(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitInterface_definition(this); - } - } - - public final Interface_definitionContext interface_definition() throws RecognitionException { - Interface_definitionContext _localctx = new Interface_definitionContext(_ctx, getState()); - enterRule(_localctx, 402, RULE_interface_definition); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2454); - match(INTERFACE); - setState(2455); - identifier(); - setState(2457); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2456); - variant_type_parameter_list(); - } - } - - setState(2460); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COLON) { - { - setState(2459); - interface_base(); - } - } - - setState(2463); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHERE) { - { - setState(2462); - type_parameter_constraints_clauses(); - } - } - - setState(2465); - class_body(); - setState(2467); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==SEMICOLON) { - { - setState(2466); - match(SEMICOLON); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Enum_definitionContext extends ParserRuleContext { - public TerminalNode ENUM() { return getToken(CSharpParser.ENUM, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public Enum_bodyContext enum_body() { - return getRuleContext(Enum_bodyContext.class,0); - } - public Enum_baseContext enum_base() { - return getRuleContext(Enum_baseContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Enum_definitionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_enum_definition; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterEnum_definition(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitEnum_definition(this); - } - } - - public final Enum_definitionContext enum_definition() throws RecognitionException { - Enum_definitionContext _localctx = new Enum_definitionContext(_ctx, getState()); - enterRule(_localctx, 404, RULE_enum_definition); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2469); - match(ENUM); - setState(2470); - identifier(); - setState(2472); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COLON) { - { - setState(2471); - enum_base(); - } - } - - setState(2474); - enum_body(); - setState(2476); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==SEMICOLON) { - { - setState(2475); - match(SEMICOLON); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Delegate_definitionContext extends ParserRuleContext { - public TerminalNode DELEGATE() { return getToken(CSharpParser.DELEGATE, 0); } - public Return_typeContext return_type() { - return getRuleContext(Return_typeContext.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Variant_type_parameter_listContext variant_type_parameter_list() { - return getRuleContext(Variant_type_parameter_listContext.class,0); - } - public Formal_parameter_listContext formal_parameter_list() { - return getRuleContext(Formal_parameter_listContext.class,0); - } - public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { - return getRuleContext(Type_parameter_constraints_clausesContext.class,0); - } - public Delegate_definitionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_delegate_definition; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterDelegate_definition(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitDelegate_definition(this); - } - } - - public final Delegate_definitionContext delegate_definition() throws RecognitionException { - Delegate_definitionContext _localctx = new Delegate_definitionContext(_ctx, getState()); - enterRule(_localctx, 406, RULE_delegate_definition); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2478); - match(DELEGATE); - setState(2479); - return_type(); - setState(2480); - identifier(); - setState(2482); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2481); - variant_type_parameter_list(); - } - } - - setState(2484); - match(OPEN_PARENS); - setState(2486); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 10)) & ~0x3f) == 0 && ((1L << (_la - 10)) & ((1L << (ADD - 10)) | (1L << (ALIAS - 10)) | (1L << (ARGLIST - 10)) | (1L << (ASCENDING - 10)) | (1L << (ASYNC - 10)) | (1L << (AWAIT - 10)) | (1L << (BOOL - 10)) | (1L << (BY - 10)) | (1L << (BYTE - 10)) | (1L << (CHAR - 10)) | (1L << (DECIMAL - 10)) | (1L << (DESCENDING - 10)) | (1L << (DOUBLE - 10)) | (1L << (DYNAMIC - 10)) | (1L << (EQUALS - 10)) | (1L << (FLOAT - 10)) | (1L << (FROM - 10)) | (1L << (GET - 10)) | (1L << (GROUP - 10)) | (1L << (IN - 10)) | (1L << (INT - 10)) | (1L << (INTO - 10)) | (1L << (JOIN - 10)) | (1L << (LET - 10)) | (1L << (LONG - 10)) | (1L << (NAMEOF - 10)) | (1L << (OBJECT - 10)) | (1L << (ON - 10)) | (1L << (ORDERBY - 10)) | (1L << (OUT - 10)))) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & ((1L << (PARAMS - 74)) | (1L << (PARTIAL - 74)) | (1L << (REF - 74)) | (1L << (REMOVE - 74)) | (1L << (SBYTE - 74)) | (1L << (SELECT - 74)) | (1L << (SET - 74)) | (1L << (SHORT - 74)) | (1L << (STRING - 74)) | (1L << (THIS - 74)) | (1L << (UINT - 74)) | (1L << (ULONG - 74)) | (1L << (UNMANAGED - 74)) | (1L << (USHORT - 74)) | (1L << (VAR - 74)) | (1L << (VOID - 74)) | (1L << (WHEN - 74)) | (1L << (WHERE - 74)) | (1L << (YIELD - 74)) | (1L << (IDENTIFIER - 74)) | (1L << (OPEN_BRACKET - 74)) | (1L << (OPEN_PARENS - 74)))) != 0)) { - { - setState(2485); - formal_parameter_list(); - } - } - - setState(2488); - match(CLOSE_PARENS); - setState(2490); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHERE) { - { - setState(2489); - type_parameter_constraints_clauses(); - } - } - - setState(2492); - match(SEMICOLON); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Event_declarationContext extends ParserRuleContext { - public TerminalNode EVENT() { return getToken(CSharpParser.EVENT, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public Variable_declaratorsContext variable_declarators() { - return getRuleContext(Variable_declaratorsContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Member_nameContext member_name() { - return getRuleContext(Member_nameContext.class,0); - } - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public Event_accessor_declarationsContext event_accessor_declarations() { - return getRuleContext(Event_accessor_declarationsContext.class,0); - } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public Event_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_event_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterEvent_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitEvent_declaration(this); - } - } - - public final Event_declarationContext event_declaration() throws RecognitionException { - Event_declarationContext _localctx = new Event_declarationContext(_ctx, getState()); - enterRule(_localctx, 408, RULE_event_declaration); - try { - enterOuterAlt(_localctx, 1); - { - setState(2494); - match(EVENT); - setState(2495); - type_(); - setState(2504); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,323,_ctx) ) { - case 1: - { - setState(2496); - variable_declarators(); - setState(2497); - match(SEMICOLON); - } - break; - case 2: - { - setState(2499); - member_name(); - setState(2500); - match(OPEN_BRACE); - setState(2501); - event_accessor_declarations(); - setState(2502); - match(CLOSE_BRACE); - } - break; - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Field_declarationContext extends ParserRuleContext { - public Variable_declaratorsContext variable_declarators() { - return getRuleContext(Variable_declaratorsContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Field_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_field_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterField_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitField_declaration(this); - } - } - - public final Field_declarationContext field_declaration() throws RecognitionException { - Field_declarationContext _localctx = new Field_declarationContext(_ctx, getState()); - enterRule(_localctx, 410, RULE_field_declaration); - try { - enterOuterAlt(_localctx, 1); - { - setState(2506); - variable_declarators(); - setState(2507); - match(SEMICOLON); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Property_declarationContext extends ParserRuleContext { - public Member_nameContext member_name() { - return getRuleContext(Member_nameContext.class,0); - } - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public Accessor_declarationsContext accessor_declarations() { - return getRuleContext(Accessor_declarationsContext.class,0); - } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public Right_arrowContext right_arrow() { - return getRuleContext(Right_arrowContext.class,0); - } - public Throwable_expressionContext throwable_expression() { - return getRuleContext(Throwable_expressionContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public Variable_initializerContext variable_initializer() { - return getRuleContext(Variable_initializerContext.class,0); - } - public Property_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_property_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterProperty_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitProperty_declaration(this); - } - } - - public final Property_declarationContext property_declaration() throws RecognitionException { - Property_declarationContext _localctx = new Property_declarationContext(_ctx, getState()); - enterRule(_localctx, 412, RULE_property_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2509); - member_name(); - setState(2523); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACE: - { - setState(2510); - match(OPEN_BRACE); - setState(2511); - accessor_declarations(); - setState(2512); - match(CLOSE_BRACE); - setState(2517); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ASSIGNMENT) { - { - setState(2513); - match(ASSIGNMENT); - setState(2514); - variable_initializer(); - setState(2515); - match(SEMICOLON); - } - } - - } - break; - case ASSIGNMENT: - { - setState(2519); - right_arrow(); - setState(2520); - throwable_expression(); - setState(2521); - match(SEMICOLON); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Constant_declarationContext extends ParserRuleContext { - public TerminalNode CONST() { return getToken(CSharpParser.CONST, 0); } - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public Constant_declaratorsContext constant_declarators() { - return getRuleContext(Constant_declaratorsContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Constant_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constant_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterConstant_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitConstant_declaration(this); - } - } - - public final Constant_declarationContext constant_declaration() throws RecognitionException { - Constant_declarationContext _localctx = new Constant_declarationContext(_ctx, getState()); - enterRule(_localctx, 414, RULE_constant_declaration); - try { - enterOuterAlt(_localctx, 1); - { - setState(2525); - match(CONST); - setState(2526); - type_(); - setState(2527); - constant_declarators(); - setState(2528); - match(SEMICOLON); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Indexer_declarationContext extends ParserRuleContext { - public TerminalNode THIS() { return getToken(CSharpParser.THIS, 0); } - public TerminalNode OPEN_BRACKET() { return getToken(CSharpParser.OPEN_BRACKET, 0); } - public Formal_parameter_listContext formal_parameter_list() { - return getRuleContext(Formal_parameter_listContext.class,0); - } - public TerminalNode CLOSE_BRACKET() { return getToken(CSharpParser.CLOSE_BRACKET, 0); } - public TerminalNode OPEN_BRACE() { return getToken(CSharpParser.OPEN_BRACE, 0); } - public Accessor_declarationsContext accessor_declarations() { - return getRuleContext(Accessor_declarationsContext.class,0); - } - public TerminalNode CLOSE_BRACE() { return getToken(CSharpParser.CLOSE_BRACE, 0); } - public Right_arrowContext right_arrow() { - return getRuleContext(Right_arrowContext.class,0); - } - public Throwable_expressionContext throwable_expression() { - return getRuleContext(Throwable_expressionContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Indexer_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_indexer_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterIndexer_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitIndexer_declaration(this); - } - } - - public final Indexer_declarationContext indexer_declaration() throws RecognitionException { - Indexer_declarationContext _localctx = new Indexer_declarationContext(_ctx, getState()); - enterRule(_localctx, 416, RULE_indexer_declaration); - try { - enterOuterAlt(_localctx, 1); - { - setState(2530); - match(THIS); - setState(2531); - match(OPEN_BRACKET); - setState(2532); - formal_parameter_list(); - setState(2533); - match(CLOSE_BRACKET); - setState(2542); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACE: - { - setState(2534); - match(OPEN_BRACE); - setState(2535); - accessor_declarations(); - setState(2536); - match(CLOSE_BRACE); - } - break; - case ASSIGNMENT: - { - setState(2538); - right_arrow(); - setState(2539); - throwable_expression(); - setState(2540); - match(SEMICOLON); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Destructor_definitionContext extends ParserRuleContext { - public TerminalNode TILDE() { return getToken(CSharpParser.TILDE, 0); } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public BodyContext body() { - return getRuleContext(BodyContext.class,0); - } - public Destructor_definitionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_destructor_definition; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterDestructor_definition(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitDestructor_definition(this); - } - } - - public final Destructor_definitionContext destructor_definition() throws RecognitionException { - Destructor_definitionContext _localctx = new Destructor_definitionContext(_ctx, getState()); - enterRule(_localctx, 418, RULE_destructor_definition); - try { - enterOuterAlt(_localctx, 1); - { - setState(2544); - match(TILDE); - setState(2545); - identifier(); - setState(2546); - match(OPEN_PARENS); - setState(2547); - match(CLOSE_PARENS); - setState(2548); - body(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Constructor_declarationContext extends ParserRuleContext { - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public BodyContext body() { - return getRuleContext(BodyContext.class,0); - } - public Formal_parameter_listContext formal_parameter_list() { - return getRuleContext(Formal_parameter_listContext.class,0); - } - public Constructor_initializerContext constructor_initializer() { - return getRuleContext(Constructor_initializerContext.class,0); - } - public Constructor_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_constructor_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterConstructor_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitConstructor_declaration(this); - } - } - - public final Constructor_declarationContext constructor_declaration() throws RecognitionException { - Constructor_declarationContext _localctx = new Constructor_declarationContext(_ctx, getState()); - enterRule(_localctx, 420, RULE_constructor_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2550); - identifier(); - setState(2551); - match(OPEN_PARENS); - setState(2553); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 10)) & ~0x3f) == 0 && ((1L << (_la - 10)) & ((1L << (ADD - 10)) | (1L << (ALIAS - 10)) | (1L << (ARGLIST - 10)) | (1L << (ASCENDING - 10)) | (1L << (ASYNC - 10)) | (1L << (AWAIT - 10)) | (1L << (BOOL - 10)) | (1L << (BY - 10)) | (1L << (BYTE - 10)) | (1L << (CHAR - 10)) | (1L << (DECIMAL - 10)) | (1L << (DESCENDING - 10)) | (1L << (DOUBLE - 10)) | (1L << (DYNAMIC - 10)) | (1L << (EQUALS - 10)) | (1L << (FLOAT - 10)) | (1L << (FROM - 10)) | (1L << (GET - 10)) | (1L << (GROUP - 10)) | (1L << (IN - 10)) | (1L << (INT - 10)) | (1L << (INTO - 10)) | (1L << (JOIN - 10)) | (1L << (LET - 10)) | (1L << (LONG - 10)) | (1L << (NAMEOF - 10)) | (1L << (OBJECT - 10)) | (1L << (ON - 10)) | (1L << (ORDERBY - 10)) | (1L << (OUT - 10)))) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & ((1L << (PARAMS - 74)) | (1L << (PARTIAL - 74)) | (1L << (REF - 74)) | (1L << (REMOVE - 74)) | (1L << (SBYTE - 74)) | (1L << (SELECT - 74)) | (1L << (SET - 74)) | (1L << (SHORT - 74)) | (1L << (STRING - 74)) | (1L << (THIS - 74)) | (1L << (UINT - 74)) | (1L << (ULONG - 74)) | (1L << (UNMANAGED - 74)) | (1L << (USHORT - 74)) | (1L << (VAR - 74)) | (1L << (VOID - 74)) | (1L << (WHEN - 74)) | (1L << (WHERE - 74)) | (1L << (YIELD - 74)) | (1L << (IDENTIFIER - 74)) | (1L << (OPEN_BRACKET - 74)) | (1L << (OPEN_PARENS - 74)))) != 0)) { - { - setState(2552); - formal_parameter_list(); - } - } - - setState(2555); - match(CLOSE_PARENS); - setState(2557); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COLON) { - { - setState(2556); - constructor_initializer(); - } - } - - setState(2559); - body(); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Method_declarationContext extends ParserRuleContext { - public Method_member_nameContext method_member_name() { - return getRuleContext(Method_member_nameContext.class,0); - } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Method_bodyContext method_body() { - return getRuleContext(Method_bodyContext.class,0); - } - public Right_arrowContext right_arrow() { - return getRuleContext(Right_arrowContext.class,0); - } - public Throwable_expressionContext throwable_expression() { - return getRuleContext(Throwable_expressionContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public Type_parameter_listContext type_parameter_list() { - return getRuleContext(Type_parameter_listContext.class,0); - } - public Formal_parameter_listContext formal_parameter_list() { - return getRuleContext(Formal_parameter_listContext.class,0); - } - public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { - return getRuleContext(Type_parameter_constraints_clausesContext.class,0); - } - public Method_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_method_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMethod_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMethod_declaration(this); - } - } - - public final Method_declarationContext method_declaration() throws RecognitionException { - Method_declarationContext _localctx = new Method_declarationContext(_ctx, getState()); - enterRule(_localctx, 422, RULE_method_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2561); - method_member_name(); - setState(2563); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2562); - type_parameter_list(); - } - } - - setState(2565); - match(OPEN_PARENS); - setState(2567); - _errHandler.sync(this); - _la = _input.LA(1); - if (((((_la - 10)) & ~0x3f) == 0 && ((1L << (_la - 10)) & ((1L << (ADD - 10)) | (1L << (ALIAS - 10)) | (1L << (ARGLIST - 10)) | (1L << (ASCENDING - 10)) | (1L << (ASYNC - 10)) | (1L << (AWAIT - 10)) | (1L << (BOOL - 10)) | (1L << (BY - 10)) | (1L << (BYTE - 10)) | (1L << (CHAR - 10)) | (1L << (DECIMAL - 10)) | (1L << (DESCENDING - 10)) | (1L << (DOUBLE - 10)) | (1L << (DYNAMIC - 10)) | (1L << (EQUALS - 10)) | (1L << (FLOAT - 10)) | (1L << (FROM - 10)) | (1L << (GET - 10)) | (1L << (GROUP - 10)) | (1L << (IN - 10)) | (1L << (INT - 10)) | (1L << (INTO - 10)) | (1L << (JOIN - 10)) | (1L << (LET - 10)) | (1L << (LONG - 10)) | (1L << (NAMEOF - 10)) | (1L << (OBJECT - 10)) | (1L << (ON - 10)) | (1L << (ORDERBY - 10)) | (1L << (OUT - 10)))) != 0) || ((((_la - 74)) & ~0x3f) == 0 && ((1L << (_la - 74)) & ((1L << (PARAMS - 74)) | (1L << (PARTIAL - 74)) | (1L << (REF - 74)) | (1L << (REMOVE - 74)) | (1L << (SBYTE - 74)) | (1L << (SELECT - 74)) | (1L << (SET - 74)) | (1L << (SHORT - 74)) | (1L << (STRING - 74)) | (1L << (THIS - 74)) | (1L << (UINT - 74)) | (1L << (ULONG - 74)) | (1L << (UNMANAGED - 74)) | (1L << (USHORT - 74)) | (1L << (VAR - 74)) | (1L << (VOID - 74)) | (1L << (WHEN - 74)) | (1L << (WHERE - 74)) | (1L << (YIELD - 74)) | (1L << (IDENTIFIER - 74)) | (1L << (OPEN_BRACKET - 74)) | (1L << (OPEN_PARENS - 74)))) != 0)) { - { - setState(2566); - formal_parameter_list(); - } - } - - setState(2569); - match(CLOSE_PARENS); - setState(2571); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==WHERE) { - { - setState(2570); - type_parameter_constraints_clauses(); - } - } - - setState(2578); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACE: - case SEMICOLON: - { - setState(2573); - method_body(); - } - break; - case ASSIGNMENT: - { - setState(2574); - right_arrow(); - setState(2575); - throwable_expression(); - setState(2576); - match(SEMICOLON); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Method_member_nameContext extends ParserRuleContext { - public List identifier() { - return getRuleContexts(IdentifierContext.class); - } - public IdentifierContext identifier(int i) { - return getRuleContext(IdentifierContext.class,i); - } - public TerminalNode DOUBLE_COLON() { return getToken(CSharpParser.DOUBLE_COLON, 0); } - public List DOT() { return getTokens(CSharpParser.DOT); } - public TerminalNode DOT(int i) { - return getToken(CSharpParser.DOT, i); - } - public List type_argument_list() { - return getRuleContexts(Type_argument_listContext.class); - } - public Type_argument_listContext type_argument_list(int i) { - return getRuleContext(Type_argument_listContext.class,i); - } - public Method_member_nameContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_method_member_name; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMethod_member_name(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMethod_member_name(this); - } - } - - public final Method_member_nameContext method_member_name() throws RecognitionException { - Method_member_nameContext _localctx = new Method_member_nameContext(_ctx, getState()); - enterRule(_localctx, 424, RULE_method_member_name); - int _la; - try { - int _alt; - enterOuterAlt(_localctx, 1); - { - setState(2585); - _errHandler.sync(this); - switch ( getInterpreter().adaptivePredict(_input,333,_ctx) ) { - case 1: - { - setState(2580); - identifier(); - } - break; - case 2: - { - setState(2581); - identifier(); - setState(2582); - match(DOUBLE_COLON); - setState(2583); - identifier(); - } - break; - } - setState(2594); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,335,_ctx); - while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) { - if ( _alt==1 ) { - { - { - setState(2588); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==LT) { - { - setState(2587); - type_argument_list(); - } - } - - setState(2590); - match(DOT); - setState(2591); - identifier(); - } - } - } - setState(2596); - _errHandler.sync(this); - _alt = getInterpreter().adaptivePredict(_input,335,_ctx); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Operator_declarationContext extends ParserRuleContext { - public TerminalNode OPERATOR() { return getToken(CSharpParser.OPERATOR, 0); } - public Overloadable_operatorContext overloadable_operator() { - return getRuleContext(Overloadable_operatorContext.class,0); - } - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public List arg_declaration() { - return getRuleContexts(Arg_declarationContext.class); - } - public Arg_declarationContext arg_declaration(int i) { - return getRuleContext(Arg_declarationContext.class,i); - } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public BodyContext body() { - return getRuleContext(BodyContext.class,0); - } - public Right_arrowContext right_arrow() { - return getRuleContext(Right_arrowContext.class,0); - } - public Throwable_expressionContext throwable_expression() { - return getRuleContext(Throwable_expressionContext.class,0); - } - public TerminalNode SEMICOLON() { return getToken(CSharpParser.SEMICOLON, 0); } - public List IN() { return getTokens(CSharpParser.IN); } - public TerminalNode IN(int i) { - return getToken(CSharpParser.IN, i); - } - public TerminalNode COMMA() { return getToken(CSharpParser.COMMA, 0); } - public Operator_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_operator_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterOperator_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitOperator_declaration(this); - } - } - - public final Operator_declarationContext operator_declaration() throws RecognitionException { - Operator_declarationContext _localctx = new Operator_declarationContext(_ctx, getState()); - enterRule(_localctx, 426, RULE_operator_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2597); - match(OPERATOR); - setState(2598); - overloadable_operator(); - setState(2599); - match(OPEN_PARENS); - setState(2601); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==IN) { - { - setState(2600); - match(IN); - } - } - - setState(2603); - arg_declaration(); - setState(2609); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==COMMA) { - { - setState(2604); - match(COMMA); - setState(2606); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==IN) { - { - setState(2605); - match(IN); - } - } - - setState(2608); - arg_declaration(); - } - } - - setState(2611); - match(CLOSE_PARENS); - setState(2617); - _errHandler.sync(this); - switch (_input.LA(1)) { - case OPEN_BRACE: - case SEMICOLON: - { - setState(2612); - body(); - } - break; - case ASSIGNMENT: - { - setState(2613); - right_arrow(); - setState(2614); - throwable_expression(); - setState(2615); - match(SEMICOLON); - } - break; - default: - throw new NoViableAltException(this); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Arg_declarationContext extends ParserRuleContext { - public Type_Context type_() { - return getRuleContext(Type_Context.class,0); - } - public IdentifierContext identifier() { - return getRuleContext(IdentifierContext.class,0); - } - public TerminalNode ASSIGNMENT() { return getToken(CSharpParser.ASSIGNMENT, 0); } - public ExpressionContext expression() { - return getRuleContext(ExpressionContext.class,0); - } - public Arg_declarationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_arg_declaration; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterArg_declaration(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitArg_declaration(this); - } - } - - public final Arg_declarationContext arg_declaration() throws RecognitionException { - Arg_declarationContext _localctx = new Arg_declarationContext(_ctx, getState()); - enterRule(_localctx, 428, RULE_arg_declaration); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2619); - type_(); - setState(2620); - identifier(); - setState(2623); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==ASSIGNMENT) { - { - setState(2621); - match(ASSIGNMENT); - setState(2622); - expression(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Method_invocationContext extends ParserRuleContext { - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Argument_listContext argument_list() { - return getRuleContext(Argument_listContext.class,0); - } - public Method_invocationContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_method_invocation; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterMethod_invocation(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitMethod_invocation(this); - } - } - - public final Method_invocationContext method_invocation() throws RecognitionException { - Method_invocationContext _localctx = new Method_invocationContext(_ctx, getState()); - enterRule(_localctx, 430, RULE_method_invocation); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2625); - match(OPEN_PARENS); - setState(2627); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << IN) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (OUT - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (VOID - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(2626); - argument_list(); - } - } - - setState(2629); - match(CLOSE_PARENS); - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class Object_creation_expressionContext extends ParserRuleContext { - public TerminalNode OPEN_PARENS() { return getToken(CSharpParser.OPEN_PARENS, 0); } - public TerminalNode CLOSE_PARENS() { return getToken(CSharpParser.CLOSE_PARENS, 0); } - public Argument_listContext argument_list() { - return getRuleContext(Argument_listContext.class,0); - } - public Object_or_collection_initializerContext object_or_collection_initializer() { - return getRuleContext(Object_or_collection_initializerContext.class,0); - } - public Object_creation_expressionContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_object_creation_expression; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterObject_creation_expression(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitObject_creation_expression(this); - } - } - - public final Object_creation_expressionContext object_creation_expression() throws RecognitionException { - Object_creation_expressionContext _localctx = new Object_creation_expressionContext(_ctx, getState()); - enterRule(_localctx, 432, RULE_object_creation_expression); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2631); - match(OPEN_PARENS); - setState(2633); - _errHandler.sync(this); - _la = _input.LA(1); - if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BASE) | (1L << BOOL) | (1L << BY) | (1L << BYTE) | (1L << CHAR) | (1L << CHECKED) | (1L << DECIMAL) | (1L << DEFAULT) | (1L << DELEGATE) | (1L << DESCENDING) | (1L << DOUBLE) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FALSE) | (1L << FLOAT) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << IN) | (1L << INT) | (1L << INTO) | (1L << JOIN) | (1L << LET) | (1L << LONG))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (NEW - 64)) | (1L << (NULL_ - 64)) | (1L << (OBJECT - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (OUT - 64)) | (1L << (PARTIAL - 64)) | (1L << (REF - 64)) | (1L << (REMOVE - 64)) | (1L << (SBYTE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (SHORT - 64)) | (1L << (SIZEOF - 64)) | (1L << (STRING - 64)) | (1L << (THIS - 64)) | (1L << (TRUE - 64)) | (1L << (TYPEOF - 64)) | (1L << (UINT - 64)) | (1L << (ULONG - 64)) | (1L << (UNCHECKED - 64)) | (1L << (UNMANAGED - 64)) | (1L << (USHORT - 64)) | (1L << (VAR - 64)) | (1L << (VOID - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)) | (1L << (LITERAL_ACCESS - 64)) | (1L << (INTEGER_LITERAL - 64)) | (1L << (HEX_INTEGER_LITERAL - 64)) | (1L << (BIN_INTEGER_LITERAL - 64)) | (1L << (REAL_LITERAL - 64)) | (1L << (CHARACTER_LITERAL - 64)) | (1L << (REGULAR_STRING - 64)) | (1L << (VERBATIUM_STRING - 64)) | (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != 0) || ((((_la - 129)) & ~0x3f) == 0 && ((1L << (_la - 129)) & ((1L << (OPEN_PARENS - 129)) | (1L << (PLUS - 129)) | (1L << (MINUS - 129)) | (1L << (STAR - 129)) | (1L << (AMP - 129)) | (1L << (CARET - 129)) | (1L << (BANG - 129)) | (1L << (TILDE - 129)) | (1L << (OP_INC - 129)) | (1L << (OP_DEC - 129)) | (1L << (OP_RANGE - 129)))) != 0)) { - { - setState(2632); - argument_list(); - } - } - - setState(2635); - match(CLOSE_PARENS); - setState(2637); - _errHandler.sync(this); - _la = _input.LA(1); - if (_la==OPEN_BRACE) { - { - setState(2636); - object_or_collection_initializer(); - } - } - - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public static class IdentifierContext extends ParserRuleContext { - public TerminalNode IDENTIFIER() { return getToken(CSharpParser.IDENTIFIER, 0); } - public TerminalNode ADD() { return getToken(CSharpParser.ADD, 0); } - public TerminalNode ALIAS() { return getToken(CSharpParser.ALIAS, 0); } - public TerminalNode ARGLIST() { return getToken(CSharpParser.ARGLIST, 0); } - public TerminalNode ASCENDING() { return getToken(CSharpParser.ASCENDING, 0); } - public TerminalNode ASYNC() { return getToken(CSharpParser.ASYNC, 0); } - public TerminalNode AWAIT() { return getToken(CSharpParser.AWAIT, 0); } - public TerminalNode BY() { return getToken(CSharpParser.BY, 0); } - public TerminalNode DESCENDING() { return getToken(CSharpParser.DESCENDING, 0); } - public TerminalNode DYNAMIC() { return getToken(CSharpParser.DYNAMIC, 0); } - public TerminalNode EQUALS() { return getToken(CSharpParser.EQUALS, 0); } - public TerminalNode FROM() { return getToken(CSharpParser.FROM, 0); } - public TerminalNode GET() { return getToken(CSharpParser.GET, 0); } - public TerminalNode GROUP() { return getToken(CSharpParser.GROUP, 0); } - public TerminalNode INTO() { return getToken(CSharpParser.INTO, 0); } - public TerminalNode JOIN() { return getToken(CSharpParser.JOIN, 0); } - public TerminalNode LET() { return getToken(CSharpParser.LET, 0); } - public TerminalNode NAMEOF() { return getToken(CSharpParser.NAMEOF, 0); } - public TerminalNode ON() { return getToken(CSharpParser.ON, 0); } - public TerminalNode ORDERBY() { return getToken(CSharpParser.ORDERBY, 0); } - public TerminalNode PARTIAL() { return getToken(CSharpParser.PARTIAL, 0); } - public TerminalNode REMOVE() { return getToken(CSharpParser.REMOVE, 0); } - public TerminalNode SELECT() { return getToken(CSharpParser.SELECT, 0); } - public TerminalNode SET() { return getToken(CSharpParser.SET, 0); } - public TerminalNode UNMANAGED() { return getToken(CSharpParser.UNMANAGED, 0); } - public TerminalNode VAR() { return getToken(CSharpParser.VAR, 0); } - public TerminalNode WHEN() { return getToken(CSharpParser.WHEN, 0); } - public TerminalNode WHERE() { return getToken(CSharpParser.WHERE, 0); } - public TerminalNode YIELD() { return getToken(CSharpParser.YIELD, 0); } - public IdentifierContext(ParserRuleContext parent, int invokingState) { - super(parent, invokingState); - } - @Override public int getRuleIndex() { return RULE_identifier; } - @Override - public void enterRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).enterIdentifier(this); - } - @Override - public void exitRule(ParseTreeListener listener) { - if ( listener instanceof CSharpParserListener ) ((CSharpParserListener)listener).exitIdentifier(this); - } - } - - public final IdentifierContext identifier() throws RecognitionException { - IdentifierContext _localctx = new IdentifierContext(_ctx, getState()); - enterRule(_localctx, 434, RULE_identifier); - int _la; - try { - enterOuterAlt(_localctx, 1); - { - setState(2639); - _la = _input.LA(1); - if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << ADD) | (1L << ALIAS) | (1L << ARGLIST) | (1L << ASCENDING) | (1L << ASYNC) | (1L << AWAIT) | (1L << BY) | (1L << DESCENDING) | (1L << DYNAMIC) | (1L << EQUALS) | (1L << FROM) | (1L << GET) | (1L << GROUP) | (1L << INTO) | (1L << JOIN) | (1L << LET))) != 0) || ((((_la - 64)) & ~0x3f) == 0 && ((1L << (_la - 64)) & ((1L << (NAMEOF - 64)) | (1L << (ON - 64)) | (1L << (ORDERBY - 64)) | (1L << (PARTIAL - 64)) | (1L << (REMOVE - 64)) | (1L << (SELECT - 64)) | (1L << (SET - 64)) | (1L << (UNMANAGED - 64)) | (1L << (VAR - 64)) | (1L << (WHEN - 64)) | (1L << (WHERE - 64)) | (1L << (YIELD - 64)) | (1L << (IDENTIFIER - 64)))) != 0)) ) { - _errHandler.recoverInline(this); - } - else { - if ( _input.LA(1)==Token.EOF ) matchedEOF = true; - _errHandler.reportMatch(this); - consume(); - } - } - } - catch (RecognitionException re) { - _localctx.exception = re; - _errHandler.reportError(this, re); - _errHandler.recover(this, re); - } - finally { - exitRule(); - } - return _localctx; - } - - public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { - switch (ruleIndex) { - case 187: - return right_arrow_sempred((Right_arrowContext)_localctx, predIndex); - case 188: - return right_shift_sempred((Right_shiftContext)_localctx, predIndex); - case 189: - return right_shift_assignment_sempred((Right_shift_assignmentContext)_localctx, predIndex); - } - return true; - } - private boolean right_arrow_sempred(Right_arrowContext _localctx, int predIndex) { - switch (predIndex) { - case 0: - return (((Right_arrowContext)_localctx).first!=null?((Right_arrowContext)_localctx).first.getTokenIndex():0) + 1 == (((Right_arrowContext)_localctx).second!=null?((Right_arrowContext)_localctx).second.getTokenIndex():0); - } - return true; - } - private boolean right_shift_sempred(Right_shiftContext _localctx, int predIndex) { - switch (predIndex) { - case 1: - return (((Right_shiftContext)_localctx).first!=null?((Right_shiftContext)_localctx).first.getTokenIndex():0) + 1 == (((Right_shiftContext)_localctx).second!=null?((Right_shiftContext)_localctx).second.getTokenIndex():0); - } - return true; - } - private boolean right_shift_assignment_sempred(Right_shift_assignmentContext _localctx, int predIndex) { - switch (predIndex) { - case 2: - return (((Right_shift_assignmentContext)_localctx).first!=null?((Right_shift_assignmentContext)_localctx).first.getTokenIndex():0) + 1 == (((Right_shift_assignmentContext)_localctx).second!=null?((Right_shift_assignmentContext)_localctx).second.getTokenIndex():0); - } - return true; - } - - private static final int _serializedATNSegments = 2; - private static final String _serializedATNSegment0 = - "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\u00c8\u0a54\4\2\t"+ - "\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13"+ - "\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+ - "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+ - "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!"+ - "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4"+ - ",\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t"+ - "\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t="+ - "\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I"+ - "\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT"+ - "\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4_\t_\4"+ - "`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h\th\4i\ti\4j\tj\4k\t"+ - "k\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4q\tq\4r\tr\4s\ts\4t\tt\4u\tu\4v\tv\4"+ - "w\tw\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177\t\177\4\u0080\t\u0080"+ - "\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083\4\u0084\t\u0084\4\u0085"+ - "\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087\4\u0088\t\u0088\4\u0089\t\u0089"+ - "\4\u008a\t\u008a\4\u008b\t\u008b\4\u008c\t\u008c\4\u008d\t\u008d\4\u008e"+ - "\t\u008e\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091\t\u0091\4\u0092\t\u0092"+ - "\4\u0093\t\u0093\4\u0094\t\u0094\4\u0095\t\u0095\4\u0096\t\u0096\4\u0097"+ - "\t\u0097\4\u0098\t\u0098\4\u0099\t\u0099\4\u009a\t\u009a\4\u009b\t\u009b"+ - "\4\u009c\t\u009c\4\u009d\t\u009d\4\u009e\t\u009e\4\u009f\t\u009f\4\u00a0"+ - "\t\u00a0\4\u00a1\t\u00a1\4\u00a2\t\u00a2\4\u00a3\t\u00a3\4\u00a4\t\u00a4"+ - "\4\u00a5\t\u00a5\4\u00a6\t\u00a6\4\u00a7\t\u00a7\4\u00a8\t\u00a8\4\u00a9"+ - "\t\u00a9\4\u00aa\t\u00aa\4\u00ab\t\u00ab\4\u00ac\t\u00ac\4\u00ad\t\u00ad"+ - "\4\u00ae\t\u00ae\4\u00af\t\u00af\4\u00b0\t\u00b0\4\u00b1\t\u00b1\4\u00b2"+ - "\t\u00b2\4\u00b3\t\u00b3\4\u00b4\t\u00b4\4\u00b5\t\u00b5\4\u00b6\t\u00b6"+ - "\4\u00b7\t\u00b7\4\u00b8\t\u00b8\4\u00b9\t\u00b9\4\u00ba\t\u00ba\4\u00bb"+ - "\t\u00bb\4\u00bc\t\u00bc\4\u00bd\t\u00bd\4\u00be\t\u00be\4\u00bf\t\u00bf"+ - "\4\u00c0\t\u00c0\4\u00c1\t\u00c1\4\u00c2\t\u00c2\4\u00c3\t\u00c3\4\u00c4"+ - "\t\u00c4\4\u00c5\t\u00c5\4\u00c6\t\u00c6\4\u00c7\t\u00c7\4\u00c8\t\u00c8"+ - "\4\u00c9\t\u00c9\4\u00ca\t\u00ca\4\u00cb\t\u00cb\4\u00cc\t\u00cc\4\u00cd"+ - "\t\u00cd\4\u00ce\t\u00ce\4\u00cf\t\u00cf\4\u00d0\t\u00d0\4\u00d1\t\u00d1"+ - "\4\u00d2\t\u00d2\4\u00d3\t\u00d3\4\u00d4\t\u00d4\4\u00d5\t\u00d5\4\u00d6"+ - "\t\u00d6\4\u00d7\t\u00d7\4\u00d8\t\u00d8\4\u00d9\t\u00d9\4\u00da\t\u00da"+ - "\4\u00db\t\u00db\3\2\5\2\u01b8\n\2\3\2\5\2\u01bb\n\2\3\2\5\2\u01be\n\2"+ - "\3\2\7\2\u01c1\n\2\f\2\16\2\u01c4\13\2\3\2\5\2\u01c7\n\2\3\2\3\2\3\3\3"+ - "\3\5\3\u01cd\n\3\3\3\5\3\u01d0\n\3\3\3\3\3\3\3\5\3\u01d5\n\3\7\3\u01d7"+ - "\n\3\f\3\16\3\u01da\13\3\3\4\3\4\3\4\3\4\7\4\u01e0\n\4\f\4\16\4\u01e3"+ - "\13\4\3\5\3\5\3\5\3\5\3\5\5\5\u01ea\n\5\3\6\3\6\3\6\3\6\6\6\u01f0\n\6"+ - "\r\6\16\6\u01f1\3\6\3\6\3\7\3\7\5\7\u01f8\n\7\3\b\3\b\5\b\u01fc\n\b\3"+ - "\t\3\t\3\t\5\t\u0201\n\t\3\n\3\n\3\13\3\13\3\f\3\f\3\f\3\f\5\f\u020b\n"+ - "\f\3\r\3\r\3\r\3\r\7\r\u0211\n\r\f\r\16\r\u0214\13\r\3\r\3\r\3\16\3\16"+ - "\3\16\7\16\u021b\n\16\f\16\16\16\u021e\13\16\3\17\3\17\3\17\5\17\u0223"+ - "\n\17\3\17\5\17\u0226\n\17\3\17\3\17\5\17\u022a\n\17\3\17\3\17\3\20\3"+ - "\20\3\20\3\20\5\20\u0232\n\20\3\21\3\21\3\21\5\21\u0237\n\21\3\22\3\22"+ - "\3\22\3\22\3\22\3\22\3\22\3\22\5\22\u0241\n\22\3\23\3\23\3\23\3\23\3\23"+ - "\3\23\3\23\3\23\3\23\3\23\3\23\5\23\u024e\n\23\3\24\3\24\3\24\3\24\3\24"+ - "\3\24\5\24\u0256\n\24\3\25\3\25\3\25\3\25\5\25\u025c\n\25\5\25\u025e\n"+ - "\25\3\26\3\26\3\26\7\26\u0263\n\26\f\26\16\26\u0266\13\26\3\27\3\27\3"+ - "\27\7\27\u026b\n\27\f\27\16\27\u026e\13\27\3\30\3\30\3\30\7\30\u0273\n"+ - "\30\f\30\16\30\u0276\13\30\3\31\3\31\3\31\7\31\u027b\n\31\f\31\16\31\u027e"+ - "\13\31\3\32\3\32\3\32\7\32\u0283\n\32\f\32\16\32\u0286\13\32\3\33\3\33"+ - "\3\33\7\33\u028b\n\33\f\33\16\33\u028e\13\33\3\34\3\34\3\34\3\34\3\34"+ - "\3\34\3\34\7\34\u0297\n\34\f\34\16\34\u029a\13\34\3\35\3\35\3\35\5\35"+ - "\u029f\n\35\3\35\7\35\u02a2\n\35\f\35\16\35\u02a5\13\35\3\36\3\36\3\36"+ - "\7\36\u02aa\n\36\f\36\16\36\u02ad\13\36\3\37\3\37\3\37\7\37\u02b2\n\37"+ - "\f\37\16\37\u02b5\13\37\3 \3 \3 \3 \3 \5 \u02bc\n \5 \u02be\n \3 \5 \u02c1"+ - "\n \3!\3!\3!\7!\u02c6\n!\f!\16!\u02c9\13!\3\"\3\"\5\"\u02cd\n\"\3\"\3"+ - "\"\3\"\3#\3#\5#\u02d4\n#\3#\3#\5#\u02d8\n#\5#\u02da\n#\3$\3$\3$\3$\3$"+ - "\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\5$\u02f6"+ - "\n$\3%\3%\5%\u02fa\n%\3%\7%\u02fd\n%\f%\16%\u0300\13%\3%\5%\u0303\n%\3"+ - "%\3%\3%\3%\3%\3%\5%\u030b\n%\3%\5%\u030e\n%\3%\7%\u0311\n%\f%\16%\u0314"+ - "\13%\3%\5%\u0317\n%\7%\u0319\n%\f%\16%\u031c\13%\3&\3&\3&\5&\u0321\n&"+ - "\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\5&\u032f\n&\3&\3&\3&\3&\5&\u0335"+ - "\n&\3&\3&\3&\3&\3&\3&\3&\3&\7&\u033f\n&\f&\16&\u0342\13&\3&\5&\u0345\n"+ - "&\3&\6&\u0348\n&\r&\16&\u0349\3&\3&\5&\u034e\n&\3&\3&\3&\3&\5&\u0354\n"+ - "&\3&\3&\3&\3&\6&\u035a\n&\r&\16&\u035b\3&\3&\3&\3&\3&\3&\3&\5&\u0365\n"+ - "&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\5&\u0377\n&\3&\5&\u037a"+ - "\n&\3&\3&\3&\5&\u037f\n&\3&\5&\u0382\n&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&"+ - "\3&\7&\u038f\n&\f&\16&\u0392\13&\3&\3&\3&\5&\u0397\n&\3\'\3\'\5\'\u039b"+ - "\n\'\3(\3(\3(\3)\5)\u03a1\n)\3)\3)\3)\5)\u03a6\n)\3*\5*\u03a9\n*\3*\3"+ - "*\3*\3*\7*\u03af\n*\f*\16*\u03b2\13*\3*\3*\3+\3+\3+\5+\u03b9\n+\3+\3+"+ - "\3,\3,\3-\3-\3-\7-\u03c2\n-\f-\16-\u03c5\13-\3.\3.\5.\u03c9\n.\3/\3/\3"+ - "/\5/\u03ce\n/\5/\u03d0\n/\3/\3/\3\60\3\60\3\60\7\60\u03d7\n\60\f\60\16"+ - "\60\u03da\13\60\3\61\3\61\3\61\3\61\3\61\5\61\u03e1\n\61\3\61\3\61\3\61"+ - "\3\62\3\62\5\62\u03e8\n\62\3\63\3\63\3\63\3\63\7\63\u03ee\n\63\f\63\16"+ - "\63\u03f1\13\63\3\63\5\63\u03f4\n\63\3\63\3\63\3\64\3\64\3\64\3\64\3\64"+ - "\5\64\u03fd\n\64\3\65\3\65\3\65\5\65\u0402\n\65\5\65\u0404\n\65\3\65\3"+ - "\65\3\66\3\66\3\66\7\66\u040b\n\66\f\66\16\66\u040e\13\66\3\67\3\67\3"+ - "\67\3\67\3\67\5\67\u0415\n\67\38\38\58\u0419\n8\38\38\38\58\u041e\n8\5"+ - "8\u0420\n8\38\38\38\58\u0425\n8\78\u0427\n8\f8\168\u042a\138\39\39\79"+ - "\u042e\n9\f9\169\u0431\139\39\39\3:\3:\3:\7:\u0438\n:\f:\16:\u043b\13"+ - ":\3:\5:\u043e\n:\3:\5:\u0441\n:\3:\5:\u0444\n:\3;\3;\3;\3;\7;\u044a\n"+ - ";\f;\16;\u044d\13;\3;\3;\3<\3<\3<\3<\3=\5=\u0456\n=\3=\3=\3=\3=\3>\3>"+ - "\3>\3>\3>\3>\3>\3>\3>\3>\3>\5>\u0467\n>\3?\3?\3?\7?\u046c\n?\f?\16?\u046f"+ - "\13?\3@\5@\u0472\n@\3@\3@\3@\3A\3A\3A\7A\u047a\nA\fA\16A\u047d\13A\3B"+ - "\3B\5B\u0481\nB\3C\3C\3C\3D\3D\5D\u0488\nD\3D\3D\3D\3D\3E\7E\u048f\nE"+ - "\fE\16E\u0492\13E\3E\3E\5E\u0496\nE\3F\3F\3F\3F\3F\5F\u049d\nF\3G\3G\3"+ - "G\3G\3G\3H\3H\3H\3I\3I\5I\u04a9\nI\3I\3I\3I\3I\3I\3I\3I\3I\3I\5I\u04b4"+ - "\nI\3J\3J\3J\3J\7J\u04ba\nJ\fJ\16J\u04bd\13J\3K\3K\5K\u04c1\nK\3L\3L\3"+ - "L\3L\3L\3L\3L\5L\u04ca\nL\3M\3M\3M\3M\3N\3N\3N\5N\u04d3\nN\3O\3O\3O\3"+ - "O\3O\3O\3O\5O\u04dc\nO\3P\3P\3P\3Q\5Q\u04e2\nQ\3Q\3Q\3Q\5Q\u04e7\nQ\3"+ - "Q\3Q\5Q\u04eb\nQ\3Q\3Q\5Q\u04ef\nQ\3R\3R\5R\u04f3\nR\3R\3R\5R\u04f7\n"+ - "R\3S\3S\3S\3S\3S\5S\u04fe\nS\3T\3T\3T\3T\3U\3U\5U\u0506\nU\3V\3V\3V\3"+ - "V\3V\3V\3V\3V\3V\3V\3V\5V\u0513\nV\3V\3V\3V\3V\3V\3V\7V\u051b\nV\fV\16"+ - "V\u051e\13V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\5"+ - "V\u0533\nV\3V\3V\5V\u0537\nV\3V\3V\5V\u053b\nV\3V\3V\3V\5V\u0540\nV\3"+ - "V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\5V\u0554\nV\3V\3"+ - "V\3V\5V\u0559\nV\3V\3V\3V\5V\u055e\nV\3V\3V\3V\3V\3V\5V\u0565\nV\3V\5"+ - "V\u0568\nV\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3"+ - "V\5V\u057e\nV\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\5V\u058a\nV\3W\3W\5W\u058e"+ - "\nW\3W\3W\3X\3X\3X\3X\5X\u0596\nX\3X\3X\3X\3X\7X\u059c\nX\fX\16X\u059f"+ - "\13X\3X\3X\3X\3X\5X\u05a5\nX\3Y\3Y\5Y\u05a9\nY\3Z\3Z\3Z\5Z\u05ae\nZ\3"+ - "Z\5Z\u05b1\nZ\3[\3[\3[\5[\u05b6\n[\3\\\3\\\3\\\3\\\3]\3]\5]\u05be\n]\3"+ - "^\6^\u05c1\n^\r^\16^\u05c2\3^\3^\3_\3_\3_\5_\u05ca\n_\3_\3_\3_\3_\5_\u05d0"+ - "\n_\3`\3`\3`\3a\6a\u05d6\na\ra\16a\u05d7\3b\3b\3b\3b\7b\u05de\nb\fb\16"+ - "b\u05e1\13b\5b\u05e3\nb\3c\3c\3c\7c\u05e8\nc\fc\16c\u05eb\13c\3d\3d\7"+ - "d\u05ef\nd\fd\16d\u05f2\13d\3d\5d\u05f5\nd\3d\5d\u05f8\nd\3e\3e\3e\3e"+ - "\5e\u05fe\ne\3e\3e\5e\u0602\ne\3e\3e\3f\3f\5f\u0608\nf\3f\3f\3g\3g\3g"+ - "\3g\3g\3h\3h\3h\3i\3i\5i\u0616\ni\3j\3j\3j\3j\5j\u061c\nj\3k\3k\3k\7k"+ - "\u0621\nk\fk\16k\u0624\13k\3l\3l\5l\u0628\nl\3l\5l\u062b\nl\3l\5l\u062e"+ - "\nl\3l\3l\3m\6m\u0633\nm\rm\16m\u0634\3n\3n\3n\3n\3n\3o\6o\u063d\no\r"+ - "o\16o\u063e\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\5p\u0650\np\3"+ - "q\6q\u0653\nq\rq\16q\u0654\3r\3r\5r\u0659\nr\3s\5s\u065c\ns\3s\5s\u065f"+ - "\ns\3s\3s\3s\3s\3s\5s\u0666\ns\3t\3t\3t\3t\5t\u066c\nt\3u\3u\3u\3u\7u"+ - "\u0672\nu\fu\16u\u0675\13u\3u\3u\3v\5v\u067a\nv\3v\3v\3w\3w\3w\3w\7w\u0682"+ - "\nw\fw\16w\u0685\13w\3x\3x\3x\7x\u068a\nx\fx\16x\u068d\13x\3y\6y\u0690"+ - "\ny\ry\16y\u0691\3z\3z\3z\3z\3z\3{\3{\3{\3{\5{\u069d\n{\3{\3{\5{\u06a1"+ - "\n{\5{\u06a3\n{\3|\3|\3|\5|\u06a8\n|\3|\3|\5|\u06ac\n|\3}\3}\3}\7}\u06b1"+ - "\n}\f}\16}\u06b4\13}\3~\3~\3~\3~\3\177\3\177\5\177\u06bc\n\177\3\177\3"+ - "\177\3\u0080\6\u0080\u06c1\n\u0080\r\u0080\16\u0080\u06c2\3\u0081\5\u0081"+ - "\u06c6\n\u0081\3\u0081\5\u0081\u06c9\n\u0081\3\u0081\3\u0081\5\u0081\u06cd"+ - "\n\u0081\3\u0082\6\u0082\u06d0\n\u0082\r\u0082\16\u0082\u06d1\3\u0083"+ - "\3\u0083\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084"+ - "\3\u0084\5\u0084\u06df\n\u0084\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084"+ - "\3\u0084\3\u0084\3\u0084\5\u0084\u06e9\n\u0084\3\u0085\3\u0085\3\u0085"+ - "\3\u0085\3\u0085\5\u0085\u06f0\n\u0085\3\u0085\3\u0085\3\u0085\3\u0085"+ - "\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\5\u0085\u06fc\n\u0085"+ - "\3\u0086\3\u0086\3\u0086\7\u0086\u0701\n\u0086\f\u0086\16\u0086\u0704"+ - "\13\u0086\3\u0087\3\u0087\3\u0087\3\u0087\3\u0088\3\u0088\3\u0088\7\u0088"+ - "\u070d\n\u0088\f\u0088\16\u0088\u0710\13\u0088\3\u0089\3\u0089\3\u0089"+ - "\5\u0089\u0715\n\u0089\3\u008a\3\u008a\5\u008a\u0719\n\u008a\3\u008b\3"+ - "\u008b\5\u008b\u071d\n\u008b\3\u008c\3\u008c\3\u008d\3\u008d\5\u008d\u0723"+ - "\n\u008d\3\u008e\3\u008e\3\u008e\3\u008e\5\u008e\u0729\n\u008e\5\u008e"+ - "\u072b\n\u008e\3\u008f\3\u008f\3\u008f\7\u008f\u0730\n\u008f\f\u008f\16"+ - "\u008f\u0733\13\u008f\3\u0090\5\u0090\u0736\n\u0090\3\u0090\5\u0090\u0739"+ - "\n\u0090\3\u0090\3\u0090\5\u0090\u073d\n\u0090\3\u0091\3\u0091\3\u0091"+ - "\3\u0091\3\u0091\3\u0091\3\u0091\3\u0091\5\u0091\u0747\n\u0091\3\u0092"+ - "\5\u0092\u074a\n\u0092\3\u0092\3\u0092\3\u0092\3\u0092\3\u0093\5\u0093"+ - "\u0751\n\u0093\3\u0093\5\u0093\u0754\n\u0093\3\u0093\3\u0093\3\u0093\5"+ - "\u0093\u0759\n\u0093\3\u0093\3\u0093\3\u0093\5\u0093\u075e\n\u0093\5\u0093"+ - "\u0760\n\u0093\3\u0094\5\u0094\u0763\n\u0094\3\u0094\5\u0094\u0766\n\u0094"+ - "\3\u0094\3\u0094\3\u0094\3\u0095\5\u0095\u076c\n\u0095\3\u0095\5\u0095"+ - "\u076f\n\u0095\3\u0095\3\u0095\3\u0095\3\u0096\3\u0096\3\u0096\3\u0096"+ - "\3\u0096\3\u0096\3\u0096\5\u0096\u077b\n\u0096\3\u0097\3\u0097\5\u0097"+ - "\u077f\n\u0097\3\u0098\5\u0098\u0782\n\u0098\3\u0098\3\u0098\3\u0098\3"+ - "\u0098\3\u0098\3\u0098\3\u0098\3\u0098\5\u0098\u078c\n\u0098\3\u0099\5"+ - "\u0099\u078f\n\u0099\3\u0099\3\u0099\3\u0099\3\u009a\5\u009a\u0795\n\u009a"+ - "\3\u009a\3\u009a\3\u009a\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b"+ - "\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b"+ - "\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\5\u009b\u07b0"+ - "\n\u009b\3\u009c\3\u009c\3\u009c\3\u009c\3\u009c\3\u009c\3\u009c\3\u009d"+ - "\3\u009d\3\u009d\3\u009d\5\u009d\u07bd\n\u009d\3\u009d\3\u009d\3\u009e"+ - "\3\u009e\5\u009e\u07c3\n\u009e\3\u009f\3\u009f\3\u009f\3\u00a0\3\u00a0"+ - "\7\u00a0\u07ca\n\u00a0\f\u00a0\16\u00a0\u07cd\13\u00a0\3\u00a0\3\u00a0"+ - "\3\u00a1\5\u00a1\u07d2\n\u00a1\3\u00a1\5\u00a1\u07d5\n\u00a1\3\u00a1\3"+ - "\u00a1\3\u00a1\3\u00a1\6\u00a1\u07db\n\u00a1\r\u00a1\16\u00a1\u07dc\3"+ - "\u00a1\3\u00a1\5\u00a1\u07e1\n\u00a1\3\u00a2\3\u00a2\7\u00a2\u07e5\n\u00a2"+ - "\f\u00a2\16\u00a2\u07e8\13\u00a2\3\u00a2\6\u00a2\u07eb\n\u00a2\r\u00a2"+ - "\16\u00a2\u07ec\3\u00a3\3\u00a3\7\u00a3\u07f1\n\u00a3\f\u00a3\16\u00a3"+ - "\u07f4\13\u00a3\3\u00a3\3\u00a3\3\u00a4\3\u00a4\3\u00a4\3\u00a4\7\u00a4"+ - "\u07fc\n\u00a4\f\u00a4\16\u00a4\u07ff\13\u00a4\3\u00a4\5\u00a4\u0802\n"+ - "\u00a4\5\u00a4\u0804\n\u00a4\3\u00a4\3\u00a4\3\u00a5\3\u00a5\3\u00a5\3"+ - "\u00a5\7\u00a5\u080c\n\u00a5\f\u00a5\16\u00a5\u080f\13\u00a5\3\u00a5\3"+ - "\u00a5\3\u00a6\5\u00a6\u0814\n\u00a6\3\u00a6\5\u00a6\u0817\n\u00a6\3\u00a6"+ - "\3\u00a6\3\u00a7\3\u00a7\3\u00a8\3\u00a8\3\u00a8\3\u00a9\3\u00a9\7\u00a9"+ - "\u0822\n\u00a9\f\u00a9\16\u00a9\u0825\13\u00a9\3\u00a9\3\u00a9\3\u00aa"+ - "\5\u00aa\u082a\n\u00aa\3\u00aa\5\u00aa\u082d\n\u00aa\3\u00aa\5\u00aa\u0830"+ - "\n\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\5\u00aa\u0837\n\u00aa"+ - "\3\u00aa\3\u00aa\3\u00aa\5\u00aa\u083c\n\u00aa\3\u00aa\3\u00aa\5\u00aa"+ - "\u0840\n\u00aa\3\u00aa\3\u00aa\5\u00aa\u0844\n\u00aa\3\u00aa\3\u00aa\3"+ - "\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa"+ - "\3\u00aa\3\u00aa\3\u00aa\3\u00aa\5\u00aa\u0855\n\u00aa\3\u00aa\5\u00aa"+ - "\u0858\n\u00aa\3\u00aa\3\u00aa\3\u00aa\5\u00aa\u085d\n\u00aa\3\u00aa\3"+ - "\u00aa\5\u00aa\u0861\n\u00aa\3\u00aa\3\u00aa\5\u00aa\u0865\n\u00aa\3\u00aa"+ - "\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\5\u00aa\u086e\n\u00aa"+ - "\3\u00ab\5\u00ab\u0871\n\u00ab\3\u00ab\3\u00ab\3\u00ab\5\u00ab\u0876\n"+ - "\u00ab\3\u00ab\3\u00ab\5\u00ab\u087a\n\u00ab\3\u00ab\3\u00ab\3\u00ab\5"+ - "\u00ab\u087f\n\u00ab\3\u00ab\3\u00ab\5\u00ab\u0883\n\u00ab\5\u00ab\u0885"+ - "\n\u00ab\3\u00ac\3\u00ac\3\u00ac\3\u00ad\3\u00ad\3\u00ad\3\u00ad\7\u00ad"+ - "\u088e\n\u00ad\f\u00ad\16\u00ad\u0891\13\u00ad\3\u00ad\5\u00ad\u0894\n"+ - "\u00ad\5\u00ad\u0896\n\u00ad\3\u00ad\3\u00ad\3\u00ae\5\u00ae\u089b\n\u00ae"+ - "\3\u00ae\3\u00ae\3\u00ae\5\u00ae\u08a0\n\u00ae\3\u00af\3\u00af\3\u00af"+ - "\3\u00af\3\u00af\5\u00af\u08a7\n\u00af\3\u00af\3\u00af\3\u00b0\3\u00b0"+ - "\5\u00b0\u08ad\n\u00b0\3\u00b1\6\u00b1\u08b0\n\u00b1\r\u00b1\16\u00b1"+ - "\u08b1\3\u00b2\3\u00b2\3\u00b2\3\u00b2\5\u00b2\u08b8\n\u00b2\3\u00b2\3"+ - "\u00b2\5\u00b2\u08bc\n\u00b2\3\u00b2\3\u00b2\3\u00b3\3\u00b3\5\u00b3\u08c2"+ - "\n\u00b3\3\u00b4\3\u00b4\3\u00b4\7\u00b4\u08c7\n\u00b4\f\u00b4\16\u00b4"+ - "\u08ca\13\u00b4\3\u00b5\3\u00b5\3\u00b5\3\u00b5\3\u00b5\7\u00b5\u08d1"+ - "\n\u00b5\f\u00b5\16\u00b5\u08d4\13\u00b5\5\u00b5\u08d6\n\u00b5\3\u00b5"+ - "\5\u00b5\u08d9\n\u00b5\3\u00b6\3\u00b6\3\u00b6\5\u00b6\u08de\n\u00b6\3"+ - "\u00b6\3\u00b6\3\u00b7\3\u00b7\5\u00b7\u08e4\n\u00b7\3\u00b7\3\u00b7\7"+ - "\u00b7\u08e8\n\u00b7\f\u00b7\16\u00b7\u08eb\13\u00b7\3\u00b7\3\u00b7\3"+ - "\u00b7\3\u00b7\5\u00b7\u08f1\n\u00b7\3\u00b8\3\u00b8\3\u00b8\7\u00b8\u08f6"+ - "\n\u00b8\f\u00b8\16\u00b8\u08f9\13\u00b8\3\u00b9\3\u00b9\3\u00b9\3\u00b9"+ - "\3\u00ba\5\u00ba\u0900\n\u00ba\3\u00ba\3\u00ba\5\u00ba\u0904\n\u00ba\3"+ - "\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bc\3\u00bc\3\u00bc\3\u00bc"+ - "\3\u00bc\3\u00bc\3\u00bc\3\u00bc\5\u00bc\u0913\n\u00bc\3\u00bc\3\u00bc"+ - "\5\u00bc\u0917\n\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\7\u00bc"+ - "\u091e\n\u00bc\f\u00bc\16\u00bc\u0921\13\u00bc\3\u00bc\5\u00bc\u0924\n"+ - "\u00bc\3\u00bc\3\u00bc\5\u00bc\u0928\n\u00bc\3\u00bd\3\u00bd\3\u00bd\3"+ - "\u00bd\3\u00be\3\u00be\3\u00be\3\u00be\3\u00bf\3\u00bf\3\u00bf\3\u00bf"+ - "\3\u00c0\3\u00c0\3\u00c0\3\u00c0\3\u00c0\3\u00c0\3\u00c0\3\u00c0\5\u00c0"+ - "\u093e\n\u00c0\3\u00c1\3\u00c1\3\u00c2\3\u00c2\3\u00c2\3\u00c2\5\u00c2"+ - "\u0946\n\u00c2\3\u00c3\3\u00c3\7\u00c3\u094a\n\u00c3\f\u00c3\16\u00c3"+ - "\u094d\13\u00c3\3\u00c3\3\u00c3\3\u00c4\3\u00c4\7\u00c4\u0953\n\u00c4"+ - "\f\u00c4\16\u00c4\u0956\13\u00c4\3\u00c4\3\u00c4\3\u00c5\3\u00c5\3\u00c5"+ - "\3\u00c5\5\u00c5\u095e\n\u00c5\3\u00c6\3\u00c6\3\u00c6\3\u00c6\5\u00c6"+ - "\u0964\n\u00c6\3\u00c7\3\u00c7\3\u00c7\7\u00c7\u0969\n\u00c7\f\u00c7\16"+ - "\u00c7\u096c\13\u00c7\3\u00c7\3\u00c7\6\u00c7\u0970\n\u00c7\r\u00c7\16"+ - "\u00c7\u0971\5\u00c7\u0974\n\u00c7\3\u00c8\3\u00c8\3\u00c9\3\u00c9\3\u00c9"+ - "\5\u00c9\u097b\n\u00c9\3\u00c9\5\u00c9\u097e\n\u00c9\3\u00c9\5\u00c9\u0981"+ - "\n\u00c9\3\u00c9\3\u00c9\5\u00c9\u0985\n\u00c9\3\u00ca\5\u00ca\u0988\n"+ - "\u00ca\3\u00ca\3\u00ca\3\u00ca\5\u00ca\u098d\n\u00ca\3\u00ca\5\u00ca\u0990"+ - "\n\u00ca\3\u00ca\5\u00ca\u0993\n\u00ca\3\u00ca\3\u00ca\5\u00ca\u0997\n"+ - "\u00ca\3\u00cb\3\u00cb\3\u00cb\5\u00cb\u099c\n\u00cb\3\u00cb\5\u00cb\u099f"+ - "\n\u00cb\3\u00cb\5\u00cb\u09a2\n\u00cb\3\u00cb\3\u00cb\5\u00cb\u09a6\n"+ - "\u00cb\3\u00cc\3\u00cc\3\u00cc\5\u00cc\u09ab\n\u00cc\3\u00cc\3\u00cc\5"+ - "\u00cc\u09af\n\u00cc\3\u00cd\3\u00cd\3\u00cd\3\u00cd\5\u00cd\u09b5\n\u00cd"+ - "\3\u00cd\3\u00cd\5\u00cd\u09b9\n\u00cd\3\u00cd\3\u00cd\5\u00cd\u09bd\n"+ - "\u00cd\3\u00cd\3\u00cd\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00ce"+ - "\3\u00ce\3\u00ce\3\u00ce\3\u00ce\5\u00ce\u09cb\n\u00ce\3\u00cf\3\u00cf"+ - "\3\u00cf\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0"+ - "\5\u00d0\u09d8\n\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\5\u00d0\u09de\n"+ - "\u00d0\3\u00d1\3\u00d1\3\u00d1\3\u00d1\3\u00d1\3\u00d2\3\u00d2\3\u00d2"+ - "\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d2"+ - "\5\u00d2\u09f1\n\u00d2\3\u00d3\3\u00d3\3\u00d3\3\u00d3\3\u00d3\3\u00d3"+ - "\3\u00d4\3\u00d4\3\u00d4\5\u00d4\u09fc\n\u00d4\3\u00d4\3\u00d4\5\u00d4"+ - "\u0a00\n\u00d4\3\u00d4\3\u00d4\3\u00d5\3\u00d5\5\u00d5\u0a06\n\u00d5\3"+ - "\u00d5\3\u00d5\5\u00d5\u0a0a\n\u00d5\3\u00d5\3\u00d5\5\u00d5\u0a0e\n\u00d5"+ - "\3\u00d5\3\u00d5\3\u00d5\3\u00d5\3\u00d5\5\u00d5\u0a15\n\u00d5\3\u00d6"+ - "\3\u00d6\3\u00d6\3\u00d6\3\u00d6\5\u00d6\u0a1c\n\u00d6\3\u00d6\5\u00d6"+ - "\u0a1f\n\u00d6\3\u00d6\3\u00d6\7\u00d6\u0a23\n\u00d6\f\u00d6\16\u00d6"+ - "\u0a26\13\u00d6\3\u00d7\3\u00d7\3\u00d7\3\u00d7\5\u00d7\u0a2c\n\u00d7"+ - "\3\u00d7\3\u00d7\3\u00d7\5\u00d7\u0a31\n\u00d7\3\u00d7\5\u00d7\u0a34\n"+ - "\u00d7\3\u00d7\3\u00d7\3\u00d7\3\u00d7\3\u00d7\3\u00d7\5\u00d7\u0a3c\n"+ - "\u00d7\3\u00d8\3\u00d8\3\u00d8\3\u00d8\5\u00d8\u0a42\n\u00d8\3\u00d9\3"+ - "\u00d9\5\u00d9\u0a46\n\u00d9\3\u00d9\3\u00d9\3\u00da\3\u00da\5\u00da\u0a4c"+ - "\n\u00da\3\u00da\3\u00da\5\u00da\u0a50\n\u00da\3\u00db\3\u00db\3\u00db"+ - "\2\2\u00dc\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\64\66"+ - "8:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082\u0084\u0086\u0088\u008a"+ - "\u008c\u008e\u0090\u0092\u0094\u0096\u0098\u009a\u009c\u009e\u00a0\u00a2"+ - "\u00a4\u00a6\u00a8\u00aa\u00ac\u00ae\u00b0\u00b2\u00b4\u00b6\u00b8\u00ba"+ - "\u00bc\u00be\u00c0\u00c2\u00c4\u00c6\u00c8\u00ca\u00cc\u00ce\u00d0\u00d2"+ - "\u00d4\u00d6\u00d8\u00da\u00dc\u00de\u00e0\u00e2\u00e4\u00e6\u00e8\u00ea"+ - "\u00ec\u00ee\u00f0\u00f2\u00f4\u00f6\u00f8\u00fa\u00fc\u00fe\u0100\u0102"+ - "\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a"+ - "\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132"+ - "\u0134\u0136\u0138\u013a\u013c\u013e\u0140\u0142\u0144\u0146\u0148\u014a"+ - "\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162"+ - "\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178\u017a"+ - "\u017c\u017e\u0180\u0182\u0184\u0186\u0188\u018a\u018c\u018e\u0190\u0192"+ - "\u0194\u0196\u0198\u019a\u019c\u019e\u01a0\u01a2\u01a4\u01a6\u01a8\u01aa"+ - "\u01ac\u01ae\u01b0\u01b2\u01b4\2\25\n\2\27\27\32\3299AAUUYYefjj\4\2$$"+ - "//\5\288JJRR\3\2\u009e\u009f\4\2\u0094\u0095\u00a0\u00a1\3\2\u0089\u008a"+ - "\3\2\u008b\u008d\20\2\24\24\27\27\32\32\37\37$$//99AAFFUUYY]]efjj\4\2"+ - "\20\20\"\"\4\2\21\21ii\16\2\13\13\21\21++;;DDKKMQVV\\\\iimmoo\4\2**\67"+ - "\67\4\2\23\23``\4\2\u008b\u008b\u0096\u0096\4\288JJ\4\2,,bb\25\2\13\13"+ - "\17\17\23\25\27!#$&\')\61\64\64\66;==@ACFHHJLNRTVYkmorr\3\2QR\26\2\f\16"+ - "\20\22\26\26\"\"%%((\62\63\65\65<<>?BBGGIIMMSSWXhhllpqst\2\u0b62\2\u01b7"+ - "\3\2\2\2\4\u01cf\3\2\2\2\6\u01db\3\2\2\2\b\u01e9\3\2\2\2\n\u01eb\3\2\2"+ - "\2\f\u01f5\3\2\2\2\16\u01fb\3\2\2\2\20\u0200\3\2\2\2\22\u0202\3\2\2\2"+ - "\24\u0204\3\2\2\2\26\u020a\3\2\2\2\30\u020c\3\2\2\2\32\u0217\3\2\2\2\34"+ - "\u0222\3\2\2\2\36\u0231\3\2\2\2 \u0236\3\2\2\2\"\u0240\3\2\2\2$\u024d"+ - "\3\2\2\2&\u024f\3\2\2\2(\u0257\3\2\2\2*\u025f\3\2\2\2,\u0267\3\2\2\2."+ - "\u026f\3\2\2\2\60\u0277\3\2\2\2\62\u027f\3\2\2\2\64\u0287\3\2\2\2\66\u028f"+ - "\3\2\2\28\u029b\3\2\2\2:\u02a6\3\2\2\2<\u02ae\3\2\2\2>\u02b6\3\2\2\2@"+ - "\u02c2\3\2\2\2B\u02ca\3\2\2\2D\u02d9\3\2\2\2F\u02f5\3\2\2\2H\u02f7\3\2"+ - "\2\2J\u0396\3\2\2\2L\u039a\3\2\2\2N\u039c\3\2\2\2P\u03a0\3\2\2\2R\u03a8"+ - "\3\2\2\2T\u03b8\3\2\2\2V\u03bc\3\2\2\2X\u03be\3\2\2\2Z\u03c8\3\2\2\2\\"+ - "\u03ca\3\2\2\2^\u03d3\3\2\2\2`\u03e0\3\2\2\2b\u03e7\3\2\2\2d\u03e9\3\2"+ - "\2\2f\u03fc\3\2\2\2h\u03fe\3\2\2\2j\u0407\3\2\2\2l\u0414\3\2\2\2n\u0416"+ - "\3\2\2\2p\u042b\3\2\2\2r\u0434\3\2\2\2t\u0445\3\2\2\2v\u0450\3\2\2\2x"+ - "\u0455\3\2\2\2z\u0466\3\2\2\2|\u0468\3\2\2\2~\u0471\3\2\2\2\u0080\u0476"+ - "\3\2\2\2\u0082\u0480\3\2\2\2\u0084\u0482\3\2\2\2\u0086\u0485\3\2\2\2\u0088"+ - "\u0490\3\2\2\2\u008a\u049c\3\2\2\2\u008c\u049e\3\2\2\2\u008e\u04a3\3\2"+ - "\2\2\u0090\u04a6\3\2\2\2\u0092\u04b5\3\2\2\2\u0094\u04be\3\2\2\2\u0096"+ - "\u04c9\3\2\2\2\u0098\u04cb\3\2\2\2\u009a\u04d2\3\2\2\2\u009c\u04db\3\2"+ - "\2\2\u009e\u04dd\3\2\2\2\u00a0\u04e1\3\2\2\2\u00a2\u04f6\3\2\2\2\u00a4"+ - "\u04fd\3\2\2\2\u00a6\u04ff\3\2\2\2\u00a8\u0505\3\2\2\2\u00aa\u0589\3\2"+ - "\2\2\u00ac\u058b\3\2\2\2\u00ae\u05a4\3\2\2\2\u00b0\u05a8\3\2\2\2\u00b2"+ - "\u05aa\3\2\2\2\u00b4\u05b5\3\2\2\2\u00b6\u05b7\3\2\2\2\u00b8\u05bd\3\2"+ - "\2\2\u00ba\u05c0\3\2\2\2\u00bc\u05cf\3\2\2\2\u00be\u05d1\3\2\2\2\u00c0"+ - "\u05d5\3\2\2\2\u00c2\u05e2\3\2\2\2\u00c4\u05e4\3\2\2\2\u00c6\u05f7\3\2"+ - "\2\2\u00c8\u05f9\3\2\2\2\u00ca\u0605\3\2\2\2\u00cc\u060b\3\2\2\2\u00ce"+ - "\u0610\3\2\2\2\u00d0\u0615\3\2\2\2\u00d2\u0617\3\2\2\2\u00d4\u061d\3\2"+ - "\2\2\u00d6\u0625\3\2\2\2\u00d8\u0632\3\2\2\2\u00da\u0636\3\2\2\2\u00dc"+ - "\u063c\3\2\2\2\u00de\u064f\3\2\2\2\u00e0\u0652\3\2\2\2\u00e2\u0658\3\2"+ - "\2\2\u00e4\u065b\3\2\2\2\u00e6\u0667\3\2\2\2\u00e8\u066d\3\2\2\2\u00ea"+ - "\u0679\3\2\2\2\u00ec\u067d\3\2\2\2\u00ee\u0686\3\2\2\2\u00f0\u068f\3\2"+ - "\2\2\u00f2\u0693\3\2\2\2\u00f4\u06a2\3\2\2\2\u00f6\u06ab\3\2\2\2\u00f8"+ - "\u06ad\3\2\2\2\u00fa\u06b5\3\2\2\2\u00fc\u06b9\3\2\2\2\u00fe\u06c0\3\2"+ - "\2\2\u0100\u06c5\3\2\2\2\u0102\u06cf\3\2\2\2\u0104\u06d3\3\2\2\2\u0106"+ - "\u06e8\3\2\2\2\u0108\u06ef\3\2\2\2\u010a\u06fd\3\2\2\2\u010c\u0705\3\2"+ - "\2\2\u010e\u0709\3\2\2\2\u0110\u0711\3\2\2\2\u0112\u0718\3\2\2\2\u0114"+ - "\u071c\3\2\2\2\u0116\u071e\3\2\2\2\u0118\u0722\3\2\2\2\u011a\u072a\3\2"+ - "\2\2\u011c\u072c\3\2\2\2\u011e\u073c\3\2\2\2\u0120\u0746\3\2\2\2\u0122"+ - "\u0749\3\2\2\2\u0124\u0750\3\2\2\2\u0126\u0762\3\2\2\2\u0128\u076b\3\2"+ - "\2\2\u012a\u077a\3\2\2\2\u012c\u077e\3\2\2\2\u012e\u0781\3\2\2\2\u0130"+ - "\u078e\3\2\2\2\u0132\u0794\3\2\2\2\u0134\u07af\3\2\2\2\u0136\u07b1\3\2"+ - "\2\2\u0138\u07b8\3\2\2\2\u013a\u07c2\3\2\2\2\u013c\u07c4\3\2\2\2\u013e"+ - "\u07c7\3\2\2\2\u0140\u07d1\3\2\2\2\u0142\u07e2\3\2\2\2\u0144\u07ee\3\2"+ - "\2\2\u0146\u07f7\3\2\2\2\u0148\u0807\3\2\2\2\u014a\u0813\3\2\2\2\u014c"+ - "\u081a\3\2\2\2\u014e\u081c\3\2\2\2\u0150\u081f\3\2\2\2\u0152\u0829\3\2"+ - "\2\2\u0154\u0870\3\2\2\2\u0156\u0886\3\2\2\2\u0158\u0889\3\2\2\2\u015a"+ - "\u089a\3\2\2\2\u015c\u08a1\3\2\2\2\u015e\u08ac\3\2\2\2\u0160\u08af\3\2"+ - "\2\2\u0162\u08b3\3\2\2\2\u0164\u08c1\3\2\2\2\u0166\u08c3\3\2\2\2\u0168"+ - "\u08cb\3\2\2\2\u016a\u08dd\3\2\2\2\u016c\u08f0\3\2\2\2\u016e\u08f2\3\2"+ - "\2\2\u0170\u08fa\3\2\2\2\u0172\u0903\3\2\2\2\u0174\u0905\3\2\2\2\u0176"+ - "\u0927\3\2\2\2\u0178\u0929\3\2\2\2\u017a\u092d\3\2\2\2\u017c\u0931\3\2"+ - "\2\2\u017e\u093d\3\2\2\2\u0180\u093f\3\2\2\2\u0182\u0945\3\2\2\2\u0184"+ - "\u0947\3\2\2\2\u0186\u0950\3\2\2\2\u0188\u095d\3\2\2\2\u018a\u0963\3\2"+ - "\2\2\u018c\u0965\3\2\2\2\u018e\u0975\3\2\2\2\u0190\u0977\3\2\2\2\u0192"+ - "\u0987\3\2\2\2\u0194\u0998\3\2\2\2\u0196\u09a7\3\2\2\2\u0198\u09b0\3\2"+ - "\2\2\u019a\u09c0\3\2\2\2\u019c\u09cc\3\2\2\2\u019e\u09cf\3\2\2\2\u01a0"+ - "\u09df\3\2\2\2\u01a2\u09e4\3\2\2\2\u01a4\u09f2\3\2\2\2\u01a6\u09f8\3\2"+ - "\2\2\u01a8\u0a03\3\2\2\2\u01aa\u0a1b\3\2\2\2\u01ac\u0a27\3\2\2\2\u01ae"+ - "\u0a3d\3\2\2\2\u01b0\u0a43\3\2\2\2\u01b2\u0a49\3\2\2\2\u01b4\u0a51\3\2"+ - "\2\2\u01b6\u01b8\7\3\2\2\u01b7\u01b6\3\2\2\2\u01b7\u01b8\3\2\2\2\u01b8"+ - "\u01ba\3\2\2\2\u01b9\u01bb\5\u00d8m\2\u01ba\u01b9\3\2\2\2\u01ba\u01bb"+ - "\3\2\2\2\u01bb\u01bd\3\2\2\2\u01bc\u01be\5\u00dco\2\u01bd\u01bc\3\2\2"+ - "\2\u01bd\u01be\3\2\2\2\u01be\u01c2\3\2\2\2\u01bf\u01c1\5\u015c\u00af\2"+ - "\u01c0\u01bf\3\2\2\2\u01c1\u01c4\3\2\2\2\u01c2\u01c0\3\2\2\2\u01c2\u01c3"+ - "\3\2\2\2\u01c3\u01c6\3\2\2\2\u01c4\u01c2\3\2\2\2\u01c5\u01c7\5\u00e0q"+ - "\2\u01c6\u01c5\3\2\2\2\u01c6\u01c7\3\2\2\2\u01c7\u01c8\3\2\2\2\u01c8\u01c9"+ - "\7\2\2\3\u01c9\3\3\2\2\2\u01ca\u01cc\5\u01b4\u00db\2\u01cb\u01cd\5\30"+ - "\r\2\u01cc\u01cb\3\2\2\2\u01cc\u01cd\3\2\2\2\u01cd\u01d0\3\2\2\2\u01ce"+ - "\u01d0\5\u00e6t\2\u01cf\u01ca\3\2\2\2\u01cf\u01ce\3\2\2\2\u01d0\u01d8"+ - "\3\2\2\2\u01d1\u01d2\7\u0085\2\2\u01d2\u01d4\5\u01b4\u00db\2\u01d3\u01d5"+ - "\5\30\r\2\u01d4\u01d3\3\2\2\2\u01d4\u01d5\3\2\2\2\u01d5\u01d7\3\2\2\2"+ - "\u01d6\u01d1\3\2\2\2\u01d7\u01da\3\2\2\2\u01d8\u01d6\3\2\2\2\u01d8\u01d9"+ - "\3\2\2\2\u01d9\5\3\2\2\2\u01da\u01d8\3\2\2\2\u01db\u01e1\5\b\5\2\u01dc"+ - "\u01e0\7\u0096\2\2\u01dd\u01e0\5\u0144\u00a3\2\u01de\u01e0\7\u008b\2\2"+ - "\u01df\u01dc\3\2\2\2\u01df\u01dd\3\2\2\2\u01df\u01de\3\2\2\2\u01e0\u01e3"+ - "\3\2\2\2\u01e1\u01df\3\2\2\2\u01e1\u01e2\3\2\2\2\u01e2\7\3\2\2\2\u01e3"+ - "\u01e1\3\2\2\2\u01e4\u01ea\5\16\b\2\u01e5\u01ea\5\26\f\2\u01e6\u01e7\7"+ - "n\2\2\u01e7\u01ea\7\u008b\2\2\u01e8\u01ea\5\n\6\2\u01e9\u01e4\3\2\2\2"+ - "\u01e9\u01e5\3\2\2\2\u01e9\u01e6\3\2\2\2\u01e9\u01e8\3\2\2\2\u01ea\t\3"+ - "\2\2\2\u01eb\u01ec\7\u0083\2\2\u01ec\u01ef\5\f\7\2\u01ed\u01ee\7\u0086"+ - "\2\2\u01ee\u01f0\5\f\7\2\u01ef\u01ed\3\2\2\2\u01f0\u01f1\3\2\2\2\u01f1"+ - "\u01ef\3\2\2\2\u01f1\u01f2\3\2\2\2\u01f2\u01f3\3\2\2\2\u01f3\u01f4\7\u0084"+ - "\2\2\u01f4\13\3\2\2\2\u01f5\u01f7\5\6\4\2\u01f6\u01f8\5\u01b4\u00db\2"+ - "\u01f7\u01f6\3\2\2\2\u01f7\u01f8\3\2\2\2\u01f8\r\3\2\2\2\u01f9\u01fc\5"+ - "\20\t\2\u01fa\u01fc\7\24\2\2\u01fb\u01f9\3\2\2\2\u01fb\u01fa\3\2\2\2\u01fc"+ - "\17\3\2\2\2\u01fd\u0201\5\22\n\2\u01fe\u0201\5\24\13\2\u01ff\u0201\7\37"+ - "\2\2\u0200\u01fd\3\2\2\2\u0200\u01fe\3\2\2\2\u0200\u01ff\3\2\2\2\u0201"+ - "\21\3\2\2\2\u0202\u0203\t\2\2\2\u0203\23\3\2\2\2\u0204\u0205\t\3\2\2\u0205"+ - "\25\3\2\2\2\u0206\u020b\5\4\3\2\u0207\u020b\7F\2\2\u0208\u020b\7%\2\2"+ - "\u0209\u020b\7]\2\2\u020a\u0206\3\2\2\2\u020a\u0207\3\2\2\2\u020a\u0208"+ - "\3\2\2\2\u020a\u0209\3\2\2\2\u020b\27\3\2\2\2\u020c\u020d\7\u0094\2\2"+ - "\u020d\u0212\5\6\4\2\u020e\u020f\7\u0086\2\2\u020f\u0211\5\6\4\2\u0210"+ - "\u020e\3\2\2\2\u0211\u0214\3\2\2\2\u0212\u0210\3\2\2\2\u0212\u0213\3\2"+ - "\2\2\u0213\u0215\3\2\2\2\u0214\u0212\3\2\2\2\u0215\u0216\7\u0095\2\2\u0216"+ - "\31\3\2\2\2\u0217\u021c\5\34\17\2\u0218\u0219\7\u0086\2\2\u0219\u021b"+ - "\5\34\17\2\u021a\u0218\3\2\2\2\u021b\u021e\3\2\2\2\u021c\u021a\3\2\2\2"+ - "\u021c\u021d\3\2\2\2\u021d\33\3\2\2\2\u021e\u021c\3\2\2\2\u021f\u0220"+ - "\5\u01b4\u00db\2\u0220\u0221\7\u0087\2\2\u0221\u0223\3\2\2\2\u0222\u021f"+ - "\3\2\2\2\u0222\u0223\3\2\2\2\u0223\u0225\3\2\2\2\u0224\u0226\t\4\2\2\u0225"+ - "\u0224\3\2\2\2\u0225\u0226\3\2\2\2\u0226\u0229\3\2\2\2\u0227\u022a\7l"+ - "\2\2\u0228\u022a\5\6\4\2\u0229\u0227\3\2\2\2\u0229\u0228\3\2\2\2\u0229"+ - "\u022a\3\2\2\2\u022a\u022b\3\2\2\2\u022b\u022c\5\36\20\2\u022c\35\3\2"+ - "\2\2\u022d\u0232\5\"\22\2\u022e\u0232\5 \21\2\u022f\u0230\7R\2\2\u0230"+ - "\u0232\5 \21\2\u0231\u022d\3\2\2\2\u0231\u022e\3\2\2\2\u0231\u022f\3\2"+ - "\2\2\u0232\37\3\2\2\2\u0233\u0237\5x=\2\u0234\u0237\5\u0084C\2\u0235\u0237"+ - "\5&\24\2\u0236\u0233\3\2\2\2\u0236\u0234\3\2\2\2\u0236\u0235\3\2\2\2\u0237"+ - "!\3\2\2\2\u0238\u0239\5F$\2\u0239\u023a\5$\23\2\u023a\u023b\5\36\20\2"+ - "\u023b\u0241\3\2\2\2\u023c\u023d\5F$\2\u023d\u023e\7\u00ac\2\2\u023e\u023f"+ - "\5L\'\2\u023f\u0241\3\2\2\2\u0240\u0238\3\2\2\2\u0240\u023c\3\2\2\2\u0241"+ - "#\3\2\2\2\u0242\u024e\7\u0093\2\2\u0243\u024e\7\u00a2\2\2\u0244\u024e"+ - "\7\u00a3\2\2\u0245\u024e\7\u00a4\2\2\u0246\u024e\7\u00a5\2\2\u0247\u024e"+ - "\7\u00a6\2\2\u0248\u024e\7\u00a7\2\2\u0249\u024e\7\u00a8\2\2\u024a\u024e"+ - "\7\u00a9\2\2\u024b\u024e\7\u00ab\2\2\u024c\u024e\5\u017c\u00bf\2\u024d"+ - "\u0242\3\2\2\2\u024d\u0243\3\2\2\2\u024d\u0244\3\2\2\2\u024d\u0245\3\2"+ - "\2\2\u024d\u0246\3\2\2\2\u024d\u0247\3\2\2\2\u024d\u0248\3\2\2\2\u024d"+ - "\u0249\3\2\2\2\u024d\u024a\3\2\2\2\u024d\u024b\3\2\2\2\u024d\u024c\3\2"+ - "\2\2\u024e%\3\2\2\2\u024f\u0255\5(\25\2\u0250\u0251\7\u0096\2\2\u0251"+ - "\u0252\5L\'\2\u0252\u0253\7\u0087\2\2\u0253\u0254\5L\'\2\u0254\u0256\3"+ - "\2\2\2\u0255\u0250\3\2\2\2\u0255\u0256\3\2\2\2\u0256\'\3\2\2\2\u0257\u025d"+ - "\5*\26\2\u0258\u025b\7\u0098\2\2\u0259\u025c\5(\25\2\u025a\u025c\5N(\2"+ - "\u025b\u0259\3\2\2\2\u025b\u025a\3\2\2\2\u025c\u025e\3\2\2\2\u025d\u0258"+ - "\3\2\2\2\u025d\u025e\3\2\2\2\u025e)\3\2\2\2\u025f\u0264\5,\27\2\u0260"+ - "\u0261\7\u009c\2\2\u0261\u0263\5,\27\2\u0262\u0260\3\2\2\2\u0263\u0266"+ - "\3\2\2\2\u0264\u0262\3\2\2\2\u0264\u0265\3\2\2\2\u0265+\3\2\2\2\u0266"+ - "\u0264\3\2\2\2\u0267\u026c\5.\30\2\u0268\u0269\7\u009b\2\2\u0269\u026b"+ - "\5.\30\2\u026a\u0268\3\2\2\2\u026b\u026e\3\2\2\2\u026c\u026a\3\2\2\2\u026c"+ - "\u026d\3\2\2\2\u026d-\3\2\2\2\u026e\u026c\3\2\2\2\u026f\u0274\5\60\31"+ - "\2\u0270\u0271\7\u008f\2\2\u0271\u0273\5\60\31\2\u0272\u0270\3\2\2\2\u0273"+ - "\u0276\3\2\2\2\u0274\u0272\3\2\2\2\u0274\u0275\3\2\2\2\u0275/\3\2\2\2"+ - "\u0276\u0274\3\2\2\2\u0277\u027c\5\62\32\2\u0278\u0279\7\u0090\2\2\u0279"+ - "\u027b\5\62\32\2\u027a\u0278\3\2\2\2\u027b\u027e\3\2\2\2\u027c\u027a\3"+ - "\2\2\2\u027c\u027d\3\2\2\2\u027d\61\3\2\2\2\u027e\u027c\3\2\2\2\u027f"+ - "\u0284\5\64\33\2\u0280\u0281\7\u008e\2\2\u0281\u0283\5\64\33\2\u0282\u0280"+ - "\3\2\2\2\u0283\u0286\3\2\2\2\u0284\u0282\3\2\2\2\u0284\u0285\3\2\2\2\u0285"+ - "\63\3\2\2\2\u0286\u0284\3\2\2\2\u0287\u028c\5\66\34\2\u0288\u0289\t\5"+ - "\2\2\u0289\u028b\5\66\34\2\u028a\u0288\3\2\2\2\u028b\u028e\3\2\2\2\u028c"+ - "\u028a\3\2\2\2\u028c\u028d\3\2\2\2\u028d\65\3\2\2\2\u028e\u028c\3\2\2"+ - "\2\u028f\u0298\58\35\2\u0290\u0291\t\6\2\2\u0291\u0297\58\35\2\u0292\u0293"+ - "\7=\2\2\u0293\u0297\5r:\2\u0294\u0295\7\17\2\2\u0295\u0297\5\6\4\2\u0296"+ - "\u0290\3\2\2\2\u0296\u0292\3\2\2\2\u0296\u0294\3\2\2\2\u0297\u029a\3\2"+ - "\2\2\u0298\u0296\3\2\2\2\u0298\u0299\3\2\2\2\u0299\67\3\2\2\2\u029a\u0298"+ - "\3\2\2\2\u029b\u02a3\5:\36\2\u029c\u029f\7\u00aa\2\2\u029d\u029f\5\u017a"+ - "\u00be\2\u029e\u029c\3\2\2\2\u029e\u029d\3\2\2\2\u029f\u02a0\3\2\2\2\u02a0"+ - "\u02a2\5:\36\2\u02a1\u029e\3\2\2\2\u02a2\u02a5\3\2\2\2\u02a3\u02a1\3\2"+ - "\2\2\u02a3\u02a4\3\2\2\2\u02a49\3\2\2\2\u02a5\u02a3\3\2\2\2\u02a6\u02ab"+ - "\5<\37\2\u02a7\u02a8\t\7\2\2\u02a8\u02aa\5<\37\2\u02a9\u02a7\3\2\2\2\u02aa"+ - "\u02ad\3\2\2\2\u02ab\u02a9\3\2\2\2\u02ab\u02ac\3\2\2\2\u02ac;\3\2\2\2"+ - "\u02ad\u02ab\3\2\2\2\u02ae\u02b3\5> \2\u02af\u02b0\t\b\2\2\u02b0\u02b2"+ - "\5> \2\u02b1\u02af\3\2\2\2\u02b2\u02b5\3\2\2\2\u02b3\u02b1\3\2\2\2\u02b3"+ - "\u02b4\3\2\2\2\u02b4=\3\2\2\2\u02b5\u02b3\3\2\2\2\u02b6\u02c0\5D#\2\u02b7"+ - "\u02b8\7_\2\2\u02b8\u02bd\7\177\2\2\u02b9\u02bb\5@!\2\u02ba\u02bc\7\u0086"+ - "\2\2\u02bb\u02ba\3\2\2\2\u02bb\u02bc\3\2\2\2\u02bc\u02be\3\2\2\2\u02bd"+ - "\u02b9\3\2\2\2\u02bd\u02be\3\2\2\2\u02be\u02bf\3\2\2\2\u02bf\u02c1\7\u0080"+ - "\2\2\u02c0\u02b7\3\2\2\2\u02c0\u02c1\3\2\2\2\u02c1?\3\2\2\2\u02c2\u02c7"+ - "\5B\"\2\u02c3\u02c4\7\u0086\2\2\u02c4\u02c6\5B\"\2\u02c5\u02c3\3\2\2\2"+ - "\u02c6\u02c9\3\2\2\2\u02c7\u02c5\3\2\2\2\u02c7\u02c8\3\2\2\2\u02c8A\3"+ - "\2\2\2\u02c9\u02c7\3\2\2\2\u02ca\u02cc\5\36\20\2\u02cb\u02cd\5\u00be`"+ - "\2\u02cc\u02cb\3\2\2\2\u02cc\u02cd\3\2\2\2\u02cd\u02ce\3\2\2\2\u02ce\u02cf"+ - "\5\u0178\u00bd\2\u02cf\u02d0\5L\'\2\u02d0C\3\2\2\2\u02d1\u02da\5F$\2\u02d2"+ - "\u02d4\5F$\2\u02d3\u02d2\3\2\2\2\u02d3\u02d4\3\2\2\2\u02d4\u02d5\3\2\2"+ - "\2\u02d5\u02d7\7\u00ad\2\2\u02d6\u02d8\5F$\2\u02d7\u02d6\3\2\2\2\u02d7"+ - "\u02d8\3\2\2\2\u02d8\u02da\3\2\2\2\u02d9\u02d1\3\2\2\2\u02d9\u02d3\3\2"+ - "\2\2\u02daE\3\2\2\2\u02db\u02f6\5H%\2\u02dc\u02dd\7\u0089\2\2\u02dd\u02f6"+ - "\5F$\2\u02de\u02df\7\u008a\2\2\u02df\u02f6\5F$\2\u02e0\u02e1\7\u0091\2"+ - "\2\u02e1\u02f6\5F$\2\u02e2\u02e3\7\u0092\2\2\u02e3\u02f6\5F$\2\u02e4\u02e5"+ - "\7\u0099\2\2\u02e5\u02f6\5F$\2\u02e6\u02e7\7\u009a\2\2\u02e7\u02f6\5F"+ - "$\2\u02e8\u02e9\7\u0083\2\2\u02e9\u02ea\5\6\4\2\u02ea\u02eb\7\u0084\2"+ - "\2\u02eb\u02ec\5F$\2\u02ec\u02f6\3\2\2\2\u02ed\u02ee\7\22\2\2\u02ee\u02f6"+ - "\5F$\2\u02ef\u02f0\7\u008e\2\2\u02f0\u02f6\5F$\2\u02f1\u02f2\7\u008b\2"+ - "\2\u02f2\u02f6\5F$\2\u02f3\u02f4\7\u0090\2\2\u02f4\u02f6\5F$\2\u02f5\u02db"+ - "\3\2\2\2\u02f5\u02dc\3\2\2\2\u02f5\u02de\3\2\2\2\u02f5\u02e0\3\2\2\2\u02f5"+ - "\u02e2\3\2\2\2\u02f5\u02e4\3\2\2\2\u02f5\u02e6\3\2\2\2\u02f5\u02e8\3\2"+ - "\2\2\u02f5\u02ed\3\2\2\2\u02f5\u02ef\3\2\2\2\u02f5\u02f1\3\2\2\2\u02f5"+ - "\u02f3\3\2\2\2\u02f6G\3\2\2\2\u02f7\u02f9\5J&\2\u02f8\u02fa\7\u0091\2"+ - "\2\u02f9\u02f8\3\2\2\2\u02f9\u02fa\3\2\2\2\u02fa\u02fe\3\2\2\2\u02fb\u02fd"+ - "\5R*\2\u02fc\u02fb\3\2\2\2\u02fd\u0300\3\2\2\2\u02fe\u02fc\3\2\2\2\u02fe"+ - "\u02ff\3\2\2\2\u02ff\u0302\3\2\2\2\u0300\u02fe\3\2\2\2\u0301\u0303\7\u0091"+ - "\2\2\u0302\u0301\3\2\2\2\u0302\u0303\3\2\2\2\u0303\u031a\3\2\2\2\u0304"+ - "\u030b\5P)\2\u0305\u030b\5\u01b0\u00d9\2\u0306\u030b\7\u0099\2\2\u0307"+ - "\u030b\7\u009a\2\2\u0308\u0309\7\u009d\2\2\u0309\u030b\5\u01b4\u00db\2"+ - "\u030a\u0304\3\2\2\2\u030a\u0305\3\2\2\2\u030a\u0306\3\2\2\2\u030a\u0307"+ - "\3\2\2\2\u030a\u0308\3\2\2\2\u030b\u030d\3\2\2\2\u030c\u030e\7\u0091\2"+ - "\2\u030d\u030c\3\2\2\2\u030d\u030e\3\2\2\2\u030e\u0312\3\2\2\2\u030f\u0311"+ - "\5R*\2\u0310\u030f\3\2\2\2\u0311\u0314\3\2\2\2\u0312\u0310\3\2\2\2\u0312"+ - "\u0313\3\2\2\2\u0313\u0316\3\2\2\2\u0314\u0312\3\2\2\2\u0315\u0317\7\u0091"+ - "\2\2\u0316\u0315\3\2\2\2\u0316\u0317\3\2\2\2\u0317\u0319\3\2\2\2\u0318"+ - "\u030a\3\2\2\2\u0319\u031c\3\2\2\2\u031a\u0318\3\2\2\2\u031a\u031b\3\2"+ - "\2\2\u031bI\3\2\2\2\u031c\u031a\3\2\2\2\u031d\u0397\5\u017e\u00c0\2\u031e"+ - "\u0320\5\u01b4\u00db\2\u031f\u0321\5\30\r\2\u0320\u031f\3\2\2\2\u0320"+ - "\u0321\3\2\2\2\u0321\u0397\3\2\2\2\u0322\u0323\7\u0083\2\2\u0323\u0324"+ - "\5\36\20\2\u0324\u0325\7\u0084\2\2\u0325\u0397\3\2\2\2\u0326\u0397\5V"+ - ",\2\u0327\u0397\5\u00e6t\2\u0328\u0397\7u\2\2\u0329\u0397\7`\2\2\u032a"+ - "\u0334\7\23\2\2\u032b\u032c\7\u0085\2\2\u032c\u032e\5\u01b4\u00db\2\u032d"+ - "\u032f\5\30\r\2\u032e\u032d\3\2\2\2\u032e\u032f\3\2\2\2\u032f\u0335\3"+ - "\2\2\2\u0330\u0331\7\u0081\2\2\u0331\u0332\5X-\2\u0332\u0333\7\u0082\2"+ - "\2\u0333\u0335\3\2\2\2\u0334\u032b\3\2\2\2\u0334\u0330\3\2\2\2\u0335\u0397"+ - "\3\2\2\2\u0336\u0353\7D\2\2\u0337\u034d\5\6\4\2\u0338\u034e\5\u01b2\u00da"+ - "\2\u0339\u034e\5Z.\2\u033a\u033b\7\u0081\2\2\u033b\u033c\5X-\2\u033c\u0340"+ - "\7\u0082\2\2\u033d\u033f\5\u0144\u00a3\2\u033e\u033d\3\2\2\2\u033f\u0342"+ - "\3\2\2\2\u0340\u033e\3\2\2\2\u0340\u0341\3\2\2\2\u0341\u0344\3\2\2\2\u0342"+ - "\u0340\3\2\2\2\u0343\u0345\5\u0146\u00a4\2\u0344\u0343\3\2\2\2\u0344\u0345"+ - "\3\2\2\2\u0345\u034e\3\2\2\2\u0346\u0348\5\u0144\u00a3\2\u0347\u0346\3"+ - "\2\2\2\u0348\u0349\3\2\2\2\u0349\u0347\3\2\2\2\u0349\u034a\3\2\2\2\u034a"+ - "\u034b\3\2\2\2\u034b\u034c\5\u0146\u00a4\2\u034c\u034e\3\2\2\2\u034d\u0338"+ - "\3\2\2\2\u034d\u0339\3\2\2\2\u034d\u033a\3\2\2\2\u034d\u0347\3\2\2\2\u034e"+ - "\u0354\3\2\2\2\u034f\u0354\5h\65\2\u0350\u0351\5\u0144\u00a3\2\u0351\u0352"+ - "\5\u0146\u00a4\2\u0352\u0354\3\2\2\2\u0353\u0337\3\2\2\2\u0353\u034f\3"+ - "\2\2\2\u0353\u0350\3\2\2\2\u0354\u0397\3\2\2\2\u0355\u0356\7\u0083\2\2"+ - "\u0356\u0359\5\34\17\2\u0357\u0358\7\u0086\2\2\u0358\u035a\5\34\17\2\u0359"+ - "\u0357\3\2\2\2\u035a\u035b\3\2\2\2\u035b\u0359\3\2\2\2\u035b\u035c\3\2"+ - "\2\2\u035c\u035d\3\2\2\2\u035d\u035e\7\u0084\2\2\u035e\u0397\3\2\2\2\u035f"+ - "\u0360\7d\2\2\u0360\u0364\7\u0083\2\2\u0361\u0365\5n8\2\u0362\u0365\5"+ - "\6\4\2\u0363\u0365\7n\2\2\u0364\u0361\3\2\2\2\u0364\u0362\3\2\2\2\u0364"+ - "\u0363\3\2\2\2\u0365\u0366\3\2\2\2\u0366\u0397\7\u0084\2\2\u0367\u0368"+ - "\7\33\2\2\u0368\u0369\7\u0083\2\2\u0369\u036a\5\36\20\2\u036a\u036b\7"+ - "\u0084\2\2\u036b\u0397\3\2\2\2\u036c\u036d\7g\2\2\u036d\u036e\7\u0083"+ - "\2\2\u036e\u036f\5\36\20\2\u036f\u0370\7\u0084\2\2\u0370\u0397\3\2\2\2"+ - "\u0371\u0376\7 \2\2\u0372\u0373\7\u0083\2\2\u0373\u0374\5\6\4\2\u0374"+ - "\u0375\7\u0084\2\2\u0375\u0377\3\2\2\2\u0376\u0372\3\2\2\2\u0376\u0377"+ - "\3\2\2\2\u0377\u0397\3\2\2\2\u0378\u037a\7\21\2\2\u0379\u0378\3\2\2\2"+ - "\u0379\u037a\3\2\2\2\u037a\u037b\3\2\2\2\u037b\u0381\7!\2\2\u037c\u037e"+ - "\7\u0083\2\2\u037d\u037f\5|?\2\u037e\u037d\3\2\2\2\u037e\u037f\3\2\2\2"+ - "\u037f\u0380\3\2\2\2\u0380\u0382\7\u0084\2\2\u0381\u037c\3\2\2\2\u0381"+ - "\u0382\3\2\2\2\u0382\u0383\3\2\2\2\u0383\u0397\5\u00acW\2\u0384\u0385"+ - "\7Z\2\2\u0385\u0386\7\u0083\2\2\u0386\u0387\5\6\4\2\u0387\u0388\7\u0084"+ - "\2\2\u0388\u0397\3\2\2\2\u0389\u038a\7B\2\2\u038a\u0390\7\u0083\2\2\u038b"+ - "\u038c\5\u01b4\u00db\2\u038c\u038d\7\u0085\2\2\u038d\u038f\3\2\2\2\u038e"+ - "\u038b\3\2\2\2\u038f\u0392\3\2\2\2\u0390\u038e\3\2\2\2\u0390\u0391\3\2"+ - "\2\2\u0391\u0393\3\2\2\2\u0392\u0390\3\2\2\2\u0393\u0394\5\u01b4\u00db"+ - "\2\u0394\u0395\7\u0084\2\2\u0395\u0397\3\2\2\2\u0396\u031d\3\2\2\2\u0396"+ - "\u031e\3\2\2\2\u0396\u0322\3\2\2\2\u0396\u0326\3\2\2\2\u0396\u0327\3\2"+ - "\2\2\u0396\u0328\3\2\2\2\u0396\u0329\3\2\2\2\u0396\u032a\3\2\2\2\u0396"+ - "\u0336\3\2\2\2\u0396\u0355\3\2\2\2\u0396\u035f\3\2\2\2\u0396\u0367\3\2"+ - "\2\2\u0396\u036c\3\2\2\2\u0396\u0371\3\2\2\2\u0396\u0379\3\2\2\2\u0396"+ - "\u0384\3\2\2\2\u0396\u0389\3\2\2\2\u0397K\3\2\2\2\u0398\u039b\5\36\20"+ - "\2\u0399\u039b\5N(\2\u039a\u0398\3\2\2\2\u039a\u0399\3\2\2\2\u039bM\3"+ - "\2\2\2\u039c\u039d\7a\2\2\u039d\u039e\5\36\20\2\u039eO\3\2\2\2\u039f\u03a1"+ - "\7\u0096\2\2\u03a0\u039f\3\2\2\2\u03a0\u03a1\3\2\2\2\u03a1\u03a2\3\2\2"+ - "\2\u03a2\u03a3\7\u0085\2\2\u03a3\u03a5\5\u01b4\u00db\2\u03a4\u03a6\5\30"+ - "\r\2\u03a5\u03a4\3\2\2\2\u03a5\u03a6\3\2\2\2\u03a6Q\3\2\2\2\u03a7\u03a9"+ - "\7\u0096\2\2\u03a8\u03a7\3\2\2\2\u03a8\u03a9\3\2\2\2\u03a9\u03aa\3\2\2"+ - "\2\u03aa\u03ab\7\u0081\2\2\u03ab\u03b0\5T+\2\u03ac\u03ad\7\u0086\2\2\u03ad"+ - "\u03af\5T+\2\u03ae\u03ac\3\2\2\2\u03af\u03b2\3\2\2\2\u03b0\u03ae\3\2\2"+ - "\2\u03b0\u03b1\3\2\2\2\u03b1\u03b3\3\2\2\2\u03b2\u03b0\3\2\2\2\u03b3\u03b4"+ - "\7\u0082\2\2\u03b4S\3\2\2\2\u03b5\u03b6\5\u01b4\u00db\2\u03b6\u03b7\7"+ - "\u0087\2\2\u03b7\u03b9\3\2\2\2\u03b8\u03b5\3\2\2\2\u03b8\u03b9\3\2\2\2"+ - "\u03b9\u03ba\3\2\2\2\u03ba\u03bb\5\36\20\2\u03bbU\3\2\2\2\u03bc\u03bd"+ - "\t\t\2\2\u03bdW\3\2\2\2\u03be\u03c3\5\36\20\2\u03bf\u03c0\7\u0086\2\2"+ - "\u03c0\u03c2\5\36\20\2\u03c1\u03bf\3\2\2\2\u03c2\u03c5\3\2\2\2\u03c3\u03c1"+ - "\3\2\2\2\u03c3\u03c4\3\2\2\2\u03c4Y\3\2\2\2\u03c5\u03c3\3\2\2\2\u03c6"+ - "\u03c9\5\\/\2\u03c7\u03c9\5d\63\2\u03c8\u03c6\3\2\2\2\u03c8\u03c7\3\2"+ - "\2\2\u03c9[\3\2\2\2\u03ca\u03cf\7\177\2\2\u03cb\u03cd\5^\60\2\u03cc\u03ce"+ - "\7\u0086\2\2\u03cd\u03cc\3\2\2\2\u03cd\u03ce\3\2\2\2\u03ce\u03d0\3\2\2"+ - "\2\u03cf\u03cb\3\2\2\2\u03cf\u03d0\3\2\2\2\u03d0\u03d1\3\2\2\2\u03d1\u03d2"+ - "\7\u0080\2\2\u03d2]\3\2\2\2\u03d3\u03d8\5`\61\2\u03d4\u03d5\7\u0086\2"+ - "\2\u03d5\u03d7\5`\61\2\u03d6\u03d4\3\2\2\2\u03d7\u03da\3\2\2\2\u03d8\u03d6"+ - "\3\2\2\2\u03d8\u03d9\3\2\2\2\u03d9_\3\2\2\2\u03da\u03d8\3\2\2\2\u03db"+ - "\u03e1\5\u01b4\u00db\2\u03dc\u03dd\7\u0081\2\2\u03dd\u03de\5\36\20\2\u03de"+ - "\u03df\7\u0082\2\2\u03df\u03e1\3\2\2\2\u03e0\u03db\3\2\2\2\u03e0\u03dc"+ - "\3\2\2\2\u03e1\u03e2\3\2\2\2\u03e2\u03e3\7\u0093\2\2\u03e3\u03e4\5b\62"+ - "\2\u03e4a\3\2\2\2\u03e5\u03e8\5\36\20\2\u03e6\u03e8\5Z.\2\u03e7\u03e5"+ - "\3\2\2\2\u03e7\u03e6\3\2\2\2\u03e8c\3\2\2\2\u03e9\u03ea\7\177\2\2\u03ea"+ - "\u03ef\5f\64\2\u03eb\u03ec\7\u0086\2\2\u03ec\u03ee\5f\64\2\u03ed\u03eb"+ - "\3\2\2\2\u03ee\u03f1\3\2\2\2\u03ef\u03ed\3\2\2\2\u03ef\u03f0\3\2\2\2\u03f0"+ - "\u03f3\3\2\2\2\u03f1\u03ef\3\2\2\2\u03f2\u03f4\7\u0086\2\2\u03f3\u03f2"+ - "\3\2\2\2\u03f3\u03f4\3\2\2\2\u03f4\u03f5\3\2\2\2\u03f5\u03f6\7\u0080\2"+ - "\2\u03f6e\3\2\2\2\u03f7\u03fd\5 \21\2\u03f8\u03f9\7\177\2\2\u03f9\u03fa"+ - "\5X-\2\u03fa\u03fb\7\u0080\2\2\u03fb\u03fd\3\2\2\2\u03fc\u03f7\3\2\2\2"+ - "\u03fc\u03f8\3\2\2\2\u03fdg\3\2\2\2\u03fe\u0403\7\177\2\2\u03ff\u0401"+ - "\5j\66\2\u0400\u0402\7\u0086\2\2\u0401\u0400\3\2\2\2\u0401\u0402\3\2\2"+ - "\2\u0402\u0404\3\2\2\2\u0403\u03ff\3\2\2\2\u0403\u0404\3\2\2\2\u0404\u0405"+ - "\3\2\2\2\u0405\u0406\7\u0080\2\2\u0406i\3\2\2\2\u0407\u040c\5l\67\2\u0408"+ - "\u0409\7\u0086\2\2\u0409\u040b\5l\67\2\u040a\u0408\3\2\2\2\u040b\u040e"+ - "\3\2\2\2\u040c\u040a\3\2\2\2\u040c\u040d\3\2\2\2\u040dk\3\2\2\2\u040e"+ - "\u040c\3\2\2\2\u040f\u0415\5H%\2\u0410\u0411\5\u01b4\u00db\2\u0411\u0412"+ - "\7\u0093\2\2\u0412\u0413\5\36\20\2\u0413\u0415\3\2\2\2\u0414\u040f\3\2"+ - "\2\2\u0414\u0410\3\2\2\2\u0415m\3\2\2\2\u0416\u041f\5\u01b4\u00db\2\u0417"+ - "\u0419\5p9\2\u0418\u0417\3\2\2\2\u0418\u0419\3\2\2\2\u0419\u0420\3\2\2"+ - "\2\u041a\u041b\7\u0097\2\2\u041b\u041d\5\u01b4\u00db\2\u041c\u041e\5p"+ - "9\2\u041d\u041c\3\2\2\2\u041d\u041e\3\2\2\2\u041e\u0420\3\2\2\2\u041f"+ - "\u0418\3\2\2\2\u041f\u041a\3\2\2\2\u0420\u0428\3\2\2\2\u0421\u0422\7\u0085"+ - "\2\2\u0422\u0424\5\u01b4\u00db\2\u0423\u0425\5p9\2\u0424\u0423\3\2\2\2"+ - "\u0424\u0425\3\2\2\2\u0425\u0427\3\2\2\2\u0426\u0421\3\2\2\2\u0427\u042a"+ - "\3\2\2\2\u0428\u0426\3\2\2\2\u0428\u0429\3\2\2\2\u0429o\3\2\2\2\u042a"+ - "\u0428\3\2\2\2\u042b\u042f\7\u0094\2\2\u042c\u042e\7\u0086\2\2\u042d\u042c"+ - "\3\2\2\2\u042e\u0431\3\2\2\2\u042f\u042d\3\2\2\2\u042f\u0430\3\2\2\2\u0430"+ - "\u0432\3\2\2\2\u0431\u042f\3\2\2\2\u0432\u0433\7\u0095\2\2\u0433q\3\2"+ - "\2\2\u0434\u0439\5\b\5\2\u0435\u0438\5\u0144\u00a3\2\u0436\u0438\7\u008b"+ - "\2\2\u0437\u0435\3\2\2\2\u0437\u0436\3\2\2\2\u0438\u043b\3\2\2\2\u0439"+ - "\u0437\3\2\2\2\u0439\u043a\3\2\2\2\u043a\u043d\3\2\2\2\u043b\u0439\3\2"+ - "\2\2\u043c\u043e\7\u0096\2\2\u043d\u043c\3\2\2\2\u043d\u043e\3\2\2\2\u043e"+ - "\u0440\3\2\2\2\u043f\u0441\5t;\2\u0440\u043f\3\2\2\2\u0440\u0441\3\2\2"+ - "\2\u0441\u0443\3\2\2\2\u0442\u0444\5\u01b4\u00db\2\u0443\u0442\3\2\2\2"+ - "\u0443\u0444\3\2\2\2\u0444s\3\2\2\2\u0445\u0446\7\177\2\2\u0446\u044b"+ - "\5v<\2\u0447\u0448\7\u0086\2\2\u0448\u044a\5v<\2\u0449\u0447\3\2\2\2\u044a"+ - "\u044d\3\2\2\2\u044b\u0449\3\2\2\2\u044b\u044c\3\2\2\2\u044c\u044e\3\2"+ - "\2\2\u044d\u044b\3\2\2\2\u044e\u044f\7\u0080\2\2\u044fu\3\2\2\2\u0450"+ - "\u0451\5\u01b4\u00db\2\u0451\u0452\7\u0087\2\2\u0452\u0453\5\36\20\2\u0453"+ - "w\3\2\2\2\u0454\u0456\7\21\2\2\u0455\u0454\3\2\2\2\u0455\u0456\3\2\2\2"+ - "\u0456\u0457\3\2\2\2\u0457\u0458\5z>\2\u0458\u0459\5\u0178\u00bd\2\u0459"+ - "\u045a\5\u0082B\2\u045ay\3\2\2\2\u045b\u045c\7\u0083\2\2\u045c\u0467\7"+ - "\u0084\2\2\u045d\u045e\7\u0083\2\2\u045e\u045f\5|?\2\u045f\u0460\7\u0084"+ - "\2\2\u0460\u0467\3\2\2\2\u0461\u0462\7\u0083\2\2\u0462\u0463\5\u0080A"+ - "\2\u0463\u0464\7\u0084\2\2\u0464\u0467\3\2\2\2\u0465\u0467\5\u01b4\u00db"+ - "\2\u0466\u045b\3\2\2\2\u0466\u045d\3\2\2\2\u0466\u0461\3\2\2\2\u0466\u0465"+ - "\3\2\2\2\u0467{\3\2\2\2\u0468\u046d\5~@\2\u0469\u046a\7\u0086\2\2\u046a"+ - "\u046c\5~@\2\u046b\u0469\3\2\2\2\u046c\u046f\3\2\2\2\u046d\u046b\3\2\2"+ - "\2\u046d\u046e\3\2\2\2\u046e}\3\2\2\2\u046f\u046d\3\2\2\2\u0470\u0472"+ - "\t\4\2\2\u0471\u0470\3\2\2\2\u0471\u0472\3\2\2\2\u0472\u0473\3\2\2\2\u0473"+ - "\u0474\5\6\4\2\u0474\u0475\5\u01b4\u00db\2\u0475\177\3\2\2\2\u0476\u047b"+ - "\5\u01b4\u00db\2\u0477\u0478\7\u0086\2\2\u0478\u047a\5\u01b4\u00db\2\u0479"+ - "\u0477\3\2\2\2\u047a\u047d\3\2\2\2\u047b\u0479\3\2\2\2\u047b\u047c\3\2"+ - "\2\2\u047c\u0081\3\2\2\2\u047d\u047b\3\2\2\2\u047e\u0481\5L\'\2\u047f"+ - "\u0481\5\u00acW\2\u0480\u047e\3\2\2\2\u0480\u047f\3\2\2\2\u0481\u0083"+ - "\3\2\2\2\u0482\u0483\5\u0086D\2\u0483\u0484\5\u0088E\2\u0484\u0085\3\2"+ - "\2\2\u0485\u0487\7\62\2\2\u0486\u0488\5\6\4\2\u0487\u0486\3\2\2\2\u0487"+ - "\u0488\3\2\2\2\u0488\u0489\3\2\2\2\u0489\u048a\5\u01b4\u00db\2\u048a\u048b"+ - "\78\2\2\u048b\u048c\5\36\20\2\u048c\u0087\3\2\2\2\u048d\u048f\5\u008a"+ - "F\2\u048e\u048d\3\2\2\2\u048f\u0492\3\2\2\2\u0490\u048e\3\2\2\2\u0490"+ - "\u0491\3\2\2\2\u0491\u0493\3\2\2\2\u0492\u0490\3\2\2\2\u0493\u0495\5\u0096"+ - "L\2\u0494\u0496\5\u0098M\2\u0495\u0494\3\2\2\2\u0495\u0496\3\2\2\2\u0496"+ - "\u0089\3\2\2\2\u0497\u049d\5\u0086D\2\u0498\u049d\5\u008cG\2\u0499\u049d"+ - "\5\u008eH\2\u049a\u049d\5\u0090I\2\u049b\u049d\5\u0092J\2\u049c\u0497"+ - "\3\2\2\2\u049c\u0498\3\2\2\2\u049c\u0499\3\2\2\2\u049c\u049a\3\2\2\2\u049c"+ - "\u049b\3\2\2\2\u049d\u008b\3\2\2\2\u049e\u049f\7?\2\2\u049f\u04a0\5\u01b4"+ - "\u00db\2\u04a0\u04a1\7\u0093\2\2\u04a1\u04a2\5\36\20\2\u04a2\u008d\3\2"+ - "\2\2\u04a3\u04a4\7q\2\2\u04a4\u04a5\5\36\20\2\u04a5\u008f\3\2\2\2\u04a6"+ - "\u04a8\7>\2\2\u04a7\u04a9\5\6\4\2\u04a8\u04a7\3\2\2\2\u04a8\u04a9\3\2"+ - "\2\2\u04a9\u04aa\3\2\2\2\u04aa\u04ab\5\u01b4\u00db\2\u04ab\u04ac\78\2"+ - "\2\u04ac\u04ad\5\36\20\2\u04ad\u04ae\7G\2\2\u04ae\u04af\5\36\20\2\u04af"+ - "\u04b0\7(\2\2\u04b0\u04b3\5\36\20\2\u04b1\u04b2\7<\2\2\u04b2\u04b4\5\u01b4"+ - "\u00db\2\u04b3\u04b1\3\2\2\2\u04b3\u04b4\3\2\2\2\u04b4\u0091\3\2\2\2\u04b5"+ - "\u04b6\7I\2\2\u04b6\u04bb\5\u0094K\2\u04b7\u04b8\7\u0086\2\2\u04b8\u04ba"+ - "\5\u0094K\2\u04b9\u04b7\3\2\2\2\u04ba\u04bd\3\2\2\2\u04bb\u04b9\3\2\2"+ - "\2\u04bb\u04bc\3\2\2\2\u04bc\u0093\3\2\2\2\u04bd\u04bb\3\2\2\2\u04be\u04c0"+ - "\5\36\20\2\u04bf\u04c1\t\n\2\2\u04c0\u04bf\3\2\2\2\u04c0\u04c1\3\2\2\2"+ - "\u04c1\u0095\3\2\2\2\u04c2\u04c3\7W\2\2\u04c3\u04ca\5\36\20\2\u04c4\u04c5"+ - "\7\65\2\2\u04c5\u04c6\5\36\20\2\u04c6\u04c7\7\26\2\2\u04c7\u04c8\5\36"+ - "\20\2\u04c8\u04ca\3\2\2\2\u04c9\u04c2\3\2\2\2\u04c9\u04c4\3\2\2\2\u04ca"+ - "\u0097\3\2\2\2\u04cb\u04cc\7<\2\2\u04cc\u04cd\5\u01b4\u00db\2\u04cd\u04ce"+ - "\5\u0088E\2\u04ce\u0099\3\2\2\2\u04cf\u04d3\5\u00a6T\2\u04d0\u04d3\5\u009c"+ - "O\2\u04d1\u04d3\5\u00a8U\2\u04d2\u04cf\3\2\2\2\u04d2\u04d0\3\2\2\2\u04d2"+ - "\u04d1\3\2\2\2\u04d3\u009b\3\2\2\2\u04d4\u04d5\5\u00aeX\2\u04d5\u04d6"+ - "\7\u0088\2\2\u04d6\u04dc\3\2\2\2\u04d7\u04d8\5\u00b6\\\2\u04d8\u04d9\7"+ - "\u0088\2\2\u04d9\u04dc\3\2\2\2\u04da\u04dc\5\u009eP\2\u04db\u04d4\3\2"+ - "\2\2\u04db\u04d7\3\2\2\2\u04db\u04da\3\2\2\2\u04dc\u009d\3\2\2\2\u04dd"+ - "\u04de\5\u00a0Q\2\u04de\u04df\5\u00a4S\2\u04df\u009f\3\2\2\2\u04e0\u04e2"+ - "\5\u00a2R\2\u04e1\u04e0\3\2\2\2\u04e1\u04e2\3\2\2\2\u04e2\u04e3\3\2\2"+ - "\2\u04e3\u04e4\5\u0114\u008b\2\u04e4\u04e6\5\u01b4\u00db\2\u04e5\u04e7"+ - "\5\u00e8u\2\u04e6\u04e5\3\2\2\2\u04e6\u04e7\3\2\2\2\u04e7\u04e8\3\2\2"+ - "\2\u04e8\u04ea\7\u0083\2\2\u04e9\u04eb\5\u011a\u008e\2\u04ea\u04e9\3\2"+ - "\2\2\u04ea\u04eb\3\2\2\2\u04eb\u04ec\3\2\2\2\u04ec\u04ee\7\u0084\2\2\u04ed"+ - "\u04ef\5\u00f0y\2\u04ee\u04ed\3\2\2\2\u04ee\u04ef\3\2\2\2\u04ef\u00a1"+ - "\3\2\2\2\u04f0\u04f2\t\13\2\2\u04f1\u04f3\7\\\2\2\u04f2\u04f1\3\2\2\2"+ - "\u04f2\u04f3\3\2\2\2\u04f3\u04f7\3\2\2\2\u04f4\u04f5\7\\\2\2\u04f5\u04f7"+ - "\t\13\2\2\u04f6\u04f0\3\2\2\2\u04f6\u04f4\3\2\2\2\u04f7\u00a3\3\2\2\2"+ - "\u04f8\u04fe\5\u00acW\2\u04f9\u04fa\5\u0178\u00bd\2\u04fa\u04fb\5L\'\2"+ - "\u04fb\u04fc\7\u0088\2\2\u04fc\u04fe\3\2\2\2\u04fd\u04f8\3\2\2\2\u04fd"+ - "\u04f9\3\2\2\2\u04fe\u00a5\3\2\2\2\u04ff\u0500\5\u01b4\u00db\2\u0500\u0501"+ - "\7\u0087\2\2\u0501\u0502\5\u009aN\2\u0502\u00a7\3\2\2\2\u0503\u0506\5"+ - "\u00acW\2\u0504\u0506\5\u00aaV\2\u0505\u0503\3\2\2\2\u0505\u0504\3\2\2"+ - "\2\u0506\u00a9\3\2\2\2\u0507\u058a\7\u0088\2\2\u0508\u0509\5\36\20\2\u0509"+ - "\u050a\7\u0088\2\2\u050a\u058a\3\2\2\2\u050b\u050c\7\66\2\2\u050c\u050d"+ - "\7\u0083\2\2\u050d\u050e\5\36\20\2\u050e\u050f\7\u0084\2\2\u050f\u0512"+ - "\5\u00b8]\2\u0510\u0511\7&\2\2\u0511\u0513\5\u00b8]\2\u0512\u0510\3\2"+ - "\2\2\u0512\u0513\3\2\2\2\u0513\u058a\3\2\2\2\u0514\u0515\7_\2\2\u0515"+ - "\u0516\7\u0083\2\2\u0516\u0517\5\36\20\2\u0517\u0518\7\u0084\2\2\u0518"+ - "\u051c\7\177\2\2\u0519\u051b\5\u00ba^\2\u051a\u0519\3\2\2\2\u051b\u051e"+ - "\3\2\2\2\u051c\u051a\3\2\2\2\u051c\u051d\3\2\2\2\u051d\u051f\3\2\2\2\u051e"+ - "\u051c\3\2\2\2\u051f\u0520\7\u0080\2\2\u0520\u058a\3\2\2\2\u0521\u0522"+ - "\7r\2\2\u0522\u0523\7\u0083\2\2\u0523\u0524\5\36\20\2\u0524\u0525\7\u0084"+ - "\2\2\u0525\u0526\5\u00a8U\2\u0526\u058a\3\2\2\2\u0527\u0528\7#\2\2\u0528"+ - "\u0529\5\u00a8U\2\u0529\u052a\7r\2\2\u052a\u052b\7\u0083\2\2\u052b\u052c"+ - "\5\36\20\2\u052c\u052d\7\u0084\2\2\u052d\u052e\7\u0088\2\2\u052e\u058a"+ - "\3\2\2\2\u052f\u0530\7\60\2\2\u0530\u0532\7\u0083\2\2\u0531\u0533\5\u00c2"+ - "b\2\u0532\u0531\3\2\2\2\u0532\u0533\3\2\2\2\u0533\u0534\3\2\2\2\u0534"+ - "\u0536\7\u0088\2\2\u0535\u0537\5\36\20\2\u0536\u0535\3\2\2\2\u0536\u0537"+ - "\3\2\2\2\u0537\u0538\3\2\2\2\u0538\u053a\7\u0088\2\2\u0539\u053b\5\u00c4"+ - "c\2\u053a\u0539\3\2\2\2\u053a\u053b\3\2\2\2\u053b\u053c\3\2\2\2\u053c"+ - "\u053d\7\u0084\2\2\u053d\u058a\5\u00a8U\2\u053e\u0540\7\22\2\2\u053f\u053e"+ - "\3\2\2\2\u053f\u0540\3\2\2\2\u0540\u0541\3\2\2\2\u0541\u0542\7\61\2\2"+ - "\u0542\u0543\7\u0083\2\2\u0543\u0544\5\u00b0Y\2\u0544\u0545\5\u01b4\u00db"+ - "\2\u0545\u0546\78\2\2\u0546\u0547\5\36\20\2\u0547\u0548\7\u0084\2\2\u0548"+ - "\u0549\5\u00a8U\2\u0549\u058a\3\2\2\2\u054a\u054b\7\25\2\2\u054b\u058a"+ - "\7\u0088\2\2\u054c\u054d\7\36\2\2\u054d\u058a\7\u0088\2\2\u054e\u0553"+ - "\7\64\2\2\u054f\u0554\5\u01b4\u00db\2\u0550\u0551\7\30\2\2\u0551\u0554"+ - "\5\36\20\2\u0552\u0554\7 \2\2\u0553\u054f\3\2\2\2\u0553\u0550\3\2\2\2"+ - "\u0553\u0552\3\2\2\2\u0554\u0555\3\2\2\2\u0555\u058a\7\u0088\2\2\u0556"+ - "\u0558\7T\2\2\u0557\u0559\5\36\20\2\u0558\u0557\3\2\2\2\u0558\u0559\3"+ - "\2\2\2\u0559\u055a\3\2\2\2\u055a\u058a\7\u0088\2\2\u055b\u055d\7a\2\2"+ - "\u055c\u055e\5\36\20\2\u055d\u055c\3\2\2\2\u055d\u055e\3\2\2\2\u055e\u055f"+ - "\3\2\2\2\u055f\u058a\7\u0088\2\2\u0560\u0561\7c\2\2\u0561\u0567\5\u00ac"+ - "W\2\u0562\u0564\5\u00c6d\2\u0563\u0565\5\u00ceh\2\u0564\u0563\3\2\2\2"+ - "\u0564\u0565\3\2\2\2\u0565\u0568\3\2\2\2\u0566\u0568\5\u00ceh\2\u0567"+ - "\u0562\3\2\2\2\u0567\u0566\3\2\2\2\u0568\u058a\3\2\2\2\u0569\u056a\7\33"+ - "\2\2\u056a\u058a\5\u00acW\2\u056b\u056c\7g\2\2\u056c\u058a\5\u00acW\2"+ - "\u056d\u056e\7@\2\2\u056e\u056f\7\u0083\2\2\u056f\u0570\5\36\20\2\u0570"+ - "\u0571\7\u0084\2\2\u0571\u0572\5\u00a8U\2\u0572\u058a\3\2\2\2\u0573\u0574"+ - "\7k\2\2\u0574\u0575\7\u0083\2\2\u0575\u0576\5\u00d0i\2\u0576\u0577\7\u0084"+ - "\2\2\u0577\u0578\5\u00a8U\2\u0578\u058a\3\2\2\2\u0579\u057d\7s\2\2\u057a"+ - "\u057b\7T\2\2\u057b\u057e\5\36\20\2\u057c\u057e\7\25\2\2\u057d\u057a\3"+ - "\2\2\2\u057d\u057c\3\2\2\2\u057e\u057f\3\2\2\2\u057f\u058a\7\u0088\2\2"+ - "\u0580\u0581\7i\2\2\u0581\u058a\5\u00acW\2\u0582\u0583\7.\2\2\u0583\u0584"+ - "\7\u0083\2\2\u0584\u0585\5\u016c\u00b7\2\u0585\u0586\5\u016e\u00b8\2\u0586"+ - "\u0587\7\u0084\2\2\u0587\u0588\5\u00a8U\2\u0588\u058a\3\2\2\2\u0589\u0507"+ - "\3\2\2\2\u0589\u0508\3\2\2\2\u0589\u050b\3\2\2\2\u0589\u0514\3\2\2\2\u0589"+ - "\u0521\3\2\2\2\u0589\u0527\3\2\2\2\u0589\u052f\3\2\2\2\u0589\u053f\3\2"+ - "\2\2\u0589\u054a\3\2\2\2\u0589\u054c\3\2\2\2\u0589\u054e\3\2\2\2\u0589"+ - "\u0556\3\2\2\2\u0589\u055b\3\2\2\2\u0589\u0560\3\2\2\2\u0589\u0569\3\2"+ - "\2\2\u0589\u056b\3\2\2\2\u0589\u056d\3\2\2\2\u0589\u0573\3\2\2\2\u0589"+ - "\u0579\3\2\2\2\u0589\u0580\3\2\2\2\u0589\u0582\3\2\2\2\u058a\u00ab\3\2"+ - "\2\2\u058b\u058d\7\177\2\2\u058c\u058e\5\u00c0a\2\u058d\u058c\3\2\2\2"+ - "\u058d\u058e\3\2\2\2\u058e\u058f\3\2\2\2\u058f\u0590\7\u0080\2\2\u0590"+ - "\u00ad\3\2\2\2\u0591\u0596\7k\2\2\u0592\u0596\7R\2\2\u0593\u0594\7R\2"+ - "\2\u0594\u0596\7Q\2\2\u0595\u0591\3\2\2\2\u0595\u0592\3\2\2\2\u0595\u0593"+ - "\3\2\2\2\u0595\u0596\3\2\2\2\u0596\u0597\3\2\2\2\u0597\u0598\5\u00b0Y"+ - "\2\u0598\u059d\5\u00b2Z\2\u0599\u059a\7\u0086\2\2\u059a\u059c\5\u00b2"+ - "Z\2\u059b\u0599\3\2\2\2\u059c\u059f\3\2\2\2\u059d\u059b\3\2\2\2\u059d"+ - "\u059e\3\2\2\2\u059e\u05a5\3\2\2\2\u059f\u059d\3\2\2\2\u05a0\u05a1\7."+ - "\2\2\u05a1\u05a2\5\u016c\u00b7\2\u05a2\u05a3\5\u016e\u00b8\2\u05a3\u05a5"+ - "\3\2\2\2\u05a4\u0595\3\2\2\2\u05a4\u05a0\3\2\2\2\u05a5\u00af\3\2\2\2\u05a6"+ - "\u05a9\7l\2\2\u05a7\u05a9\5\6\4\2\u05a8\u05a6\3\2\2\2\u05a8\u05a7\3\2"+ - "\2\2\u05a9\u00b1\3\2\2\2\u05aa\u05b0\5\u01b4\u00db\2\u05ab\u05ad\7\u0093"+ - "\2\2\u05ac\u05ae\7R\2\2\u05ad\u05ac\3\2\2\2\u05ad\u05ae\3\2\2\2\u05ae"+ - "\u05af\3\2\2\2\u05af\u05b1\5\u00b4[\2\u05b0\u05ab\3\2\2\2\u05b0\u05b1"+ - "\3\2\2\2\u05b1\u00b3\3\2\2\2\u05b2\u05b6\5\36\20\2\u05b3\u05b6\5\u0146"+ - "\u00a4\2\u05b4\u05b6\5\u0176\u00bc\2\u05b5\u05b2\3\2\2\2\u05b5\u05b3\3"+ - "\2\2\2\u05b5\u05b4\3\2\2\2\u05b6\u00b5\3\2\2\2\u05b7\u05b8\7\35\2\2\u05b8"+ - "\u05b9\5\6\4\2\u05b9\u05ba\5\u010a\u0086\2\u05ba\u00b7\3\2\2\2\u05bb\u05be"+ - "\5\u00acW\2\u05bc\u05be\5\u00aaV\2\u05bd\u05bb\3\2\2\2\u05bd\u05bc\3\2"+ - "\2\2\u05be\u00b9\3\2\2\2\u05bf\u05c1\5\u00bc_\2\u05c0\u05bf\3\2\2\2\u05c1"+ - "\u05c2\3\2\2\2\u05c2\u05c0\3\2\2\2\u05c2\u05c3\3\2\2\2\u05c3\u05c4\3\2"+ - "\2\2\u05c4\u05c5\5\u00c0a\2\u05c5\u00bb\3\2\2\2\u05c6\u05c7\7\30\2\2\u05c7"+ - "\u05c9\5\36\20\2\u05c8\u05ca\5\u00be`\2\u05c9\u05c8\3\2\2\2\u05c9\u05ca"+ - "\3\2\2\2\u05ca\u05cb\3\2\2\2\u05cb\u05cc\7\u0087\2\2\u05cc\u05d0\3\2\2"+ - "\2\u05cd\u05ce\7 \2\2\u05ce\u05d0\7\u0087\2\2\u05cf\u05c6\3\2\2\2\u05cf"+ - "\u05cd\3\2\2\2\u05d0\u00bd\3\2\2\2\u05d1\u05d2\7p\2\2\u05d2\u05d3\5\36"+ - "\20\2\u05d3\u00bf\3\2\2\2\u05d4\u05d6\5\u009aN\2\u05d5\u05d4\3\2\2\2\u05d6"+ - "\u05d7\3\2\2\2\u05d7\u05d5\3\2\2\2\u05d7\u05d8\3\2\2\2\u05d8\u00c1\3\2"+ - "\2\2\u05d9\u05e3\5\u00aeX\2\u05da\u05df\5\36\20\2\u05db\u05dc\7\u0086"+ - "\2\2\u05dc\u05de\5\36\20\2\u05dd\u05db\3\2\2\2\u05de\u05e1\3\2\2\2\u05df"+ - "\u05dd\3\2\2\2\u05df\u05e0\3\2\2\2\u05e0\u05e3\3\2\2\2\u05e1\u05df\3\2"+ - "\2\2\u05e2\u05d9\3\2\2\2\u05e2\u05da\3\2\2\2\u05e3\u00c3\3\2\2\2\u05e4"+ - "\u05e9\5\36\20\2\u05e5\u05e6\7\u0086\2\2\u05e6\u05e8\5\36\20\2\u05e7\u05e5"+ - "\3\2\2\2\u05e8\u05eb\3\2\2\2\u05e9\u05e7\3\2\2\2\u05e9\u05ea\3\2\2\2\u05ea"+ - "\u00c5\3\2\2\2\u05eb\u05e9\3\2\2\2\u05ec\u05f0\5\u00c8e\2\u05ed\u05ef"+ - "\5\u00c8e\2\u05ee\u05ed\3\2\2\2\u05ef\u05f2\3\2\2\2\u05f0\u05ee\3\2\2"+ - "\2\u05f0\u05f1\3\2\2\2\u05f1\u05f4\3\2\2\2\u05f2\u05f0\3\2\2\2\u05f3\u05f5"+ - "\5\u00caf\2\u05f4\u05f3\3\2\2\2\u05f4\u05f5\3\2\2\2\u05f5\u05f8\3\2\2"+ - "\2\u05f6\u05f8\5\u00caf\2\u05f7\u05ec\3\2\2\2\u05f7\u05f6\3\2\2\2\u05f8"+ - "\u00c7\3\2\2\2\u05f9\u05fa\7\31\2\2\u05fa\u05fb\7\u0083\2\2\u05fb\u05fd"+ - "\5\26\f\2\u05fc\u05fe\5\u01b4\u00db\2\u05fd\u05fc\3\2\2\2\u05fd\u05fe"+ - "\3\2\2\2\u05fe\u05ff\3\2\2\2\u05ff\u0601\7\u0084\2\2\u0600\u0602\5\u00cc"+ - "g\2\u0601\u0600\3\2\2\2\u0601\u0602\3\2\2\2\u0602\u0603\3\2\2\2\u0603"+ - "\u0604\5\u00acW\2\u0604\u00c9\3\2\2\2\u0605\u0607\7\31\2\2\u0606\u0608"+ - "\5\u00ccg\2\u0607\u0606\3\2\2\2\u0607\u0608\3\2\2\2\u0608\u0609\3\2\2"+ - "\2\u0609\u060a\5\u00acW\2\u060a\u00cb\3\2\2\2\u060b\u060c\7p\2\2\u060c"+ - "\u060d\7\u0083\2\2\u060d\u060e\5\36\20\2\u060e\u060f\7\u0084\2\2\u060f"+ - "\u00cd\3\2\2\2\u0610\u0611\7-\2\2\u0611\u0612\5\u00acW\2\u0612\u00cf\3"+ - "\2\2\2\u0613\u0616\5\u00aeX\2\u0614\u0616\5\36\20\2\u0615\u0613\3\2\2"+ - "\2\u0615\u0614\3\2\2\2\u0616\u00d1\3\2\2\2\u0617\u0618\7C\2\2\u0618\u0619"+ - "\5\u00d4k\2\u0619\u061b\5\u00d6l\2\u061a\u061c\7\u0088\2\2\u061b\u061a"+ - "\3\2\2\2\u061b\u061c\3\2\2\2\u061c\u00d3\3\2\2\2\u061d\u0622\5\u01b4\u00db"+ - "\2\u061e\u061f\7\u0085\2\2\u061f\u0621\5\u01b4\u00db\2\u0620\u061e\3\2"+ - "\2\2\u0621\u0624\3\2\2\2\u0622\u0620\3\2\2\2\u0622\u0623\3\2\2\2\u0623"+ - "\u00d5\3\2\2\2\u0624\u0622\3\2\2\2\u0625\u0627\7\177\2\2\u0626\u0628\5"+ - "\u00d8m\2\u0627\u0626\3\2\2\2\u0627\u0628\3\2\2\2\u0628\u062a\3\2\2\2"+ - "\u0629\u062b\5\u00dco\2\u062a\u0629\3\2\2\2\u062a\u062b\3\2\2\2\u062b"+ - "\u062d\3\2\2\2\u062c\u062e\5\u00e0q\2\u062d\u062c\3\2\2\2\u062d\u062e"+ - "\3\2\2\2\u062e\u062f\3\2\2\2\u062f\u0630\7\u0080\2\2\u0630\u00d7\3\2\2"+ - "\2\u0631\u0633\5\u00dan\2\u0632\u0631\3\2\2\2\u0633\u0634\3\2\2\2\u0634"+ - "\u0632\3\2\2\2\u0634\u0635\3\2\2\2\u0635\u00d9\3\2\2\2\u0636\u0637\7+"+ - "\2\2\u0637\u0638\7\r\2\2\u0638\u0639\5\u01b4\u00db\2\u0639\u063a\7\u0088"+ - "\2\2\u063a\u00db\3\2\2\2\u063b\u063d\5\u00dep\2\u063c\u063b\3\2\2\2\u063d"+ - "\u063e\3\2\2\2\u063e\u063c\3\2\2\2\u063e\u063f\3\2\2\2\u063f\u00dd\3\2"+ - "\2\2\u0640\u0641\7k\2\2\u0641\u0642\5\u01b4\u00db\2\u0642\u0643\7\u0093"+ - "\2\2\u0643\u0644\5\4\3\2\u0644\u0645\7\u0088\2\2\u0645\u0650\3\2\2\2\u0646"+ - "\u0647\7k\2\2\u0647\u0648\5\4\3\2\u0648\u0649\7\u0088\2\2\u0649\u0650"+ - "\3\2\2\2\u064a\u064b\7k\2\2\u064b\u064c\7\\\2\2\u064c\u064d\5\4\3\2\u064d"+ - "\u064e\7\u0088\2\2\u064e\u0650\3\2\2\2\u064f\u0640\3\2\2\2\u064f\u0646"+ - "\3\2\2\2\u064f\u064a\3\2\2\2\u0650\u00df\3\2\2\2\u0651\u0653\5\u00e2r"+ - "\2\u0652\u0651\3\2\2\2\u0653\u0654\3\2\2\2\u0654\u0652\3\2\2\2\u0654\u0655"+ - "\3\2\2\2\u0655\u00e1\3\2\2\2\u0656\u0659\5\u00d2j\2\u0657\u0659\5\u00e4"+ - "s\2\u0658\u0656\3\2\2\2\u0658\u0657\3\2\2\2\u0659\u00e3\3\2\2\2\u065a"+ - "\u065c\5\u0160\u00b1\2\u065b\u065a\3\2\2\2\u065b\u065c\3\2\2\2\u065c\u065e"+ - "\3\2\2\2\u065d\u065f\5\u0102\u0082\2\u065e\u065d\3\2\2\2\u065e\u065f\3"+ - "\2\2\2\u065f\u0665\3\2\2\2\u0660\u0666\5\u0190\u00c9\2\u0661\u0666\5\u0192"+ - "\u00ca\2\u0662\u0666\5\u0194\u00cb\2\u0663\u0666\5\u0196\u00cc\2\u0664"+ - "\u0666\5\u0198\u00cd\2\u0665\u0660\3\2\2\2\u0665\u0661\3\2\2\2\u0665\u0662"+ - "\3\2\2\2\u0665\u0663\3\2\2\2\u0665\u0664\3\2\2\2\u0666\u00e5\3\2\2\2\u0667"+ - "\u0668\5\u01b4\u00db\2\u0668\u0669\7\u0097\2\2\u0669\u066b\5\u01b4\u00db"+ - "\2\u066a\u066c\5\30\r\2\u066b\u066a\3\2\2\2\u066b\u066c\3\2\2\2\u066c"+ - "\u00e7\3\2\2\2\u066d\u066e\7\u0094\2\2\u066e\u0673\5\u00eav\2\u066f\u0670"+ - "\7\u0086\2\2\u0670\u0672\5\u00eav\2\u0671\u066f\3\2\2\2\u0672\u0675\3"+ - "\2\2\2\u0673\u0671\3\2\2\2\u0673\u0674\3\2\2\2\u0674\u0676\3\2\2\2\u0675"+ - "\u0673\3\2\2\2\u0676\u0677\7\u0095\2\2\u0677\u00e9\3\2\2\2\u0678\u067a"+ - "\5\u0160\u00b1\2\u0679\u0678\3\2\2\2\u0679\u067a\3\2\2\2\u067a\u067b\3"+ - "\2\2\2\u067b\u067c\5\u01b4\u00db\2\u067c\u00eb\3\2\2\2\u067d\u067e\7\u0087"+ - "\2\2\u067e\u0683\5\26\f\2\u067f\u0680\7\u0086\2\2\u0680\u0682\5\4\3\2"+ - "\u0681\u067f\3\2\2\2\u0682\u0685\3\2\2\2\u0683\u0681\3\2\2\2\u0683\u0684"+ - "\3\2\2\2\u0684\u00ed\3\2\2\2\u0685\u0683\3\2\2\2\u0686\u068b\5\4\3\2\u0687"+ - "\u0688\7\u0086\2\2\u0688\u068a\5\4\3\2\u0689\u0687\3\2\2\2\u068a\u068d"+ - "\3\2\2\2\u068b\u0689\3\2\2\2\u068b\u068c\3\2\2\2\u068c\u00ef\3\2\2\2\u068d"+ - "\u068b\3\2\2\2\u068e\u0690\5\u00f2z\2\u068f\u068e\3\2\2\2\u0690\u0691"+ - "\3\2\2\2\u0691\u068f\3\2\2\2\u0691\u0692\3\2\2\2\u0692\u00f1\3\2\2\2\u0693"+ - "\u0694\7q\2\2\u0694\u0695\5\u01b4\u00db\2\u0695\u0696\7\u0087\2\2\u0696"+ - "\u0697\5\u00f4{\2\u0697\u00f3\3\2\2\2\u0698\u06a3\5\u00fa~\2\u0699\u069c"+ - "\5\u00f6|\2\u069a\u069b\7\u0086\2\2\u069b\u069d\5\u00f8}\2\u069c\u069a"+ - "\3\2\2\2\u069c\u069d\3\2\2\2\u069d\u06a0\3\2\2\2\u069e\u069f\7\u0086\2"+ - "\2\u069f\u06a1\5\u00fa~\2\u06a0\u069e\3\2\2\2\u06a0\u06a1\3\2\2\2\u06a1"+ - "\u06a3\3\2\2\2\u06a2\u0698\3\2\2\2\u06a2\u0699\3\2\2\2\u06a3\u00f5\3\2"+ - "\2\2\u06a4\u06ac\5\26\f\2\u06a5\u06a7\7\34\2\2\u06a6\u06a8\7\u0096\2\2"+ - "\u06a7\u06a6\3\2\2\2\u06a7\u06a8\3\2\2\2\u06a8\u06ac\3\2\2\2\u06a9\u06ac"+ - "\7^\2\2\u06aa\u06ac\7h\2\2\u06ab\u06a4\3\2\2\2\u06ab\u06a5\3\2\2\2\u06ab"+ - "\u06a9\3\2\2\2\u06ab\u06aa\3\2\2\2\u06ac\u00f7\3\2\2\2\u06ad\u06b2\5\4"+ - "\3\2\u06ae\u06af\7\u0086\2\2\u06af\u06b1\5\4\3\2\u06b0\u06ae\3\2\2\2\u06b1"+ - "\u06b4\3\2\2\2\u06b2\u06b0\3\2\2\2\u06b2\u06b3\3\2\2\2\u06b3\u00f9\3\2"+ - "\2\2\u06b4\u06b2\3\2\2\2\u06b5\u06b6\7D\2\2\u06b6\u06b7\7\u0083\2\2\u06b7"+ - "\u06b8\7\u0084\2\2\u06b8\u00fb\3\2\2\2\u06b9\u06bb\7\177\2\2\u06ba\u06bc"+ - "\5\u00fe\u0080\2\u06bb\u06ba\3\2\2\2\u06bb\u06bc\3\2\2\2\u06bc\u06bd\3"+ - "\2\2\2\u06bd\u06be\7\u0080\2\2\u06be\u00fd\3\2\2\2\u06bf\u06c1\5\u0100"+ - "\u0081\2\u06c0\u06bf\3\2\2\2\u06c1\u06c2\3\2\2\2\u06c2\u06c0\3\2\2\2\u06c2"+ - "\u06c3\3\2\2\2\u06c3\u00ff\3\2\2\2\u06c4\u06c6\5\u0160\u00b1\2\u06c5\u06c4"+ - "\3\2\2\2\u06c5\u06c6\3\2\2\2\u06c6\u06c8\3\2\2\2\u06c7\u06c9\5\u0102\u0082"+ - "\2\u06c8\u06c7\3\2\2\2\u06c8\u06c9\3\2\2\2\u06c9\u06cc\3\2\2\2\u06ca\u06cd"+ - "\5\u0106\u0084\2\u06cb\u06cd\5\u01a4\u00d3\2\u06cc\u06ca\3\2\2\2\u06cc"+ - "\u06cb\3\2\2\2\u06cd\u0101\3\2\2\2\u06ce\u06d0\5\u0104\u0083\2\u06cf\u06ce"+ - "\3\2\2\2\u06d0\u06d1\3\2\2\2\u06d1\u06cf\3\2\2\2\u06d1\u06d2\3\2\2\2\u06d2"+ - "\u0103\3\2\2\2\u06d3\u06d4\t\f\2\2\u06d4\u0105\3\2\2\2\u06d5\u06e9\5\u01a0"+ - "\u00d1\2\u06d6\u06e9\5\u0108\u0085\2\u06d7\u06e9\5\u019a\u00ce\2\u06d8"+ - "\u06de\5\u0136\u009c\2\u06d9\u06df\5\u013a\u009e\2\u06da\u06db\5\u0178"+ - "\u00bd\2\u06db\u06dc\5L\'\2\u06dc\u06dd\7\u0088\2\2\u06dd\u06df\3\2\2"+ - "\2\u06de\u06d9\3\2\2\2\u06de\u06da\3\2\2\2\u06df\u06e9\3\2\2\2\u06e0\u06e9"+ - "\5\u01a6\u00d4\2\u06e1\u06e2\7n\2\2\u06e2\u06e9\5\u01a8\u00d5\2\u06e3"+ - "\u06e9\5\u0190\u00c9\2\u06e4\u06e9\5\u0192\u00ca\2\u06e5\u06e9\5\u0194"+ - "\u00cb\2\u06e6\u06e9\5\u0196\u00cc\2\u06e7\u06e9\5\u0198\u00cd\2\u06e8"+ - "\u06d5\3\2\2\2\u06e8\u06d6\3\2\2\2\u06e8\u06d7\3\2\2\2\u06e8\u06d8\3\2"+ - "\2\2\u06e8\u06e0\3\2\2\2\u06e8\u06e1\3\2\2\2\u06e8\u06e3\3\2\2\2\u06e8"+ - "\u06e4\3\2\2\2\u06e8\u06e5\3\2\2\2\u06e8\u06e6\3\2\2\2\u06e8\u06e7\3\2"+ - "\2\2\u06e9\u0107\3\2\2\2\u06ea\u06f0\7R\2\2\u06eb\u06ec\7Q\2\2\u06ec\u06f0"+ - "\7R\2\2\u06ed\u06ee\7R\2\2\u06ee\u06f0\7Q\2\2\u06ef\u06ea\3\2\2\2\u06ef"+ - "\u06eb\3\2\2\2\u06ef\u06ed\3\2\2\2\u06ef\u06f0\3\2\2\2\u06f0\u06f1\3\2"+ - "\2\2\u06f1\u06fb\5\6\4\2\u06f2\u06f3\5\4\3\2\u06f3\u06f4\7\u0085\2\2\u06f4"+ - "\u06f5\5\u01a2\u00d2\2\u06f5\u06fc\3\2\2\2\u06f6\u06fc\5\u01a8\u00d5\2"+ - "\u06f7\u06fc\5\u019e\u00d0\2\u06f8\u06fc\5\u01a2\u00d2\2\u06f9\u06fc\5"+ - "\u01ac\u00d7\2\u06fa\u06fc\5\u019c\u00cf\2\u06fb\u06f2\3\2\2\2\u06fb\u06f6"+ - "\3\2\2\2\u06fb\u06f7\3\2\2\2\u06fb\u06f8\3\2\2\2\u06fb\u06f9\3\2\2\2\u06fb"+ - "\u06fa\3\2\2\2\u06fc\u0109\3\2\2\2\u06fd\u0702\5\u010c\u0087\2\u06fe\u06ff"+ - "\7\u0086\2\2\u06ff\u0701\5\u010c\u0087\2\u0700\u06fe\3\2\2\2\u0701\u0704"+ - "\3\2\2\2\u0702\u0700\3\2\2\2\u0702\u0703\3\2\2\2\u0703\u010b\3\2\2\2\u0704"+ - "\u0702\3\2\2\2\u0705\u0706\5\u01b4\u00db\2\u0706\u0707\7\u0093\2\2\u0707"+ - "\u0708\5\36\20\2\u0708\u010d\3\2\2\2\u0709\u070e\5\u0110\u0089\2\u070a"+ - "\u070b\7\u0086\2\2\u070b\u070d\5\u0110\u0089\2\u070c\u070a\3\2\2\2\u070d"+ - "\u0710\3\2\2\2\u070e\u070c\3\2\2\2\u070e\u070f\3\2\2\2\u070f\u010f\3\2"+ - "\2\2\u0710\u070e\3\2\2\2\u0711\u0714\5\u01b4\u00db\2\u0712\u0713\7\u0093"+ - "\2\2\u0713\u0715\5\u0112\u008a\2\u0714\u0712\3\2\2\2\u0714\u0715\3\2\2"+ - "\2\u0715\u0111\3\2\2\2\u0716\u0719\5\36\20\2\u0717\u0719\5\u0146\u00a4"+ - "\2\u0718\u0716\3\2\2\2\u0718\u0717\3\2\2\2\u0719\u0113\3\2\2\2\u071a\u071d"+ - "\5\6\4\2\u071b\u071d\7n\2\2\u071c\u071a\3\2\2\2\u071c\u071b\3\2\2\2\u071d"+ - "\u0115\3\2\2\2\u071e\u071f\5\4\3\2\u071f\u0117\3\2\2\2\u0720\u0723\5\u00ac"+ - "W\2\u0721\u0723\7\u0088\2\2\u0722\u0720\3\2\2\2\u0722\u0721\3\2\2\2\u0723"+ - "\u0119\3\2\2\2\u0724\u072b\5\u0122\u0092\2\u0725\u0728\5\u011c\u008f\2"+ - "\u0726\u0727\7\u0086\2\2\u0727\u0729\5\u0122\u0092\2\u0728\u0726\3\2\2"+ - "\2\u0728\u0729\3\2\2\2\u0729\u072b\3\2\2\2\u072a\u0724\3\2\2\2\u072a\u0725"+ - "\3\2\2\2\u072b\u011b\3\2\2\2\u072c\u0731\5\u011e\u0090\2\u072d\u072e\7"+ - "\u0086\2\2\u072e\u0730\5\u011e\u0090\2\u072f\u072d\3\2\2\2\u0730\u0733"+ - "\3\2\2\2\u0731\u072f\3\2\2\2\u0731\u0732\3\2\2\2\u0732\u011d\3\2\2\2\u0733"+ - "\u0731\3\2\2\2\u0734\u0736\5\u0160\u00b1\2\u0735\u0734\3\2\2\2\u0735\u0736"+ - "\3\2\2\2\u0736\u0738\3\2\2\2\u0737\u0739\5\u0120\u0091\2\u0738\u0737\3"+ - "\2\2\2\u0738\u0739\3\2\2\2\u0739\u073a\3\2\2\2\u073a\u073d\5\u01ae\u00d8"+ - "\2\u073b\u073d\7\16\2\2\u073c\u0735\3\2\2\2\u073c\u073b\3\2\2\2\u073d"+ - "\u011f\3\2\2\2\u073e\u0747\7R\2\2\u073f\u0747\7J\2\2\u0740\u0747\78\2"+ - "\2\u0741\u0742\7R\2\2\u0742\u0747\7`\2\2\u0743\u0744\78\2\2\u0744\u0747"+ - "\7`\2\2\u0745\u0747\7`\2\2\u0746\u073e\3\2\2\2\u0746\u073f\3\2\2\2\u0746"+ - "\u0740\3\2\2\2\u0746\u0741\3\2\2\2\u0746\u0743\3\2\2\2\u0746\u0745\3\2"+ - "\2\2\u0747\u0121\3\2\2\2\u0748\u074a\5\u0160\u00b1\2\u0749\u0748\3\2\2"+ - "\2\u0749\u074a\3\2\2\2\u074a\u074b\3\2\2\2\u074b\u074c\7L\2\2\u074c\u074d"+ - "\5\u0142\u00a2\2\u074d\u074e\5\u01b4\u00db\2\u074e\u0123\3\2\2\2\u074f"+ - "\u0751\5\u0160\u00b1\2\u0750\u074f\3\2\2\2\u0750\u0751\3\2\2\2\u0751\u0753"+ - "\3\2\2\2\u0752\u0754\5\u012a\u0096\2\u0753\u0752\3\2\2\2\u0753\u0754\3"+ - "\2\2\2\u0754\u075f\3\2\2\2\u0755\u0756\7\63\2\2\u0756\u0758\5\u012c\u0097"+ - "\2\u0757\u0759\5\u0128\u0095\2\u0758\u0757\3\2\2\2\u0758\u0759\3\2\2\2"+ - "\u0759\u0760\3\2\2\2\u075a\u075b\7X\2\2\u075b\u075d\5\u012c\u0097\2\u075c"+ - "\u075e\5\u0126\u0094\2\u075d\u075c\3\2\2\2\u075d\u075e\3\2\2\2\u075e\u0760"+ - "\3\2\2\2\u075f\u0755\3\2\2\2\u075f\u075a\3\2\2\2\u0760\u0125\3\2\2\2\u0761"+ - "\u0763\5\u0160\u00b1\2\u0762\u0761\3\2\2\2\u0762\u0763\3\2\2\2\u0763\u0765"+ - "\3\2\2\2\u0764\u0766\5\u012a\u0096\2\u0765\u0764\3\2\2\2\u0765\u0766\3"+ - "\2\2\2\u0766\u0767\3\2\2\2\u0767\u0768\7\63\2\2\u0768\u0769\5\u012c\u0097"+ - "\2\u0769\u0127\3\2\2\2\u076a\u076c\5\u0160\u00b1\2\u076b\u076a\3\2\2\2"+ - "\u076b\u076c\3\2\2\2\u076c\u076e\3\2\2\2\u076d\u076f\5\u012a\u0096\2\u076e"+ - "\u076d\3\2\2\2\u076e\u076f\3\2\2\2\u076f\u0770\3\2\2\2\u0770\u0771\7X"+ - "\2\2\u0771\u0772\5\u012c\u0097\2\u0772\u0129\3\2\2\2\u0773\u077b\7O\2"+ - "\2\u0774\u077b\7;\2\2\u0775\u077b\7N\2\2\u0776\u0777\7O\2\2\u0777\u077b"+ - "\7;\2\2\u0778\u0779\7;\2\2\u0779\u077b\7O\2\2\u077a\u0773\3\2\2\2\u077a"+ - "\u0774\3\2\2\2\u077a\u0775\3\2\2\2\u077a\u0776\3\2\2\2\u077a\u0778\3\2"+ - "\2\2\u077b\u012b\3\2\2\2\u077c\u077f\5\u00acW\2\u077d\u077f\7\u0088\2"+ - "\2\u077e\u077c\3\2\2\2\u077e\u077d\3\2\2\2\u077f\u012d\3\2\2\2\u0780\u0782"+ - "\5\u0160\u00b1\2\u0781\u0780\3\2\2\2\u0781\u0782\3\2\2\2\u0782\u078b\3"+ - "\2\2\2\u0783\u0784\7\f\2\2\u0784\u0785\5\u00acW\2\u0785\u0786\5\u0132"+ - "\u009a\2\u0786\u078c\3\2\2\2\u0787\u0788\7S\2\2\u0788\u0789\5\u00acW\2"+ - "\u0789\u078a\5\u0130\u0099\2\u078a\u078c\3\2\2\2\u078b\u0783\3\2\2\2\u078b"+ - "\u0787\3\2\2\2\u078c\u012f\3\2\2\2\u078d\u078f\5\u0160\u00b1\2\u078e\u078d"+ - "\3\2\2\2\u078e\u078f\3\2\2\2\u078f\u0790\3\2\2\2\u0790\u0791\7\f\2\2\u0791"+ - "\u0792\5\u00acW\2\u0792\u0131\3\2\2\2\u0793\u0795\5\u0160\u00b1\2\u0794"+ - "\u0793\3\2\2\2\u0794\u0795\3\2\2\2\u0795\u0796\3\2\2\2\u0796\u0797\7S"+ - "\2\2\u0797\u0798\5\u00acW\2\u0798\u0133\3\2\2\2\u0799\u07b0\7\u0089\2"+ - "\2\u079a\u07b0\7\u008a\2\2\u079b\u07b0\7\u0091\2\2\u079c\u07b0\7\u0092"+ - "\2\2\u079d\u07b0\7\u0099\2\2\u079e\u07b0\7\u009a\2\2\u079f\u07b0\7b\2"+ - "\2\u07a0\u07b0\7,\2\2\u07a1\u07b0\7\u008b\2\2\u07a2\u07b0\7\u008c\2\2"+ - "\u07a3\u07b0\7\u008d\2\2\u07a4\u07b0\7\u008e\2\2\u07a5\u07b0\7\u008f\2"+ - "\2\u07a6\u07b0\7\u0090\2\2\u07a7\u07b0\7\u00aa\2\2\u07a8\u07b0\5\u017a"+ - "\u00be\2\u07a9\u07b0\7\u009e\2\2\u07aa\u07b0\7\u009f\2\2\u07ab\u07b0\7"+ - "\u0095\2\2\u07ac\u07b0\7\u0094\2\2\u07ad\u07b0\7\u00a1\2\2\u07ae\u07b0"+ - "\7\u00a0\2\2\u07af\u0799\3\2\2\2\u07af\u079a\3\2\2\2\u07af\u079b\3\2\2"+ - "\2\u07af\u079c\3\2\2\2\u07af\u079d\3\2\2\2\u07af\u079e\3\2\2\2\u07af\u079f"+ - "\3\2\2\2\u07af\u07a0\3\2\2\2\u07af\u07a1\3\2\2\2\u07af\u07a2\3\2\2\2\u07af"+ - "\u07a3\3\2\2\2\u07af\u07a4\3\2\2\2\u07af\u07a5\3\2\2\2\u07af\u07a6\3\2"+ - "\2\2\u07af\u07a7\3\2\2\2\u07af\u07a8\3\2\2\2\u07af\u07a9\3\2\2\2\u07af"+ - "\u07aa\3\2\2\2\u07af\u07ab\3\2\2\2\u07af\u07ac\3\2\2\2\u07af\u07ad\3\2"+ - "\2\2\u07af\u07ae\3\2\2\2\u07b0\u0135\3\2\2\2\u07b1\u07b2\t\r\2\2\u07b2"+ - "\u07b3\7H\2\2\u07b3\u07b4\5\6\4\2\u07b4\u07b5\7\u0083\2\2\u07b5\u07b6"+ - "\5\u01ae\u00d8\2\u07b6\u07b7\7\u0084\2\2\u07b7\u0137\3\2\2\2\u07b8\u07b9"+ - "\7\u0087\2\2\u07b9\u07ba\t\16\2\2\u07ba\u07bc\7\u0083\2\2\u07bb\u07bd"+ - "\5\32\16\2\u07bc\u07bb\3\2\2\2\u07bc\u07bd\3\2\2\2\u07bd\u07be\3\2\2\2"+ - "\u07be\u07bf\7\u0084\2\2\u07bf\u0139\3\2\2\2\u07c0\u07c3\5\u00acW\2\u07c1"+ - "\u07c3\7\u0088\2\2\u07c2\u07c0\3\2\2\2\u07c2\u07c1\3\2\2\2\u07c3\u013b"+ - "\3\2\2\2\u07c4\u07c5\7\u0087\2\2\u07c5\u07c6\5\u00eex\2\u07c6\u013d\3"+ - "\2\2\2\u07c7\u07cb\7\177\2\2\u07c8\u07ca\5\u0140\u00a1\2\u07c9\u07c8\3"+ - "\2\2\2\u07ca\u07cd\3\2\2\2\u07cb\u07c9\3\2\2\2\u07cb\u07cc\3\2\2\2\u07cc"+ - "\u07ce\3\2\2\2\u07cd\u07cb\3\2\2\2\u07ce\u07cf\7\u0080\2\2\u07cf\u013f"+ - "\3\2\2\2\u07d0\u07d2\5\u0160\u00b1\2\u07d1\u07d0\3\2\2\2\u07d1\u07d2\3"+ - "\2\2\2\u07d2\u07d4\3\2\2\2\u07d3\u07d5\5\u0102\u0082\2\u07d4\u07d3\3\2"+ - "\2\2\u07d4\u07d5\3\2\2\2\u07d5\u07e0\3\2\2\2\u07d6\u07e1\5\u0106\u0084"+ - "\2\u07d7\u07d8\7.\2\2\u07d8\u07da\5\6\4\2\u07d9\u07db\5\u0174\u00bb\2"+ - "\u07da\u07d9\3\2\2\2\u07db\u07dc\3\2\2\2\u07dc\u07da\3\2\2\2\u07dc\u07dd"+ - "\3\2\2\2\u07dd\u07de\3\2\2\2\u07de\u07df\7\u0088\2\2\u07df\u07e1\3\2\2"+ - "\2\u07e0\u07d6\3\2\2\2\u07e0\u07d7\3\2\2\2\u07e1\u0141\3\2\2\2\u07e2\u07ea"+ - "\5\b\5\2\u07e3\u07e5\t\17\2\2\u07e4\u07e3\3\2\2\2\u07e5\u07e8\3\2\2\2"+ - "\u07e6\u07e4\3\2\2\2\u07e6\u07e7\3\2\2\2\u07e7\u07e9\3\2\2\2\u07e8\u07e6"+ - "\3\2\2\2\u07e9\u07eb\5\u0144\u00a3\2\u07ea\u07e6\3\2\2\2\u07eb\u07ec\3"+ - "\2\2\2\u07ec\u07ea\3\2\2\2\u07ec\u07ed\3\2\2\2\u07ed\u0143\3\2\2\2\u07ee"+ - "\u07f2\7\u0081\2\2\u07ef\u07f1\7\u0086\2\2\u07f0\u07ef\3\2\2\2\u07f1\u07f4"+ - "\3\2\2\2\u07f2\u07f0\3\2\2\2\u07f2\u07f3\3\2\2\2\u07f3\u07f5\3\2\2\2\u07f4"+ - "\u07f2\3\2\2\2\u07f5\u07f6\7\u0082\2\2\u07f6\u0145\3\2\2\2\u07f7\u0803"+ - "\7\177\2\2\u07f8\u07fd\5\u0112\u008a\2\u07f9\u07fa\7\u0086\2\2\u07fa\u07fc"+ - "\5\u0112\u008a\2\u07fb\u07f9\3\2\2\2\u07fc\u07ff\3\2\2\2\u07fd\u07fb\3"+ - "\2\2\2\u07fd\u07fe\3\2\2\2\u07fe\u0801\3\2\2\2\u07ff\u07fd\3\2\2\2\u0800"+ - "\u0802\7\u0086\2\2\u0801\u0800\3\2\2\2\u0801\u0802\3\2\2\2\u0802\u0804"+ - "\3\2\2\2\u0803\u07f8\3\2\2\2\u0803\u0804\3\2\2\2\u0804\u0805\3\2\2\2\u0805"+ - "\u0806\7\u0080\2\2\u0806\u0147\3\2\2\2\u0807\u0808\7\u0094\2\2\u0808\u080d"+ - "\5\u014a\u00a6\2\u0809\u080a\7\u0086\2\2\u080a\u080c\5\u014a\u00a6\2\u080b"+ - "\u0809\3\2\2\2\u080c\u080f\3\2\2\2\u080d\u080b\3\2\2\2\u080d\u080e\3\2"+ - "\2\2\u080e\u0810\3\2\2\2\u080f\u080d\3\2\2\2\u0810\u0811\7\u0095\2\2\u0811"+ - "\u0149\3\2\2\2\u0812\u0814\5\u0160\u00b1\2\u0813\u0812\3\2\2\2\u0813\u0814"+ - "\3\2\2\2\u0814\u0816\3\2\2\2\u0815\u0817\5\u014c\u00a7\2\u0816\u0815\3"+ - "\2\2\2\u0816\u0817\3\2\2\2\u0817\u0818\3\2\2\2\u0818\u0819\5\u01b4\u00db"+ - "\2\u0819\u014b\3\2\2\2\u081a\u081b\t\20\2\2\u081b\u014d\3\2\2\2\u081c"+ - "\u081d\7\u0087\2\2\u081d\u081e\5\u00eex\2\u081e\u014f\3\2\2\2\u081f\u0823"+ - "\7\177\2\2\u0820\u0822\5\u0152\u00aa\2\u0821\u0820\3\2\2\2\u0822\u0825"+ - "\3\2\2\2\u0823\u0821\3\2\2\2\u0823\u0824\3\2\2\2\u0824\u0826\3\2\2\2\u0825"+ - "\u0823\3\2\2\2\u0826\u0827\7\u0080\2\2\u0827\u0151\3\2\2\2\u0828\u082a"+ - "\5\u0160\u00b1\2\u0829\u0828\3\2\2\2\u0829\u082a\3\2\2\2\u082a\u082c\3"+ - "\2\2\2\u082b\u082d\7D\2\2\u082c\u082b\3\2\2\2\u082c\u082d\3\2\2\2\u082d"+ - "\u086d\3\2\2\2\u082e\u0830\7i\2\2\u082f\u082e\3\2\2\2\u082f\u0830\3\2"+ - "\2\2\u0830\u0836\3\2\2\2\u0831\u0837\7R\2\2\u0832\u0833\7R\2\2\u0833\u0837"+ - "\7Q\2\2\u0834\u0835\7Q\2\2\u0835\u0837\7R\2\2\u0836\u0831\3\2\2\2\u0836"+ - "\u0832\3\2\2\2\u0836\u0834\3\2\2\2\u0836\u0837\3\2\2\2\u0837\u0838\3\2"+ - "\2\2\u0838\u0854\5\6\4\2\u0839\u083b\5\u01b4\u00db\2\u083a\u083c\5\u00e8"+ - "u\2\u083b\u083a\3\2\2\2\u083b\u083c\3\2\2\2\u083c\u083d\3\2\2\2\u083d"+ - "\u083f\7\u0083\2\2\u083e\u0840\5\u011a\u008e\2\u083f\u083e\3\2\2\2\u083f"+ - "\u0840\3\2\2\2\u0840\u0841\3\2\2\2\u0841\u0843\7\u0084\2\2\u0842\u0844"+ - "\5\u00f0y\2\u0843\u0842\3\2\2\2\u0843\u0844\3\2\2\2\u0844\u0845\3\2\2"+ - "\2\u0845\u0846\7\u0088\2\2\u0846\u0855\3\2\2\2\u0847\u0848\5\u01b4\u00db"+ - "\2\u0848\u0849\7\177\2\2\u0849\u084a\5\u0154\u00ab\2\u084a\u084b\7\u0080"+ - "\2\2\u084b\u0855\3\2\2\2\u084c\u084d\7`\2\2\u084d\u084e\7\u0081\2\2\u084e"+ - "\u084f\5\u011a\u008e\2\u084f\u0850\7\u0082\2\2\u0850\u0851\7\177\2\2\u0851"+ - "\u0852\5\u0154\u00ab\2\u0852\u0853\7\u0080\2\2\u0853\u0855\3\2\2\2\u0854"+ - "\u0839\3\2\2\2\u0854\u0847\3\2\2\2\u0854\u084c\3\2\2\2\u0855\u086e\3\2"+ - "\2\2\u0856\u0858\7i\2\2\u0857\u0856\3\2\2\2\u0857\u0858\3\2\2\2\u0858"+ - "\u0859\3\2\2\2\u0859\u085a\7n\2\2\u085a\u085c\5\u01b4\u00db\2\u085b\u085d"+ - "\5\u00e8u\2\u085c\u085b\3\2\2\2\u085c\u085d\3\2\2\2\u085d\u085e\3\2\2"+ - "\2\u085e\u0860\7\u0083\2\2\u085f\u0861\5\u011a\u008e\2\u0860\u085f\3\2"+ - "\2\2\u0860\u0861\3\2\2\2\u0861\u0862\3\2\2\2\u0862\u0864\7\u0084\2\2\u0863"+ - "\u0865\5\u00f0y\2\u0864\u0863\3\2\2\2\u0864\u0865\3\2\2\2\u0865\u0866"+ - "\3\2\2\2\u0866\u0867\7\u0088\2\2\u0867\u086e\3\2\2\2\u0868\u0869\7)\2"+ - "\2\u0869\u086a\5\6\4\2\u086a\u086b\5\u01b4\u00db\2\u086b\u086c\7\u0088"+ - "\2\2\u086c\u086e\3\2\2\2\u086d\u082f\3\2\2\2\u086d\u0857\3\2\2\2\u086d"+ - "\u0868\3\2\2\2\u086e\u0153\3\2\2\2\u086f\u0871\5\u0160\u00b1\2\u0870\u086f"+ - "\3\2\2\2\u0870\u0871\3\2\2\2\u0871\u0884\3\2\2\2\u0872\u0873\7\63\2\2"+ - "\u0873\u0879\7\u0088\2\2\u0874\u0876\5\u0160\u00b1\2\u0875\u0874\3\2\2"+ - "\2\u0875\u0876\3\2\2\2\u0876\u0877\3\2\2\2\u0877\u0878\7X\2\2\u0878\u087a"+ - "\7\u0088\2\2\u0879\u0875\3\2\2\2\u0879\u087a\3\2\2\2\u087a\u0885\3\2\2"+ - "\2\u087b\u087c\7X\2\2\u087c\u0882\7\u0088\2\2\u087d\u087f\5\u0160\u00b1"+ - "\2\u087e\u087d\3\2\2\2\u087e\u087f\3\2\2\2\u087f\u0880\3\2\2\2\u0880\u0881"+ - "\7\63\2\2\u0881\u0883\7\u0088\2\2\u0882\u087e\3\2\2\2\u0882\u0883\3\2"+ - "\2\2\u0883\u0885\3\2\2\2\u0884\u0872\3\2\2\2\u0884\u087b\3\2\2\2\u0885"+ - "\u0155\3\2\2\2\u0886\u0887\7\u0087\2\2\u0887\u0888\5\6\4\2\u0888\u0157"+ - "\3\2\2\2\u0889\u0895\7\177\2\2\u088a\u088f\5\u015a\u00ae\2\u088b\u088c"+ - "\7\u0086\2\2\u088c\u088e\5\u015a\u00ae\2\u088d\u088b\3\2\2\2\u088e\u0891"+ - "\3\2\2\2\u088f\u088d\3\2\2\2\u088f\u0890\3\2\2\2\u0890\u0893\3\2\2\2\u0891"+ - "\u088f\3\2\2\2\u0892\u0894\7\u0086\2\2\u0893\u0892\3\2\2\2\u0893\u0894"+ - "\3\2\2\2\u0894\u0896\3\2\2\2\u0895\u088a\3\2\2\2\u0895\u0896\3\2\2\2\u0896"+ - "\u0897\3\2\2\2\u0897\u0898\7\u0080\2\2\u0898\u0159\3\2\2\2\u0899\u089b"+ - "\5\u0160\u00b1\2\u089a\u0899\3\2\2\2\u089a\u089b\3\2\2\2\u089b\u089c\3"+ - "\2\2\2\u089c\u089f\5\u01b4\u00db\2\u089d\u089e\7\u0093\2\2\u089e\u08a0"+ - "\5\36\20\2\u089f\u089d\3\2\2\2\u089f\u08a0\3\2\2\2\u08a0\u015b\3\2\2\2"+ - "\u08a1\u08a2\7\u0081\2\2\u08a2\u08a3\5\u015e\u00b0\2\u08a3\u08a4\7\u0087"+ - "\2\2\u08a4\u08a6\5\u0166\u00b4\2\u08a5\u08a7\7\u0086\2\2\u08a6\u08a5\3"+ - "\2\2\2\u08a6\u08a7\3\2\2\2\u08a7\u08a8\3\2\2\2\u08a8\u08a9\7\u0082\2\2"+ - "\u08a9\u015d\3\2\2\2\u08aa\u08ad\5\u018e\u00c8\2\u08ab\u08ad\5\u01b4\u00db"+ - "\2\u08ac\u08aa\3\2\2\2\u08ac\u08ab\3\2\2\2\u08ad\u015f\3\2\2\2\u08ae\u08b0"+ - "\5\u0162\u00b2\2\u08af\u08ae\3\2\2\2\u08b0\u08b1\3\2\2\2\u08b1\u08af\3"+ - "\2\2\2\u08b1\u08b2\3\2\2\2\u08b2\u0161\3\2\2\2\u08b3\u08b7\7\u0081\2\2"+ - "\u08b4\u08b5\5\u0164\u00b3\2\u08b5\u08b6\7\u0087\2\2\u08b6\u08b8\3\2\2"+ - "\2\u08b7\u08b4\3\2\2\2\u08b7\u08b8\3\2\2\2\u08b8\u08b9\3\2\2\2\u08b9\u08bb"+ - "\5\u0166\u00b4\2\u08ba\u08bc\7\u0086\2\2\u08bb\u08ba\3\2\2\2\u08bb\u08bc"+ - "\3\2\2\2\u08bc\u08bd\3\2\2\2\u08bd\u08be\7\u0082\2\2\u08be\u0163\3\2\2"+ - "\2\u08bf\u08c2\5\u018e\u00c8\2\u08c0\u08c2\5\u01b4\u00db\2\u08c1\u08bf"+ - "\3\2\2\2\u08c1\u08c0\3\2\2\2\u08c2\u0165\3\2\2\2\u08c3\u08c8\5\u0168\u00b5"+ - "\2\u08c4\u08c5\7\u0086\2\2\u08c5\u08c7\5\u0168\u00b5\2\u08c6\u08c4\3\2"+ - "\2\2\u08c7\u08ca\3\2\2\2\u08c8\u08c6\3\2\2\2\u08c8\u08c9\3\2\2\2\u08c9"+ - "\u0167\3\2\2\2\u08ca\u08c8\3\2\2\2\u08cb\u08d8\5\4\3\2\u08cc\u08d5\7\u0083"+ - "\2\2\u08cd\u08d2\5\u016a\u00b6\2\u08ce\u08cf\7\u0086\2\2\u08cf\u08d1\5"+ - "\u016a\u00b6\2\u08d0\u08ce\3\2\2\2\u08d1\u08d4\3\2\2\2\u08d2\u08d0\3\2"+ - "\2\2\u08d2\u08d3\3\2\2\2\u08d3\u08d6\3\2\2\2\u08d4\u08d2\3\2\2\2\u08d5"+ - "\u08cd\3\2\2\2\u08d5\u08d6\3\2\2\2\u08d6\u08d7\3\2\2\2\u08d7\u08d9\7\u0084"+ - "\2\2\u08d8\u08cc\3\2\2\2\u08d8\u08d9\3\2\2\2\u08d9\u0169\3\2\2\2\u08da"+ - "\u08db\5\u01b4\u00db\2\u08db\u08dc\7\u0087\2\2\u08dc\u08de\3\2\2\2\u08dd"+ - "\u08da\3\2\2\2\u08dd\u08de\3\2\2\2\u08de\u08df\3\2\2\2\u08df\u08e0\5\36"+ - "\20\2\u08e0\u016b\3\2\2\2\u08e1\u08e4\5\16\b\2\u08e2\u08e4\5\26\f\2\u08e3"+ - "\u08e1\3\2\2\2\u08e3\u08e2\3\2\2\2\u08e4\u08e9\3\2\2\2\u08e5\u08e8\5\u0144"+ - "\u00a3\2\u08e6\u08e8\7\u0096\2\2\u08e7\u08e5\3\2\2\2\u08e7\u08e6\3\2\2"+ - "\2\u08e8\u08eb\3\2\2\2\u08e9\u08e7\3\2\2\2\u08e9\u08ea\3\2\2\2\u08ea\u08ec"+ - "\3\2\2\2\u08eb\u08e9\3\2\2\2\u08ec\u08ed\7\u008b\2\2\u08ed\u08f1\3\2\2"+ - "\2\u08ee\u08ef\7n\2\2\u08ef\u08f1\7\u008b\2\2\u08f0\u08e3\3\2\2\2\u08f0"+ - "\u08ee\3\2\2\2\u08f1\u016d\3\2\2\2\u08f2\u08f7\5\u0170\u00b9\2\u08f3\u08f4"+ - "\7\u0086\2\2\u08f4\u08f6\5\u0170\u00b9\2\u08f5\u08f3\3\2\2\2\u08f6\u08f9"+ - "\3\2\2\2\u08f7\u08f5\3\2\2\2\u08f7\u08f8\3\2\2\2\u08f8\u016f\3\2\2\2\u08f9"+ - "\u08f7\3\2\2\2\u08fa\u08fb\5\u01b4\u00db\2\u08fb\u08fc\7\u0093\2\2\u08fc"+ - "\u08fd\5\u0172\u00ba\2\u08fd\u0171\3\2\2\2\u08fe\u0900\7\u008e\2\2\u08ff"+ - "\u08fe\3\2\2\2\u08ff\u0900\3\2\2\2\u0900\u0901\3\2\2\2\u0901\u0904\5\36"+ - "\20\2\u0902\u0904\5\u0176\u00bc\2\u0903\u08ff\3\2\2\2\u0903\u0902\3\2"+ - "\2\2\u0904\u0173\3\2\2\2\u0905\u0906\5\u01b4\u00db\2\u0906\u0907\7\u0081"+ - "\2\2\u0907\u0908\5\36\20\2\u0908\u0909\7\u0082\2\2\u0909\u0175\3\2\2\2"+ - "\u090a\u090b\7[\2\2\u090b\u090c\5\6\4\2\u090c\u090d\7\u0081\2\2\u090d"+ - "\u090e\5\36\20\2\u090e\u090f\7\u0082\2\2\u090f\u0928\3\2\2\2\u0910\u0912"+ - "\7[\2\2\u0911\u0913\5\6\4\2\u0912\u0911\3\2\2\2\u0912\u0913\3\2\2\2\u0913"+ - "\u0914\3\2\2\2\u0914\u0916\7\u0081\2\2\u0915\u0917\5\36\20\2\u0916\u0915"+ - "\3\2\2\2\u0916\u0917\3\2\2\2\u0917\u0918\3\2\2\2\u0918\u0919\7\u0082\2"+ - "\2\u0919\u091a\7\177\2\2\u091a\u091f\5\36\20\2\u091b\u091c\7\u0086\2\2"+ - "\u091c\u091e\5\36\20\2\u091d\u091b\3\2\2\2\u091e\u0921\3\2\2\2\u091f\u091d"+ - "\3\2\2\2\u091f\u0920\3\2\2\2\u0920\u0923\3\2\2\2\u0921\u091f\3\2\2\2\u0922"+ - "\u0924\7\u0086\2\2\u0923\u0922\3\2\2\2\u0923\u0924\3\2\2\2\u0924\u0925"+ - "\3\2\2\2\u0925\u0926\7\u0080\2\2\u0926\u0928\3\2\2\2\u0927\u090a\3\2\2"+ - "\2\u0927\u0910\3\2\2\2\u0928\u0177\3\2\2\2\u0929\u092a\7\u0093\2\2\u092a"+ - "\u092b\7\u0095\2\2\u092b\u092c\6\u00bd\2\3\u092c\u0179\3\2\2\2\u092d\u092e"+ - "\7\u0095\2\2\u092e\u092f\7\u0095\2\2\u092f\u0930\6\u00be\3\3\u0930\u017b"+ - "\3\2\2\2\u0931\u0932\7\u0095\2\2\u0932\u0933\7\u00a1\2\2\u0933\u0934\6"+ - "\u00bf\4\3\u0934\u017d\3\2\2\2\u0935\u093e\5\u0180\u00c1\2\u0936\u093e"+ - "\5\u0182\u00c2\2\u0937\u093e\7v\2\2\u0938\u093e\7w\2\2\u0939\u093e\7x"+ - "\2\2\u093a\u093e\7y\2\2\u093b\u093e\7z\2\2\u093c\u093e\7E\2\2\u093d\u0935"+ - "\3\2\2\2\u093d\u0936\3\2\2\2\u093d\u0937\3\2\2\2\u093d\u0938\3\2\2\2\u093d"+ - "\u0939\3\2\2\2\u093d\u093a\3\2\2\2\u093d\u093b\3\2\2\2\u093d\u093c\3\2"+ - "\2\2\u093e\u017f\3\2\2\2\u093f\u0940\t\21\2\2\u0940\u0181\3\2\2\2\u0941"+ - "\u0946\5\u0184\u00c3\2\u0942\u0946\5\u0186\u00c4\2\u0943\u0946\7{\2\2"+ - "\u0944\u0946\7|\2\2\u0945\u0941\3\2\2\2\u0945\u0942\3\2\2\2\u0945\u0943"+ - "\3\2\2\2\u0945\u0944\3\2\2\2\u0946\u0183\3\2\2\2\u0947\u094b\7}\2\2\u0948"+ - "\u094a\5\u0188\u00c5\2\u0949\u0948\3\2\2\2\u094a\u094d\3\2\2\2\u094b\u0949"+ - "\3\2\2\2\u094b\u094c\3\2\2\2\u094c\u094e\3\2\2\2\u094d\u094b\3\2\2\2\u094e"+ - "\u094f\7\u00b2\2\2\u094f\u0185\3\2\2\2\u0950\u0954\7~\2\2\u0951\u0953"+ - "\5\u018a\u00c6\2\u0952\u0951\3\2\2\2\u0953\u0956\3\2\2\2\u0954\u0952\3"+ - "\2\2\2\u0954\u0955\3\2\2\2\u0955\u0957\3\2\2\2\u0956\u0954\3\2\2\2"; - private static final String _serializedATNSegment1 = - "\u0957\u0958\7\u00b2\2\2\u0958\u0187\3\2\2\2\u0959\u095e\5\u018c\u00c7"+ - "\2\u095a\u095e\7\u00ae\2\2\u095b\u095e\7\u00b0\2\2\u095c\u095e\7\u00b3"+ - "\2\2\u095d\u0959\3\2\2\2\u095d\u095a\3\2\2\2\u095d\u095b\3\2\2\2\u095d"+ - "\u095c\3\2\2\2\u095e\u0189\3\2\2\2\u095f\u0964\5\u018c\u00c7\2\u0960\u0964"+ - "\7\u00ae\2\2\u0961\u0964\7\u00b1\2\2\u0962\u0964\7\u00b4\2\2\u0963\u095f"+ - "\3\2\2\2\u0963\u0960\3\2\2\2\u0963\u0961\3\2\2\2\u0963\u0962\3\2\2\2\u0964"+ - "\u018b\3\2\2\2\u0965\u096a\5\36\20\2\u0966\u0967\7\u0086\2\2\u0967\u0969"+ - "\5\36\20\2\u0968\u0966\3\2\2\2\u0969\u096c\3\2\2\2\u096a\u0968\3\2\2\2"+ - "\u096a\u096b\3\2\2\2\u096b\u0973\3\2\2\2\u096c\u096a\3\2\2\2\u096d\u096f"+ - "\7\u0087\2\2\u096e\u0970\7\u00b6\2\2\u096f\u096e\3\2\2\2\u0970\u0971\3"+ - "\2\2\2\u0971\u096f\3\2\2\2\u0971\u0972\3\2\2\2\u0972\u0974\3\2\2\2\u0973"+ - "\u096d\3\2\2\2\u0973\u0974\3\2\2\2\u0974\u018d\3\2\2\2\u0975\u0976\t\22"+ - "\2\2\u0976\u018f\3\2\2\2\u0977\u0978\7\34\2\2\u0978\u097a\5\u01b4\u00db"+ - "\2\u0979\u097b\5\u00e8u\2\u097a\u0979\3\2\2\2\u097a\u097b\3\2\2\2\u097b"+ - "\u097d\3\2\2\2\u097c\u097e\5\u00ecw\2\u097d\u097c\3\2\2\2\u097d\u097e"+ - "\3\2\2\2\u097e\u0980\3\2\2\2\u097f\u0981\5\u00f0y\2\u0980\u097f\3\2\2"+ - "\2\u0980\u0981\3\2\2\2\u0981\u0982\3\2\2\2\u0982\u0984\5\u00fc\177\2\u0983"+ - "\u0985\7\u0088\2\2\u0984\u0983\3\2\2\2\u0984\u0985\3\2\2\2\u0985\u0191"+ - "\3\2\2\2\u0986\u0988\t\23\2\2\u0987\u0986\3\2\2\2\u0987\u0988\3\2\2\2"+ - "\u0988\u0989\3\2\2\2\u0989\u098a\7^\2\2\u098a\u098c\5\u01b4\u00db\2\u098b"+ - "\u098d\5\u00e8u\2\u098c\u098b\3\2\2\2\u098c\u098d\3\2\2\2\u098d\u098f"+ - "\3\2\2\2\u098e\u0990\5\u013c\u009f\2\u098f\u098e\3\2\2\2\u098f\u0990\3"+ - "\2\2\2\u0990\u0992\3\2\2\2\u0991\u0993\5\u00f0y\2\u0992\u0991\3\2\2\2"+ - "\u0992\u0993\3\2\2\2\u0993\u0994\3\2\2\2\u0994\u0996\5\u013e\u00a0\2\u0995"+ - "\u0997\7\u0088\2\2\u0996\u0995\3\2\2\2\u0996\u0997\3\2\2\2\u0997\u0193"+ - "\3\2\2\2\u0998\u0999\7:\2\2\u0999\u099b\5\u01b4\u00db\2\u099a\u099c\5"+ - "\u0148\u00a5\2\u099b\u099a\3\2\2\2\u099b\u099c\3\2\2\2\u099c\u099e\3\2"+ - "\2\2\u099d\u099f\5\u014e\u00a8\2\u099e\u099d\3\2\2\2\u099e\u099f\3\2\2"+ - "\2\u099f\u09a1\3\2\2\2\u09a0\u09a2\5\u00f0y\2\u09a1\u09a0\3\2\2\2\u09a1"+ - "\u09a2\3\2\2\2\u09a2\u09a3\3\2\2\2\u09a3\u09a5\5\u00fc\177\2\u09a4\u09a6"+ - "\7\u0088\2\2\u09a5\u09a4\3\2\2\2\u09a5\u09a6\3\2\2\2\u09a6\u0195\3\2\2"+ - "\2\u09a7\u09a8\7\'\2\2\u09a8\u09aa\5\u01b4\u00db\2\u09a9\u09ab\5\u0156"+ - "\u00ac\2\u09aa\u09a9\3\2\2\2\u09aa\u09ab\3\2\2\2\u09ab\u09ac\3\2\2\2\u09ac"+ - "\u09ae\5\u0158\u00ad\2\u09ad\u09af\7\u0088\2\2\u09ae\u09ad\3\2\2\2\u09ae"+ - "\u09af\3\2\2\2\u09af\u0197\3\2\2\2\u09b0\u09b1\7!\2\2\u09b1\u09b2\5\u0114"+ - "\u008b\2\u09b2\u09b4\5\u01b4\u00db\2\u09b3\u09b5\5\u0148\u00a5\2\u09b4"+ - "\u09b3\3\2\2\2\u09b4\u09b5\3\2\2\2\u09b5\u09b6\3\2\2\2\u09b6\u09b8\7\u0083"+ - "\2\2\u09b7\u09b9\5\u011a\u008e\2\u09b8\u09b7\3\2\2\2\u09b8\u09b9\3\2\2"+ - "\2\u09b9\u09ba\3\2\2\2\u09ba\u09bc\7\u0084\2\2\u09bb\u09bd\5\u00f0y\2"+ - "\u09bc\u09bb\3\2\2\2\u09bc\u09bd\3\2\2\2\u09bd\u09be\3\2\2\2\u09be\u09bf"+ - "\7\u0088\2\2\u09bf\u0199\3\2\2\2\u09c0\u09c1\7)\2\2\u09c1\u09ca\5\6\4"+ - "\2\u09c2\u09c3\5\u010e\u0088\2\u09c3\u09c4\7\u0088\2\2\u09c4\u09cb\3\2"+ - "\2\2\u09c5\u09c6\5\u0116\u008c\2\u09c6\u09c7\7\177\2\2\u09c7\u09c8\5\u012e"+ - "\u0098\2\u09c8\u09c9\7\u0080\2\2\u09c9\u09cb\3\2\2\2\u09ca\u09c2\3\2\2"+ - "\2\u09ca\u09c5\3\2\2\2\u09cb\u019b\3\2\2\2\u09cc\u09cd\5\u010e\u0088\2"+ - "\u09cd\u09ce\7\u0088\2\2\u09ce\u019d\3\2\2\2\u09cf\u09dd\5\u0116\u008c"+ - "\2\u09d0\u09d1\7\177\2\2\u09d1\u09d2\5\u0124\u0093\2\u09d2\u09d7\7\u0080"+ - "\2\2\u09d3\u09d4\7\u0093\2\2\u09d4\u09d5\5\u0112\u008a\2\u09d5\u09d6\7"+ - "\u0088\2\2\u09d6\u09d8\3\2\2\2\u09d7\u09d3\3\2\2\2\u09d7\u09d8\3\2\2\2"+ - "\u09d8\u09de\3\2\2\2\u09d9\u09da\5\u0178\u00bd\2\u09da\u09db\5L\'\2\u09db"+ - "\u09dc\7\u0088\2\2\u09dc\u09de\3\2\2\2\u09dd\u09d0\3\2\2\2\u09dd\u09d9"+ - "\3\2\2\2\u09de\u019f\3\2\2\2\u09df\u09e0\7\35\2\2\u09e0\u09e1\5\6\4\2"+ - "\u09e1\u09e2\5\u010a\u0086\2\u09e2\u09e3\7\u0088\2\2\u09e3\u01a1\3\2\2"+ - "\2\u09e4\u09e5\7`\2\2\u09e5\u09e6\7\u0081\2\2\u09e6\u09e7\5\u011a\u008e"+ - "\2\u09e7\u09f0\7\u0082\2\2\u09e8\u09e9\7\177\2\2\u09e9\u09ea\5\u0124\u0093"+ - "\2\u09ea\u09eb\7\u0080\2\2\u09eb\u09f1\3\2\2\2\u09ec\u09ed\5\u0178\u00bd"+ - "\2\u09ed\u09ee\5L\'\2\u09ee\u09ef\7\u0088\2\2\u09ef\u09f1\3\2\2\2\u09f0"+ - "\u09e8\3\2\2\2\u09f0\u09ec\3\2\2\2\u09f1\u01a3\3\2\2\2\u09f2\u09f3\7\u0092"+ - "\2\2\u09f3\u09f4\5\u01b4\u00db\2\u09f4\u09f5\7\u0083\2\2\u09f5\u09f6\7"+ - "\u0084\2\2\u09f6\u09f7\5\u013a\u009e\2\u09f7\u01a5\3\2\2\2\u09f8\u09f9"+ - "\5\u01b4\u00db\2\u09f9\u09fb\7\u0083\2\2\u09fa\u09fc\5\u011a\u008e\2\u09fb"+ - "\u09fa\3\2\2\2\u09fb\u09fc\3\2\2\2\u09fc\u09fd\3\2\2\2\u09fd\u09ff\7\u0084"+ - "\2\2\u09fe\u0a00\5\u0138\u009d\2\u09ff\u09fe\3\2\2\2\u09ff\u0a00\3\2\2"+ - "\2\u0a00\u0a01\3\2\2\2\u0a01\u0a02\5\u013a\u009e\2\u0a02\u01a7\3\2\2\2"+ - "\u0a03\u0a05\5\u01aa\u00d6\2\u0a04\u0a06\5\u00e8u\2\u0a05\u0a04\3\2\2"+ - "\2\u0a05\u0a06\3\2\2\2\u0a06\u0a07\3\2\2\2\u0a07\u0a09\7\u0083\2\2\u0a08"+ - "\u0a0a\5\u011a\u008e\2\u0a09\u0a08\3\2\2\2\u0a09\u0a0a\3\2\2\2\u0a0a\u0a0b"+ - "\3\2\2\2\u0a0b\u0a0d\7\u0084\2\2\u0a0c\u0a0e\5\u00f0y\2\u0a0d\u0a0c\3"+ - "\2\2\2\u0a0d\u0a0e\3\2\2\2\u0a0e\u0a14\3\2\2\2\u0a0f\u0a15\5\u0118\u008d"+ - "\2\u0a10\u0a11\5\u0178\u00bd\2\u0a11\u0a12\5L\'\2\u0a12\u0a13\7\u0088"+ - "\2\2\u0a13\u0a15\3\2\2\2\u0a14\u0a0f\3\2\2\2\u0a14\u0a10\3\2\2\2\u0a15"+ - "\u01a9\3\2\2\2\u0a16\u0a1c\5\u01b4\u00db\2\u0a17\u0a18\5\u01b4\u00db\2"+ - "\u0a18\u0a19\7\u0097\2\2\u0a19\u0a1a\5\u01b4\u00db\2\u0a1a\u0a1c\3\2\2"+ - "\2\u0a1b\u0a16\3\2\2\2\u0a1b\u0a17\3\2\2\2\u0a1c\u0a24\3\2\2\2\u0a1d\u0a1f"+ - "\5\30\r\2\u0a1e\u0a1d\3\2\2\2\u0a1e\u0a1f\3\2\2\2\u0a1f\u0a20\3\2\2\2"+ - "\u0a20\u0a21\7\u0085\2\2\u0a21\u0a23\5\u01b4\u00db\2\u0a22\u0a1e\3\2\2"+ - "\2\u0a23\u0a26\3\2\2\2\u0a24\u0a22\3\2\2\2\u0a24\u0a25\3\2\2\2\u0a25\u01ab"+ - "\3\2\2\2\u0a26\u0a24\3\2\2\2\u0a27\u0a28\7H\2\2\u0a28\u0a29\5\u0134\u009b"+ - "\2\u0a29\u0a2b\7\u0083\2\2\u0a2a\u0a2c\78\2\2\u0a2b\u0a2a\3\2\2\2\u0a2b"+ - "\u0a2c\3\2\2\2\u0a2c\u0a2d\3\2\2\2\u0a2d\u0a33\5\u01ae\u00d8\2\u0a2e\u0a30"+ - "\7\u0086\2\2\u0a2f\u0a31\78\2\2\u0a30\u0a2f\3\2\2\2\u0a30\u0a31\3\2\2"+ - "\2\u0a31\u0a32\3\2\2\2\u0a32\u0a34\5\u01ae\u00d8\2\u0a33\u0a2e\3\2\2\2"+ - "\u0a33\u0a34\3\2\2\2\u0a34\u0a35\3\2\2\2\u0a35\u0a3b\7\u0084\2\2\u0a36"+ - "\u0a3c\5\u013a\u009e\2\u0a37\u0a38\5\u0178\u00bd\2\u0a38\u0a39\5L\'\2"+ - "\u0a39\u0a3a\7\u0088\2\2\u0a3a\u0a3c\3\2\2\2\u0a3b\u0a36\3\2\2\2\u0a3b"+ - "\u0a37\3\2\2\2\u0a3c\u01ad\3\2\2\2\u0a3d\u0a3e\5\6\4\2\u0a3e\u0a41\5\u01b4"+ - "\u00db\2\u0a3f\u0a40\7\u0093\2\2\u0a40\u0a42\5\36\20\2\u0a41\u0a3f\3\2"+ - "\2\2\u0a41\u0a42\3\2\2\2\u0a42\u01af\3\2\2\2\u0a43\u0a45\7\u0083\2\2\u0a44"+ - "\u0a46\5\32\16\2\u0a45\u0a44\3\2\2\2\u0a45\u0a46\3\2\2\2\u0a46\u0a47\3"+ - "\2\2\2\u0a47\u0a48\7\u0084\2\2\u0a48\u01b1\3\2\2\2\u0a49\u0a4b\7\u0083"+ - "\2\2\u0a4a\u0a4c\5\32\16\2\u0a4b\u0a4a\3\2\2\2\u0a4b\u0a4c\3\2\2\2\u0a4c"+ - "\u0a4d\3\2\2\2\u0a4d\u0a4f\7\u0084\2\2\u0a4e\u0a50\5Z.\2\u0a4f\u0a4e\3"+ - "\2\2\2\u0a4f\u0a50\3\2\2\2\u0a50\u01b3\3\2\2\2\u0a51\u0a52\t\24\2\2\u0a52"+ - "\u01b5\3\2\2\2\u015a\u01b7\u01ba\u01bd\u01c2\u01c6\u01cc\u01cf\u01d4\u01d8"+ - "\u01df\u01e1\u01e9\u01f1\u01f7\u01fb\u0200\u020a\u0212\u021c\u0222\u0225"+ - "\u0229\u0231\u0236\u0240\u024d\u0255\u025b\u025d\u0264\u026c\u0274\u027c"+ - "\u0284\u028c\u0296\u0298\u029e\u02a3\u02ab\u02b3\u02bb\u02bd\u02c0\u02c7"+ - "\u02cc\u02d3\u02d7\u02d9\u02f5\u02f9\u02fe\u0302\u030a\u030d\u0312\u0316"+ - "\u031a\u0320\u032e\u0334\u0340\u0344\u0349\u034d\u0353\u035b\u0364\u0376"+ - "\u0379\u037e\u0381\u0390\u0396\u039a\u03a0\u03a5\u03a8\u03b0\u03b8\u03c3"+ - "\u03c8\u03cd\u03cf\u03d8\u03e0\u03e7\u03ef\u03f3\u03fc\u0401\u0403\u040c"+ - "\u0414\u0418\u041d\u041f\u0424\u0428\u042f\u0437\u0439\u043d\u0440\u0443"+ - "\u044b\u0455\u0466\u046d\u0471\u047b\u0480\u0487\u0490\u0495\u049c\u04a8"+ - "\u04b3\u04bb\u04c0\u04c9\u04d2\u04db\u04e1\u04e6\u04ea\u04ee\u04f2\u04f6"+ - "\u04fd\u0505\u0512\u051c\u0532\u0536\u053a\u053f\u0553\u0558\u055d\u0564"+ - "\u0567\u057d\u0589\u058d\u0595\u059d\u05a4\u05a8\u05ad\u05b0\u05b5\u05bd"+ - "\u05c2\u05c9\u05cf\u05d7\u05df\u05e2\u05e9\u05f0\u05f4\u05f7\u05fd\u0601"+ - "\u0607\u0615\u061b\u0622\u0627\u062a\u062d\u0634\u063e\u064f\u0654\u0658"+ - "\u065b\u065e\u0665\u066b\u0673\u0679\u0683\u068b\u0691\u069c\u06a0\u06a2"+ - "\u06a7\u06ab\u06b2\u06bb\u06c2\u06c5\u06c8\u06cc\u06d1\u06de\u06e8\u06ef"+ - "\u06fb\u0702\u070e\u0714\u0718\u071c\u0722\u0728\u072a\u0731\u0735\u0738"+ - "\u073c\u0746\u0749\u0750\u0753\u0758\u075d\u075f\u0762\u0765\u076b\u076e"+ - "\u077a\u077e\u0781\u078b\u078e\u0794\u07af\u07bc\u07c2\u07cb\u07d1\u07d4"+ - "\u07dc\u07e0\u07e6\u07ec\u07f2\u07fd\u0801\u0803\u080d\u0813\u0816\u0823"+ - "\u0829\u082c\u082f\u0836\u083b\u083f\u0843\u0854\u0857\u085c\u0860\u0864"+ - "\u086d\u0870\u0875\u0879\u087e\u0882\u0884\u088f\u0893\u0895\u089a\u089f"+ - "\u08a6\u08ac\u08b1\u08b7\u08bb\u08c1\u08c8\u08d2\u08d5\u08d8\u08dd\u08e3"+ - "\u08e7\u08e9\u08f0\u08f7\u08ff\u0903\u0912\u0916\u091f\u0923\u0927\u093d"+ - "\u0945\u094b\u0954\u095d\u0963\u096a\u0971\u0973\u097a\u097d\u0980\u0984"+ - "\u0987\u098c\u098f\u0992\u0996\u099b\u099e\u09a1\u09a5\u09aa\u09ae\u09b4"+ - "\u09b8\u09bc\u09ca\u09d7\u09dd\u09f0\u09fb\u09ff\u0a05\u0a09\u0a0d\u0a14"+ - "\u0a1b\u0a1e\u0a24\u0a2b\u0a30\u0a33\u0a3b\u0a41\u0a45\u0a4b\u0a4f"; - public static final String _serializedATN = Utils.join( - new String[] { - _serializedATNSegment0, - _serializedATNSegment1 - }, - "" - ); - public static final ATN _ATN = - new ATNDeserializer().deserialize(_serializedATN.toCharArray()); - static { - _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; - for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { - _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); - } - } + static { + RuntimeMetaData.checkVersion("4.9.2", RuntimeMetaData.VERSION); + } + + protected static final DFA[] _decisionToDFA; + protected static final PredictionContextCache _sharedContextCache = + new PredictionContextCache(); + public static final int BYTE_ORDER_MARK = 1, SINGLE_LINE_DOC_COMMENT = + 2, EMPTY_DELIMITED_DOC_COMMENT = 3, DELIMITED_DOC_COMMENT = + 4, SINGLE_LINE_COMMENT = 5, DELIMITED_COMMENT = 6, WHITESPACES = 7, SHARP = + 8, ABSTRACT = 9, ADD = 10, ALIAS = 11, ARGLIST = 12, AS = 13, ASCENDING = + 14, ASYNC = 15, AWAIT = 16, BASE = 17, BOOL = 18, BREAK = 19, BY = + 20, BYTE = 21, CASE = 22, CATCH = 23, CHAR = 24, CHECKED = 25, CLASS = + 26, CONST = 27, CONTINUE = 28, DECIMAL = 29, DEFAULT = 30, DELEGATE = + 31, DESCENDING = 32, DO = 33, DOUBLE = 34, DYNAMIC = 35, ELSE = 36, ENUM = + 37, EQUALS = 38, EVENT = 39, EXPLICIT = 40, EXTERN = 41, FALSE = + 42, FINALLY = 43, FIXED = 44, FLOAT = 45, FOR = 46, FOREACH = 47, FROM = + 48, GET = 49, GOTO = 50, GROUP = 51, IF = 52, IMPLICIT = 53, IN = 54, INT = + 55, INTERFACE = 56, INTERNAL = 57, INTO = 58, IS = 59, JOIN = 60, LET = + 61, LOCK = 62, LONG = 63, NAMEOF = 64, NAMESPACE = 65, NEW = 66, NULL_ = + 67, OBJECT = 68, ON = 69, OPERATOR = 70, ORDERBY = 71, OUT = 72, OVERRIDE = + 73, PARAMS = 74, PARTIAL = 75, PRIVATE = 76, PROTECTED = 77, PUBLIC = + 78, READONLY = 79, REF = 80, REMOVE = 81, RETURN = 82, SBYTE = 83, SEALED = + 84, SELECT = 85, SET = 86, SHORT = 87, SIZEOF = 88, STACKALLOC = + 89, STATIC = 90, STRING = 91, STRUCT = 92, SWITCH = 93, THIS = 94, THROW = + 95, TRUE = 96, TRY = 97, TYPEOF = 98, UINT = 99, ULONG = 100, UNCHECKED = + 101, UNMANAGED = 102, UNSAFE = 103, USHORT = 104, USING = 105, VAR = + 106, VIRTUAL = 107, VOID = 108, VOLATILE = 109, WHEN = 110, WHERE = + 111, WHILE = 112, YIELD = 113, IDENTIFIER = 114, LITERAL_ACCESS = + 115, INTEGER_LITERAL = 116, HEX_INTEGER_LITERAL = 117, BIN_INTEGER_LITERAL = + 118, REAL_LITERAL = 119, CHARACTER_LITERAL = 120, REGULAR_STRING = + 121, VERBATIUM_STRING = 122, INTERPOLATED_REGULAR_STRING_START = + 123, INTERPOLATED_VERBATIUM_STRING_START = 124, OPEN_BRACE = + 125, CLOSE_BRACE = 126, OPEN_BRACKET = 127, CLOSE_BRACKET = + 128, OPEN_PARENS = 129, CLOSE_PARENS = 130, DOT = 131, COMMA = 132, COLON = + 133, SEMICOLON = 134, PLUS = 135, MINUS = 136, STAR = 137, DIV = + 138, PERCENT = 139, AMP = 140, BITWISE_OR = 141, CARET = 142, BANG = + 143, TILDE = 144, ASSIGNMENT = 145, LT = 146, GT = 147, INTERR = + 148, DOUBLE_COLON = 149, OP_COALESCING = 150, OP_INC = 151, OP_DEC = + 152, OP_AND = 153, OP_OR = 154, OP_PTR = 155, OP_EQ = 156, OP_NE = + 157, OP_LE = 158, OP_GE = 159, OP_ADD_ASSIGNMENT = 160, OP_SUB_ASSIGNMENT = + 161, OP_MULT_ASSIGNMENT = 162, OP_DIV_ASSIGNMENT = 163, OP_MOD_ASSIGNMENT = + 164, OP_AND_ASSIGNMENT = 165, OP_OR_ASSIGNMENT = 166, OP_XOR_ASSIGNMENT = + 167, OP_LEFT_SHIFT = 168, OP_LEFT_SHIFT_ASSIGNMENT = + 169, OP_COALESCING_ASSIGNMENT = 170, OP_RANGE = 171, DOUBLE_CURLY_INSIDE = + 172, OPEN_BRACE_INSIDE = 173, REGULAR_CHAR_INSIDE = + 174, VERBATIUM_DOUBLE_QUOTE_INSIDE = 175, DOUBLE_QUOTE_INSIDE = + 176, REGULAR_STRING_INSIDE = 177, VERBATIUM_INSIDE_STRING = + 178, CLOSE_BRACE_INSIDE = 179, FORMAT_STRING = 180, DIRECTIVE_WHITESPACES = + 181, DIGITS = 182, DEFINE = 183, UNDEF = 184, ELIF = 185, ENDIF = + 186, LINE = 187, ERROR = 188, WARNING = 189, REGION = 190, ENDREGION = + 191, PRAGMA = 192, NULLABLE = 193, DIRECTIVE_HIDDEN = + 194, CONDITIONAL_SYMBOL = 195, DIRECTIVE_NEW_LINE = 196, TEXT = + 197, DOUBLE_CURLY_CLOSE_INSIDE = 198; + public static final int RULE_compilation_unit = + 0, RULE_namespace_or_type_name = 1, RULE_type_ = 2, RULE_base_type = + 3, RULE_tuple_type = 4, RULE_tuple_element = 5, RULE_simple_type = + 6, RULE_numeric_type = 7, RULE_integral_type = 8, RULE_floating_point_type = + 9, RULE_class_type = 10, RULE_type_argument_list = 11, RULE_argument_list = + 12, RULE_argument = 13, RULE_expression = + 14, RULE_non_assignment_expression = 15, RULE_assignment = + 16, RULE_assignment_operator = 17, RULE_conditional_expression = + 18, RULE_null_coalescing_expression = 19, RULE_conditional_or_expression = + 20, RULE_conditional_and_expression = 21, RULE_inclusive_or_expression = + 22, RULE_exclusive_or_expression = 23, RULE_and_expression = + 24, RULE_equality_expression = 25, RULE_relational_expression = + 26, RULE_shift_expression = 27, RULE_additive_expression = + 28, RULE_multiplicative_expression = 29, RULE_switch_expression = + 30, RULE_switch_expression_arms = 31, RULE_switch_expression_arm = + 32, RULE_range_expression = 33, RULE_unary_expression = + 34, RULE_primary_expression = 35, RULE_primary_expression_start = + 36, RULE_throwable_expression = 37, RULE_throw_expression = + 38, RULE_member_access = 39, RULE_bracket_expression = + 40, RULE_indexer_argument = 41, RULE_predefined_type = + 42, RULE_expression_list = 43, RULE_object_or_collection_initializer = + 44, RULE_object_initializer = 45, RULE_member_initializer_list = + 46, RULE_member_initializer = 47, RULE_initializer_value = + 48, RULE_collection_initializer = 49, RULE_element_initializer = + 50, RULE_anonymous_object_initializer = 51, RULE_member_declarator_list = + 52, RULE_member_declarator = 53, RULE_unbound_type_name = + 54, RULE_generic_dimension_specifier = 55, RULE_isType = + 56, RULE_isTypePatternArms = 57, RULE_isTypePatternArm = + 58, RULE_lambda_expression = 59, RULE_anonymous_function_signature = + 60, RULE_explicit_anonymous_function_parameter_list = + 61, RULE_explicit_anonymous_function_parameter = + 62, RULE_implicit_anonymous_function_parameter_list = + 63, RULE_anonymous_function_body = 64, RULE_query_expression = + 65, RULE_from_clause = 66, RULE_query_body = 67, RULE_query_body_clause = + 68, RULE_let_clause = 69, RULE_where_clause = + 70, RULE_combined_join_clause = 71, RULE_orderby_clause = + 72, RULE_ordering = 73, RULE_select_or_group_clause = + 74, RULE_query_continuation = 75, RULE_statement = + 76, RULE_declarationStatement = 77, RULE_local_function_declaration = + 78, RULE_local_function_header = 79, RULE_local_function_modifiers = + 80, RULE_local_function_body = 81, RULE_labeled_Statement = + 82, RULE_embedded_statement = 83, RULE_simple_embedded_statement = + 84, RULE_block = 85, RULE_local_variable_declaration = + 86, RULE_local_variable_type = 87, RULE_local_variable_declarator = + 88, RULE_local_variable_initializer = 89, RULE_local_constant_declaration = + 90, RULE_if_body = 91, RULE_switch_section = 92, RULE_switch_label = + 93, RULE_case_guard = 94, RULE_statement_list = 95, RULE_for_initializer = + 96, RULE_for_iterator = 97, RULE_catch_clauses = + 98, RULE_specific_catch_clause = 99, RULE_general_catch_clause = + 100, RULE_exception_filter = 101, RULE_finally_clause = + 102, RULE_resource_acquisition = 103, RULE_namespace_declaration = + 104, RULE_qualified_identifier = 105, RULE_namespace_body = + 106, RULE_extern_alias_directives = 107, RULE_extern_alias_directive = + 108, RULE_using_directives = 109, RULE_using_directive = + 110, RULE_namespace_member_declarations = + 111, RULE_namespace_member_declaration = 112, RULE_type_declaration = + 113, RULE_qualified_alias_member = 114, RULE_type_parameter_list = + 115, RULE_type_parameter = 116, RULE_class_base = + 117, RULE_interface_type_list = + 118, RULE_type_parameter_constraints_clauses = + 119, RULE_type_parameter_constraints_clause = + 120, RULE_type_parameter_constraints = 121, RULE_primary_constraint = + 122, RULE_secondary_constraints = 123, RULE_constructor_constraint = + 124, RULE_class_body = 125, RULE_class_member_declarations = + 126, RULE_class_member_declaration = 127, RULE_all_member_modifiers = + 128, RULE_all_member_modifier = 129, RULE_common_member_declaration = + 130, RULE_typed_member_declaration = 131, RULE_constant_declarators = + 132, RULE_constant_declarator = 133, RULE_variable_declarators = + 134, RULE_variable_declarator = 135, RULE_variable_initializer = + 136, RULE_return_type = 137, RULE_member_name = 138, RULE_method_body = + 139, RULE_formal_parameter_list = 140, RULE_fixed_parameters = + 141, RULE_fixed_parameter = 142, RULE_parameter_modifier = + 143, RULE_parameter_array = 144, RULE_accessor_declarations = + 145, RULE_get_accessor_declaration = 146, RULE_set_accessor_declaration = + 147, RULE_accessor_modifier = 148, RULE_accessor_body = + 149, RULE_event_accessor_declarations = 150, RULE_add_accessor_declaration = + 151, RULE_remove_accessor_declaration = 152, RULE_overloadable_operator = + 153, RULE_conversion_operator_declarator = + 154, RULE_constructor_initializer = 155, RULE_body = + 156, RULE_struct_interfaces = 157, RULE_struct_body = + 158, RULE_struct_member_declaration = 159, RULE_array_type = + 160, RULE_rank_specifier = 161, RULE_array_initializer = + 162, RULE_variant_type_parameter_list = 163, RULE_variant_type_parameter = + 164, RULE_variance_annotation = 165, RULE_interface_base = + 166, RULE_interface_body = 167, RULE_interface_member_declaration = + 168, RULE_interface_accessors = 169, RULE_enum_base = 170, RULE_enum_body = + 171, RULE_enum_member_declaration = 172, RULE_global_attribute_section = + 173, RULE_global_attribute_target = 174, RULE_attributes = + 175, RULE_attribute_section = 176, RULE_attribute_target = + 177, RULE_attribute_list = 178, RULE_attribute = + 179, RULE_attribute_argument = 180, RULE_pointer_type = + 181, RULE_fixed_pointer_declarators = 182, RULE_fixed_pointer_declarator = + 183, RULE_fixed_pointer_initializer = + 184, RULE_fixed_size_buffer_declarator = 185, RULE_stackalloc_initializer = + 186, RULE_right_arrow = 187, RULE_right_shift = + 188, RULE_right_shift_assignment = 189, RULE_literal = + 190, RULE_boolean_literal = 191, RULE_string_literal = + 192, RULE_interpolated_regular_string = + 193, RULE_interpolated_verbatium_string = + 194, RULE_interpolated_regular_string_part = + 195, RULE_interpolated_verbatium_string_part = + 196, RULE_interpolated_string_expression = 197, RULE_keyword = + 198, RULE_class_definition = 199, RULE_struct_definition = + 200, RULE_interface_definition = 201, RULE_enum_definition = + 202, RULE_delegate_definition = 203, RULE_event_declaration = + 204, RULE_field_declaration = 205, RULE_property_declaration = + 206, RULE_constant_declaration = 207, RULE_indexer_declaration = + 208, RULE_destructor_definition = 209, RULE_constructor_declaration = + 210, RULE_method_declaration = 211, RULE_method_member_name = + 212, RULE_operator_declaration = 213, RULE_arg_declaration = + 214, RULE_method_invocation = 215, RULE_object_creation_expression = + 216, RULE_identifier = 217; + + private static String[] makeRuleNames() { + return new String[] { + "compilation_unit", + "namespace_or_type_name", + "type_", + "base_type", + "tuple_type", + "tuple_element", + "simple_type", + "numeric_type", + "integral_type", + "floating_point_type", + "class_type", + "type_argument_list", + "argument_list", + "argument", + "expression", + "non_assignment_expression", + "assignment", + "assignment_operator", + "conditional_expression", + "null_coalescing_expression", + "conditional_or_expression", + "conditional_and_expression", + "inclusive_or_expression", + "exclusive_or_expression", + "and_expression", + "equality_expression", + "relational_expression", + "shift_expression", + "additive_expression", + "multiplicative_expression", + "switch_expression", + "switch_expression_arms", + "switch_expression_arm", + "range_expression", + "unary_expression", + "primary_expression", + "primary_expression_start", + "throwable_expression", + "throw_expression", + "member_access", + "bracket_expression", + "indexer_argument", + "predefined_type", + "expression_list", + "object_or_collection_initializer", + "object_initializer", + "member_initializer_list", + "member_initializer", + "initializer_value", + "collection_initializer", + "element_initializer", + "anonymous_object_initializer", + "member_declarator_list", + "member_declarator", + "unbound_type_name", + "generic_dimension_specifier", + "isType", + "isTypePatternArms", + "isTypePatternArm", + "lambda_expression", + "anonymous_function_signature", + "explicit_anonymous_function_parameter_list", + "explicit_anonymous_function_parameter", + "implicit_anonymous_function_parameter_list", + "anonymous_function_body", + "query_expression", + "from_clause", + "query_body", + "query_body_clause", + "let_clause", + "where_clause", + "combined_join_clause", + "orderby_clause", + "ordering", + "select_or_group_clause", + "query_continuation", + "statement", + "declarationStatement", + "local_function_declaration", + "local_function_header", + "local_function_modifiers", + "local_function_body", + "labeled_Statement", + "embedded_statement", + "simple_embedded_statement", + "block", + "local_variable_declaration", + "local_variable_type", + "local_variable_declarator", + "local_variable_initializer", + "local_constant_declaration", + "if_body", + "switch_section", + "switch_label", + "case_guard", + "statement_list", + "for_initializer", + "for_iterator", + "catch_clauses", + "specific_catch_clause", + "general_catch_clause", + "exception_filter", + "finally_clause", + "resource_acquisition", + "namespace_declaration", + "qualified_identifier", + "namespace_body", + "extern_alias_directives", + "extern_alias_directive", + "using_directives", + "using_directive", + "namespace_member_declarations", + "namespace_member_declaration", + "type_declaration", + "qualified_alias_member", + "type_parameter_list", + "type_parameter", + "class_base", + "interface_type_list", + "type_parameter_constraints_clauses", + "type_parameter_constraints_clause", + "type_parameter_constraints", + "primary_constraint", + "secondary_constraints", + "constructor_constraint", + "class_body", + "class_member_declarations", + "class_member_declaration", + "all_member_modifiers", + "all_member_modifier", + "common_member_declaration", + "typed_member_declaration", + "constant_declarators", + "constant_declarator", + "variable_declarators", + "variable_declarator", + "variable_initializer", + "return_type", + "member_name", + "method_body", + "formal_parameter_list", + "fixed_parameters", + "fixed_parameter", + "parameter_modifier", + "parameter_array", + "accessor_declarations", + "get_accessor_declaration", + "set_accessor_declaration", + "accessor_modifier", + "accessor_body", + "event_accessor_declarations", + "add_accessor_declaration", + "remove_accessor_declaration", + "overloadable_operator", + "conversion_operator_declarator", + "constructor_initializer", + "body", + "struct_interfaces", + "struct_body", + "struct_member_declaration", + "array_type", + "rank_specifier", + "array_initializer", + "variant_type_parameter_list", + "variant_type_parameter", + "variance_annotation", + "interface_base", + "interface_body", + "interface_member_declaration", + "interface_accessors", + "enum_base", + "enum_body", + "enum_member_declaration", + "global_attribute_section", + "global_attribute_target", + "attributes", + "attribute_section", + "attribute_target", + "attribute_list", + "attribute", + "attribute_argument", + "pointer_type", + "fixed_pointer_declarators", + "fixed_pointer_declarator", + "fixed_pointer_initializer", + "fixed_size_buffer_declarator", + "stackalloc_initializer", + "right_arrow", + "right_shift", + "right_shift_assignment", + "literal", + "boolean_literal", + "string_literal", + "interpolated_regular_string", + "interpolated_verbatium_string", + "interpolated_regular_string_part", + "interpolated_verbatium_string_part", + "interpolated_string_expression", + "keyword", + "class_definition", + "struct_definition", + "interface_definition", + "enum_definition", + "delegate_definition", + "event_declaration", + "field_declaration", + "property_declaration", + "constant_declaration", + "indexer_declaration", + "destructor_definition", + "constructor_declaration", + "method_declaration", + "method_member_name", + "operator_declaration", + "arg_declaration", + "method_invocation", + "object_creation_expression", + "identifier", + }; + } + + public static final String[] ruleNames = makeRuleNames(); + + private static String[] makeLiteralNames() { + return new String[] { + null, + "'\u00EF\u00BB\u00BF'", + null, + "'/***/'", + null, + null, + null, + null, + "'#'", + "'abstract'", + "'add'", + "'alias'", + "'__arglist'", + "'as'", + "'ascending'", + "'async'", + "'await'", + "'base'", + "'bool'", + "'break'", + "'by'", + "'byte'", + "'case'", + "'catch'", + "'char'", + "'checked'", + "'class'", + "'const'", + "'continue'", + "'decimal'", + "'default'", + "'delegate'", + "'descending'", + "'do'", + "'double'", + "'dynamic'", + "'else'", + "'enum'", + "'equals'", + "'event'", + "'explicit'", + "'extern'", + "'false'", + "'finally'", + "'fixed'", + "'float'", + "'for'", + "'foreach'", + "'from'", + "'get'", + "'goto'", + "'group'", + "'if'", + "'implicit'", + "'in'", + "'int'", + "'interface'", + "'internal'", + "'into'", + "'is'", + "'join'", + "'let'", + "'lock'", + "'long'", + "'nameof'", + "'namespace'", + "'new'", + "'null'", + "'object'", + "'on'", + "'operator'", + "'orderby'", + "'out'", + "'override'", + "'params'", + "'partial'", + "'private'", + "'protected'", + "'public'", + "'readonly'", + "'ref'", + "'remove'", + "'return'", + "'sbyte'", + "'sealed'", + "'select'", + "'set'", + "'short'", + "'sizeof'", + "'stackalloc'", + "'static'", + "'string'", + "'struct'", + "'switch'", + "'this'", + "'throw'", + "'true'", + "'try'", + "'typeof'", + "'uint'", + "'ulong'", + "'unchecked'", + "'unmanaged'", + "'unsafe'", + "'ushort'", + "'using'", + "'var'", + "'virtual'", + "'void'", + "'volatile'", + "'when'", + "'where'", + "'while'", + "'yield'", + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + "'{'", + "'}'", + "'['", + "']'", + "'('", + "')'", + "'.'", + "','", + "':'", + "';'", + "'+'", + "'-'", + "'*'", + "'/'", + "'%'", + "'&'", + "'|'", + "'^'", + "'!'", + "'~'", + "'='", + "'<'", + "'>'", + "'?'", + "'::'", + "'??'", + "'++'", + "'--'", + "'&&'", + "'||'", + "'->'", + "'=='", + "'!='", + "'<='", + "'>='", + "'+='", + "'-='", + "'*='", + "'/='", + "'%='", + "'&='", + "'|='", + "'^='", + "'<<'", + "'<<='", + "'??='", + "'..'", + "'{{'", + null, + null, + null, + null, + null, + null, + null, + null, + null, + null, + "'define'", + "'undef'", + "'elif'", + "'endif'", + "'line'", + null, + null, + null, + null, + null, + null, + "'hidden'", + null, + null, + null, + "'}}'", + }; + } + + private static final String[] _LITERAL_NAMES = makeLiteralNames(); + + private static String[] makeSymbolicNames() { + return new String[] { + null, + "BYTE_ORDER_MARK", + "SINGLE_LINE_DOC_COMMENT", + "EMPTY_DELIMITED_DOC_COMMENT", + "DELIMITED_DOC_COMMENT", + "SINGLE_LINE_COMMENT", + "DELIMITED_COMMENT", + "WHITESPACES", + "SHARP", + "ABSTRACT", + "ADD", + "ALIAS", + "ARGLIST", + "AS", + "ASCENDING", + "ASYNC", + "AWAIT", + "BASE", + "BOOL", + "BREAK", + "BY", + "BYTE", + "CASE", + "CATCH", + "CHAR", + "CHECKED", + "CLASS", + "CONST", + "CONTINUE", + "DECIMAL", + "DEFAULT", + "DELEGATE", + "DESCENDING", + "DO", + "DOUBLE", + "DYNAMIC", + "ELSE", + "ENUM", + "EQUALS", + "EVENT", + "EXPLICIT", + "EXTERN", + "FALSE", + "FINALLY", + "FIXED", + "FLOAT", + "FOR", + "FOREACH", + "FROM", + "GET", + "GOTO", + "GROUP", + "IF", + "IMPLICIT", + "IN", + "INT", + "INTERFACE", + "INTERNAL", + "INTO", + "IS", + "JOIN", + "LET", + "LOCK", + "LONG", + "NAMEOF", + "NAMESPACE", + "NEW", + "NULL_", + "OBJECT", + "ON", + "OPERATOR", + "ORDERBY", + "OUT", + "OVERRIDE", + "PARAMS", + "PARTIAL", + "PRIVATE", + "PROTECTED", + "PUBLIC", + "READONLY", + "REF", + "REMOVE", + "RETURN", + "SBYTE", + "SEALED", + "SELECT", + "SET", + "SHORT", + "SIZEOF", + "STACKALLOC", + "STATIC", + "STRING", + "STRUCT", + "SWITCH", + "THIS", + "THROW", + "TRUE", + "TRY", + "TYPEOF", + "UINT", + "ULONG", + "UNCHECKED", + "UNMANAGED", + "UNSAFE", + "USHORT", + "USING", + "VAR", + "VIRTUAL", + "VOID", + "VOLATILE", + "WHEN", + "WHERE", + "WHILE", + "YIELD", + "IDENTIFIER", + "LITERAL_ACCESS", + "INTEGER_LITERAL", + "HEX_INTEGER_LITERAL", + "BIN_INTEGER_LITERAL", + "REAL_LITERAL", + "CHARACTER_LITERAL", + "REGULAR_STRING", + "VERBATIUM_STRING", + "INTERPOLATED_REGULAR_STRING_START", + "INTERPOLATED_VERBATIUM_STRING_START", + "OPEN_BRACE", + "CLOSE_BRACE", + "OPEN_BRACKET", + "CLOSE_BRACKET", + "OPEN_PARENS", + "CLOSE_PARENS", + "DOT", + "COMMA", + "COLON", + "SEMICOLON", + "PLUS", + "MINUS", + "STAR", + "DIV", + "PERCENT", + "AMP", + "BITWISE_OR", + "CARET", + "BANG", + "TILDE", + "ASSIGNMENT", + "LT", + "GT", + "INTERR", + "DOUBLE_COLON", + "OP_COALESCING", + "OP_INC", + "OP_DEC", + "OP_AND", + "OP_OR", + "OP_PTR", + "OP_EQ", + "OP_NE", + "OP_LE", + "OP_GE", + "OP_ADD_ASSIGNMENT", + "OP_SUB_ASSIGNMENT", + "OP_MULT_ASSIGNMENT", + "OP_DIV_ASSIGNMENT", + "OP_MOD_ASSIGNMENT", + "OP_AND_ASSIGNMENT", + "OP_OR_ASSIGNMENT", + "OP_XOR_ASSIGNMENT", + "OP_LEFT_SHIFT", + "OP_LEFT_SHIFT_ASSIGNMENT", + "OP_COALESCING_ASSIGNMENT", + "OP_RANGE", + "DOUBLE_CURLY_INSIDE", + "OPEN_BRACE_INSIDE", + "REGULAR_CHAR_INSIDE", + "VERBATIUM_DOUBLE_QUOTE_INSIDE", + "DOUBLE_QUOTE_INSIDE", + "REGULAR_STRING_INSIDE", + "VERBATIUM_INSIDE_STRING", + "CLOSE_BRACE_INSIDE", + "FORMAT_STRING", + "DIRECTIVE_WHITESPACES", + "DIGITS", + "DEFINE", + "UNDEF", + "ELIF", + "ENDIF", + "LINE", + "ERROR", + "WARNING", + "REGION", + "ENDREGION", + "PRAGMA", + "NULLABLE", + "DIRECTIVE_HIDDEN", + "CONDITIONAL_SYMBOL", + "DIRECTIVE_NEW_LINE", + "TEXT", + "DOUBLE_CURLY_CLOSE_INSIDE", + }; + } + + private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames(); + public static final Vocabulary VOCABULARY = new VocabularyImpl( + _LITERAL_NAMES, + _SYMBOLIC_NAMES + ); + + /** + * @deprecated Use {@link #VOCABULARY} instead. + */ + @Deprecated + public static final String[] tokenNames; + + static { + tokenNames = new String[_SYMBOLIC_NAMES.length]; + for (int i = 0; i < tokenNames.length; i++) { + tokenNames[i] = VOCABULARY.getLiteralName(i); + if (tokenNames[i] == null) { + tokenNames[i] = VOCABULARY.getSymbolicName(i); + } + + if (tokenNames[i] == null) { + tokenNames[i] = ""; + } + } + } + + @Override + @Deprecated + public String[] getTokenNames() { + return tokenNames; + } + + @Override + public Vocabulary getVocabulary() { + return VOCABULARY; + } + + @Override + public String getGrammarFileName() { + return "CSharpParser.g4"; + } + + @Override + public String[] getRuleNames() { + return ruleNames; + } + + @Override + public String getSerializedATN() { + return _serializedATN; + } + + @Override + public ATN getATN() { + return _ATN; + } + + public CSharpParser(TokenStream input) { + super(input); + _interp = + new ParserATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache); + } + + public static class Compilation_unitContext extends ParserRuleContext { + + public TerminalNode EOF() { + return getToken(CSharpParser.EOF, 0); + } + + public TerminalNode BYTE_ORDER_MARK() { + return getToken(CSharpParser.BYTE_ORDER_MARK, 0); + } + + public Extern_alias_directivesContext extern_alias_directives() { + return getRuleContext(Extern_alias_directivesContext.class, 0); + } + + public Using_directivesContext using_directives() { + return getRuleContext(Using_directivesContext.class, 0); + } + + public List global_attribute_section() { + return getRuleContexts(Global_attribute_sectionContext.class); + } + + public Global_attribute_sectionContext global_attribute_section(int i) { + return getRuleContext(Global_attribute_sectionContext.class, i); + } + + public Namespace_member_declarationsContext namespace_member_declarations() { + return getRuleContext(Namespace_member_declarationsContext.class, 0); + } + + public Compilation_unitContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_compilation_unit; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterCompilation_unit(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitCompilation_unit(this); + } + } + + public final Compilation_unitContext compilation_unit() + throws RecognitionException { + Compilation_unitContext _localctx = new Compilation_unitContext( + _ctx, + getState() + ); + enterRule(_localctx, 0, RULE_compilation_unit); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(437); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == BYTE_ORDER_MARK) { + { + setState(436); + match(BYTE_ORDER_MARK); + } + } + + setState(440); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 1, _ctx)) { + case 1: + { + setState(439); + extern_alias_directives(); + } + break; + } + setState(443); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == USING) { + { + setState(442); + using_directives(); + } + } + + setState(448); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 3, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(445); + global_attribute_section(); + } + } + } + setState(450); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 3, _ctx); + } + setState(452); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ABSTRACT) | + (1L << ASYNC) | + (1L << CLASS) | + (1L << DELEGATE) | + (1L << ENUM) | + (1L << EXTERN) | + (1L << INTERFACE) | + (1L << INTERNAL))) != + 0) || + ((((_la - 65)) & ~0x3f) == 0 && + ((1L << (_la - 65)) & + ((1L << (NAMESPACE - 65)) | + (1L << (NEW - 65)) | + (1L << (OVERRIDE - 65)) | + (1L << (PARTIAL - 65)) | + (1L << (PRIVATE - 65)) | + (1L << (PROTECTED - 65)) | + (1L << (PUBLIC - 65)) | + (1L << (READONLY - 65)) | + (1L << (REF - 65)) | + (1L << (SEALED - 65)) | + (1L << (STATIC - 65)) | + (1L << (STRUCT - 65)) | + (1L << (UNSAFE - 65)) | + (1L << (VIRTUAL - 65)) | + (1L << (VOLATILE - 65)) | + (1L << (OPEN_BRACKET - 65)))) != + 0) + ) { + { + setState(451); + namespace_member_declarations(); + } + } + + setState(454); + match(Recognizer.EOF); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Namespace_or_type_nameContext extends ParserRuleContext { + + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class, i); + } + + public Qualified_alias_memberContext qualified_alias_member() { + return getRuleContext(Qualified_alias_memberContext.class, 0); + } + + public List DOT() { + return getTokens(CSharpParser.DOT); + } + + public TerminalNode DOT(int i) { + return getToken(CSharpParser.DOT, i); + } + + public List type_argument_list() { + return getRuleContexts(Type_argument_listContext.class); + } + + public Type_argument_listContext type_argument_list(int i) { + return getRuleContext(Type_argument_listContext.class, i); + } + + public Namespace_or_type_nameContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_namespace_or_type_name; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterNamespace_or_type_name(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitNamespace_or_type_name(this); + } + } + + public final Namespace_or_type_nameContext namespace_or_type_name() + throws RecognitionException { + Namespace_or_type_nameContext _localctx = new Namespace_or_type_nameContext( + _ctx, + getState() + ); + enterRule(_localctx, 2, RULE_namespace_or_type_name); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(461); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 6, _ctx)) { + case 1: + { + setState(456); + identifier(); + setState(458); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 5, _ctx)) { + case 1: + { + setState(457); + type_argument_list(); + } + break; + } + } + break; + case 2: + { + setState(460); + qualified_alias_member(); + } + break; + } + setState(470); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 8, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(463); + match(DOT); + setState(464); + identifier(); + setState(466); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 7, _ctx)) { + case 1: + { + setState(465); + type_argument_list(); + } + break; + } + } + } + } + setState(472); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 8, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Type_Context extends ParserRuleContext { + + public Base_typeContext base_type() { + return getRuleContext(Base_typeContext.class, 0); + } + + public List INTERR() { + return getTokens(CSharpParser.INTERR); + } + + public TerminalNode INTERR(int i) { + return getToken(CSharpParser.INTERR, i); + } + + public List rank_specifier() { + return getRuleContexts(Rank_specifierContext.class); + } + + public Rank_specifierContext rank_specifier(int i) { + return getRuleContext(Rank_specifierContext.class, i); + } + + public List STAR() { + return getTokens(CSharpParser.STAR); + } + + public TerminalNode STAR(int i) { + return getToken(CSharpParser.STAR, i); + } + + public Type_Context(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_type_; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterType_(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitType_(this); + } + } + + public final Type_Context type_() throws RecognitionException { + Type_Context _localctx = new Type_Context(_ctx, getState()); + enterRule(_localctx, 4, RULE_type_); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(473); + base_type(); + setState(479); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 10, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + setState(477); + _errHandler.sync(this); + switch (_input.LA(1)) { + case INTERR: + { + setState(474); + match(INTERR); + } + break; + case OPEN_BRACKET: + { + setState(475); + rank_specifier(); + } + break; + case STAR: + { + setState(476); + match(STAR); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + setState(481); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 10, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Base_typeContext extends ParserRuleContext { + + public Simple_typeContext simple_type() { + return getRuleContext(Simple_typeContext.class, 0); + } + + public Class_typeContext class_type() { + return getRuleContext(Class_typeContext.class, 0); + } + + public TerminalNode VOID() { + return getToken(CSharpParser.VOID, 0); + } + + public TerminalNode STAR() { + return getToken(CSharpParser.STAR, 0); + } + + public Tuple_typeContext tuple_type() { + return getRuleContext(Tuple_typeContext.class, 0); + } + + public Base_typeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_base_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterBase_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitBase_type(this); + } + } + + public final Base_typeContext base_type() throws RecognitionException { + Base_typeContext _localctx = new Base_typeContext(_ctx, getState()); + enterRule(_localctx, 6, RULE_base_type); + try { + setState(487); + _errHandler.sync(this); + switch (_input.LA(1)) { + case BOOL: + case BYTE: + case CHAR: + case DECIMAL: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SBYTE: + case SHORT: + case UINT: + case ULONG: + case USHORT: + enterOuterAlt(_localctx, 1); + { + setState(482); + simple_type(); + } + break; + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BY: + case DESCENDING: + case DYNAMIC: + case EQUALS: + case FROM: + case GET: + case GROUP: + case INTO: + case JOIN: + case LET: + case NAMEOF: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REMOVE: + case SELECT: + case SET: + case STRING: + case UNMANAGED: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + enterOuterAlt(_localctx, 2); + { + setState(483); + class_type(); + } + break; + case VOID: + enterOuterAlt(_localctx, 3); + { + setState(484); + match(VOID); + setState(485); + match(STAR); + } + break; + case OPEN_PARENS: + enterOuterAlt(_localctx, 4); + { + setState(486); + tuple_type(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Tuple_typeContext extends ParserRuleContext { + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public List tuple_element() { + return getRuleContexts(Tuple_elementContext.class); + } + + public Tuple_elementContext tuple_element(int i) { + return getRuleContext(Tuple_elementContext.class, i); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Tuple_typeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_tuple_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterTuple_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitTuple_type(this); + } + } + + public final Tuple_typeContext tuple_type() throws RecognitionException { + Tuple_typeContext _localctx = new Tuple_typeContext(_ctx, getState()); + enterRule(_localctx, 8, RULE_tuple_type); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(489); + match(OPEN_PARENS); + setState(490); + tuple_element(); + setState(493); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(491); + match(COMMA); + setState(492); + tuple_element(); + } + } + setState(495); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == COMMA); + setState(497); + match(CLOSE_PARENS); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Tuple_elementContext extends ParserRuleContext { + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Tuple_elementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_tuple_element; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterTuple_element(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitTuple_element(this); + } + } + + public final Tuple_elementContext tuple_element() + throws RecognitionException { + Tuple_elementContext _localctx = new Tuple_elementContext(_ctx, getState()); + enterRule(_localctx, 10, RULE_tuple_element); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(499); + type_(); + setState(501); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BY) | + (1L << DESCENDING) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)))) != + 0) + ) { + { + setState(500); + identifier(); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Simple_typeContext extends ParserRuleContext { + + public Numeric_typeContext numeric_type() { + return getRuleContext(Numeric_typeContext.class, 0); + } + + public TerminalNode BOOL() { + return getToken(CSharpParser.BOOL, 0); + } + + public Simple_typeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_simple_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSimple_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSimple_type(this); + } + } + + public final Simple_typeContext simple_type() throws RecognitionException { + Simple_typeContext _localctx = new Simple_typeContext(_ctx, getState()); + enterRule(_localctx, 12, RULE_simple_type); + try { + setState(505); + _errHandler.sync(this); + switch (_input.LA(1)) { + case BYTE: + case CHAR: + case DECIMAL: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SBYTE: + case SHORT: + case UINT: + case ULONG: + case USHORT: + enterOuterAlt(_localctx, 1); + { + setState(503); + numeric_type(); + } + break; + case BOOL: + enterOuterAlt(_localctx, 2); + { + setState(504); + match(BOOL); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Numeric_typeContext extends ParserRuleContext { + + public Integral_typeContext integral_type() { + return getRuleContext(Integral_typeContext.class, 0); + } + + public Floating_point_typeContext floating_point_type() { + return getRuleContext(Floating_point_typeContext.class, 0); + } + + public TerminalNode DECIMAL() { + return getToken(CSharpParser.DECIMAL, 0); + } + + public Numeric_typeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_numeric_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterNumeric_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitNumeric_type(this); + } + } + + public final Numeric_typeContext numeric_type() throws RecognitionException { + Numeric_typeContext _localctx = new Numeric_typeContext(_ctx, getState()); + enterRule(_localctx, 14, RULE_numeric_type); + try { + setState(510); + _errHandler.sync(this); + switch (_input.LA(1)) { + case BYTE: + case CHAR: + case INT: + case LONG: + case SBYTE: + case SHORT: + case UINT: + case ULONG: + case USHORT: + enterOuterAlt(_localctx, 1); + { + setState(507); + integral_type(); + } + break; + case DOUBLE: + case FLOAT: + enterOuterAlt(_localctx, 2); + { + setState(508); + floating_point_type(); + } + break; + case DECIMAL: + enterOuterAlt(_localctx, 3); + { + setState(509); + match(DECIMAL); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Integral_typeContext extends ParserRuleContext { + + public TerminalNode SBYTE() { + return getToken(CSharpParser.SBYTE, 0); + } + + public TerminalNode BYTE() { + return getToken(CSharpParser.BYTE, 0); + } + + public TerminalNode SHORT() { + return getToken(CSharpParser.SHORT, 0); + } + + public TerminalNode USHORT() { + return getToken(CSharpParser.USHORT, 0); + } + + public TerminalNode INT() { + return getToken(CSharpParser.INT, 0); + } + + public TerminalNode UINT() { + return getToken(CSharpParser.UINT, 0); + } + + public TerminalNode LONG() { + return getToken(CSharpParser.LONG, 0); + } + + public TerminalNode ULONG() { + return getToken(CSharpParser.ULONG, 0); + } + + public TerminalNode CHAR() { + return getToken(CSharpParser.CHAR, 0); + } + + public Integral_typeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_integral_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterIntegral_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitIntegral_type(this); + } + } + + public final Integral_typeContext integral_type() + throws RecognitionException { + Integral_typeContext _localctx = new Integral_typeContext(_ctx, getState()); + enterRule(_localctx, 16, RULE_integral_type); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(512); + _la = _input.LA(1); + if ( + !((((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << BYTE) | (1L << CHAR) | (1L << INT) | (1L << LONG))) != + 0) || + ((((_la - 83)) & ~0x3f) == 0 && + ((1L << (_la - 83)) & + ((1L << (SBYTE - 83)) | + (1L << (SHORT - 83)) | + (1L << (UINT - 83)) | + (1L << (ULONG - 83)) | + (1L << (USHORT - 83)))) != + 0)) + ) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Floating_point_typeContext extends ParserRuleContext { + + public TerminalNode FLOAT() { + return getToken(CSharpParser.FLOAT, 0); + } + + public TerminalNode DOUBLE() { + return getToken(CSharpParser.DOUBLE, 0); + } + + public Floating_point_typeContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_floating_point_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFloating_point_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFloating_point_type(this); + } + } + + public final Floating_point_typeContext floating_point_type() + throws RecognitionException { + Floating_point_typeContext _localctx = new Floating_point_typeContext( + _ctx, + getState() + ); + enterRule(_localctx, 18, RULE_floating_point_type); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(514); + _la = _input.LA(1); + if (!(_la == DOUBLE || _la == FLOAT)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Class_typeContext extends ParserRuleContext { + + public Namespace_or_type_nameContext namespace_or_type_name() { + return getRuleContext(Namespace_or_type_nameContext.class, 0); + } + + public TerminalNode OBJECT() { + return getToken(CSharpParser.OBJECT, 0); + } + + public TerminalNode DYNAMIC() { + return getToken(CSharpParser.DYNAMIC, 0); + } + + public TerminalNode STRING() { + return getToken(CSharpParser.STRING, 0); + } + + public Class_typeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_class_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterClass_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitClass_type(this); + } + } + + public final Class_typeContext class_type() throws RecognitionException { + Class_typeContext _localctx = new Class_typeContext(_ctx, getState()); + enterRule(_localctx, 20, RULE_class_type); + try { + setState(520); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 16, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(516); + namespace_or_type_name(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(517); + match(OBJECT); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(518); + match(DYNAMIC); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(519); + match(STRING); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Type_argument_listContext extends ParserRuleContext { + + public TerminalNode LT() { + return getToken(CSharpParser.LT, 0); + } + + public List type_() { + return getRuleContexts(Type_Context.class); + } + + public Type_Context type_(int i) { + return getRuleContext(Type_Context.class, i); + } + + public TerminalNode GT() { + return getToken(CSharpParser.GT, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Type_argument_listContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_type_argument_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterType_argument_list(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitType_argument_list(this); + } + } + + public final Type_argument_listContext type_argument_list() + throws RecognitionException { + Type_argument_listContext _localctx = new Type_argument_listContext( + _ctx, + getState() + ); + enterRule(_localctx, 22, RULE_type_argument_list); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(522); + match(LT); + setState(523); + type_(); + setState(528); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(524); + match(COMMA); + setState(525); + type_(); + } + } + setState(530); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(531); + match(GT); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Argument_listContext extends ParserRuleContext { + + public List argument() { + return getRuleContexts(ArgumentContext.class); + } + + public ArgumentContext argument(int i) { + return getRuleContext(ArgumentContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Argument_listContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_argument_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterArgument_list(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitArgument_list(this); + } + } + + public final Argument_listContext argument_list() + throws RecognitionException { + Argument_listContext _localctx = new Argument_listContext(_ctx, getState()); + enterRule(_localctx, 24, RULE_argument_list); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(533); + argument(); + setState(538); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(534); + match(COMMA); + setState(535); + argument(); + } + } + setState(540); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class ArgumentContext extends ParserRuleContext { + + public Token refout; + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public TerminalNode VAR() { + return getToken(CSharpParser.VAR, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public TerminalNode REF() { + return getToken(CSharpParser.REF, 0); + } + + public TerminalNode OUT() { + return getToken(CSharpParser.OUT, 0); + } + + public TerminalNode IN() { + return getToken(CSharpParser.IN, 0); + } + + public ArgumentContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_argument; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterArgument(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitArgument(this); + } + } + + public final ArgumentContext argument() throws RecognitionException { + ArgumentContext _localctx = new ArgumentContext(_ctx, getState()); + enterRule(_localctx, 26, RULE_argument); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(544); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 19, _ctx)) { + case 1: + { + setState(541); + identifier(); + setState(542); + match(COLON); + } + break; + } + setState(547); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 20, _ctx)) { + case 1: + { + setState(546); + ((ArgumentContext) _localctx).refout = _input.LT(1); + _la = _input.LA(1); + if ( + !(((((_la - 54)) & ~0x3f) == 0 && + ((1L << (_la - 54)) & + ((1L << (IN - 54)) | + (1L << (OUT - 54)) | + (1L << (REF - 54)))) != + 0)) + ) { + ((ArgumentContext) _localctx).refout = + (Token) _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + break; + } + setState(551); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 21, _ctx)) { + case 1: + { + setState(549); + match(VAR); + } + break; + case 2: + { + setState(550); + type_(); + } + break; + } + setState(553); + expression(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class ExpressionContext extends ParserRuleContext { + + public AssignmentContext assignment() { + return getRuleContext(AssignmentContext.class, 0); + } + + public Non_assignment_expressionContext non_assignment_expression() { + return getRuleContext(Non_assignment_expressionContext.class, 0); + } + + public TerminalNode REF() { + return getToken(CSharpParser.REF, 0); + } + + public ExpressionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitExpression(this); + } + } + + public final ExpressionContext expression() throws RecognitionException { + ExpressionContext _localctx = new ExpressionContext(_ctx, getState()); + enterRule(_localctx, 28, RULE_expression); + try { + setState(559); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 22, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(555); + assignment(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(556); + non_assignment_expression(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(557); + match(REF); + setState(558); + non_assignment_expression(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Non_assignment_expressionContext + extends ParserRuleContext { + + public Lambda_expressionContext lambda_expression() { + return getRuleContext(Lambda_expressionContext.class, 0); + } + + public Query_expressionContext query_expression() { + return getRuleContext(Query_expressionContext.class, 0); + } + + public Conditional_expressionContext conditional_expression() { + return getRuleContext(Conditional_expressionContext.class, 0); + } + + public Non_assignment_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_non_assignment_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterNon_assignment_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitNon_assignment_expression(this); + } + } + + public final Non_assignment_expressionContext non_assignment_expression() + throws RecognitionException { + Non_assignment_expressionContext _localctx = + new Non_assignment_expressionContext(_ctx, getState()); + enterRule(_localctx, 30, RULE_non_assignment_expression); + try { + setState(564); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 23, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(561); + lambda_expression(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(562); + query_expression(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(563); + conditional_expression(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class AssignmentContext extends ParserRuleContext { + + public Unary_expressionContext unary_expression() { + return getRuleContext(Unary_expressionContext.class, 0); + } + + public Assignment_operatorContext assignment_operator() { + return getRuleContext(Assignment_operatorContext.class, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode OP_COALESCING_ASSIGNMENT() { + return getToken(CSharpParser.OP_COALESCING_ASSIGNMENT, 0); + } + + public Throwable_expressionContext throwable_expression() { + return getRuleContext(Throwable_expressionContext.class, 0); + } + + public AssignmentContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_assignment; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAssignment(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAssignment(this); + } + } + + public final AssignmentContext assignment() throws RecognitionException { + AssignmentContext _localctx = new AssignmentContext(_ctx, getState()); + enterRule(_localctx, 32, RULE_assignment); + try { + setState(574); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 24, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(566); + unary_expression(); + setState(567); + assignment_operator(); + setState(568); + expression(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(570); + unary_expression(); + setState(571); + match(OP_COALESCING_ASSIGNMENT); + setState(572); + throwable_expression(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Assignment_operatorContext extends ParserRuleContext { + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public TerminalNode OP_ADD_ASSIGNMENT() { + return getToken(CSharpParser.OP_ADD_ASSIGNMENT, 0); + } + + public TerminalNode OP_SUB_ASSIGNMENT() { + return getToken(CSharpParser.OP_SUB_ASSIGNMENT, 0); + } + + public TerminalNode OP_MULT_ASSIGNMENT() { + return getToken(CSharpParser.OP_MULT_ASSIGNMENT, 0); + } + + public TerminalNode OP_DIV_ASSIGNMENT() { + return getToken(CSharpParser.OP_DIV_ASSIGNMENT, 0); + } + + public TerminalNode OP_MOD_ASSIGNMENT() { + return getToken(CSharpParser.OP_MOD_ASSIGNMENT, 0); + } + + public TerminalNode OP_AND_ASSIGNMENT() { + return getToken(CSharpParser.OP_AND_ASSIGNMENT, 0); + } + + public TerminalNode OP_OR_ASSIGNMENT() { + return getToken(CSharpParser.OP_OR_ASSIGNMENT, 0); + } + + public TerminalNode OP_XOR_ASSIGNMENT() { + return getToken(CSharpParser.OP_XOR_ASSIGNMENT, 0); + } + + public TerminalNode OP_LEFT_SHIFT_ASSIGNMENT() { + return getToken(CSharpParser.OP_LEFT_SHIFT_ASSIGNMENT, 0); + } + + public Right_shift_assignmentContext right_shift_assignment() { + return getRuleContext(Right_shift_assignmentContext.class, 0); + } + + public Assignment_operatorContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_assignment_operator; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAssignment_operator(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAssignment_operator(this); + } + } + + public final Assignment_operatorContext assignment_operator() + throws RecognitionException { + Assignment_operatorContext _localctx = new Assignment_operatorContext( + _ctx, + getState() + ); + enterRule(_localctx, 34, RULE_assignment_operator); + try { + setState(587); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ASSIGNMENT: + enterOuterAlt(_localctx, 1); + { + setState(576); + match(ASSIGNMENT); + } + break; + case OP_ADD_ASSIGNMENT: + enterOuterAlt(_localctx, 2); + { + setState(577); + match(OP_ADD_ASSIGNMENT); + } + break; + case OP_SUB_ASSIGNMENT: + enterOuterAlt(_localctx, 3); + { + setState(578); + match(OP_SUB_ASSIGNMENT); + } + break; + case OP_MULT_ASSIGNMENT: + enterOuterAlt(_localctx, 4); + { + setState(579); + match(OP_MULT_ASSIGNMENT); + } + break; + case OP_DIV_ASSIGNMENT: + enterOuterAlt(_localctx, 5); + { + setState(580); + match(OP_DIV_ASSIGNMENT); + } + break; + case OP_MOD_ASSIGNMENT: + enterOuterAlt(_localctx, 6); + { + setState(581); + match(OP_MOD_ASSIGNMENT); + } + break; + case OP_AND_ASSIGNMENT: + enterOuterAlt(_localctx, 7); + { + setState(582); + match(OP_AND_ASSIGNMENT); + } + break; + case OP_OR_ASSIGNMENT: + enterOuterAlt(_localctx, 8); + { + setState(583); + match(OP_OR_ASSIGNMENT); + } + break; + case OP_XOR_ASSIGNMENT: + enterOuterAlt(_localctx, 9); + { + setState(584); + match(OP_XOR_ASSIGNMENT); + } + break; + case OP_LEFT_SHIFT_ASSIGNMENT: + enterOuterAlt(_localctx, 10); + { + setState(585); + match(OP_LEFT_SHIFT_ASSIGNMENT); + } + break; + case GT: + enterOuterAlt(_localctx, 11); + { + setState(586); + right_shift_assignment(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Conditional_expressionContext extends ParserRuleContext { + + public Null_coalescing_expressionContext null_coalescing_expression() { + return getRuleContext(Null_coalescing_expressionContext.class, 0); + } + + public TerminalNode INTERR() { + return getToken(CSharpParser.INTERR, 0); + } + + public List throwable_expression() { + return getRuleContexts(Throwable_expressionContext.class); + } + + public Throwable_expressionContext throwable_expression(int i) { + return getRuleContext(Throwable_expressionContext.class, i); + } + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public Conditional_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_conditional_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterConditional_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitConditional_expression(this); + } + } + + public final Conditional_expressionContext conditional_expression() + throws RecognitionException { + Conditional_expressionContext _localctx = new Conditional_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 36, RULE_conditional_expression); + try { + enterOuterAlt(_localctx, 1); + { + setState(589); + null_coalescing_expression(); + setState(595); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 26, _ctx)) { + case 1: + { + setState(590); + match(INTERR); + setState(591); + throwable_expression(); + setState(592); + match(COLON); + setState(593); + throwable_expression(); + } + break; + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Null_coalescing_expressionContext + extends ParserRuleContext { + + public Conditional_or_expressionContext conditional_or_expression() { + return getRuleContext(Conditional_or_expressionContext.class, 0); + } + + public TerminalNode OP_COALESCING() { + return getToken(CSharpParser.OP_COALESCING, 0); + } + + public Null_coalescing_expressionContext null_coalescing_expression() { + return getRuleContext(Null_coalescing_expressionContext.class, 0); + } + + public Throw_expressionContext throw_expression() { + return getRuleContext(Throw_expressionContext.class, 0); + } + + public Null_coalescing_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_null_coalescing_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterNull_coalescing_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitNull_coalescing_expression(this); + } + } + + public final Null_coalescing_expressionContext null_coalescing_expression() + throws RecognitionException { + Null_coalescing_expressionContext _localctx = + new Null_coalescing_expressionContext(_ctx, getState()); + enterRule(_localctx, 38, RULE_null_coalescing_expression); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(597); + conditional_or_expression(); + setState(603); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OP_COALESCING) { + { + setState(598); + match(OP_COALESCING); + setState(601); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case THIS: + case TRUE: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case USHORT: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + { + setState(599); + null_coalescing_expression(); + } + break; + case THROW: + { + setState(600); + throw_expression(); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Conditional_or_expressionContext + extends ParserRuleContext { + + public List< + Conditional_and_expressionContext + > conditional_and_expression() { + return getRuleContexts(Conditional_and_expressionContext.class); + } + + public Conditional_and_expressionContext conditional_and_expression(int i) { + return getRuleContext(Conditional_and_expressionContext.class, i); + } + + public List OP_OR() { + return getTokens(CSharpParser.OP_OR); + } + + public TerminalNode OP_OR(int i) { + return getToken(CSharpParser.OP_OR, i); + } + + public Conditional_or_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_conditional_or_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterConditional_or_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitConditional_or_expression(this); + } + } + + public final Conditional_or_expressionContext conditional_or_expression() + throws RecognitionException { + Conditional_or_expressionContext _localctx = + new Conditional_or_expressionContext(_ctx, getState()); + enterRule(_localctx, 40, RULE_conditional_or_expression); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(605); + conditional_and_expression(); + setState(610); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == OP_OR) { + { + { + setState(606); + match(OP_OR); + setState(607); + conditional_and_expression(); + } + } + setState(612); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Conditional_and_expressionContext + extends ParserRuleContext { + + public List inclusive_or_expression() { + return getRuleContexts(Inclusive_or_expressionContext.class); + } + + public Inclusive_or_expressionContext inclusive_or_expression(int i) { + return getRuleContext(Inclusive_or_expressionContext.class, i); + } + + public List OP_AND() { + return getTokens(CSharpParser.OP_AND); + } + + public TerminalNode OP_AND(int i) { + return getToken(CSharpParser.OP_AND, i); + } + + public Conditional_and_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_conditional_and_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterConditional_and_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitConditional_and_expression(this); + } + } + + public final Conditional_and_expressionContext conditional_and_expression() + throws RecognitionException { + Conditional_and_expressionContext _localctx = + new Conditional_and_expressionContext(_ctx, getState()); + enterRule(_localctx, 42, RULE_conditional_and_expression); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(613); + inclusive_or_expression(); + setState(618); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == OP_AND) { + { + { + setState(614); + match(OP_AND); + setState(615); + inclusive_or_expression(); + } + } + setState(620); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Inclusive_or_expressionContext extends ParserRuleContext { + + public List exclusive_or_expression() { + return getRuleContexts(Exclusive_or_expressionContext.class); + } + + public Exclusive_or_expressionContext exclusive_or_expression(int i) { + return getRuleContext(Exclusive_or_expressionContext.class, i); + } + + public List BITWISE_OR() { + return getTokens(CSharpParser.BITWISE_OR); + } + + public TerminalNode BITWISE_OR(int i) { + return getToken(CSharpParser.BITWISE_OR, i); + } + + public Inclusive_or_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_inclusive_or_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInclusive_or_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInclusive_or_expression(this); + } + } + + public final Inclusive_or_expressionContext inclusive_or_expression() + throws RecognitionException { + Inclusive_or_expressionContext _localctx = + new Inclusive_or_expressionContext(_ctx, getState()); + enterRule(_localctx, 44, RULE_inclusive_or_expression); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(621); + exclusive_or_expression(); + setState(626); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == BITWISE_OR) { + { + { + setState(622); + match(BITWISE_OR); + setState(623); + exclusive_or_expression(); + } + } + setState(628); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Exclusive_or_expressionContext extends ParserRuleContext { + + public List and_expression() { + return getRuleContexts(And_expressionContext.class); + } + + public And_expressionContext and_expression(int i) { + return getRuleContext(And_expressionContext.class, i); + } + + public List CARET() { + return getTokens(CSharpParser.CARET); + } + + public TerminalNode CARET(int i) { + return getToken(CSharpParser.CARET, i); + } + + public Exclusive_or_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_exclusive_or_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterExclusive_or_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitExclusive_or_expression(this); + } + } + + public final Exclusive_or_expressionContext exclusive_or_expression() + throws RecognitionException { + Exclusive_or_expressionContext _localctx = + new Exclusive_or_expressionContext(_ctx, getState()); + enterRule(_localctx, 46, RULE_exclusive_or_expression); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(629); + and_expression(); + setState(634); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 32, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(630); + match(CARET); + setState(631); + and_expression(); + } + } + } + setState(636); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 32, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class And_expressionContext extends ParserRuleContext { + + public List equality_expression() { + return getRuleContexts(Equality_expressionContext.class); + } + + public Equality_expressionContext equality_expression(int i) { + return getRuleContext(Equality_expressionContext.class, i); + } + + public List AMP() { + return getTokens(CSharpParser.AMP); + } + + public TerminalNode AMP(int i) { + return getToken(CSharpParser.AMP, i); + } + + public And_expressionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_and_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAnd_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAnd_expression(this); + } + } + + public final And_expressionContext and_expression() + throws RecognitionException { + And_expressionContext _localctx = new And_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 48, RULE_and_expression); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(637); + equality_expression(); + setState(642); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 33, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(638); + match(AMP); + setState(639); + equality_expression(); + } + } + } + setState(644); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 33, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Equality_expressionContext extends ParserRuleContext { + + public List relational_expression() { + return getRuleContexts(Relational_expressionContext.class); + } + + public Relational_expressionContext relational_expression(int i) { + return getRuleContext(Relational_expressionContext.class, i); + } + + public List OP_EQ() { + return getTokens(CSharpParser.OP_EQ); + } + + public TerminalNode OP_EQ(int i) { + return getToken(CSharpParser.OP_EQ, i); + } + + public List OP_NE() { + return getTokens(CSharpParser.OP_NE); + } + + public TerminalNode OP_NE(int i) { + return getToken(CSharpParser.OP_NE, i); + } + + public Equality_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_equality_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterEquality_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitEquality_expression(this); + } + } + + public final Equality_expressionContext equality_expression() + throws RecognitionException { + Equality_expressionContext _localctx = new Equality_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 50, RULE_equality_expression); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(645); + relational_expression(); + setState(650); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == OP_EQ || _la == OP_NE) { + { + { + setState(646); + _la = _input.LA(1); + if (!(_la == OP_EQ || _la == OP_NE)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(647); + relational_expression(); + } + } + setState(652); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Relational_expressionContext extends ParserRuleContext { + + public List shift_expression() { + return getRuleContexts(Shift_expressionContext.class); + } + + public Shift_expressionContext shift_expression(int i) { + return getRuleContext(Shift_expressionContext.class, i); + } + + public List IS() { + return getTokens(CSharpParser.IS); + } + + public TerminalNode IS(int i) { + return getToken(CSharpParser.IS, i); + } + + public List isType() { + return getRuleContexts(IsTypeContext.class); + } + + public IsTypeContext isType(int i) { + return getRuleContext(IsTypeContext.class, i); + } + + public List AS() { + return getTokens(CSharpParser.AS); + } + + public TerminalNode AS(int i) { + return getToken(CSharpParser.AS, i); + } + + public List type_() { + return getRuleContexts(Type_Context.class); + } + + public Type_Context type_(int i) { + return getRuleContext(Type_Context.class, i); + } + + public List LT() { + return getTokens(CSharpParser.LT); + } + + public TerminalNode LT(int i) { + return getToken(CSharpParser.LT, i); + } + + public List GT() { + return getTokens(CSharpParser.GT); + } + + public TerminalNode GT(int i) { + return getToken(CSharpParser.GT, i); + } + + public List OP_LE() { + return getTokens(CSharpParser.OP_LE); + } + + public TerminalNode OP_LE(int i) { + return getToken(CSharpParser.OP_LE, i); + } + + public List OP_GE() { + return getTokens(CSharpParser.OP_GE); + } + + public TerminalNode OP_GE(int i) { + return getToken(CSharpParser.OP_GE, i); + } + + public Relational_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_relational_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterRelational_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitRelational_expression(this); + } + } + + public final Relational_expressionContext relational_expression() + throws RecognitionException { + Relational_expressionContext _localctx = new Relational_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 52, RULE_relational_expression); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(653); + shift_expression(); + setState(662); + _errHandler.sync(this); + _la = _input.LA(1); + while ( + _la == AS || + _la == IS || + ((((_la - 146)) & ~0x3f) == 0 && + ((1L << (_la - 146)) & + ((1L << (LT - 146)) | + (1L << (GT - 146)) | + (1L << (OP_LE - 146)) | + (1L << (OP_GE - 146)))) != + 0) + ) { + { + setState(660); + _errHandler.sync(this); + switch (_input.LA(1)) { + case LT: + case GT: + case OP_LE: + case OP_GE: + { + setState(654); + _la = _input.LA(1); + if ( + !(((((_la - 146)) & ~0x3f) == 0 && + ((1L << (_la - 146)) & + ((1L << (LT - 146)) | + (1L << (GT - 146)) | + (1L << (OP_LE - 146)) | + (1L << (OP_GE - 146)))) != + 0)) + ) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(655); + shift_expression(); + } + break; + case IS: + { + setState(656); + match(IS); + setState(657); + isType(); + } + break; + case AS: + { + setState(658); + match(AS); + setState(659); + type_(); + } + break; + default: + throw new NoViableAltException(this); + } + } + setState(664); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Shift_expressionContext extends ParserRuleContext { + + public List additive_expression() { + return getRuleContexts(Additive_expressionContext.class); + } + + public Additive_expressionContext additive_expression(int i) { + return getRuleContext(Additive_expressionContext.class, i); + } + + public List OP_LEFT_SHIFT() { + return getTokens(CSharpParser.OP_LEFT_SHIFT); + } + + public TerminalNode OP_LEFT_SHIFT(int i) { + return getToken(CSharpParser.OP_LEFT_SHIFT, i); + } + + public List right_shift() { + return getRuleContexts(Right_shiftContext.class); + } + + public Right_shiftContext right_shift(int i) { + return getRuleContext(Right_shiftContext.class, i); + } + + public Shift_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_shift_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterShift_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitShift_expression(this); + } + } + + public final Shift_expressionContext shift_expression() + throws RecognitionException { + Shift_expressionContext _localctx = new Shift_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 54, RULE_shift_expression); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(665); + additive_expression(); + setState(673); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 38, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(668); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OP_LEFT_SHIFT: + { + setState(666); + match(OP_LEFT_SHIFT); + } + break; + case GT: + { + setState(667); + right_shift(); + } + break; + default: + throw new NoViableAltException(this); + } + setState(670); + additive_expression(); + } + } + } + setState(675); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 38, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Additive_expressionContext extends ParserRuleContext { + + public List multiplicative_expression() { + return getRuleContexts(Multiplicative_expressionContext.class); + } + + public Multiplicative_expressionContext multiplicative_expression(int i) { + return getRuleContext(Multiplicative_expressionContext.class, i); + } + + public List PLUS() { + return getTokens(CSharpParser.PLUS); + } + + public TerminalNode PLUS(int i) { + return getToken(CSharpParser.PLUS, i); + } + + public List MINUS() { + return getTokens(CSharpParser.MINUS); + } + + public TerminalNode MINUS(int i) { + return getToken(CSharpParser.MINUS, i); + } + + public Additive_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_additive_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAdditive_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAdditive_expression(this); + } + } + + public final Additive_expressionContext additive_expression() + throws RecognitionException { + Additive_expressionContext _localctx = new Additive_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 56, RULE_additive_expression); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(676); + multiplicative_expression(); + setState(681); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 39, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(677); + _la = _input.LA(1); + if (!(_la == PLUS || _la == MINUS)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(678); + multiplicative_expression(); + } + } + } + setState(683); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 39, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Multiplicative_expressionContext + extends ParserRuleContext { + + public List switch_expression() { + return getRuleContexts(Switch_expressionContext.class); + } + + public Switch_expressionContext switch_expression(int i) { + return getRuleContext(Switch_expressionContext.class, i); + } + + public List STAR() { + return getTokens(CSharpParser.STAR); + } + + public TerminalNode STAR(int i) { + return getToken(CSharpParser.STAR, i); + } + + public List DIV() { + return getTokens(CSharpParser.DIV); + } + + public TerminalNode DIV(int i) { + return getToken(CSharpParser.DIV, i); + } + + public List PERCENT() { + return getTokens(CSharpParser.PERCENT); + } + + public TerminalNode PERCENT(int i) { + return getToken(CSharpParser.PERCENT, i); + } + + public Multiplicative_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_multiplicative_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMultiplicative_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMultiplicative_expression(this); + } + } + + public final Multiplicative_expressionContext multiplicative_expression() + throws RecognitionException { + Multiplicative_expressionContext _localctx = + new Multiplicative_expressionContext(_ctx, getState()); + enterRule(_localctx, 58, RULE_multiplicative_expression); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(684); + switch_expression(); + setState(689); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 40, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(685); + _la = _input.LA(1); + if ( + !(((((_la - 137)) & ~0x3f) == 0 && + ((1L << (_la - 137)) & + ((1L << (STAR - 137)) | + (1L << (DIV - 137)) | + (1L << (PERCENT - 137)))) != + 0)) + ) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(686); + switch_expression(); + } + } + } + setState(691); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 40, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Switch_expressionContext extends ParserRuleContext { + + public Range_expressionContext range_expression() { + return getRuleContext(Range_expressionContext.class, 0); + } + + public TerminalNode SWITCH() { + return getToken(CSharpParser.SWITCH, 0); + } + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public Switch_expression_armsContext switch_expression_arms() { + return getRuleContext(Switch_expression_armsContext.class, 0); + } + + public TerminalNode COMMA() { + return getToken(CSharpParser.COMMA, 0); + } + + public Switch_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_switch_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSwitch_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSwitch_expression(this); + } + } + + public final Switch_expressionContext switch_expression() + throws RecognitionException { + Switch_expressionContext _localctx = new Switch_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 60, RULE_switch_expression); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(692); + range_expression(); + setState(702); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == SWITCH) { + { + setState(693); + match(SWITCH); + setState(694); + match(OPEN_BRACE); + setState(699); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(695); + switch_expression_arms(); + setState(697); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(696); + match(COMMA); + } + } + } + } + + setState(701); + match(CLOSE_BRACE); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Switch_expression_armsContext extends ParserRuleContext { + + public List switch_expression_arm() { + return getRuleContexts(Switch_expression_armContext.class); + } + + public Switch_expression_armContext switch_expression_arm(int i) { + return getRuleContext(Switch_expression_armContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Switch_expression_armsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_switch_expression_arms; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSwitch_expression_arms(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSwitch_expression_arms(this); + } + } + + public final Switch_expression_armsContext switch_expression_arms() + throws RecognitionException { + Switch_expression_armsContext _localctx = new Switch_expression_armsContext( + _ctx, + getState() + ); + enterRule(_localctx, 62, RULE_switch_expression_arms); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(704); + switch_expression_arm(); + setState(709); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 44, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(705); + match(COMMA); + setState(706); + switch_expression_arm(); + } + } + } + setState(711); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 44, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Switch_expression_armContext extends ParserRuleContext { + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Right_arrowContext right_arrow() { + return getRuleContext(Right_arrowContext.class, 0); + } + + public Throwable_expressionContext throwable_expression() { + return getRuleContext(Throwable_expressionContext.class, 0); + } + + public Case_guardContext case_guard() { + return getRuleContext(Case_guardContext.class, 0); + } + + public Switch_expression_armContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_switch_expression_arm; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSwitch_expression_arm(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSwitch_expression_arm(this); + } + } + + public final Switch_expression_armContext switch_expression_arm() + throws RecognitionException { + Switch_expression_armContext _localctx = new Switch_expression_armContext( + _ctx, + getState() + ); + enterRule(_localctx, 64, RULE_switch_expression_arm); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(712); + expression(); + setState(714); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHEN) { + { + setState(713); + case_guard(); + } + } + + setState(716); + right_arrow(); + setState(717); + throwable_expression(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Range_expressionContext extends ParserRuleContext { + + public List unary_expression() { + return getRuleContexts(Unary_expressionContext.class); + } + + public Unary_expressionContext unary_expression(int i) { + return getRuleContext(Unary_expressionContext.class, i); + } + + public TerminalNode OP_RANGE() { + return getToken(CSharpParser.OP_RANGE, 0); + } + + public Range_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_range_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterRange_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitRange_expression(this); + } + } + + public final Range_expressionContext range_expression() + throws RecognitionException { + Range_expressionContext _localctx = new Range_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 66, RULE_range_expression); + int _la; + try { + setState(727); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 48, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(719); + unary_expression(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(721); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)))) != + 0) + ) { + { + setState(720); + unary_expression(); + } + } + + setState(723); + match(OP_RANGE); + setState(725); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 47, _ctx)) { + case 1: + { + setState(724); + unary_expression(); + } + break; + } + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Unary_expressionContext extends ParserRuleContext { + + public Primary_expressionContext primary_expression() { + return getRuleContext(Primary_expressionContext.class, 0); + } + + public TerminalNode PLUS() { + return getToken(CSharpParser.PLUS, 0); + } + + public Unary_expressionContext unary_expression() { + return getRuleContext(Unary_expressionContext.class, 0); + } + + public TerminalNode MINUS() { + return getToken(CSharpParser.MINUS, 0); + } + + public TerminalNode BANG() { + return getToken(CSharpParser.BANG, 0); + } + + public TerminalNode TILDE() { + return getToken(CSharpParser.TILDE, 0); + } + + public TerminalNode OP_INC() { + return getToken(CSharpParser.OP_INC, 0); + } + + public TerminalNode OP_DEC() { + return getToken(CSharpParser.OP_DEC, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public TerminalNode AWAIT() { + return getToken(CSharpParser.AWAIT, 0); + } + + public TerminalNode AMP() { + return getToken(CSharpParser.AMP, 0); + } + + public TerminalNode STAR() { + return getToken(CSharpParser.STAR, 0); + } + + public TerminalNode CARET() { + return getToken(CSharpParser.CARET, 0); + } + + public Unary_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_unary_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterUnary_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitUnary_expression(this); + } + } + + public final Unary_expressionContext unary_expression() + throws RecognitionException { + Unary_expressionContext _localctx = new Unary_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 68, RULE_unary_expression); + try { + setState(755); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 49, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(729); + primary_expression(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(730); + match(PLUS); + setState(731); + unary_expression(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(732); + match(MINUS); + setState(733); + unary_expression(); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(734); + match(BANG); + setState(735); + unary_expression(); + } + break; + case 5: + enterOuterAlt(_localctx, 5); + { + setState(736); + match(TILDE); + setState(737); + unary_expression(); + } + break; + case 6: + enterOuterAlt(_localctx, 6); + { + setState(738); + match(OP_INC); + setState(739); + unary_expression(); + } + break; + case 7: + enterOuterAlt(_localctx, 7); + { + setState(740); + match(OP_DEC); + setState(741); + unary_expression(); + } + break; + case 8: + enterOuterAlt(_localctx, 8); + { + setState(742); + match(OPEN_PARENS); + setState(743); + type_(); + setState(744); + match(CLOSE_PARENS); + setState(745); + unary_expression(); + } + break; + case 9: + enterOuterAlt(_localctx, 9); + { + setState(747); + match(AWAIT); + setState(748); + unary_expression(); + } + break; + case 10: + enterOuterAlt(_localctx, 10); + { + setState(749); + match(AMP); + setState(750); + unary_expression(); + } + break; + case 11: + enterOuterAlt(_localctx, 11); + { + setState(751); + match(STAR); + setState(752); + unary_expression(); + } + break; + case 12: + enterOuterAlt(_localctx, 12); + { + setState(753); + match(CARET); + setState(754); + unary_expression(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Primary_expressionContext extends ParserRuleContext { + + public Primary_expression_startContext pe; + + public Primary_expression_startContext primary_expression_start() { + return getRuleContext(Primary_expression_startContext.class, 0); + } + + public List BANG() { + return getTokens(CSharpParser.BANG); + } + + public TerminalNode BANG(int i) { + return getToken(CSharpParser.BANG, i); + } + + public List bracket_expression() { + return getRuleContexts(Bracket_expressionContext.class); + } + + public Bracket_expressionContext bracket_expression(int i) { + return getRuleContext(Bracket_expressionContext.class, i); + } + + public List member_access() { + return getRuleContexts(Member_accessContext.class); + } + + public Member_accessContext member_access(int i) { + return getRuleContext(Member_accessContext.class, i); + } + + public List method_invocation() { + return getRuleContexts(Method_invocationContext.class); + } + + public Method_invocationContext method_invocation(int i) { + return getRuleContext(Method_invocationContext.class, i); + } + + public List OP_INC() { + return getTokens(CSharpParser.OP_INC); + } + + public TerminalNode OP_INC(int i) { + return getToken(CSharpParser.OP_INC, i); + } + + public List OP_DEC() { + return getTokens(CSharpParser.OP_DEC); + } + + public TerminalNode OP_DEC(int i) { + return getToken(CSharpParser.OP_DEC, i); + } + + public List OP_PTR() { + return getTokens(CSharpParser.OP_PTR); + } + + public TerminalNode OP_PTR(int i) { + return getToken(CSharpParser.OP_PTR, i); + } + + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class, i); + } + + public Primary_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_primary_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterPrimary_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitPrimary_expression(this); + } + } + + public final Primary_expressionContext primary_expression() + throws RecognitionException { + Primary_expressionContext _localctx = new Primary_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 70, RULE_primary_expression); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(757); + ((Primary_expressionContext) _localctx).pe = primary_expression_start(); + setState(759); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 50, _ctx)) { + case 1: + { + setState(758); + match(BANG); + } + break; + } + setState(764); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 51, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(761); + bracket_expression(); + } + } + } + setState(766); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 51, _ctx); + } + setState(768); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 52, _ctx)) { + case 1: + { + setState(767); + match(BANG); + } + break; + } + setState(792); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 57, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + { + setState(776); + _errHandler.sync(this); + switch (_input.LA(1)) { + case DOT: + case INTERR: + { + setState(770); + member_access(); + } + break; + case OPEN_PARENS: + { + setState(771); + method_invocation(); + } + break; + case OP_INC: + { + setState(772); + match(OP_INC); + } + break; + case OP_DEC: + { + setState(773); + match(OP_DEC); + } + break; + case OP_PTR: + { + setState(774); + match(OP_PTR); + setState(775); + identifier(); + } + break; + default: + throw new NoViableAltException(this); + } + setState(779); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 54, _ctx)) { + case 1: + { + setState(778); + match(BANG); + } + break; + } + } + setState(784); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 55, _ctx); + while ( + _alt != 2 && + _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(781); + bracket_expression(); + } + } + } + setState(786); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 55, _ctx); + } + setState(788); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 56, _ctx)) { + case 1: + { + setState(787); + match(BANG); + } + break; + } + } + } + } + setState(794); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 57, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Primary_expression_startContext + extends ParserRuleContext { + + public Primary_expression_startContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_primary_expression_start; + } + + public Primary_expression_startContext() {} + + public void copyFrom(Primary_expression_startContext ctx) { + super.copyFrom(ctx); + } + } + + public static class LiteralAccessExpressionContext + extends Primary_expression_startContext { + + public TerminalNode LITERAL_ACCESS() { + return getToken(CSharpParser.LITERAL_ACCESS, 0); + } + + public LiteralAccessExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLiteralAccessExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLiteralAccessExpression(this); + } + } + + public static class DefaultValueExpressionContext + extends Primary_expression_startContext { + + public TerminalNode DEFAULT() { + return getToken(CSharpParser.DEFAULT, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public DefaultValueExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterDefaultValueExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitDefaultValueExpression(this); + } + } + + public static class BaseAccessExpressionContext + extends Primary_expression_startContext { + + public TerminalNode BASE() { + return getToken(CSharpParser.BASE, 0); + } + + public TerminalNode DOT() { + return getToken(CSharpParser.DOT, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode OPEN_BRACKET() { + return getToken(CSharpParser.OPEN_BRACKET, 0); + } + + public Expression_listContext expression_list() { + return getRuleContext(Expression_listContext.class, 0); + } + + public TerminalNode CLOSE_BRACKET() { + return getToken(CSharpParser.CLOSE_BRACKET, 0); + } + + public Type_argument_listContext type_argument_list() { + return getRuleContext(Type_argument_listContext.class, 0); + } + + public BaseAccessExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterBaseAccessExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitBaseAccessExpression(this); + } + } + + public static class SizeofExpressionContext + extends Primary_expression_startContext { + + public TerminalNode SIZEOF() { + return getToken(CSharpParser.SIZEOF, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public SizeofExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSizeofExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSizeofExpression(this); + } + } + + public static class ParenthesisExpressionsContext + extends Primary_expression_startContext { + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public ParenthesisExpressionsContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterParenthesisExpressions(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitParenthesisExpressions(this); + } + } + + public static class ThisReferenceExpressionContext + extends Primary_expression_startContext { + + public TerminalNode THIS() { + return getToken(CSharpParser.THIS, 0); + } + + public ThisReferenceExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterThisReferenceExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitThisReferenceExpression(this); + } + } + + public static class ObjectCreationExpressionContext + extends Primary_expression_startContext { + + public TerminalNode NEW() { + return getToken(CSharpParser.NEW, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public Anonymous_object_initializerContext anonymous_object_initializer() { + return getRuleContext(Anonymous_object_initializerContext.class, 0); + } + + public List rank_specifier() { + return getRuleContexts(Rank_specifierContext.class); + } + + public Rank_specifierContext rank_specifier(int i) { + return getRuleContext(Rank_specifierContext.class, i); + } + + public Array_initializerContext array_initializer() { + return getRuleContext(Array_initializerContext.class, 0); + } + + public Object_creation_expressionContext object_creation_expression() { + return getRuleContext(Object_creation_expressionContext.class, 0); + } + + public Object_or_collection_initializerContext object_or_collection_initializer() { + return getRuleContext(Object_or_collection_initializerContext.class, 0); + } + + public TerminalNode OPEN_BRACKET() { + return getToken(CSharpParser.OPEN_BRACKET, 0); + } + + public Expression_listContext expression_list() { + return getRuleContext(Expression_listContext.class, 0); + } + + public TerminalNode CLOSE_BRACKET() { + return getToken(CSharpParser.CLOSE_BRACKET, 0); + } + + public ObjectCreationExpressionContext( + Primary_expression_startContext ctx + ) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterObjectCreationExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitObjectCreationExpression(this); + } + } + + public static class AnonymousMethodExpressionContext + extends Primary_expression_startContext { + + public TerminalNode DELEGATE() { + return getToken(CSharpParser.DELEGATE, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public TerminalNode ASYNC() { + return getToken(CSharpParser.ASYNC, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Explicit_anonymous_function_parameter_listContext explicit_anonymous_function_parameter_list() { + return getRuleContext( + Explicit_anonymous_function_parameter_listContext.class, + 0 + ); + } + + public AnonymousMethodExpressionContext( + Primary_expression_startContext ctx + ) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAnonymousMethodExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAnonymousMethodExpression(this); + } + } + + public static class TypeofExpressionContext + extends Primary_expression_startContext { + + public TerminalNode TYPEOF() { + return getToken(CSharpParser.TYPEOF, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Unbound_type_nameContext unbound_type_name() { + return getRuleContext(Unbound_type_nameContext.class, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public TerminalNode VOID() { + return getToken(CSharpParser.VOID, 0); + } + + public TypeofExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterTypeofExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitTypeofExpression(this); + } + } + + public static class TupleExpressionContext + extends Primary_expression_startContext { + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public List argument() { + return getRuleContexts(ArgumentContext.class); + } + + public ArgumentContext argument(int i) { + return getRuleContext(ArgumentContext.class, i); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public TupleExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterTupleExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitTupleExpression(this); + } + } + + public static class UncheckedExpressionContext + extends Primary_expression_startContext { + + public TerminalNode UNCHECKED() { + return getToken(CSharpParser.UNCHECKED, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public UncheckedExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterUncheckedExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitUncheckedExpression(this); + } + } + + public static class SimpleNameExpressionContext + extends Primary_expression_startContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Type_argument_listContext type_argument_list() { + return getRuleContext(Type_argument_listContext.class, 0); + } + + public SimpleNameExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSimpleNameExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSimpleNameExpression(this); + } + } + + public static class MemberAccessExpressionContext + extends Primary_expression_startContext { + + public Predefined_typeContext predefined_type() { + return getRuleContext(Predefined_typeContext.class, 0); + } + + public Qualified_alias_memberContext qualified_alias_member() { + return getRuleContext(Qualified_alias_memberContext.class, 0); + } + + public MemberAccessExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMemberAccessExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMemberAccessExpression(this); + } + } + + public static class CheckedExpressionContext + extends Primary_expression_startContext { + + public TerminalNode CHECKED() { + return getToken(CSharpParser.CHECKED, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public CheckedExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterCheckedExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitCheckedExpression(this); + } + } + + public static class LiteralExpressionContext + extends Primary_expression_startContext { + + public LiteralContext literal() { + return getRuleContext(LiteralContext.class, 0); + } + + public LiteralExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLiteralExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLiteralExpression(this); + } + } + + public static class NameofExpressionContext + extends Primary_expression_startContext { + + public TerminalNode NAMEOF() { + return getToken(CSharpParser.NAMEOF, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class, i); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public List DOT() { + return getTokens(CSharpParser.DOT); + } + + public TerminalNode DOT(int i) { + return getToken(CSharpParser.DOT, i); + } + + public NameofExpressionContext(Primary_expression_startContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterNameofExpression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitNameofExpression(this); + } + } + + public final Primary_expression_startContext primary_expression_start() + throws RecognitionException { + Primary_expression_startContext _localctx = + new Primary_expression_startContext(_ctx, getState()); + enterRule(_localctx, 72, RULE_primary_expression_start); + int _la; + try { + int _alt; + setState(916); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 73, _ctx)) { + case 1: + _localctx = new LiteralExpressionContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(795); + literal(); + } + break; + case 2: + _localctx = new SimpleNameExpressionContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(796); + identifier(); + setState(798); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 58, _ctx)) { + case 1: + { + setState(797); + type_argument_list(); + } + break; + } + } + break; + case 3: + _localctx = new ParenthesisExpressionsContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(800); + match(OPEN_PARENS); + setState(801); + expression(); + setState(802); + match(CLOSE_PARENS); + } + break; + case 4: + _localctx = new MemberAccessExpressionContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(804); + predefined_type(); + } + break; + case 5: + _localctx = new MemberAccessExpressionContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(805); + qualified_alias_member(); + } + break; + case 6: + _localctx = new LiteralAccessExpressionContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(806); + match(LITERAL_ACCESS); + } + break; + case 7: + _localctx = new ThisReferenceExpressionContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(807); + match(THIS); + } + break; + case 8: + _localctx = new BaseAccessExpressionContext(_localctx); + enterOuterAlt(_localctx, 8); + { + setState(808); + match(BASE); + setState(818); + _errHandler.sync(this); + switch (_input.LA(1)) { + case DOT: + { + setState(809); + match(DOT); + setState(810); + identifier(); + setState(812); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 59, _ctx)) { + case 1: + { + setState(811); + type_argument_list(); + } + break; + } + } + break; + case OPEN_BRACKET: + { + setState(814); + match(OPEN_BRACKET); + setState(815); + expression_list(); + setState(816); + match(CLOSE_BRACKET); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + case 9: + _localctx = new ObjectCreationExpressionContext(_localctx); + enterOuterAlt(_localctx, 9); + { + setState(820); + match(NEW); + setState(849); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BOOL: + case BY: + case BYTE: + case CHAR: + case DECIMAL: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case STRING: + case UINT: + case ULONG: + case UNMANAGED: + case USHORT: + case VAR: + case VOID: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case OPEN_PARENS: + { + setState(821); + type_(); + setState(843); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 64, _ctx)) { + case 1: + { + setState(822); + object_creation_expression(); + } + break; + case 2: + { + setState(823); + object_or_collection_initializer(); + } + break; + case 3: + { + setState(824); + match(OPEN_BRACKET); + setState(825); + expression_list(); + setState(826); + match(CLOSE_BRACKET); + setState(830); + _errHandler.sync(this); + _alt = + getInterpreter().adaptivePredict(_input, 61, _ctx); + while ( + _alt != 2 && + _alt != + org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(827); + rank_specifier(); + } + } + } + setState(832); + _errHandler.sync(this); + _alt = + getInterpreter().adaptivePredict(_input, 61, _ctx); + } + setState(834); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACE) { + { + setState(833); + array_initializer(); + } + } + } + break; + case 4: + { + setState(837); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(836); + rank_specifier(); + } + } + setState(839); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == OPEN_BRACKET); + setState(841); + array_initializer(); + } + break; + } + } + break; + case OPEN_BRACE: + { + setState(845); + anonymous_object_initializer(); + } + break; + case OPEN_BRACKET: + { + setState(846); + rank_specifier(); + setState(847); + array_initializer(); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + case 10: + _localctx = new TupleExpressionContext(_localctx); + enterOuterAlt(_localctx, 10); + { + setState(851); + match(OPEN_PARENS); + setState(852); + argument(); + setState(855); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(853); + match(COMMA); + setState(854); + argument(); + } + } + setState(857); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == COMMA); + setState(859); + match(CLOSE_PARENS); + } + break; + case 11: + _localctx = new TypeofExpressionContext(_localctx); + enterOuterAlt(_localctx, 11); + { + setState(861); + match(TYPEOF); + setState(862); + match(OPEN_PARENS); + setState(866); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 67, _ctx)) { + case 1: + { + setState(863); + unbound_type_name(); + } + break; + case 2: + { + setState(864); + type_(); + } + break; + case 3: + { + setState(865); + match(VOID); + } + break; + } + setState(868); + match(CLOSE_PARENS); + } + break; + case 12: + _localctx = new CheckedExpressionContext(_localctx); + enterOuterAlt(_localctx, 12); + { + setState(869); + match(CHECKED); + setState(870); + match(OPEN_PARENS); + setState(871); + expression(); + setState(872); + match(CLOSE_PARENS); + } + break; + case 13: + _localctx = new UncheckedExpressionContext(_localctx); + enterOuterAlt(_localctx, 13); + { + setState(874); + match(UNCHECKED); + setState(875); + match(OPEN_PARENS); + setState(876); + expression(); + setState(877); + match(CLOSE_PARENS); + } + break; + case 14: + _localctx = new DefaultValueExpressionContext(_localctx); + enterOuterAlt(_localctx, 14); + { + setState(879); + match(DEFAULT); + setState(884); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 68, _ctx)) { + case 1: + { + setState(880); + match(OPEN_PARENS); + setState(881); + type_(); + setState(882); + match(CLOSE_PARENS); + } + break; + } + } + break; + case 15: + _localctx = new AnonymousMethodExpressionContext(_localctx); + enterOuterAlt(_localctx, 15); + { + setState(887); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == ASYNC) { + { + setState(886); + match(ASYNC); + } + } + + setState(889); + match(DELEGATE); + setState(895); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_PARENS) { + { + setState(890); + match(OPEN_PARENS); + setState(892); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 10)) & ~0x3f) == 0 && + ((1L << (_la - 10)) & + ((1L << (ADD - 10)) | + (1L << (ALIAS - 10)) | + (1L << (ARGLIST - 10)) | + (1L << (ASCENDING - 10)) | + (1L << (ASYNC - 10)) | + (1L << (AWAIT - 10)) | + (1L << (BOOL - 10)) | + (1L << (BY - 10)) | + (1L << (BYTE - 10)) | + (1L << (CHAR - 10)) | + (1L << (DECIMAL - 10)) | + (1L << (DESCENDING - 10)) | + (1L << (DOUBLE - 10)) | + (1L << (DYNAMIC - 10)) | + (1L << (EQUALS - 10)) | + (1L << (FLOAT - 10)) | + (1L << (FROM - 10)) | + (1L << (GET - 10)) | + (1L << (GROUP - 10)) | + (1L << (IN - 10)) | + (1L << (INT - 10)) | + (1L << (INTO - 10)) | + (1L << (JOIN - 10)) | + (1L << (LET - 10)) | + (1L << (LONG - 10)) | + (1L << (NAMEOF - 10)) | + (1L << (OBJECT - 10)) | + (1L << (ON - 10)) | + (1L << (ORDERBY - 10)) | + (1L << (OUT - 10)))) != + 0) || + ((((_la - 75)) & ~0x3f) == 0 && + ((1L << (_la - 75)) & + ((1L << (PARTIAL - 75)) | + (1L << (REF - 75)) | + (1L << (REMOVE - 75)) | + (1L << (SBYTE - 75)) | + (1L << (SELECT - 75)) | + (1L << (SET - 75)) | + (1L << (SHORT - 75)) | + (1L << (STRING - 75)) | + (1L << (UINT - 75)) | + (1L << (ULONG - 75)) | + (1L << (UNMANAGED - 75)) | + (1L << (USHORT - 75)) | + (1L << (VAR - 75)) | + (1L << (VOID - 75)) | + (1L << (WHEN - 75)) | + (1L << (WHERE - 75)) | + (1L << (YIELD - 75)) | + (1L << (IDENTIFIER - 75)) | + (1L << (OPEN_PARENS - 75)))) != + 0) + ) { + { + setState(891); + explicit_anonymous_function_parameter_list(); + } + } + + setState(894); + match(CLOSE_PARENS); + } + } + + setState(897); + block(); + } + break; + case 16: + _localctx = new SizeofExpressionContext(_localctx); + enterOuterAlt(_localctx, 16); + { + setState(898); + match(SIZEOF); + setState(899); + match(OPEN_PARENS); + setState(900); + type_(); + setState(901); + match(CLOSE_PARENS); + } + break; + case 17: + _localctx = new NameofExpressionContext(_localctx); + enterOuterAlt(_localctx, 17); + { + setState(903); + match(NAMEOF); + setState(904); + match(OPEN_PARENS); + setState(910); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 72, _ctx); + while ( + _alt != 2 && + _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(905); + identifier(); + setState(906); + match(DOT); + } + } + } + setState(912); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 72, _ctx); + } + setState(913); + identifier(); + setState(914); + match(CLOSE_PARENS); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Throwable_expressionContext extends ParserRuleContext { + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Throw_expressionContext throw_expression() { + return getRuleContext(Throw_expressionContext.class, 0); + } + + public Throwable_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_throwable_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterThrowable_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitThrowable_expression(this); + } + } + + public final Throwable_expressionContext throwable_expression() + throws RecognitionException { + Throwable_expressionContext _localctx = new Throwable_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 74, RULE_throwable_expression); + try { + setState(920); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REF: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case THIS: + case TRUE: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case USHORT: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + enterOuterAlt(_localctx, 1); + { + setState(918); + expression(); + } + break; + case THROW: + enterOuterAlt(_localctx, 2); + { + setState(919); + throw_expression(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Throw_expressionContext extends ParserRuleContext { + + public TerminalNode THROW() { + return getToken(CSharpParser.THROW, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Throw_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_throw_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterThrow_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitThrow_expression(this); + } + } + + public final Throw_expressionContext throw_expression() + throws RecognitionException { + Throw_expressionContext _localctx = new Throw_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 76, RULE_throw_expression); + try { + enterOuterAlt(_localctx, 1); + { + setState(922); + match(THROW); + setState(923); + expression(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Member_accessContext extends ParserRuleContext { + + public TerminalNode DOT() { + return getToken(CSharpParser.DOT, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode INTERR() { + return getToken(CSharpParser.INTERR, 0); + } + + public Type_argument_listContext type_argument_list() { + return getRuleContext(Type_argument_listContext.class, 0); + } + + public Member_accessContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_member_access; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMember_access(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMember_access(this); + } + } + + public final Member_accessContext member_access() + throws RecognitionException { + Member_accessContext _localctx = new Member_accessContext(_ctx, getState()); + enterRule(_localctx, 78, RULE_member_access); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(926); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == INTERR) { + { + setState(925); + match(INTERR); + } + } + + setState(928); + match(DOT); + setState(929); + identifier(); + setState(931); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 76, _ctx)) { + case 1: + { + setState(930); + type_argument_list(); + } + break; + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Bracket_expressionContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACKET() { + return getToken(CSharpParser.OPEN_BRACKET, 0); + } + + public List indexer_argument() { + return getRuleContexts(Indexer_argumentContext.class); + } + + public Indexer_argumentContext indexer_argument(int i) { + return getRuleContext(Indexer_argumentContext.class, i); + } + + public TerminalNode CLOSE_BRACKET() { + return getToken(CSharpParser.CLOSE_BRACKET, 0); + } + + public TerminalNode INTERR() { + return getToken(CSharpParser.INTERR, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Bracket_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_bracket_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterBracket_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitBracket_expression(this); + } + } + + public final Bracket_expressionContext bracket_expression() + throws RecognitionException { + Bracket_expressionContext _localctx = new Bracket_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 80, RULE_bracket_expression); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(934); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == INTERR) { + { + setState(933); + match(INTERR); + } + } + + setState(936); + match(OPEN_BRACKET); + setState(937); + indexer_argument(); + setState(942); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(938); + match(COMMA); + setState(939); + indexer_argument(); + } + } + setState(944); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(945); + match(CLOSE_BRACKET); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Indexer_argumentContext extends ParserRuleContext { + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public Indexer_argumentContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_indexer_argument; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterIndexer_argument(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitIndexer_argument(this); + } + } + + public final Indexer_argumentContext indexer_argument() + throws RecognitionException { + Indexer_argumentContext _localctx = new Indexer_argumentContext( + _ctx, + getState() + ); + enterRule(_localctx, 82, RULE_indexer_argument); + try { + enterOuterAlt(_localctx, 1); + { + setState(950); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 79, _ctx)) { + case 1: + { + setState(947); + identifier(); + setState(948); + match(COLON); + } + break; + } + setState(952); + expression(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Predefined_typeContext extends ParserRuleContext { + + public TerminalNode BOOL() { + return getToken(CSharpParser.BOOL, 0); + } + + public TerminalNode BYTE() { + return getToken(CSharpParser.BYTE, 0); + } + + public TerminalNode CHAR() { + return getToken(CSharpParser.CHAR, 0); + } + + public TerminalNode DECIMAL() { + return getToken(CSharpParser.DECIMAL, 0); + } + + public TerminalNode DOUBLE() { + return getToken(CSharpParser.DOUBLE, 0); + } + + public TerminalNode FLOAT() { + return getToken(CSharpParser.FLOAT, 0); + } + + public TerminalNode INT() { + return getToken(CSharpParser.INT, 0); + } + + public TerminalNode LONG() { + return getToken(CSharpParser.LONG, 0); + } + + public TerminalNode OBJECT() { + return getToken(CSharpParser.OBJECT, 0); + } + + public TerminalNode SBYTE() { + return getToken(CSharpParser.SBYTE, 0); + } + + public TerminalNode SHORT() { + return getToken(CSharpParser.SHORT, 0); + } + + public TerminalNode STRING() { + return getToken(CSharpParser.STRING, 0); + } + + public TerminalNode UINT() { + return getToken(CSharpParser.UINT, 0); + } + + public TerminalNode ULONG() { + return getToken(CSharpParser.ULONG, 0); + } + + public TerminalNode USHORT() { + return getToken(CSharpParser.USHORT, 0); + } + + public Predefined_typeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_predefined_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterPredefined_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitPredefined_type(this); + } + } + + public final Predefined_typeContext predefined_type() + throws RecognitionException { + Predefined_typeContext _localctx = new Predefined_typeContext( + _ctx, + getState() + ); + enterRule(_localctx, 84, RULE_predefined_type); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(954); + _la = _input.LA(1); + if ( + !((((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << BOOL) | + (1L << BYTE) | + (1L << CHAR) | + (1L << DECIMAL) | + (1L << DOUBLE) | + (1L << FLOAT) | + (1L << INT) | + (1L << LONG))) != + 0) || + ((((_la - 68)) & ~0x3f) == 0 && + ((1L << (_la - 68)) & + ((1L << (OBJECT - 68)) | + (1L << (SBYTE - 68)) | + (1L << (SHORT - 68)) | + (1L << (STRING - 68)) | + (1L << (UINT - 68)) | + (1L << (ULONG - 68)) | + (1L << (USHORT - 68)))) != + 0)) + ) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Expression_listContext extends ParserRuleContext { + + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Expression_listContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_expression_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterExpression_list(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitExpression_list(this); + } + } + + public final Expression_listContext expression_list() + throws RecognitionException { + Expression_listContext _localctx = new Expression_listContext( + _ctx, + getState() + ); + enterRule(_localctx, 86, RULE_expression_list); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(956); + expression(); + setState(961); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(957); + match(COMMA); + setState(958); + expression(); + } + } + setState(963); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Object_or_collection_initializerContext + extends ParserRuleContext { + + public Object_initializerContext object_initializer() { + return getRuleContext(Object_initializerContext.class, 0); + } + + public Collection_initializerContext collection_initializer() { + return getRuleContext(Collection_initializerContext.class, 0); + } + + public Object_or_collection_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_object_or_collection_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterObject_or_collection_initializer( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitObject_or_collection_initializer( + this + ); + } + } + + public final Object_or_collection_initializerContext object_or_collection_initializer() + throws RecognitionException { + Object_or_collection_initializerContext _localctx = + new Object_or_collection_initializerContext(_ctx, getState()); + enterRule(_localctx, 88, RULE_object_or_collection_initializer); + try { + setState(966); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 81, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(964); + object_initializer(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(965); + collection_initializer(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Object_initializerContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public Member_initializer_listContext member_initializer_list() { + return getRuleContext(Member_initializer_listContext.class, 0); + } + + public TerminalNode COMMA() { + return getToken(CSharpParser.COMMA, 0); + } + + public Object_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_object_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterObject_initializer(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitObject_initializer(this); + } + } + + public final Object_initializerContext object_initializer() + throws RecognitionException { + Object_initializerContext _localctx = new Object_initializerContext( + _ctx, + getState() + ); + enterRule(_localctx, 90, RULE_object_initializer); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(968); + match(OPEN_BRACE); + setState(973); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BY) | + (1L << DESCENDING) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (OPEN_BRACKET - 64)))) != + 0) + ) { + { + setState(969); + member_initializer_list(); + setState(971); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(970); + match(COMMA); + } + } + } + } + + setState(975); + match(CLOSE_BRACE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Member_initializer_listContext extends ParserRuleContext { + + public List member_initializer() { + return getRuleContexts(Member_initializerContext.class); + } + + public Member_initializerContext member_initializer(int i) { + return getRuleContext(Member_initializerContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Member_initializer_listContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_member_initializer_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMember_initializer_list(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMember_initializer_list(this); + } + } + + public final Member_initializer_listContext member_initializer_list() + throws RecognitionException { + Member_initializer_listContext _localctx = + new Member_initializer_listContext(_ctx, getState()); + enterRule(_localctx, 92, RULE_member_initializer_list); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(977); + member_initializer(); + setState(982); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 84, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(978); + match(COMMA); + setState(979); + member_initializer(); + } + } + } + setState(984); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 84, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Member_initializerContext extends ParserRuleContext { + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public Initializer_valueContext initializer_value() { + return getRuleContext(Initializer_valueContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode OPEN_BRACKET() { + return getToken(CSharpParser.OPEN_BRACKET, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_BRACKET() { + return getToken(CSharpParser.CLOSE_BRACKET, 0); + } + + public Member_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_member_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMember_initializer(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMember_initializer(this); + } + } + + public final Member_initializerContext member_initializer() + throws RecognitionException { + Member_initializerContext _localctx = new Member_initializerContext( + _ctx, + getState() + ); + enterRule(_localctx, 94, RULE_member_initializer); + try { + enterOuterAlt(_localctx, 1); + { + setState(990); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BY: + case DESCENDING: + case DYNAMIC: + case EQUALS: + case FROM: + case GET: + case GROUP: + case INTO: + case JOIN: + case LET: + case NAMEOF: + case ON: + case ORDERBY: + case PARTIAL: + case REMOVE: + case SELECT: + case SET: + case UNMANAGED: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + { + setState(985); + identifier(); + } + break; + case OPEN_BRACKET: + { + setState(986); + match(OPEN_BRACKET); + setState(987); + expression(); + setState(988); + match(CLOSE_BRACKET); + } + break; + default: + throw new NoViableAltException(this); + } + setState(992); + match(ASSIGNMENT); + setState(993); + initializer_value(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Initializer_valueContext extends ParserRuleContext { + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Object_or_collection_initializerContext object_or_collection_initializer() { + return getRuleContext(Object_or_collection_initializerContext.class, 0); + } + + public Initializer_valueContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_initializer_value; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInitializer_value(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInitializer_value(this); + } + } + + public final Initializer_valueContext initializer_value() + throws RecognitionException { + Initializer_valueContext _localctx = new Initializer_valueContext( + _ctx, + getState() + ); + enterRule(_localctx, 96, RULE_initializer_value); + try { + setState(997); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REF: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case THIS: + case TRUE: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case USHORT: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + enterOuterAlt(_localctx, 1); + { + setState(995); + expression(); + } + break; + case OPEN_BRACE: + enterOuterAlt(_localctx, 2); + { + setState(996); + object_or_collection_initializer(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Collection_initializerContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public List element_initializer() { + return getRuleContexts(Element_initializerContext.class); + } + + public Element_initializerContext element_initializer(int i) { + return getRuleContext(Element_initializerContext.class, i); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Collection_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_collection_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterCollection_initializer(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitCollection_initializer(this); + } + } + + public final Collection_initializerContext collection_initializer() + throws RecognitionException { + Collection_initializerContext _localctx = new Collection_initializerContext( + _ctx, + getState() + ); + enterRule(_localctx, 98, RULE_collection_initializer); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(999); + match(OPEN_BRACE); + setState(1000); + element_initializer(); + setState(1005); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 87, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(1001); + match(COMMA); + setState(1002); + element_initializer(); + } + } + } + setState(1007); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 87, _ctx); + } + setState(1009); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(1008); + match(COMMA); + } + } + + setState(1011); + match(CLOSE_BRACE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Element_initializerContext extends ParserRuleContext { + + public Non_assignment_expressionContext non_assignment_expression() { + return getRuleContext(Non_assignment_expressionContext.class, 0); + } + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public Expression_listContext expression_list() { + return getRuleContext(Expression_listContext.class, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public Element_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_element_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterElement_initializer(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitElement_initializer(this); + } + } + + public final Element_initializerContext element_initializer() + throws RecognitionException { + Element_initializerContext _localctx = new Element_initializerContext( + _ctx, + getState() + ); + enterRule(_localctx, 100, RULE_element_initializer); + try { + setState(1018); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case THIS: + case TRUE: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case USHORT: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + enterOuterAlt(_localctx, 1); + { + setState(1013); + non_assignment_expression(); + } + break; + case OPEN_BRACE: + enterOuterAlt(_localctx, 2); + { + setState(1014); + match(OPEN_BRACE); + setState(1015); + expression_list(); + setState(1016); + match(CLOSE_BRACE); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Anonymous_object_initializerContext + extends ParserRuleContext { + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public Member_declarator_listContext member_declarator_list() { + return getRuleContext(Member_declarator_listContext.class, 0); + } + + public TerminalNode COMMA() { + return getToken(CSharpParser.COMMA, 0); + } + + public Anonymous_object_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_anonymous_object_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAnonymous_object_initializer( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAnonymous_object_initializer( + this + ); + } + } + + public final Anonymous_object_initializerContext anonymous_object_initializer() + throws RecognitionException { + Anonymous_object_initializerContext _localctx = + new Anonymous_object_initializerContext(_ctx, getState()); + enterRule(_localctx, 102, RULE_anonymous_object_initializer); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1020); + match(OPEN_BRACE); + setState(1025); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 10)) & ~0x3f) == 0 && + ((1L << (_la - 10)) & + ((1L << (ADD - 10)) | + (1L << (ALIAS - 10)) | + (1L << (ARGLIST - 10)) | + (1L << (ASCENDING - 10)) | + (1L << (ASYNC - 10)) | + (1L << (AWAIT - 10)) | + (1L << (BASE - 10)) | + (1L << (BOOL - 10)) | + (1L << (BY - 10)) | + (1L << (BYTE - 10)) | + (1L << (CHAR - 10)) | + (1L << (CHECKED - 10)) | + (1L << (DECIMAL - 10)) | + (1L << (DEFAULT - 10)) | + (1L << (DELEGATE - 10)) | + (1L << (DESCENDING - 10)) | + (1L << (DOUBLE - 10)) | + (1L << (DYNAMIC - 10)) | + (1L << (EQUALS - 10)) | + (1L << (FALSE - 10)) | + (1L << (FLOAT - 10)) | + (1L << (FROM - 10)) | + (1L << (GET - 10)) | + (1L << (GROUP - 10)) | + (1L << (INT - 10)) | + (1L << (INTO - 10)) | + (1L << (JOIN - 10)) | + (1L << (LET - 10)) | + (1L << (LONG - 10)) | + (1L << (NAMEOF - 10)) | + (1L << (NEW - 10)) | + (1L << (NULL_ - 10)) | + (1L << (OBJECT - 10)) | + (1L << (ON - 10)) | + (1L << (ORDERBY - 10)))) != + 0) || + ((((_la - 75)) & ~0x3f) == 0 && + ((1L << (_la - 75)) & + ((1L << (PARTIAL - 75)) | + (1L << (REMOVE - 75)) | + (1L << (SBYTE - 75)) | + (1L << (SELECT - 75)) | + (1L << (SET - 75)) | + (1L << (SHORT - 75)) | + (1L << (SIZEOF - 75)) | + (1L << (STRING - 75)) | + (1L << (THIS - 75)) | + (1L << (TRUE - 75)) | + (1L << (TYPEOF - 75)) | + (1L << (UINT - 75)) | + (1L << (ULONG - 75)) | + (1L << (UNCHECKED - 75)) | + (1L << (UNMANAGED - 75)) | + (1L << (USHORT - 75)) | + (1L << (VAR - 75)) | + (1L << (WHEN - 75)) | + (1L << (WHERE - 75)) | + (1L << (YIELD - 75)) | + (1L << (IDENTIFIER - 75)) | + (1L << (LITERAL_ACCESS - 75)) | + (1L << (INTEGER_LITERAL - 75)) | + (1L << (HEX_INTEGER_LITERAL - 75)) | + (1L << (BIN_INTEGER_LITERAL - 75)) | + (1L << (REAL_LITERAL - 75)) | + (1L << (CHARACTER_LITERAL - 75)) | + (1L << (REGULAR_STRING - 75)) | + (1L << (VERBATIUM_STRING - 75)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 75)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 75)) | + (1L << (OPEN_PARENS - 75)))) != + 0) + ) { + { + setState(1021); + member_declarator_list(); + setState(1023); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(1022); + match(COMMA); + } + } + } + } + + setState(1027); + match(CLOSE_BRACE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Member_declarator_listContext extends ParserRuleContext { + + public List member_declarator() { + return getRuleContexts(Member_declaratorContext.class); + } + + public Member_declaratorContext member_declarator(int i) { + return getRuleContext(Member_declaratorContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Member_declarator_listContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_member_declarator_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMember_declarator_list(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMember_declarator_list(this); + } + } + + public final Member_declarator_listContext member_declarator_list() + throws RecognitionException { + Member_declarator_listContext _localctx = new Member_declarator_listContext( + _ctx, + getState() + ); + enterRule(_localctx, 104, RULE_member_declarator_list); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1029); + member_declarator(); + setState(1034); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 92, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(1030); + match(COMMA); + setState(1031); + member_declarator(); + } + } + } + setState(1036); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 92, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Member_declaratorContext extends ParserRuleContext { + + public Primary_expressionContext primary_expression() { + return getRuleContext(Primary_expressionContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Member_declaratorContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_member_declarator; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMember_declarator(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMember_declarator(this); + } + } + + public final Member_declaratorContext member_declarator() + throws RecognitionException { + Member_declaratorContext _localctx = new Member_declaratorContext( + _ctx, + getState() + ); + enterRule(_localctx, 106, RULE_member_declarator); + try { + setState(1042); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 93, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1037); + primary_expression(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1038); + identifier(); + setState(1039); + match(ASSIGNMENT); + setState(1040); + expression(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Unbound_type_nameContext extends ParserRuleContext { + + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class, i); + } + + public TerminalNode DOUBLE_COLON() { + return getToken(CSharpParser.DOUBLE_COLON, 0); + } + + public List DOT() { + return getTokens(CSharpParser.DOT); + } + + public TerminalNode DOT(int i) { + return getToken(CSharpParser.DOT, i); + } + + public List< + Generic_dimension_specifierContext + > generic_dimension_specifier() { + return getRuleContexts(Generic_dimension_specifierContext.class); + } + + public Generic_dimension_specifierContext generic_dimension_specifier( + int i + ) { + return getRuleContext(Generic_dimension_specifierContext.class, i); + } + + public Unbound_type_nameContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_unbound_type_name; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterUnbound_type_name(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitUnbound_type_name(this); + } + } + + public final Unbound_type_nameContext unbound_type_name() + throws RecognitionException { + Unbound_type_nameContext _localctx = new Unbound_type_nameContext( + _ctx, + getState() + ); + enterRule(_localctx, 108, RULE_unbound_type_name); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1044); + identifier(); + setState(1053); + _errHandler.sync(this); + switch (_input.LA(1)) { + case CLOSE_PARENS: + case DOT: + case LT: + { + setState(1046); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(1045); + generic_dimension_specifier(); + } + } + } + break; + case DOUBLE_COLON: + { + setState(1048); + match(DOUBLE_COLON); + setState(1049); + identifier(); + setState(1051); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(1050); + generic_dimension_specifier(); + } + } + } + break; + default: + throw new NoViableAltException(this); + } + setState(1062); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == DOT) { + { + { + setState(1055); + match(DOT); + setState(1056); + identifier(); + setState(1058); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(1057); + generic_dimension_specifier(); + } + } + } + } + setState(1064); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Generic_dimension_specifierContext + extends ParserRuleContext { + + public TerminalNode LT() { + return getToken(CSharpParser.LT, 0); + } + + public TerminalNode GT() { + return getToken(CSharpParser.GT, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Generic_dimension_specifierContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_generic_dimension_specifier; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterGeneric_dimension_specifier( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitGeneric_dimension_specifier(this); + } + } + + public final Generic_dimension_specifierContext generic_dimension_specifier() + throws RecognitionException { + Generic_dimension_specifierContext _localctx = + new Generic_dimension_specifierContext(_ctx, getState()); + enterRule(_localctx, 110, RULE_generic_dimension_specifier); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1065); + match(LT); + setState(1069); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1066); + match(COMMA); + } + } + setState(1071); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1072); + match(GT); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class IsTypeContext extends ParserRuleContext { + + public Base_typeContext base_type() { + return getRuleContext(Base_typeContext.class, 0); + } + + public List rank_specifier() { + return getRuleContexts(Rank_specifierContext.class); + } + + public Rank_specifierContext rank_specifier(int i) { + return getRuleContext(Rank_specifierContext.class, i); + } + + public List STAR() { + return getTokens(CSharpParser.STAR); + } + + public TerminalNode STAR(int i) { + return getToken(CSharpParser.STAR, i); + } + + public TerminalNode INTERR() { + return getToken(CSharpParser.INTERR, 0); + } + + public IsTypePatternArmsContext isTypePatternArms() { + return getRuleContext(IsTypePatternArmsContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public IsTypeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_isType; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterIsType(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitIsType(this); + } + } + + public final IsTypeContext isType() throws RecognitionException { + IsTypeContext _localctx = new IsTypeContext(_ctx, getState()); + enterRule(_localctx, 112, RULE_isType); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1074); + base_type(); + setState(1079); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 101, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + setState(1077); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACKET: + { + setState(1075); + rank_specifier(); + } + break; + case STAR: + { + setState(1076); + match(STAR); + } + break; + default: + throw new NoViableAltException(this); + } + } + } + setState(1081); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 101, _ctx); + } + setState(1083); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 102, _ctx)) { + case 1: + { + setState(1082); + match(INTERR); + } + break; + } + setState(1086); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACE) { + { + setState(1085); + isTypePatternArms(); + } + } + + setState(1089); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 104, _ctx)) { + case 1: + { + setState(1088); + identifier(); + } + break; + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class IsTypePatternArmsContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public List isTypePatternArm() { + return getRuleContexts(IsTypePatternArmContext.class); + } + + public IsTypePatternArmContext isTypePatternArm(int i) { + return getRuleContext(IsTypePatternArmContext.class, i); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public IsTypePatternArmsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_isTypePatternArms; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterIsTypePatternArms(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitIsTypePatternArms(this); + } + } + + public final IsTypePatternArmsContext isTypePatternArms() + throws RecognitionException { + IsTypePatternArmsContext _localctx = new IsTypePatternArmsContext( + _ctx, + getState() + ); + enterRule(_localctx, 114, RULE_isTypePatternArms); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1091); + match(OPEN_BRACE); + setState(1092); + isTypePatternArm(); + setState(1097); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1093); + match(COMMA); + setState(1094); + isTypePatternArm(); + } + } + setState(1099); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1100); + match(CLOSE_BRACE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class IsTypePatternArmContext extends ParserRuleContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public IsTypePatternArmContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_isTypePatternArm; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterIsTypePatternArm(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitIsTypePatternArm(this); + } + } + + public final IsTypePatternArmContext isTypePatternArm() + throws RecognitionException { + IsTypePatternArmContext _localctx = new IsTypePatternArmContext( + _ctx, + getState() + ); + enterRule(_localctx, 116, RULE_isTypePatternArm); + try { + enterOuterAlt(_localctx, 1); + { + setState(1102); + identifier(); + setState(1103); + match(COLON); + setState(1104); + expression(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Lambda_expressionContext extends ParserRuleContext { + + public Anonymous_function_signatureContext anonymous_function_signature() { + return getRuleContext(Anonymous_function_signatureContext.class, 0); + } + + public Right_arrowContext right_arrow() { + return getRuleContext(Right_arrowContext.class, 0); + } + + public Anonymous_function_bodyContext anonymous_function_body() { + return getRuleContext(Anonymous_function_bodyContext.class, 0); + } + + public TerminalNode ASYNC() { + return getToken(CSharpParser.ASYNC, 0); + } + + public Lambda_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_lambda_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLambda_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLambda_expression(this); + } + } + + public final Lambda_expressionContext lambda_expression() + throws RecognitionException { + Lambda_expressionContext _localctx = new Lambda_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 118, RULE_lambda_expression); + try { + enterOuterAlt(_localctx, 1); + { + setState(1107); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 106, _ctx)) { + case 1: + { + setState(1106); + match(ASYNC); + } + break; + } + setState(1109); + anonymous_function_signature(); + setState(1110); + right_arrow(); + setState(1111); + anonymous_function_body(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Anonymous_function_signatureContext + extends ParserRuleContext { + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Explicit_anonymous_function_parameter_listContext explicit_anonymous_function_parameter_list() { + return getRuleContext( + Explicit_anonymous_function_parameter_listContext.class, + 0 + ); + } + + public Implicit_anonymous_function_parameter_listContext implicit_anonymous_function_parameter_list() { + return getRuleContext( + Implicit_anonymous_function_parameter_listContext.class, + 0 + ); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Anonymous_function_signatureContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_anonymous_function_signature; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAnonymous_function_signature( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAnonymous_function_signature( + this + ); + } + } + + public final Anonymous_function_signatureContext anonymous_function_signature() + throws RecognitionException { + Anonymous_function_signatureContext _localctx = + new Anonymous_function_signatureContext(_ctx, getState()); + enterRule(_localctx, 120, RULE_anonymous_function_signature); + try { + setState(1124); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 107, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1113); + match(OPEN_PARENS); + setState(1114); + match(CLOSE_PARENS); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1115); + match(OPEN_PARENS); + setState(1116); + explicit_anonymous_function_parameter_list(); + setState(1117); + match(CLOSE_PARENS); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(1119); + match(OPEN_PARENS); + setState(1120); + implicit_anonymous_function_parameter_list(); + setState(1121); + match(CLOSE_PARENS); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(1123); + identifier(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Explicit_anonymous_function_parameter_listContext + extends ParserRuleContext { + + public List< + Explicit_anonymous_function_parameterContext + > explicit_anonymous_function_parameter() { + return getRuleContexts( + Explicit_anonymous_function_parameterContext.class + ); + } + + public Explicit_anonymous_function_parameterContext explicit_anonymous_function_parameter( + int i + ) { + return getRuleContext( + Explicit_anonymous_function_parameterContext.class, + i + ); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Explicit_anonymous_function_parameter_listContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_explicit_anonymous_function_parameter_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterExplicit_anonymous_function_parameter_list( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitExplicit_anonymous_function_parameter_list( + this + ); + } + } + + public final Explicit_anonymous_function_parameter_listContext explicit_anonymous_function_parameter_list() + throws RecognitionException { + Explicit_anonymous_function_parameter_listContext _localctx = + new Explicit_anonymous_function_parameter_listContext(_ctx, getState()); + enterRule(_localctx, 122, RULE_explicit_anonymous_function_parameter_list); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1126); + explicit_anonymous_function_parameter(); + setState(1131); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1127); + match(COMMA); + setState(1128); + explicit_anonymous_function_parameter(); + } + } + setState(1133); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Explicit_anonymous_function_parameterContext + extends ParserRuleContext { + + public Token refout; + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode REF() { + return getToken(CSharpParser.REF, 0); + } + + public TerminalNode OUT() { + return getToken(CSharpParser.OUT, 0); + } + + public TerminalNode IN() { + return getToken(CSharpParser.IN, 0); + } + + public Explicit_anonymous_function_parameterContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_explicit_anonymous_function_parameter; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterExplicit_anonymous_function_parameter( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitExplicit_anonymous_function_parameter( + this + ); + } + } + + public final Explicit_anonymous_function_parameterContext explicit_anonymous_function_parameter() + throws RecognitionException { + Explicit_anonymous_function_parameterContext _localctx = + new Explicit_anonymous_function_parameterContext(_ctx, getState()); + enterRule(_localctx, 124, RULE_explicit_anonymous_function_parameter); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1135); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 54)) & ~0x3f) == 0 && + ((1L << (_la - 54)) & + ((1L << (IN - 54)) | + (1L << (OUT - 54)) | + (1L << (REF - 54)))) != + 0) + ) { + { + setState(1134); + ((Explicit_anonymous_function_parameterContext) _localctx).refout = + _input.LT(1); + _la = _input.LA(1); + if ( + !(((((_la - 54)) & ~0x3f) == 0 && + ((1L << (_la - 54)) & + ((1L << (IN - 54)) | + (1L << (OUT - 54)) | + (1L << (REF - 54)))) != + 0)) + ) { + ((Explicit_anonymous_function_parameterContext) _localctx).refout = + (Token) _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + + setState(1137); + type_(); + setState(1138); + identifier(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Implicit_anonymous_function_parameter_listContext + extends ParserRuleContext { + + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Implicit_anonymous_function_parameter_listContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_implicit_anonymous_function_parameter_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterImplicit_anonymous_function_parameter_list( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitImplicit_anonymous_function_parameter_list( + this + ); + } + } + + public final Implicit_anonymous_function_parameter_listContext implicit_anonymous_function_parameter_list() + throws RecognitionException { + Implicit_anonymous_function_parameter_listContext _localctx = + new Implicit_anonymous_function_parameter_listContext(_ctx, getState()); + enterRule(_localctx, 126, RULE_implicit_anonymous_function_parameter_list); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1140); + identifier(); + setState(1145); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1141); + match(COMMA); + setState(1142); + identifier(); + } + } + setState(1147); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Anonymous_function_bodyContext extends ParserRuleContext { + + public Throwable_expressionContext throwable_expression() { + return getRuleContext(Throwable_expressionContext.class, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public Anonymous_function_bodyContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_anonymous_function_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAnonymous_function_body(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAnonymous_function_body(this); + } + } + + public final Anonymous_function_bodyContext anonymous_function_body() + throws RecognitionException { + Anonymous_function_bodyContext _localctx = + new Anonymous_function_bodyContext(_ctx, getState()); + enterRule(_localctx, 128, RULE_anonymous_function_body); + try { + setState(1150); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REF: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case THIS: + case THROW: + case TRUE: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case USHORT: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + enterOuterAlt(_localctx, 1); + { + setState(1148); + throwable_expression(); + } + break; + case OPEN_BRACE: + enterOuterAlt(_localctx, 2); + { + setState(1149); + block(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Query_expressionContext extends ParserRuleContext { + + public From_clauseContext from_clause() { + return getRuleContext(From_clauseContext.class, 0); + } + + public Query_bodyContext query_body() { + return getRuleContext(Query_bodyContext.class, 0); + } + + public Query_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_query_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterQuery_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitQuery_expression(this); + } + } + + public final Query_expressionContext query_expression() + throws RecognitionException { + Query_expressionContext _localctx = new Query_expressionContext( + _ctx, + getState() + ); + enterRule(_localctx, 130, RULE_query_expression); + try { + enterOuterAlt(_localctx, 1); + { + setState(1152); + from_clause(); + setState(1153); + query_body(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class From_clauseContext extends ParserRuleContext { + + public TerminalNode FROM() { + return getToken(CSharpParser.FROM, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode IN() { + return getToken(CSharpParser.IN, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public From_clauseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_from_clause; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFrom_clause(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFrom_clause(this); + } + } + + public final From_clauseContext from_clause() throws RecognitionException { + From_clauseContext _localctx = new From_clauseContext(_ctx, getState()); + enterRule(_localctx, 132, RULE_from_clause); + try { + enterOuterAlt(_localctx, 1); + { + setState(1155); + match(FROM); + setState(1157); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 112, _ctx)) { + case 1: + { + setState(1156); + type_(); + } + break; + } + setState(1159); + identifier(); + setState(1160); + match(IN); + setState(1161); + expression(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Query_bodyContext extends ParserRuleContext { + + public Select_or_group_clauseContext select_or_group_clause() { + return getRuleContext(Select_or_group_clauseContext.class, 0); + } + + public List query_body_clause() { + return getRuleContexts(Query_body_clauseContext.class); + } + + public Query_body_clauseContext query_body_clause(int i) { + return getRuleContext(Query_body_clauseContext.class, i); + } + + public Query_continuationContext query_continuation() { + return getRuleContext(Query_continuationContext.class, 0); + } + + public Query_bodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_query_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterQuery_body(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitQuery_body(this); + } + } + + public final Query_bodyContext query_body() throws RecognitionException { + Query_bodyContext _localctx = new Query_bodyContext(_ctx, getState()); + enterRule(_localctx, 134, RULE_query_body); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1166); + _errHandler.sync(this); + _la = _input.LA(1); + while ( + ((((_la - 48)) & ~0x3f) == 0 && + ((1L << (_la - 48)) & + ((1L << (FROM - 48)) | + (1L << (JOIN - 48)) | + (1L << (LET - 48)) | + (1L << (ORDERBY - 48)) | + (1L << (WHERE - 48)))) != + 0) + ) { + { + { + setState(1163); + query_body_clause(); + } + } + setState(1168); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1169); + select_or_group_clause(); + setState(1171); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 114, _ctx)) { + case 1: + { + setState(1170); + query_continuation(); + } + break; + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Query_body_clauseContext extends ParserRuleContext { + + public From_clauseContext from_clause() { + return getRuleContext(From_clauseContext.class, 0); + } + + public Let_clauseContext let_clause() { + return getRuleContext(Let_clauseContext.class, 0); + } + + public Where_clauseContext where_clause() { + return getRuleContext(Where_clauseContext.class, 0); + } + + public Combined_join_clauseContext combined_join_clause() { + return getRuleContext(Combined_join_clauseContext.class, 0); + } + + public Orderby_clauseContext orderby_clause() { + return getRuleContext(Orderby_clauseContext.class, 0); + } + + public Query_body_clauseContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_query_body_clause; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterQuery_body_clause(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitQuery_body_clause(this); + } + } + + public final Query_body_clauseContext query_body_clause() + throws RecognitionException { + Query_body_clauseContext _localctx = new Query_body_clauseContext( + _ctx, + getState() + ); + enterRule(_localctx, 136, RULE_query_body_clause); + try { + setState(1178); + _errHandler.sync(this); + switch (_input.LA(1)) { + case FROM: + enterOuterAlt(_localctx, 1); + { + setState(1173); + from_clause(); + } + break; + case LET: + enterOuterAlt(_localctx, 2); + { + setState(1174); + let_clause(); + } + break; + case WHERE: + enterOuterAlt(_localctx, 3); + { + setState(1175); + where_clause(); + } + break; + case JOIN: + enterOuterAlt(_localctx, 4); + { + setState(1176); + combined_join_clause(); + } + break; + case ORDERBY: + enterOuterAlt(_localctx, 5); + { + setState(1177); + orderby_clause(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Let_clauseContext extends ParserRuleContext { + + public TerminalNode LET() { + return getToken(CSharpParser.LET, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Let_clauseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_let_clause; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLet_clause(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLet_clause(this); + } + } + + public final Let_clauseContext let_clause() throws RecognitionException { + Let_clauseContext _localctx = new Let_clauseContext(_ctx, getState()); + enterRule(_localctx, 138, RULE_let_clause); + try { + enterOuterAlt(_localctx, 1); + { + setState(1180); + match(LET); + setState(1181); + identifier(); + setState(1182); + match(ASSIGNMENT); + setState(1183); + expression(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Where_clauseContext extends ParserRuleContext { + + public TerminalNode WHERE() { + return getToken(CSharpParser.WHERE, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Where_clauseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_where_clause; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterWhere_clause(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitWhere_clause(this); + } + } + + public final Where_clauseContext where_clause() throws RecognitionException { + Where_clauseContext _localctx = new Where_clauseContext(_ctx, getState()); + enterRule(_localctx, 140, RULE_where_clause); + try { + enterOuterAlt(_localctx, 1); + { + setState(1185); + match(WHERE); + setState(1186); + expression(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Combined_join_clauseContext extends ParserRuleContext { + + public TerminalNode JOIN() { + return getToken(CSharpParser.JOIN, 0); + } + + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class, i); + } + + public TerminalNode IN() { + return getToken(CSharpParser.IN, 0); + } + + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class, i); + } + + public TerminalNode ON() { + return getToken(CSharpParser.ON, 0); + } + + public TerminalNode EQUALS() { + return getToken(CSharpParser.EQUALS, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public TerminalNode INTO() { + return getToken(CSharpParser.INTO, 0); + } + + public Combined_join_clauseContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_combined_join_clause; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterCombined_join_clause(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitCombined_join_clause(this); + } + } + + public final Combined_join_clauseContext combined_join_clause() + throws RecognitionException { + Combined_join_clauseContext _localctx = new Combined_join_clauseContext( + _ctx, + getState() + ); + enterRule(_localctx, 142, RULE_combined_join_clause); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1188); + match(JOIN); + setState(1190); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 116, _ctx)) { + case 1: + { + setState(1189); + type_(); + } + break; + } + setState(1192); + identifier(); + setState(1193); + match(IN); + setState(1194); + expression(); + setState(1195); + match(ON); + setState(1196); + expression(); + setState(1197); + match(EQUALS); + setState(1198); + expression(); + setState(1201); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == INTO) { + { + setState(1199); + match(INTO); + setState(1200); + identifier(); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Orderby_clauseContext extends ParserRuleContext { + + public TerminalNode ORDERBY() { + return getToken(CSharpParser.ORDERBY, 0); + } + + public List ordering() { + return getRuleContexts(OrderingContext.class); + } + + public OrderingContext ordering(int i) { + return getRuleContext(OrderingContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Orderby_clauseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_orderby_clause; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterOrderby_clause(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitOrderby_clause(this); + } + } + + public final Orderby_clauseContext orderby_clause() + throws RecognitionException { + Orderby_clauseContext _localctx = new Orderby_clauseContext( + _ctx, + getState() + ); + enterRule(_localctx, 144, RULE_orderby_clause); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1203); + match(ORDERBY); + setState(1204); + ordering(); + setState(1209); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1205); + match(COMMA); + setState(1206); + ordering(); + } + } + setState(1211); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class OrderingContext extends ParserRuleContext { + + public Token dir; + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode ASCENDING() { + return getToken(CSharpParser.ASCENDING, 0); + } + + public TerminalNode DESCENDING() { + return getToken(CSharpParser.DESCENDING, 0); + } + + public OrderingContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_ordering; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterOrdering(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitOrdering(this); + } + } + + public final OrderingContext ordering() throws RecognitionException { + OrderingContext _localctx = new OrderingContext(_ctx, getState()); + enterRule(_localctx, 146, RULE_ordering); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1212); + expression(); + setState(1214); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == ASCENDING || _la == DESCENDING) { + { + setState(1213); + ((OrderingContext) _localctx).dir = _input.LT(1); + _la = _input.LA(1); + if (!(_la == ASCENDING || _la == DESCENDING)) { + ((OrderingContext) _localctx).dir = + (Token) _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Select_or_group_clauseContext extends ParserRuleContext { + + public TerminalNode SELECT() { + return getToken(CSharpParser.SELECT, 0); + } + + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class, i); + } + + public TerminalNode GROUP() { + return getToken(CSharpParser.GROUP, 0); + } + + public TerminalNode BY() { + return getToken(CSharpParser.BY, 0); + } + + public Select_or_group_clauseContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_select_or_group_clause; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSelect_or_group_clause(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSelect_or_group_clause(this); + } + } + + public final Select_or_group_clauseContext select_or_group_clause() + throws RecognitionException { + Select_or_group_clauseContext _localctx = new Select_or_group_clauseContext( + _ctx, + getState() + ); + enterRule(_localctx, 148, RULE_select_or_group_clause); + try { + setState(1223); + _errHandler.sync(this); + switch (_input.LA(1)) { + case SELECT: + enterOuterAlt(_localctx, 1); + { + setState(1216); + match(SELECT); + setState(1217); + expression(); + } + break; + case GROUP: + enterOuterAlt(_localctx, 2); + { + setState(1218); + match(GROUP); + setState(1219); + expression(); + setState(1220); + match(BY); + setState(1221); + expression(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Query_continuationContext extends ParserRuleContext { + + public TerminalNode INTO() { + return getToken(CSharpParser.INTO, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Query_bodyContext query_body() { + return getRuleContext(Query_bodyContext.class, 0); + } + + public Query_continuationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_query_continuation; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterQuery_continuation(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitQuery_continuation(this); + } + } + + public final Query_continuationContext query_continuation() + throws RecognitionException { + Query_continuationContext _localctx = new Query_continuationContext( + _ctx, + getState() + ); + enterRule(_localctx, 150, RULE_query_continuation); + try { + enterOuterAlt(_localctx, 1); + { + setState(1225); + match(INTO); + setState(1226); + identifier(); + setState(1227); + query_body(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class StatementContext extends ParserRuleContext { + + public Labeled_StatementContext labeled_Statement() { + return getRuleContext(Labeled_StatementContext.class, 0); + } + + public DeclarationStatementContext declarationStatement() { + return getRuleContext(DeclarationStatementContext.class, 0); + } + + public Embedded_statementContext embedded_statement() { + return getRuleContext(Embedded_statementContext.class, 0); + } + + public StatementContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_statement; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitStatement(this); + } + } + + public final StatementContext statement() throws RecognitionException { + StatementContext _localctx = new StatementContext(_ctx, getState()); + enterRule(_localctx, 152, RULE_statement); + try { + setState(1232); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 121, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1229); + labeled_Statement(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1230); + declarationStatement(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(1231); + embedded_statement(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class DeclarationStatementContext extends ParserRuleContext { + + public Local_variable_declarationContext local_variable_declaration() { + return getRuleContext(Local_variable_declarationContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Local_constant_declarationContext local_constant_declaration() { + return getRuleContext(Local_constant_declarationContext.class, 0); + } + + public Local_function_declarationContext local_function_declaration() { + return getRuleContext(Local_function_declarationContext.class, 0); + } + + public DeclarationStatementContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_declarationStatement; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterDeclarationStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitDeclarationStatement(this); + } + } + + public final DeclarationStatementContext declarationStatement() + throws RecognitionException { + DeclarationStatementContext _localctx = new DeclarationStatementContext( + _ctx, + getState() + ); + enterRule(_localctx, 154, RULE_declarationStatement); + try { + setState(1241); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 122, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1234); + local_variable_declaration(); + setState(1235); + match(SEMICOLON); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1237); + local_constant_declaration(); + setState(1238); + match(SEMICOLON); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(1240); + local_function_declaration(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Local_function_declarationContext + extends ParserRuleContext { + + public Local_function_headerContext local_function_header() { + return getRuleContext(Local_function_headerContext.class, 0); + } + + public Local_function_bodyContext local_function_body() { + return getRuleContext(Local_function_bodyContext.class, 0); + } + + public Local_function_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_local_function_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLocal_function_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLocal_function_declaration(this); + } + } + + public final Local_function_declarationContext local_function_declaration() + throws RecognitionException { + Local_function_declarationContext _localctx = + new Local_function_declarationContext(_ctx, getState()); + enterRule(_localctx, 156, RULE_local_function_declaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(1243); + local_function_header(); + setState(1244); + local_function_body(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Local_function_headerContext extends ParserRuleContext { + + public Return_typeContext return_type() { + return getRuleContext(Return_typeContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Local_function_modifiersContext local_function_modifiers() { + return getRuleContext(Local_function_modifiersContext.class, 0); + } + + public Type_parameter_listContext type_parameter_list() { + return getRuleContext(Type_parameter_listContext.class, 0); + } + + public Formal_parameter_listContext formal_parameter_list() { + return getRuleContext(Formal_parameter_listContext.class, 0); + } + + public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { + return getRuleContext(Type_parameter_constraints_clausesContext.class, 0); + } + + public Local_function_headerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_local_function_header; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLocal_function_header(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLocal_function_header(this); + } + } + + public final Local_function_headerContext local_function_header() + throws RecognitionException { + Local_function_headerContext _localctx = new Local_function_headerContext( + _ctx, + getState() + ); + enterRule(_localctx, 158, RULE_local_function_header); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1247); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 123, _ctx)) { + case 1: + { + setState(1246); + local_function_modifiers(); + } + break; + } + setState(1249); + return_type(); + setState(1250); + identifier(); + setState(1252); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(1251); + type_parameter_list(); + } + } + + setState(1254); + match(OPEN_PARENS); + setState(1256); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 10)) & ~0x3f) == 0 && + ((1L << (_la - 10)) & + ((1L << (ADD - 10)) | + (1L << (ALIAS - 10)) | + (1L << (ARGLIST - 10)) | + (1L << (ASCENDING - 10)) | + (1L << (ASYNC - 10)) | + (1L << (AWAIT - 10)) | + (1L << (BOOL - 10)) | + (1L << (BY - 10)) | + (1L << (BYTE - 10)) | + (1L << (CHAR - 10)) | + (1L << (DECIMAL - 10)) | + (1L << (DESCENDING - 10)) | + (1L << (DOUBLE - 10)) | + (1L << (DYNAMIC - 10)) | + (1L << (EQUALS - 10)) | + (1L << (FLOAT - 10)) | + (1L << (FROM - 10)) | + (1L << (GET - 10)) | + (1L << (GROUP - 10)) | + (1L << (IN - 10)) | + (1L << (INT - 10)) | + (1L << (INTO - 10)) | + (1L << (JOIN - 10)) | + (1L << (LET - 10)) | + (1L << (LONG - 10)) | + (1L << (NAMEOF - 10)) | + (1L << (OBJECT - 10)) | + (1L << (ON - 10)) | + (1L << (ORDERBY - 10)) | + (1L << (OUT - 10)))) != + 0) || + ((((_la - 74)) & ~0x3f) == 0 && + ((1L << (_la - 74)) & + ((1L << (PARAMS - 74)) | + (1L << (PARTIAL - 74)) | + (1L << (REF - 74)) | + (1L << (REMOVE - 74)) | + (1L << (SBYTE - 74)) | + (1L << (SELECT - 74)) | + (1L << (SET - 74)) | + (1L << (SHORT - 74)) | + (1L << (STRING - 74)) | + (1L << (THIS - 74)) | + (1L << (UINT - 74)) | + (1L << (ULONG - 74)) | + (1L << (UNMANAGED - 74)) | + (1L << (USHORT - 74)) | + (1L << (VAR - 74)) | + (1L << (VOID - 74)) | + (1L << (WHEN - 74)) | + (1L << (WHERE - 74)) | + (1L << (YIELD - 74)) | + (1L << (IDENTIFIER - 74)) | + (1L << (OPEN_BRACKET - 74)) | + (1L << (OPEN_PARENS - 74)))) != + 0) + ) { + { + setState(1255); + formal_parameter_list(); + } + } + + setState(1258); + match(CLOSE_PARENS); + setState(1260); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHERE) { + { + setState(1259); + type_parameter_constraints_clauses(); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Local_function_modifiersContext + extends ParserRuleContext { + + public TerminalNode ASYNC() { + return getToken(CSharpParser.ASYNC, 0); + } + + public TerminalNode UNSAFE() { + return getToken(CSharpParser.UNSAFE, 0); + } + + public TerminalNode STATIC() { + return getToken(CSharpParser.STATIC, 0); + } + + public Local_function_modifiersContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_local_function_modifiers; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLocal_function_modifiers(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLocal_function_modifiers(this); + } + } + + public final Local_function_modifiersContext local_function_modifiers() + throws RecognitionException { + Local_function_modifiersContext _localctx = + new Local_function_modifiersContext(_ctx, getState()); + enterRule(_localctx, 160, RULE_local_function_modifiers); + int _la; + try { + setState(1268); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ASYNC: + case UNSAFE: + enterOuterAlt(_localctx, 1); + { + setState(1262); + _la = _input.LA(1); + if (!(_la == ASYNC || _la == UNSAFE)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(1264); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == STATIC) { + { + setState(1263); + match(STATIC); + } + } + } + break; + case STATIC: + enterOuterAlt(_localctx, 2); + { + setState(1266); + match(STATIC); + setState(1267); + _la = _input.LA(1); + if (!(_la == ASYNC || _la == UNSAFE)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Local_function_bodyContext extends ParserRuleContext { + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public Right_arrowContext right_arrow() { + return getRuleContext(Right_arrowContext.class, 0); + } + + public Throwable_expressionContext throwable_expression() { + return getRuleContext(Throwable_expressionContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Local_function_bodyContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_local_function_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLocal_function_body(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLocal_function_body(this); + } + } + + public final Local_function_bodyContext local_function_body() + throws RecognitionException { + Local_function_bodyContext _localctx = new Local_function_bodyContext( + _ctx, + getState() + ); + enterRule(_localctx, 162, RULE_local_function_body); + try { + setState(1275); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACE: + enterOuterAlt(_localctx, 1); + { + setState(1270); + block(); + } + break; + case ASSIGNMENT: + enterOuterAlt(_localctx, 2); + { + setState(1271); + right_arrow(); + setState(1272); + throwable_expression(); + setState(1273); + match(SEMICOLON); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Labeled_StatementContext extends ParserRuleContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public StatementContext statement() { + return getRuleContext(StatementContext.class, 0); + } + + public Labeled_StatementContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_labeled_Statement; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLabeled_Statement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLabeled_Statement(this); + } + } + + public final Labeled_StatementContext labeled_Statement() + throws RecognitionException { + Labeled_StatementContext _localctx = new Labeled_StatementContext( + _ctx, + getState() + ); + enterRule(_localctx, 164, RULE_labeled_Statement); + try { + enterOuterAlt(_localctx, 1); + { + setState(1277); + identifier(); + setState(1278); + match(COLON); + setState(1279); + statement(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Embedded_statementContext extends ParserRuleContext { + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public Simple_embedded_statementContext simple_embedded_statement() { + return getRuleContext(Simple_embedded_statementContext.class, 0); + } + + public Embedded_statementContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_embedded_statement; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterEmbedded_statement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitEmbedded_statement(this); + } + } + + public final Embedded_statementContext embedded_statement() + throws RecognitionException { + Embedded_statementContext _localctx = new Embedded_statementContext( + _ctx, + getState() + ); + enterRule(_localctx, 166, RULE_embedded_statement); + try { + setState(1283); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACE: + enterOuterAlt(_localctx, 1); + { + setState(1281); + block(); + } + break; + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BREAK: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case CONTINUE: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DO: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FIXED: + case FLOAT: + case FOR: + case FOREACH: + case FROM: + case GET: + case GOTO: + case GROUP: + case IF: + case INT: + case INTO: + case JOIN: + case LET: + case LOCK: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REF: + case REMOVE: + case RETURN: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case SWITCH: + case THIS: + case THROW: + case TRUE: + case TRY: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case UNSAFE: + case USHORT: + case USING: + case VAR: + case WHEN: + case WHERE: + case WHILE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case SEMICOLON: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + enterOuterAlt(_localctx, 2); + { + setState(1282); + simple_embedded_statement(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Simple_embedded_statementContext + extends ParserRuleContext { + + public Simple_embedded_statementContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_simple_embedded_statement; + } + + public Simple_embedded_statementContext() {} + + public void copyFrom(Simple_embedded_statementContext ctx) { + super.copyFrom(ctx); + } + } + + public static class TryStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode TRY() { + return getToken(CSharpParser.TRY, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public Catch_clausesContext catch_clauses() { + return getRuleContext(Catch_clausesContext.class, 0); + } + + public Finally_clauseContext finally_clause() { + return getRuleContext(Finally_clauseContext.class, 0); + } + + public TryStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterTryStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitTryStatement(this); + } + } + + public static class CheckedStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode CHECKED() { + return getToken(CSharpParser.CHECKED, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public CheckedStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterCheckedStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitCheckedStatement(this); + } + } + + public static class ThrowStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode THROW() { + return getToken(CSharpParser.THROW, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public ThrowStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterThrowStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitThrowStatement(this); + } + } + + public static class TheEmptyStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public TheEmptyStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterTheEmptyStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitTheEmptyStatement(this); + } + } + + public static class UnsafeStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode UNSAFE() { + return getToken(CSharpParser.UNSAFE, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public UnsafeStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterUnsafeStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitUnsafeStatement(this); + } + } + + public static class ForStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode FOR() { + return getToken(CSharpParser.FOR, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public List SEMICOLON() { + return getTokens(CSharpParser.SEMICOLON); + } + + public TerminalNode SEMICOLON(int i) { + return getToken(CSharpParser.SEMICOLON, i); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Embedded_statementContext embedded_statement() { + return getRuleContext(Embedded_statementContext.class, 0); + } + + public For_initializerContext for_initializer() { + return getRuleContext(For_initializerContext.class, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public For_iteratorContext for_iterator() { + return getRuleContext(For_iteratorContext.class, 0); + } + + public ForStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterForStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitForStatement(this); + } + } + + public static class BreakStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode BREAK() { + return getToken(CSharpParser.BREAK, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public BreakStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterBreakStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitBreakStatement(this); + } + } + + public static class IfStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode IF() { + return getToken(CSharpParser.IF, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public List if_body() { + return getRuleContexts(If_bodyContext.class); + } + + public If_bodyContext if_body(int i) { + return getRuleContext(If_bodyContext.class, i); + } + + public TerminalNode ELSE() { + return getToken(CSharpParser.ELSE, 0); + } + + public IfStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterIfStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitIfStatement(this); + } + } + + public static class ReturnStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode RETURN() { + return getToken(CSharpParser.RETURN, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public ReturnStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterReturnStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitReturnStatement(this); + } + } + + public static class GotoStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode GOTO() { + return getToken(CSharpParser.GOTO, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode CASE() { + return getToken(CSharpParser.CASE, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode DEFAULT() { + return getToken(CSharpParser.DEFAULT, 0); + } + + public GotoStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterGotoStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitGotoStatement(this); + } + } + + public static class SwitchStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode SWITCH() { + return getToken(CSharpParser.SWITCH, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public List switch_section() { + return getRuleContexts(Switch_sectionContext.class); + } + + public Switch_sectionContext switch_section(int i) { + return getRuleContext(Switch_sectionContext.class, i); + } + + public SwitchStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSwitchStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSwitchStatement(this); + } + } + + public static class FixedStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode FIXED() { + return getToken(CSharpParser.FIXED, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public Pointer_typeContext pointer_type() { + return getRuleContext(Pointer_typeContext.class, 0); + } + + public Fixed_pointer_declaratorsContext fixed_pointer_declarators() { + return getRuleContext(Fixed_pointer_declaratorsContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Embedded_statementContext embedded_statement() { + return getRuleContext(Embedded_statementContext.class, 0); + } + + public FixedStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFixedStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFixedStatement(this); + } + } + + public static class WhileStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode WHILE() { + return getToken(CSharpParser.WHILE, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Embedded_statementContext embedded_statement() { + return getRuleContext(Embedded_statementContext.class, 0); + } + + public WhileStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterWhileStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitWhileStatement(this); + } + } + + public static class DoStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode DO() { + return getToken(CSharpParser.DO, 0); + } + + public Embedded_statementContext embedded_statement() { + return getRuleContext(Embedded_statementContext.class, 0); + } + + public TerminalNode WHILE() { + return getToken(CSharpParser.WHILE, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public DoStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterDoStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitDoStatement(this); + } + } + + public static class ForeachStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode FOREACH() { + return getToken(CSharpParser.FOREACH, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public Local_variable_typeContext local_variable_type() { + return getRuleContext(Local_variable_typeContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode IN() { + return getToken(CSharpParser.IN, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Embedded_statementContext embedded_statement() { + return getRuleContext(Embedded_statementContext.class, 0); + } + + public TerminalNode AWAIT() { + return getToken(CSharpParser.AWAIT, 0); + } + + public ForeachStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterForeachStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitForeachStatement(this); + } + } + + public static class UncheckedStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode UNCHECKED() { + return getToken(CSharpParser.UNCHECKED, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public UncheckedStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterUncheckedStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitUncheckedStatement(this); + } + } + + public static class ExpressionStatementContext + extends Simple_embedded_statementContext { + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public ExpressionStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterExpressionStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitExpressionStatement(this); + } + } + + public static class ContinueStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode CONTINUE() { + return getToken(CSharpParser.CONTINUE, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public ContinueStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterContinueStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitContinueStatement(this); + } + } + + public static class UsingStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode USING() { + return getToken(CSharpParser.USING, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public Resource_acquisitionContext resource_acquisition() { + return getRuleContext(Resource_acquisitionContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Embedded_statementContext embedded_statement() { + return getRuleContext(Embedded_statementContext.class, 0); + } + + public UsingStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterUsingStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitUsingStatement(this); + } + } + + public static class LockStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode LOCK() { + return getToken(CSharpParser.LOCK, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Embedded_statementContext embedded_statement() { + return getRuleContext(Embedded_statementContext.class, 0); + } + + public LockStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLockStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLockStatement(this); + } + } + + public static class YieldStatementContext + extends Simple_embedded_statementContext { + + public TerminalNode YIELD() { + return getToken(CSharpParser.YIELD, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public TerminalNode RETURN() { + return getToken(CSharpParser.RETURN, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode BREAK() { + return getToken(CSharpParser.BREAK, 0); + } + + public YieldStatementContext(Simple_embedded_statementContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterYieldStatement(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitYieldStatement(this); + } + } + + public final Simple_embedded_statementContext simple_embedded_statement() + throws RecognitionException { + Simple_embedded_statementContext _localctx = + new Simple_embedded_statementContext(_ctx, getState()); + enterRule(_localctx, 168, RULE_simple_embedded_statement); + int _la; + try { + setState(1415); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 143, _ctx)) { + case 1: + _localctx = new TheEmptyStatementContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1285); + match(SEMICOLON); + } + break; + case 2: + _localctx = new ExpressionStatementContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1286); + expression(); + setState(1287); + match(SEMICOLON); + } + break; + case 3: + _localctx = new IfStatementContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(1289); + match(IF); + setState(1290); + match(OPEN_PARENS); + setState(1291); + expression(); + setState(1292); + match(CLOSE_PARENS); + setState(1293); + if_body(); + setState(1296); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 131, _ctx)) { + case 1: + { + setState(1294); + match(ELSE); + setState(1295); + if_body(); + } + break; + } + } + break; + case 4: + _localctx = new SwitchStatementContext(_localctx); + enterOuterAlt(_localctx, 4); + { + setState(1298); + match(SWITCH); + setState(1299); + match(OPEN_PARENS); + setState(1300); + expression(); + setState(1301); + match(CLOSE_PARENS); + setState(1302); + match(OPEN_BRACE); + setState(1306); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == CASE || _la == DEFAULT) { + { + { + setState(1303); + switch_section(); + } + } + setState(1308); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1309); + match(CLOSE_BRACE); + } + break; + case 5: + _localctx = new WhileStatementContext(_localctx); + enterOuterAlt(_localctx, 5); + { + setState(1311); + match(WHILE); + setState(1312); + match(OPEN_PARENS); + setState(1313); + expression(); + setState(1314); + match(CLOSE_PARENS); + setState(1315); + embedded_statement(); + } + break; + case 6: + _localctx = new DoStatementContext(_localctx); + enterOuterAlt(_localctx, 6); + { + setState(1317); + match(DO); + setState(1318); + embedded_statement(); + setState(1319); + match(WHILE); + setState(1320); + match(OPEN_PARENS); + setState(1321); + expression(); + setState(1322); + match(CLOSE_PARENS); + setState(1323); + match(SEMICOLON); + } + break; + case 7: + _localctx = new ForStatementContext(_localctx); + enterOuterAlt(_localctx, 7); + { + setState(1325); + match(FOR); + setState(1326); + match(OPEN_PARENS); + setState(1328); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FIXED) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (USING - 64)) | + (1L << (VAR - 64)) | + (1L << (VOID - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(1327); + for_initializer(); + } + } + + setState(1330); + match(SEMICOLON); + setState(1332); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(1331); + expression(); + } + } + + setState(1334); + match(SEMICOLON); + setState(1336); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(1335); + for_iterator(); + } + } + + setState(1338); + match(CLOSE_PARENS); + setState(1339); + embedded_statement(); + } + break; + case 8: + _localctx = new ForeachStatementContext(_localctx); + enterOuterAlt(_localctx, 8); + { + setState(1341); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == AWAIT) { + { + setState(1340); + match(AWAIT); + } + } + + setState(1343); + match(FOREACH); + setState(1344); + match(OPEN_PARENS); + setState(1345); + local_variable_type(); + setState(1346); + identifier(); + setState(1347); + match(IN); + setState(1348); + expression(); + setState(1349); + match(CLOSE_PARENS); + setState(1350); + embedded_statement(); + } + break; + case 9: + _localctx = new BreakStatementContext(_localctx); + enterOuterAlt(_localctx, 9); + { + setState(1352); + match(BREAK); + setState(1353); + match(SEMICOLON); + } + break; + case 10: + _localctx = new ContinueStatementContext(_localctx); + enterOuterAlt(_localctx, 10); + { + setState(1354); + match(CONTINUE); + setState(1355); + match(SEMICOLON); + } + break; + case 11: + _localctx = new GotoStatementContext(_localctx); + enterOuterAlt(_localctx, 11); + { + setState(1356); + match(GOTO); + setState(1361); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BY: + case DESCENDING: + case DYNAMIC: + case EQUALS: + case FROM: + case GET: + case GROUP: + case INTO: + case JOIN: + case LET: + case NAMEOF: + case ON: + case ORDERBY: + case PARTIAL: + case REMOVE: + case SELECT: + case SET: + case UNMANAGED: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + { + setState(1357); + identifier(); + } + break; + case CASE: + { + setState(1358); + match(CASE); + setState(1359); + expression(); + } + break; + case DEFAULT: + { + setState(1360); + match(DEFAULT); + } + break; + default: + throw new NoViableAltException(this); + } + setState(1363); + match(SEMICOLON); + } + break; + case 12: + _localctx = new ReturnStatementContext(_localctx); + enterOuterAlt(_localctx, 12); + { + setState(1364); + match(RETURN); + setState(1366); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(1365); + expression(); + } + } + + setState(1368); + match(SEMICOLON); + } + break; + case 13: + _localctx = new ThrowStatementContext(_localctx); + enterOuterAlt(_localctx, 13); + { + setState(1369); + match(THROW); + setState(1371); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(1370); + expression(); + } + } + + setState(1373); + match(SEMICOLON); + } + break; + case 14: + _localctx = new TryStatementContext(_localctx); + enterOuterAlt(_localctx, 14); + { + setState(1374); + match(TRY); + setState(1375); + block(); + setState(1381); + _errHandler.sync(this); + switch (_input.LA(1)) { + case CATCH: + { + setState(1376); + catch_clauses(); + setState(1378); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == FINALLY) { + { + setState(1377); + finally_clause(); + } + } + } + break; + case FINALLY: + { + setState(1380); + finally_clause(); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + case 15: + _localctx = new CheckedStatementContext(_localctx); + enterOuterAlt(_localctx, 15); + { + setState(1383); + match(CHECKED); + setState(1384); + block(); + } + break; + case 16: + _localctx = new UncheckedStatementContext(_localctx); + enterOuterAlt(_localctx, 16); + { + setState(1385); + match(UNCHECKED); + setState(1386); + block(); + } + break; + case 17: + _localctx = new LockStatementContext(_localctx); + enterOuterAlt(_localctx, 17); + { + setState(1387); + match(LOCK); + setState(1388); + match(OPEN_PARENS); + setState(1389); + expression(); + setState(1390); + match(CLOSE_PARENS); + setState(1391); + embedded_statement(); + } + break; + case 18: + _localctx = new UsingStatementContext(_localctx); + enterOuterAlt(_localctx, 18); + { + setState(1393); + match(USING); + setState(1394); + match(OPEN_PARENS); + setState(1395); + resource_acquisition(); + setState(1396); + match(CLOSE_PARENS); + setState(1397); + embedded_statement(); + } + break; + case 19: + _localctx = new YieldStatementContext(_localctx); + enterOuterAlt(_localctx, 19); + { + setState(1399); + match(YIELD); + setState(1403); + _errHandler.sync(this); + switch (_input.LA(1)) { + case RETURN: + { + setState(1400); + match(RETURN); + setState(1401); + expression(); + } + break; + case BREAK: + { + setState(1402); + match(BREAK); + } + break; + default: + throw new NoViableAltException(this); + } + setState(1405); + match(SEMICOLON); + } + break; + case 20: + _localctx = new UnsafeStatementContext(_localctx); + enterOuterAlt(_localctx, 20); + { + setState(1406); + match(UNSAFE); + setState(1407); + block(); + } + break; + case 21: + _localctx = new FixedStatementContext(_localctx); + enterOuterAlt(_localctx, 21); + { + setState(1408); + match(FIXED); + setState(1409); + match(OPEN_PARENS); + setState(1410); + pointer_type(); + setState(1411); + fixed_pointer_declarators(); + setState(1412); + match(CLOSE_PARENS); + setState(1413); + embedded_statement(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class BlockContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public Statement_listContext statement_list() { + return getRuleContext(Statement_listContext.class, 0); + } + + public BlockContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_block; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterBlock(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitBlock(this); + } + } + + public final BlockContext block() throws RecognitionException { + BlockContext _localctx = new BlockContext(_ctx, getState()); + enterRule(_localctx, 170, RULE_block); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1417); + match(OPEN_BRACE); + setState(1419); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BREAK) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << CONST) | + (1L << CONTINUE) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DO) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FIXED) | + (1L << FLOAT) | + (1L << FOR) | + (1L << FOREACH) | + (1L << FROM) | + (1L << GET) | + (1L << GOTO) | + (1L << GROUP) | + (1L << IF) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LOCK) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (RETURN - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STATIC - 64)) | + (1L << (STRING - 64)) | + (1L << (SWITCH - 64)) | + (1L << (THIS - 64)) | + (1L << (THROW - 64)) | + (1L << (TRUE - 64)) | + (1L << (TRY - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (UNSAFE - 64)) | + (1L << (USHORT - 64)) | + (1L << (USING - 64)) | + (1L << (VAR - 64)) | + (1L << (VOID - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (WHILE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)) | + (1L << (OPEN_BRACE - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (SEMICOLON - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(1418); + statement_list(); + } + } + + setState(1421); + match(CLOSE_BRACE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Local_variable_declarationContext + extends ParserRuleContext { + + public Local_variable_typeContext local_variable_type() { + return getRuleContext(Local_variable_typeContext.class, 0); + } + + public List local_variable_declarator() { + return getRuleContexts(Local_variable_declaratorContext.class); + } + + public Local_variable_declaratorContext local_variable_declarator(int i) { + return getRuleContext(Local_variable_declaratorContext.class, i); + } + + public TerminalNode USING() { + return getToken(CSharpParser.USING, 0); + } + + public TerminalNode REF() { + return getToken(CSharpParser.REF, 0); + } + + public TerminalNode READONLY() { + return getToken(CSharpParser.READONLY, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public TerminalNode FIXED() { + return getToken(CSharpParser.FIXED, 0); + } + + public Pointer_typeContext pointer_type() { + return getRuleContext(Pointer_typeContext.class, 0); + } + + public Fixed_pointer_declaratorsContext fixed_pointer_declarators() { + return getRuleContext(Fixed_pointer_declaratorsContext.class, 0); + } + + public Local_variable_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_local_variable_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLocal_variable_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLocal_variable_declaration(this); + } + } + + public final Local_variable_declarationContext local_variable_declaration() + throws RecognitionException { + Local_variable_declarationContext _localctx = + new Local_variable_declarationContext(_ctx, getState()); + enterRule(_localctx, 172, RULE_local_variable_declaration); + int _la; + try { + setState(1442); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BOOL: + case BY: + case BYTE: + case CHAR: + case DECIMAL: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REF: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case STRING: + case UINT: + case ULONG: + case UNMANAGED: + case USHORT: + case USING: + case VAR: + case VOID: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case OPEN_PARENS: + enterOuterAlt(_localctx, 1); + { + setState(1427); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 145, _ctx)) { + case 1: + { + setState(1423); + match(USING); + } + break; + case 2: + { + setState(1424); + match(REF); + } + break; + case 3: + { + setState(1425); + match(REF); + setState(1426); + match(READONLY); + } + break; + } + setState(1429); + local_variable_type(); + setState(1430); + local_variable_declarator(); + setState(1435); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1431); + match(COMMA); + setState(1432); + local_variable_declarator(); + } + } + setState(1437); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + break; + case FIXED: + enterOuterAlt(_localctx, 2); + { + setState(1438); + match(FIXED); + setState(1439); + pointer_type(); + setState(1440); + fixed_pointer_declarators(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Local_variable_typeContext extends ParserRuleContext { + + public TerminalNode VAR() { + return getToken(CSharpParser.VAR, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public Local_variable_typeContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_local_variable_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLocal_variable_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLocal_variable_type(this); + } + } + + public final Local_variable_typeContext local_variable_type() + throws RecognitionException { + Local_variable_typeContext _localctx = new Local_variable_typeContext( + _ctx, + getState() + ); + enterRule(_localctx, 174, RULE_local_variable_type); + try { + setState(1446); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 148, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1444); + match(VAR); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1445); + type_(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Local_variable_declaratorContext + extends ParserRuleContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public Local_variable_initializerContext local_variable_initializer() { + return getRuleContext(Local_variable_initializerContext.class, 0); + } + + public TerminalNode REF() { + return getToken(CSharpParser.REF, 0); + } + + public Local_variable_declaratorContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_local_variable_declarator; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLocal_variable_declarator(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLocal_variable_declarator(this); + } + } + + public final Local_variable_declaratorContext local_variable_declarator() + throws RecognitionException { + Local_variable_declaratorContext _localctx = + new Local_variable_declaratorContext(_ctx, getState()); + enterRule(_localctx, 176, RULE_local_variable_declarator); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1448); + identifier(); + setState(1454); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == ASSIGNMENT) { + { + setState(1449); + match(ASSIGNMENT); + setState(1451); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 149, _ctx)) { + case 1: + { + setState(1450); + match(REF); + } + break; + } + setState(1453); + local_variable_initializer(); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Local_variable_initializerContext + extends ParserRuleContext { + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Array_initializerContext array_initializer() { + return getRuleContext(Array_initializerContext.class, 0); + } + + public Stackalloc_initializerContext stackalloc_initializer() { + return getRuleContext(Stackalloc_initializerContext.class, 0); + } + + public Local_variable_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_local_variable_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLocal_variable_initializer(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLocal_variable_initializer(this); + } + } + + public final Local_variable_initializerContext local_variable_initializer() + throws RecognitionException { + Local_variable_initializerContext _localctx = + new Local_variable_initializerContext(_ctx, getState()); + enterRule(_localctx, 178, RULE_local_variable_initializer); + try { + setState(1459); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REF: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case THIS: + case TRUE: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case USHORT: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + enterOuterAlt(_localctx, 1); + { + setState(1456); + expression(); + } + break; + case OPEN_BRACE: + enterOuterAlt(_localctx, 2); + { + setState(1457); + array_initializer(); + } + break; + case STACKALLOC: + enterOuterAlt(_localctx, 3); + { + setState(1458); + stackalloc_initializer(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Local_constant_declarationContext + extends ParserRuleContext { + + public TerminalNode CONST() { + return getToken(CSharpParser.CONST, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public Constant_declaratorsContext constant_declarators() { + return getRuleContext(Constant_declaratorsContext.class, 0); + } + + public Local_constant_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_local_constant_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLocal_constant_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLocal_constant_declaration(this); + } + } + + public final Local_constant_declarationContext local_constant_declaration() + throws RecognitionException { + Local_constant_declarationContext _localctx = + new Local_constant_declarationContext(_ctx, getState()); + enterRule(_localctx, 180, RULE_local_constant_declaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(1461); + match(CONST); + setState(1462); + type_(); + setState(1463); + constant_declarators(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class If_bodyContext extends ParserRuleContext { + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public Simple_embedded_statementContext simple_embedded_statement() { + return getRuleContext(Simple_embedded_statementContext.class, 0); + } + + public If_bodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_if_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterIf_body(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitIf_body(this); + } + } + + public final If_bodyContext if_body() throws RecognitionException { + If_bodyContext _localctx = new If_bodyContext(_ctx, getState()); + enterRule(_localctx, 182, RULE_if_body); + try { + setState(1467); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACE: + enterOuterAlt(_localctx, 1); + { + setState(1465); + block(); + } + break; + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BREAK: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case CONTINUE: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DO: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FIXED: + case FLOAT: + case FOR: + case FOREACH: + case FROM: + case GET: + case GOTO: + case GROUP: + case IF: + case INT: + case INTO: + case JOIN: + case LET: + case LOCK: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REF: + case REMOVE: + case RETURN: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case SWITCH: + case THIS: + case THROW: + case TRUE: + case TRY: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case UNSAFE: + case USHORT: + case USING: + case VAR: + case WHEN: + case WHERE: + case WHILE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case SEMICOLON: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + enterOuterAlt(_localctx, 2); + { + setState(1466); + simple_embedded_statement(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Switch_sectionContext extends ParserRuleContext { + + public Statement_listContext statement_list() { + return getRuleContext(Statement_listContext.class, 0); + } + + public List switch_label() { + return getRuleContexts(Switch_labelContext.class); + } + + public Switch_labelContext switch_label(int i) { + return getRuleContext(Switch_labelContext.class, i); + } + + public Switch_sectionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_switch_section; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSwitch_section(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSwitch_section(this); + } + } + + public final Switch_sectionContext switch_section() + throws RecognitionException { + Switch_sectionContext _localctx = new Switch_sectionContext( + _ctx, + getState() + ); + enterRule(_localctx, 184, RULE_switch_section); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1470); + _errHandler.sync(this); + _alt = 1; + do { + switch (_alt) { + case 1: + { + { + setState(1469); + switch_label(); + } + } + break; + default: + throw new NoViableAltException(this); + } + setState(1472); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 153, _ctx); + } while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ); + setState(1474); + statement_list(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Switch_labelContext extends ParserRuleContext { + + public TerminalNode CASE() { + return getToken(CSharpParser.CASE, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public Case_guardContext case_guard() { + return getRuleContext(Case_guardContext.class, 0); + } + + public TerminalNode DEFAULT() { + return getToken(CSharpParser.DEFAULT, 0); + } + + public Switch_labelContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_switch_label; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSwitch_label(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSwitch_label(this); + } + } + + public final Switch_labelContext switch_label() throws RecognitionException { + Switch_labelContext _localctx = new Switch_labelContext(_ctx, getState()); + enterRule(_localctx, 186, RULE_switch_label); + int _la; + try { + setState(1485); + _errHandler.sync(this); + switch (_input.LA(1)) { + case CASE: + enterOuterAlt(_localctx, 1); + { + setState(1476); + match(CASE); + setState(1477); + expression(); + setState(1479); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHEN) { + { + setState(1478); + case_guard(); + } + } + + setState(1481); + match(COLON); + } + break; + case DEFAULT: + enterOuterAlt(_localctx, 2); + { + setState(1483); + match(DEFAULT); + setState(1484); + match(COLON); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Case_guardContext extends ParserRuleContext { + + public TerminalNode WHEN() { + return getToken(CSharpParser.WHEN, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Case_guardContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_case_guard; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterCase_guard(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitCase_guard(this); + } + } + + public final Case_guardContext case_guard() throws RecognitionException { + Case_guardContext _localctx = new Case_guardContext(_ctx, getState()); + enterRule(_localctx, 188, RULE_case_guard); + try { + enterOuterAlt(_localctx, 1); + { + setState(1487); + match(WHEN); + setState(1488); + expression(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Statement_listContext extends ParserRuleContext { + + public List statement() { + return getRuleContexts(StatementContext.class); + } + + public StatementContext statement(int i) { + return getRuleContext(StatementContext.class, i); + } + + public Statement_listContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_statement_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterStatement_list(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitStatement_list(this); + } + } + + public final Statement_listContext statement_list() + throws RecognitionException { + Statement_listContext _localctx = new Statement_listContext( + _ctx, + getState() + ); + enterRule(_localctx, 190, RULE_statement_list); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1491); + _errHandler.sync(this); + _alt = 1; + do { + switch (_alt) { + case 1: + { + { + setState(1490); + statement(); + } + } + break; + default: + throw new NoViableAltException(this); + } + setState(1493); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 156, _ctx); + } while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class For_initializerContext extends ParserRuleContext { + + public Local_variable_declarationContext local_variable_declaration() { + return getRuleContext(Local_variable_declarationContext.class, 0); + } + + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public For_initializerContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_for_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFor_initializer(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFor_initializer(this); + } + } + + public final For_initializerContext for_initializer() + throws RecognitionException { + For_initializerContext _localctx = new For_initializerContext( + _ctx, + getState() + ); + enterRule(_localctx, 192, RULE_for_initializer); + int _la; + try { + setState(1504); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 158, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1495); + local_variable_declaration(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1496); + expression(); + setState(1501); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1497); + match(COMMA); + setState(1498); + expression(); + } + } + setState(1503); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class For_iteratorContext extends ParserRuleContext { + + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public For_iteratorContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_for_iterator; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFor_iterator(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFor_iterator(this); + } + } + + public final For_iteratorContext for_iterator() throws RecognitionException { + For_iteratorContext _localctx = new For_iteratorContext(_ctx, getState()); + enterRule(_localctx, 194, RULE_for_iterator); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1506); + expression(); + setState(1511); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1507); + match(COMMA); + setState(1508); + expression(); + } + } + setState(1513); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Catch_clausesContext extends ParserRuleContext { + + public List specific_catch_clause() { + return getRuleContexts(Specific_catch_clauseContext.class); + } + + public Specific_catch_clauseContext specific_catch_clause(int i) { + return getRuleContext(Specific_catch_clauseContext.class, i); + } + + public General_catch_clauseContext general_catch_clause() { + return getRuleContext(General_catch_clauseContext.class, 0); + } + + public Catch_clausesContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_catch_clauses; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterCatch_clauses(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitCatch_clauses(this); + } + } + + public final Catch_clausesContext catch_clauses() + throws RecognitionException { + Catch_clausesContext _localctx = new Catch_clausesContext(_ctx, getState()); + enterRule(_localctx, 196, RULE_catch_clauses); + int _la; + try { + int _alt; + setState(1525); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 162, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1514); + specific_catch_clause(); + setState(1518); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 160, _ctx); + while ( + _alt != 2 && + _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(1515); + specific_catch_clause(); + } + } + } + setState(1520); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 160, _ctx); + } + setState(1522); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == CATCH) { + { + setState(1521); + general_catch_clause(); + } + } + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1524); + general_catch_clause(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Specific_catch_clauseContext extends ParserRuleContext { + + public TerminalNode CATCH() { + return getToken(CSharpParser.CATCH, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public Class_typeContext class_type() { + return getRuleContext(Class_typeContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Exception_filterContext exception_filter() { + return getRuleContext(Exception_filterContext.class, 0); + } + + public Specific_catch_clauseContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_specific_catch_clause; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSpecific_catch_clause(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSpecific_catch_clause(this); + } + } + + public final Specific_catch_clauseContext specific_catch_clause() + throws RecognitionException { + Specific_catch_clauseContext _localctx = new Specific_catch_clauseContext( + _ctx, + getState() + ); + enterRule(_localctx, 198, RULE_specific_catch_clause); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1527); + match(CATCH); + setState(1528); + match(OPEN_PARENS); + setState(1529); + class_type(); + setState(1531); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BY) | + (1L << DESCENDING) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)))) != + 0) + ) { + { + setState(1530); + identifier(); + } + } + + setState(1533); + match(CLOSE_PARENS); + setState(1535); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHEN) { + { + setState(1534); + exception_filter(); + } + } + + setState(1537); + block(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class General_catch_clauseContext extends ParserRuleContext { + + public TerminalNode CATCH() { + return getToken(CSharpParser.CATCH, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public Exception_filterContext exception_filter() { + return getRuleContext(Exception_filterContext.class, 0); + } + + public General_catch_clauseContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_general_catch_clause; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterGeneral_catch_clause(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitGeneral_catch_clause(this); + } + } + + public final General_catch_clauseContext general_catch_clause() + throws RecognitionException { + General_catch_clauseContext _localctx = new General_catch_clauseContext( + _ctx, + getState() + ); + enterRule(_localctx, 200, RULE_general_catch_clause); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1539); + match(CATCH); + setState(1541); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHEN) { + { + setState(1540); + exception_filter(); + } + } + + setState(1543); + block(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Exception_filterContext extends ParserRuleContext { + + public TerminalNode WHEN() { + return getToken(CSharpParser.WHEN, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Exception_filterContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_exception_filter; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterException_filter(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitException_filter(this); + } + } + + public final Exception_filterContext exception_filter() + throws RecognitionException { + Exception_filterContext _localctx = new Exception_filterContext( + _ctx, + getState() + ); + enterRule(_localctx, 202, RULE_exception_filter); + try { + enterOuterAlt(_localctx, 1); + { + setState(1545); + match(WHEN); + setState(1546); + match(OPEN_PARENS); + setState(1547); + expression(); + setState(1548); + match(CLOSE_PARENS); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Finally_clauseContext extends ParserRuleContext { + + public TerminalNode FINALLY() { + return getToken(CSharpParser.FINALLY, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public Finally_clauseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_finally_clause; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFinally_clause(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFinally_clause(this); + } + } + + public final Finally_clauseContext finally_clause() + throws RecognitionException { + Finally_clauseContext _localctx = new Finally_clauseContext( + _ctx, + getState() + ); + enterRule(_localctx, 204, RULE_finally_clause); + try { + enterOuterAlt(_localctx, 1); + { + setState(1550); + match(FINALLY); + setState(1551); + block(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Resource_acquisitionContext extends ParserRuleContext { + + public Local_variable_declarationContext local_variable_declaration() { + return getRuleContext(Local_variable_declarationContext.class, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Resource_acquisitionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_resource_acquisition; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterResource_acquisition(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitResource_acquisition(this); + } + } + + public final Resource_acquisitionContext resource_acquisition() + throws RecognitionException { + Resource_acquisitionContext _localctx = new Resource_acquisitionContext( + _ctx, + getState() + ); + enterRule(_localctx, 206, RULE_resource_acquisition); + try { + setState(1555); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 166, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1553); + local_variable_declaration(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1554); + expression(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Namespace_declarationContext extends ParserRuleContext { + + public Qualified_identifierContext qi; + + public TerminalNode NAMESPACE() { + return getToken(CSharpParser.NAMESPACE, 0); + } + + public Namespace_bodyContext namespace_body() { + return getRuleContext(Namespace_bodyContext.class, 0); + } + + public Qualified_identifierContext qualified_identifier() { + return getRuleContext(Qualified_identifierContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Namespace_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_namespace_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterNamespace_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitNamespace_declaration(this); + } + } + + public final Namespace_declarationContext namespace_declaration() + throws RecognitionException { + Namespace_declarationContext _localctx = new Namespace_declarationContext( + _ctx, + getState() + ); + enterRule(_localctx, 208, RULE_namespace_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1557); + match(NAMESPACE); + setState(1558); + ((Namespace_declarationContext) _localctx).qi = qualified_identifier(); + setState(1559); + namespace_body(); + setState(1561); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == SEMICOLON) { + { + setState(1560); + match(SEMICOLON); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Qualified_identifierContext extends ParserRuleContext { + + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class, i); + } + + public List DOT() { + return getTokens(CSharpParser.DOT); + } + + public TerminalNode DOT(int i) { + return getToken(CSharpParser.DOT, i); + } + + public Qualified_identifierContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_qualified_identifier; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterQualified_identifier(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitQualified_identifier(this); + } + } + + public final Qualified_identifierContext qualified_identifier() + throws RecognitionException { + Qualified_identifierContext _localctx = new Qualified_identifierContext( + _ctx, + getState() + ); + enterRule(_localctx, 210, RULE_qualified_identifier); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1563); + identifier(); + setState(1568); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == DOT) { + { + { + setState(1564); + match(DOT); + setState(1565); + identifier(); + } + } + setState(1570); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Namespace_bodyContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public Extern_alias_directivesContext extern_alias_directives() { + return getRuleContext(Extern_alias_directivesContext.class, 0); + } + + public Using_directivesContext using_directives() { + return getRuleContext(Using_directivesContext.class, 0); + } + + public Namespace_member_declarationsContext namespace_member_declarations() { + return getRuleContext(Namespace_member_declarationsContext.class, 0); + } + + public Namespace_bodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_namespace_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterNamespace_body(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitNamespace_body(this); + } + } + + public final Namespace_bodyContext namespace_body() + throws RecognitionException { + Namespace_bodyContext _localctx = new Namespace_bodyContext( + _ctx, + getState() + ); + enterRule(_localctx, 212, RULE_namespace_body); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1571); + match(OPEN_BRACE); + setState(1573); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 169, _ctx)) { + case 1: + { + setState(1572); + extern_alias_directives(); + } + break; + } + setState(1576); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == USING) { + { + setState(1575); + using_directives(); + } + } + + setState(1579); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ABSTRACT) | + (1L << ASYNC) | + (1L << CLASS) | + (1L << DELEGATE) | + (1L << ENUM) | + (1L << EXTERN) | + (1L << INTERFACE) | + (1L << INTERNAL))) != + 0) || + ((((_la - 65)) & ~0x3f) == 0 && + ((1L << (_la - 65)) & + ((1L << (NAMESPACE - 65)) | + (1L << (NEW - 65)) | + (1L << (OVERRIDE - 65)) | + (1L << (PARTIAL - 65)) | + (1L << (PRIVATE - 65)) | + (1L << (PROTECTED - 65)) | + (1L << (PUBLIC - 65)) | + (1L << (READONLY - 65)) | + (1L << (REF - 65)) | + (1L << (SEALED - 65)) | + (1L << (STATIC - 65)) | + (1L << (STRUCT - 65)) | + (1L << (UNSAFE - 65)) | + (1L << (VIRTUAL - 65)) | + (1L << (VOLATILE - 65)) | + (1L << (OPEN_BRACKET - 65)))) != + 0) + ) { + { + setState(1578); + namespace_member_declarations(); + } + } + + setState(1581); + match(CLOSE_BRACE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Extern_alias_directivesContext extends ParserRuleContext { + + public List extern_alias_directive() { + return getRuleContexts(Extern_alias_directiveContext.class); + } + + public Extern_alias_directiveContext extern_alias_directive(int i) { + return getRuleContext(Extern_alias_directiveContext.class, i); + } + + public Extern_alias_directivesContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_extern_alias_directives; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterExtern_alias_directives(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitExtern_alias_directives(this); + } + } + + public final Extern_alias_directivesContext extern_alias_directives() + throws RecognitionException { + Extern_alias_directivesContext _localctx = + new Extern_alias_directivesContext(_ctx, getState()); + enterRule(_localctx, 214, RULE_extern_alias_directives); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1584); + _errHandler.sync(this); + _alt = 1; + do { + switch (_alt) { + case 1: + { + { + setState(1583); + extern_alias_directive(); + } + } + break; + default: + throw new NoViableAltException(this); + } + setState(1586); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 172, _ctx); + } while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Extern_alias_directiveContext extends ParserRuleContext { + + public TerminalNode EXTERN() { + return getToken(CSharpParser.EXTERN, 0); + } + + public TerminalNode ALIAS() { + return getToken(CSharpParser.ALIAS, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Extern_alias_directiveContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_extern_alias_directive; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterExtern_alias_directive(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitExtern_alias_directive(this); + } + } + + public final Extern_alias_directiveContext extern_alias_directive() + throws RecognitionException { + Extern_alias_directiveContext _localctx = new Extern_alias_directiveContext( + _ctx, + getState() + ); + enterRule(_localctx, 216, RULE_extern_alias_directive); + try { + enterOuterAlt(_localctx, 1); + { + setState(1588); + match(EXTERN); + setState(1589); + match(ALIAS); + setState(1590); + identifier(); + setState(1591); + match(SEMICOLON); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Using_directivesContext extends ParserRuleContext { + + public List using_directive() { + return getRuleContexts(Using_directiveContext.class); + } + + public Using_directiveContext using_directive(int i) { + return getRuleContext(Using_directiveContext.class, i); + } + + public Using_directivesContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_using_directives; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterUsing_directives(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitUsing_directives(this); + } + } + + public final Using_directivesContext using_directives() + throws RecognitionException { + Using_directivesContext _localctx = new Using_directivesContext( + _ctx, + getState() + ); + enterRule(_localctx, 218, RULE_using_directives); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1594); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(1593); + using_directive(); + } + } + setState(1596); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == USING); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Using_directiveContext extends ParserRuleContext { + + public Using_directiveContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_using_directive; + } + + public Using_directiveContext() {} + + public void copyFrom(Using_directiveContext ctx) { + super.copyFrom(ctx); + } + } + + public static class UsingAliasDirectiveContext + extends Using_directiveContext { + + public TerminalNode USING() { + return getToken(CSharpParser.USING, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public Namespace_or_type_nameContext namespace_or_type_name() { + return getRuleContext(Namespace_or_type_nameContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public UsingAliasDirectiveContext(Using_directiveContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterUsingAliasDirective(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitUsingAliasDirective(this); + } + } + + public static class UsingNamespaceDirectiveContext + extends Using_directiveContext { + + public TerminalNode USING() { + return getToken(CSharpParser.USING, 0); + } + + public Namespace_or_type_nameContext namespace_or_type_name() { + return getRuleContext(Namespace_or_type_nameContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public UsingNamespaceDirectiveContext(Using_directiveContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterUsingNamespaceDirective(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitUsingNamespaceDirective(this); + } + } + + public static class UsingStaticDirectiveContext + extends Using_directiveContext { + + public TerminalNode USING() { + return getToken(CSharpParser.USING, 0); + } + + public TerminalNode STATIC() { + return getToken(CSharpParser.STATIC, 0); + } + + public Namespace_or_type_nameContext namespace_or_type_name() { + return getRuleContext(Namespace_or_type_nameContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public UsingStaticDirectiveContext(Using_directiveContext ctx) { + copyFrom(ctx); + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterUsingStaticDirective(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitUsingStaticDirective(this); + } + } + + public final Using_directiveContext using_directive() + throws RecognitionException { + Using_directiveContext _localctx = new Using_directiveContext( + _ctx, + getState() + ); + enterRule(_localctx, 220, RULE_using_directive); + try { + setState(1613); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 174, _ctx)) { + case 1: + _localctx = new UsingAliasDirectiveContext(_localctx); + enterOuterAlt(_localctx, 1); + { + setState(1598); + match(USING); + setState(1599); + identifier(); + setState(1600); + match(ASSIGNMENT); + setState(1601); + namespace_or_type_name(); + setState(1602); + match(SEMICOLON); + } + break; + case 2: + _localctx = new UsingNamespaceDirectiveContext(_localctx); + enterOuterAlt(_localctx, 2); + { + setState(1604); + match(USING); + setState(1605); + namespace_or_type_name(); + setState(1606); + match(SEMICOLON); + } + break; + case 3: + _localctx = new UsingStaticDirectiveContext(_localctx); + enterOuterAlt(_localctx, 3); + { + setState(1608); + match(USING); + setState(1609); + match(STATIC); + setState(1610); + namespace_or_type_name(); + setState(1611); + match(SEMICOLON); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Namespace_member_declarationsContext + extends ParserRuleContext { + + public List< + Namespace_member_declarationContext + > namespace_member_declaration() { + return getRuleContexts(Namespace_member_declarationContext.class); + } + + public Namespace_member_declarationContext namespace_member_declaration( + int i + ) { + return getRuleContext(Namespace_member_declarationContext.class, i); + } + + public Namespace_member_declarationsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_namespace_member_declarations; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterNamespace_member_declarations( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitNamespace_member_declarations( + this + ); + } + } + + public final Namespace_member_declarationsContext namespace_member_declarations() + throws RecognitionException { + Namespace_member_declarationsContext _localctx = + new Namespace_member_declarationsContext(_ctx, getState()); + enterRule(_localctx, 222, RULE_namespace_member_declarations); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1616); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(1615); + namespace_member_declaration(); + } + } + setState(1618); + _errHandler.sync(this); + _la = _input.LA(1); + } while ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ABSTRACT) | + (1L << ASYNC) | + (1L << CLASS) | + (1L << DELEGATE) | + (1L << ENUM) | + (1L << EXTERN) | + (1L << INTERFACE) | + (1L << INTERNAL))) != + 0) || + ((((_la - 65)) & ~0x3f) == 0 && + ((1L << (_la - 65)) & + ((1L << (NAMESPACE - 65)) | + (1L << (NEW - 65)) | + (1L << (OVERRIDE - 65)) | + (1L << (PARTIAL - 65)) | + (1L << (PRIVATE - 65)) | + (1L << (PROTECTED - 65)) | + (1L << (PUBLIC - 65)) | + (1L << (READONLY - 65)) | + (1L << (REF - 65)) | + (1L << (SEALED - 65)) | + (1L << (STATIC - 65)) | + (1L << (STRUCT - 65)) | + (1L << (UNSAFE - 65)) | + (1L << (VIRTUAL - 65)) | + (1L << (VOLATILE - 65)) | + (1L << (OPEN_BRACKET - 65)))) != + 0) + ); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Namespace_member_declarationContext + extends ParserRuleContext { + + public Namespace_declarationContext namespace_declaration() { + return getRuleContext(Namespace_declarationContext.class, 0); + } + + public Type_declarationContext type_declaration() { + return getRuleContext(Type_declarationContext.class, 0); + } + + public Namespace_member_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_namespace_member_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterNamespace_member_declaration( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitNamespace_member_declaration( + this + ); + } + } + + public final Namespace_member_declarationContext namespace_member_declaration() + throws RecognitionException { + Namespace_member_declarationContext _localctx = + new Namespace_member_declarationContext(_ctx, getState()); + enterRule(_localctx, 224, RULE_namespace_member_declaration); + try { + setState(1622); + _errHandler.sync(this); + switch (_input.LA(1)) { + case NAMESPACE: + enterOuterAlt(_localctx, 1); + { + setState(1620); + namespace_declaration(); + } + break; + case ABSTRACT: + case ASYNC: + case CLASS: + case DELEGATE: + case ENUM: + case EXTERN: + case INTERFACE: + case INTERNAL: + case NEW: + case OVERRIDE: + case PARTIAL: + case PRIVATE: + case PROTECTED: + case PUBLIC: + case READONLY: + case REF: + case SEALED: + case STATIC: + case STRUCT: + case UNSAFE: + case VIRTUAL: + case VOLATILE: + case OPEN_BRACKET: + enterOuterAlt(_localctx, 2); + { + setState(1621); + type_declaration(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Type_declarationContext extends ParserRuleContext { + + public Class_definitionContext class_definition() { + return getRuleContext(Class_definitionContext.class, 0); + } + + public Struct_definitionContext struct_definition() { + return getRuleContext(Struct_definitionContext.class, 0); + } + + public Interface_definitionContext interface_definition() { + return getRuleContext(Interface_definitionContext.class, 0); + } + + public Enum_definitionContext enum_definition() { + return getRuleContext(Enum_definitionContext.class, 0); + } + + public Delegate_definitionContext delegate_definition() { + return getRuleContext(Delegate_definitionContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public All_member_modifiersContext all_member_modifiers() { + return getRuleContext(All_member_modifiersContext.class, 0); + } + + public Type_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_type_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterType_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitType_declaration(this); + } + } + + public final Type_declarationContext type_declaration() + throws RecognitionException { + Type_declarationContext _localctx = new Type_declarationContext( + _ctx, + getState() + ); + enterRule(_localctx, 226, RULE_type_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1625); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1624); + attributes(); + } + } + + setState(1628); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 178, _ctx)) { + case 1: + { + setState(1627); + all_member_modifiers(); + } + break; + } + setState(1635); + _errHandler.sync(this); + switch (_input.LA(1)) { + case CLASS: + { + setState(1630); + class_definition(); + } + break; + case READONLY: + case REF: + case STRUCT: + { + setState(1631); + struct_definition(); + } + break; + case INTERFACE: + { + setState(1632); + interface_definition(); + } + break; + case ENUM: + { + setState(1633); + enum_definition(); + } + break; + case DELEGATE: + { + setState(1634); + delegate_definition(); + } + break; + default: + throw new NoViableAltException(this); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Qualified_alias_memberContext extends ParserRuleContext { + + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class, i); + } + + public TerminalNode DOUBLE_COLON() { + return getToken(CSharpParser.DOUBLE_COLON, 0); + } + + public Type_argument_listContext type_argument_list() { + return getRuleContext(Type_argument_listContext.class, 0); + } + + public Qualified_alias_memberContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_qualified_alias_member; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterQualified_alias_member(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitQualified_alias_member(this); + } + } + + public final Qualified_alias_memberContext qualified_alias_member() + throws RecognitionException { + Qualified_alias_memberContext _localctx = new Qualified_alias_memberContext( + _ctx, + getState() + ); + enterRule(_localctx, 228, RULE_qualified_alias_member); + try { + enterOuterAlt(_localctx, 1); + { + setState(1637); + identifier(); + setState(1638); + match(DOUBLE_COLON); + setState(1639); + identifier(); + setState(1641); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 180, _ctx)) { + case 1: + { + setState(1640); + type_argument_list(); + } + break; + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Type_parameter_listContext extends ParserRuleContext { + + public TerminalNode LT() { + return getToken(CSharpParser.LT, 0); + } + + public List type_parameter() { + return getRuleContexts(Type_parameterContext.class); + } + + public Type_parameterContext type_parameter(int i) { + return getRuleContext(Type_parameterContext.class, i); + } + + public TerminalNode GT() { + return getToken(CSharpParser.GT, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Type_parameter_listContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_type_parameter_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterType_parameter_list(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitType_parameter_list(this); + } + } + + public final Type_parameter_listContext type_parameter_list() + throws RecognitionException { + Type_parameter_listContext _localctx = new Type_parameter_listContext( + _ctx, + getState() + ); + enterRule(_localctx, 230, RULE_type_parameter_list); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1643); + match(LT); + setState(1644); + type_parameter(); + setState(1649); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1645); + match(COMMA); + setState(1646); + type_parameter(); + } + } + setState(1651); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1652); + match(GT); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Type_parameterContext extends ParserRuleContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public Type_parameterContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_type_parameter; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterType_parameter(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitType_parameter(this); + } + } + + public final Type_parameterContext type_parameter() + throws RecognitionException { + Type_parameterContext _localctx = new Type_parameterContext( + _ctx, + getState() + ); + enterRule(_localctx, 232, RULE_type_parameter); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1655); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1654); + attributes(); + } + } + + setState(1657); + identifier(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Class_baseContext extends ParserRuleContext { + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public Class_typeContext class_type() { + return getRuleContext(Class_typeContext.class, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public List namespace_or_type_name() { + return getRuleContexts(Namespace_or_type_nameContext.class); + } + + public Namespace_or_type_nameContext namespace_or_type_name(int i) { + return getRuleContext(Namespace_or_type_nameContext.class, i); + } + + public Class_baseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_class_base; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterClass_base(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitClass_base(this); + } + } + + public final Class_baseContext class_base() throws RecognitionException { + Class_baseContext _localctx = new Class_baseContext(_ctx, getState()); + enterRule(_localctx, 234, RULE_class_base); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1659); + match(COLON); + setState(1660); + class_type(); + setState(1665); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1661); + match(COMMA); + setState(1662); + namespace_or_type_name(); + } + } + setState(1667); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Interface_type_listContext extends ParserRuleContext { + + public List namespace_or_type_name() { + return getRuleContexts(Namespace_or_type_nameContext.class); + } + + public Namespace_or_type_nameContext namespace_or_type_name(int i) { + return getRuleContext(Namespace_or_type_nameContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Interface_type_listContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_interface_type_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInterface_type_list(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInterface_type_list(this); + } + } + + public final Interface_type_listContext interface_type_list() + throws RecognitionException { + Interface_type_listContext _localctx = new Interface_type_listContext( + _ctx, + getState() + ); + enterRule(_localctx, 236, RULE_interface_type_list); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1668); + namespace_or_type_name(); + setState(1673); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1669); + match(COMMA); + setState(1670); + namespace_or_type_name(); + } + } + setState(1675); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Type_parameter_constraints_clausesContext + extends ParserRuleContext { + + public List< + Type_parameter_constraints_clauseContext + > type_parameter_constraints_clause() { + return getRuleContexts(Type_parameter_constraints_clauseContext.class); + } + + public Type_parameter_constraints_clauseContext type_parameter_constraints_clause( + int i + ) { + return getRuleContext(Type_parameter_constraints_clauseContext.class, i); + } + + public Type_parameter_constraints_clausesContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_type_parameter_constraints_clauses; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterType_parameter_constraints_clauses( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitType_parameter_constraints_clauses( + this + ); + } + } + + public final Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() + throws RecognitionException { + Type_parameter_constraints_clausesContext _localctx = + new Type_parameter_constraints_clausesContext(_ctx, getState()); + enterRule(_localctx, 238, RULE_type_parameter_constraints_clauses); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1677); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(1676); + type_parameter_constraints_clause(); + } + } + setState(1679); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == WHERE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Type_parameter_constraints_clauseContext + extends ParserRuleContext { + + public TerminalNode WHERE() { + return getToken(CSharpParser.WHERE, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public Type_parameter_constraintsContext type_parameter_constraints() { + return getRuleContext(Type_parameter_constraintsContext.class, 0); + } + + public Type_parameter_constraints_clauseContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_type_parameter_constraints_clause; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterType_parameter_constraints_clause( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitType_parameter_constraints_clause( + this + ); + } + } + + public final Type_parameter_constraints_clauseContext type_parameter_constraints_clause() + throws RecognitionException { + Type_parameter_constraints_clauseContext _localctx = + new Type_parameter_constraints_clauseContext(_ctx, getState()); + enterRule(_localctx, 240, RULE_type_parameter_constraints_clause); + try { + enterOuterAlt(_localctx, 1); + { + setState(1681); + match(WHERE); + setState(1682); + identifier(); + setState(1683); + match(COLON); + setState(1684); + type_parameter_constraints(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Type_parameter_constraintsContext + extends ParserRuleContext { + + public Constructor_constraintContext constructor_constraint() { + return getRuleContext(Constructor_constraintContext.class, 0); + } + + public Primary_constraintContext primary_constraint() { + return getRuleContext(Primary_constraintContext.class, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Secondary_constraintsContext secondary_constraints() { + return getRuleContext(Secondary_constraintsContext.class, 0); + } + + public Type_parameter_constraintsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_type_parameter_constraints; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterType_parameter_constraints(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitType_parameter_constraints(this); + } + } + + public final Type_parameter_constraintsContext type_parameter_constraints() + throws RecognitionException { + Type_parameter_constraintsContext _localctx = + new Type_parameter_constraintsContext(_ctx, getState()); + enterRule(_localctx, 242, RULE_type_parameter_constraints); + int _la; + try { + setState(1696); + _errHandler.sync(this); + switch (_input.LA(1)) { + case NEW: + enterOuterAlt(_localctx, 1); + { + setState(1686); + constructor_constraint(); + } + break; + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BY: + case CLASS: + case DESCENDING: + case DYNAMIC: + case EQUALS: + case FROM: + case GET: + case GROUP: + case INTO: + case JOIN: + case LET: + case NAMEOF: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REMOVE: + case SELECT: + case SET: + case STRING: + case STRUCT: + case UNMANAGED: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + enterOuterAlt(_localctx, 2); + { + setState(1687); + primary_constraint(); + setState(1690); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 186, _ctx)) { + case 1: + { + setState(1688); + match(COMMA); + setState(1689); + secondary_constraints(); + } + break; + } + setState(1694); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(1692); + match(COMMA); + setState(1693); + constructor_constraint(); + } + } + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Primary_constraintContext extends ParserRuleContext { + + public Class_typeContext class_type() { + return getRuleContext(Class_typeContext.class, 0); + } + + public TerminalNode CLASS() { + return getToken(CSharpParser.CLASS, 0); + } + + public TerminalNode INTERR() { + return getToken(CSharpParser.INTERR, 0); + } + + public TerminalNode STRUCT() { + return getToken(CSharpParser.STRUCT, 0); + } + + public TerminalNode UNMANAGED() { + return getToken(CSharpParser.UNMANAGED, 0); + } + + public Primary_constraintContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_primary_constraint; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterPrimary_constraint(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitPrimary_constraint(this); + } + } + + public final Primary_constraintContext primary_constraint() + throws RecognitionException { + Primary_constraintContext _localctx = new Primary_constraintContext( + _ctx, + getState() + ); + enterRule(_localctx, 244, RULE_primary_constraint); + int _la; + try { + setState(1705); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 190, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1698); + class_type(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1699); + match(CLASS); + setState(1701); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == INTERR) { + { + setState(1700); + match(INTERR); + } + } + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(1703); + match(STRUCT); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(1704); + match(UNMANAGED); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Secondary_constraintsContext extends ParserRuleContext { + + public List namespace_or_type_name() { + return getRuleContexts(Namespace_or_type_nameContext.class); + } + + public Namespace_or_type_nameContext namespace_or_type_name(int i) { + return getRuleContext(Namespace_or_type_nameContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Secondary_constraintsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_secondary_constraints; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSecondary_constraints(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSecondary_constraints(this); + } + } + + public final Secondary_constraintsContext secondary_constraints() + throws RecognitionException { + Secondary_constraintsContext _localctx = new Secondary_constraintsContext( + _ctx, + getState() + ); + enterRule(_localctx, 246, RULE_secondary_constraints); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1707); + namespace_or_type_name(); + setState(1712); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 191, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(1708); + match(COMMA); + setState(1709); + namespace_or_type_name(); + } + } + } + setState(1714); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 191, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Constructor_constraintContext extends ParserRuleContext { + + public TerminalNode NEW() { + return getToken(CSharpParser.NEW, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Constructor_constraintContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_constructor_constraint; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterConstructor_constraint(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitConstructor_constraint(this); + } + } + + public final Constructor_constraintContext constructor_constraint() + throws RecognitionException { + Constructor_constraintContext _localctx = new Constructor_constraintContext( + _ctx, + getState() + ); + enterRule(_localctx, 248, RULE_constructor_constraint); + try { + enterOuterAlt(_localctx, 1); + { + setState(1715); + match(NEW); + setState(1716); + match(OPEN_PARENS); + setState(1717); + match(CLOSE_PARENS); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Class_bodyContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public Class_member_declarationsContext class_member_declarations() { + return getRuleContext(Class_member_declarationsContext.class, 0); + } + + public Class_bodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_class_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterClass_body(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitClass_body(this); + } + } + + public final Class_bodyContext class_body() throws RecognitionException { + Class_bodyContext _localctx = new Class_bodyContext(_ctx, getState()); + enterRule(_localctx, 250, RULE_class_body); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1719); + match(OPEN_BRACE); + setState(1721); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ABSTRACT) | + (1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CLASS) | + (1L << CONST) | + (1L << DECIMAL) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << ENUM) | + (1L << EQUALS) | + (1L << EVENT) | + (1L << EXPLICIT) | + (1L << EXTERN) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << IMPLICIT) | + (1L << INT) | + (1L << INTERFACE) | + (1L << INTERNAL) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (OVERRIDE - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (PRIVATE - 64)) | + (1L << (PROTECTED - 64)) | + (1L << (PUBLIC - 64)) | + (1L << (READONLY - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SEALED - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (STATIC - 64)) | + (1L << (STRING - 64)) | + (1L << (STRUCT - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (UNSAFE - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (VIRTUAL - 64)) | + (1L << (VOID - 64)) | + (1L << (VOLATILE - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (OPEN_BRACKET - 64)))) != + 0) || + _la == OPEN_PARENS || + _la == TILDE + ) { + { + setState(1720); + class_member_declarations(); + } + } + + setState(1723); + match(CLOSE_BRACE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Class_member_declarationsContext + extends ParserRuleContext { + + public List class_member_declaration() { + return getRuleContexts(Class_member_declarationContext.class); + } + + public Class_member_declarationContext class_member_declaration(int i) { + return getRuleContext(Class_member_declarationContext.class, i); + } + + public Class_member_declarationsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_class_member_declarations; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterClass_member_declarations(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitClass_member_declarations(this); + } + } + + public final Class_member_declarationsContext class_member_declarations() + throws RecognitionException { + Class_member_declarationsContext _localctx = + new Class_member_declarationsContext(_ctx, getState()); + enterRule(_localctx, 252, RULE_class_member_declarations); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1726); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(1725); + class_member_declaration(); + } + } + setState(1728); + _errHandler.sync(this); + _la = _input.LA(1); + } while ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ABSTRACT) | + (1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CLASS) | + (1L << CONST) | + (1L << DECIMAL) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << ENUM) | + (1L << EQUALS) | + (1L << EVENT) | + (1L << EXPLICIT) | + (1L << EXTERN) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << IMPLICIT) | + (1L << INT) | + (1L << INTERFACE) | + (1L << INTERNAL) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (OVERRIDE - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (PRIVATE - 64)) | + (1L << (PROTECTED - 64)) | + (1L << (PUBLIC - 64)) | + (1L << (READONLY - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SEALED - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (STATIC - 64)) | + (1L << (STRING - 64)) | + (1L << (STRUCT - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (UNSAFE - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (VIRTUAL - 64)) | + (1L << (VOID - 64)) | + (1L << (VOLATILE - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (OPEN_BRACKET - 64)))) != + 0) || + _la == OPEN_PARENS || + _la == TILDE + ); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Class_member_declarationContext + extends ParserRuleContext { + + public Common_member_declarationContext common_member_declaration() { + return getRuleContext(Common_member_declarationContext.class, 0); + } + + public Destructor_definitionContext destructor_definition() { + return getRuleContext(Destructor_definitionContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public All_member_modifiersContext all_member_modifiers() { + return getRuleContext(All_member_modifiersContext.class, 0); + } + + public Class_member_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_class_member_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterClass_member_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitClass_member_declaration(this); + } + } + + public final Class_member_declarationContext class_member_declaration() + throws RecognitionException { + Class_member_declarationContext _localctx = + new Class_member_declarationContext(_ctx, getState()); + enterRule(_localctx, 254, RULE_class_member_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1731); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1730); + attributes(); + } + } + + setState(1734); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 195, _ctx)) { + case 1: + { + setState(1733); + all_member_modifiers(); + } + break; + } + setState(1738); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CLASS: + case CONST: + case DECIMAL: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case ENUM: + case EQUALS: + case EVENT: + case EXPLICIT: + case FLOAT: + case FROM: + case GET: + case GROUP: + case IMPLICIT: + case INT: + case INTERFACE: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case READONLY: + case REF: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case STRING: + case STRUCT: + case UINT: + case ULONG: + case UNMANAGED: + case USHORT: + case VAR: + case VOID: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case OPEN_PARENS: + { + setState(1736); + common_member_declaration(); + } + break; + case TILDE: + { + setState(1737); + destructor_definition(); + } + break; + default: + throw new NoViableAltException(this); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class All_member_modifiersContext extends ParserRuleContext { + + public List all_member_modifier() { + return getRuleContexts(All_member_modifierContext.class); + } + + public All_member_modifierContext all_member_modifier(int i) { + return getRuleContext(All_member_modifierContext.class, i); + } + + public All_member_modifiersContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_all_member_modifiers; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAll_member_modifiers(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAll_member_modifiers(this); + } + } + + public final All_member_modifiersContext all_member_modifiers() + throws RecognitionException { + All_member_modifiersContext _localctx = new All_member_modifiersContext( + _ctx, + getState() + ); + enterRule(_localctx, 256, RULE_all_member_modifiers); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1741); + _errHandler.sync(this); + _alt = 1; + do { + switch (_alt) { + case 1: + { + { + setState(1740); + all_member_modifier(); + } + } + break; + default: + throw new NoViableAltException(this); + } + setState(1743); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 197, _ctx); + } while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class All_member_modifierContext extends ParserRuleContext { + + public TerminalNode NEW() { + return getToken(CSharpParser.NEW, 0); + } + + public TerminalNode PUBLIC() { + return getToken(CSharpParser.PUBLIC, 0); + } + + public TerminalNode PROTECTED() { + return getToken(CSharpParser.PROTECTED, 0); + } + + public TerminalNode INTERNAL() { + return getToken(CSharpParser.INTERNAL, 0); + } + + public TerminalNode PRIVATE() { + return getToken(CSharpParser.PRIVATE, 0); + } + + public TerminalNode READONLY() { + return getToken(CSharpParser.READONLY, 0); + } + + public TerminalNode VOLATILE() { + return getToken(CSharpParser.VOLATILE, 0); + } + + public TerminalNode VIRTUAL() { + return getToken(CSharpParser.VIRTUAL, 0); + } + + public TerminalNode SEALED() { + return getToken(CSharpParser.SEALED, 0); + } + + public TerminalNode OVERRIDE() { + return getToken(CSharpParser.OVERRIDE, 0); + } + + public TerminalNode ABSTRACT() { + return getToken(CSharpParser.ABSTRACT, 0); + } + + public TerminalNode STATIC() { + return getToken(CSharpParser.STATIC, 0); + } + + public TerminalNode UNSAFE() { + return getToken(CSharpParser.UNSAFE, 0); + } + + public TerminalNode EXTERN() { + return getToken(CSharpParser.EXTERN, 0); + } + + public TerminalNode PARTIAL() { + return getToken(CSharpParser.PARTIAL, 0); + } + + public TerminalNode ASYNC() { + return getToken(CSharpParser.ASYNC, 0); + } + + public All_member_modifierContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_all_member_modifier; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAll_member_modifier(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAll_member_modifier(this); + } + } + + public final All_member_modifierContext all_member_modifier() + throws RecognitionException { + All_member_modifierContext _localctx = new All_member_modifierContext( + _ctx, + getState() + ); + enterRule(_localctx, 258, RULE_all_member_modifier); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1745); + _la = _input.LA(1); + if ( + !((((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ABSTRACT) | + (1L << ASYNC) | + (1L << EXTERN) | + (1L << INTERNAL))) != + 0) || + ((((_la - 66)) & ~0x3f) == 0 && + ((1L << (_la - 66)) & + ((1L << (NEW - 66)) | + (1L << (OVERRIDE - 66)) | + (1L << (PARTIAL - 66)) | + (1L << (PRIVATE - 66)) | + (1L << (PROTECTED - 66)) | + (1L << (PUBLIC - 66)) | + (1L << (READONLY - 66)) | + (1L << (SEALED - 66)) | + (1L << (STATIC - 66)) | + (1L << (UNSAFE - 66)) | + (1L << (VIRTUAL - 66)) | + (1L << (VOLATILE - 66)))) != + 0)) + ) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Common_member_declarationContext + extends ParserRuleContext { + + public Constant_declarationContext constant_declaration() { + return getRuleContext(Constant_declarationContext.class, 0); + } + + public Typed_member_declarationContext typed_member_declaration() { + return getRuleContext(Typed_member_declarationContext.class, 0); + } + + public Event_declarationContext event_declaration() { + return getRuleContext(Event_declarationContext.class, 0); + } + + public Conversion_operator_declaratorContext conversion_operator_declarator() { + return getRuleContext(Conversion_operator_declaratorContext.class, 0); + } + + public BodyContext body() { + return getRuleContext(BodyContext.class, 0); + } + + public Right_arrowContext right_arrow() { + return getRuleContext(Right_arrowContext.class, 0); + } + + public Throwable_expressionContext throwable_expression() { + return getRuleContext(Throwable_expressionContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Constructor_declarationContext constructor_declaration() { + return getRuleContext(Constructor_declarationContext.class, 0); + } + + public TerminalNode VOID() { + return getToken(CSharpParser.VOID, 0); + } + + public Method_declarationContext method_declaration() { + return getRuleContext(Method_declarationContext.class, 0); + } + + public Class_definitionContext class_definition() { + return getRuleContext(Class_definitionContext.class, 0); + } + + public Struct_definitionContext struct_definition() { + return getRuleContext(Struct_definitionContext.class, 0); + } + + public Interface_definitionContext interface_definition() { + return getRuleContext(Interface_definitionContext.class, 0); + } + + public Enum_definitionContext enum_definition() { + return getRuleContext(Enum_definitionContext.class, 0); + } + + public Delegate_definitionContext delegate_definition() { + return getRuleContext(Delegate_definitionContext.class, 0); + } + + public Common_member_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_common_member_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterCommon_member_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitCommon_member_declaration(this); + } + } + + public final Common_member_declarationContext common_member_declaration() + throws RecognitionException { + Common_member_declarationContext _localctx = + new Common_member_declarationContext(_ctx, getState()); + enterRule(_localctx, 260, RULE_common_member_declaration); + try { + setState(1766); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 199, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1747); + constant_declaration(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1748); + typed_member_declaration(); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(1749); + event_declaration(); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(1750); + conversion_operator_declarator(); + setState(1756); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACE: + case SEMICOLON: + { + setState(1751); + body(); + } + break; + case ASSIGNMENT: + { + setState(1752); + right_arrow(); + setState(1753); + throwable_expression(); + setState(1754); + match(SEMICOLON); + } + break; + default: + throw new NoViableAltException(this); + } + } + break; + case 5: + enterOuterAlt(_localctx, 5); + { + setState(1758); + constructor_declaration(); + } + break; + case 6: + enterOuterAlt(_localctx, 6); + { + setState(1759); + match(VOID); + setState(1760); + method_declaration(); + } + break; + case 7: + enterOuterAlt(_localctx, 7); + { + setState(1761); + class_definition(); + } + break; + case 8: + enterOuterAlt(_localctx, 8); + { + setState(1762); + struct_definition(); + } + break; + case 9: + enterOuterAlt(_localctx, 9); + { + setState(1763); + interface_definition(); + } + break; + case 10: + enterOuterAlt(_localctx, 10); + { + setState(1764); + enum_definition(); + } + break; + case 11: + enterOuterAlt(_localctx, 11); + { + setState(1765); + delegate_definition(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Typed_member_declarationContext + extends ParserRuleContext { + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public Namespace_or_type_nameContext namespace_or_type_name() { + return getRuleContext(Namespace_or_type_nameContext.class, 0); + } + + public TerminalNode DOT() { + return getToken(CSharpParser.DOT, 0); + } + + public Indexer_declarationContext indexer_declaration() { + return getRuleContext(Indexer_declarationContext.class, 0); + } + + public Method_declarationContext method_declaration() { + return getRuleContext(Method_declarationContext.class, 0); + } + + public Property_declarationContext property_declaration() { + return getRuleContext(Property_declarationContext.class, 0); + } + + public Operator_declarationContext operator_declaration() { + return getRuleContext(Operator_declarationContext.class, 0); + } + + public Field_declarationContext field_declaration() { + return getRuleContext(Field_declarationContext.class, 0); + } + + public TerminalNode REF() { + return getToken(CSharpParser.REF, 0); + } + + public TerminalNode READONLY() { + return getToken(CSharpParser.READONLY, 0); + } + + public Typed_member_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_typed_member_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterTyped_member_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitTyped_member_declaration(this); + } + } + + public final Typed_member_declarationContext typed_member_declaration() + throws RecognitionException { + Typed_member_declarationContext _localctx = + new Typed_member_declarationContext(_ctx, getState()); + enterRule(_localctx, 262, RULE_typed_member_declaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(1773); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 200, _ctx)) { + case 1: + { + setState(1768); + match(REF); + } + break; + case 2: + { + setState(1769); + match(READONLY); + setState(1770); + match(REF); + } + break; + case 3: + { + setState(1771); + match(REF); + setState(1772); + match(READONLY); + } + break; + } + setState(1775); + type_(); + setState(1785); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 201, _ctx)) { + case 1: + { + setState(1776); + namespace_or_type_name(); + setState(1777); + match(DOT); + setState(1778); + indexer_declaration(); + } + break; + case 2: + { + setState(1780); + method_declaration(); + } + break; + case 3: + { + setState(1781); + property_declaration(); + } + break; + case 4: + { + setState(1782); + indexer_declaration(); + } + break; + case 5: + { + setState(1783); + operator_declaration(); + } + break; + case 6: + { + setState(1784); + field_declaration(); + } + break; + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Constant_declaratorsContext extends ParserRuleContext { + + public List constant_declarator() { + return getRuleContexts(Constant_declaratorContext.class); + } + + public Constant_declaratorContext constant_declarator(int i) { + return getRuleContext(Constant_declaratorContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Constant_declaratorsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_constant_declarators; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterConstant_declarators(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitConstant_declarators(this); + } + } + + public final Constant_declaratorsContext constant_declarators() + throws RecognitionException { + Constant_declaratorsContext _localctx = new Constant_declaratorsContext( + _ctx, + getState() + ); + enterRule(_localctx, 264, RULE_constant_declarators); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1787); + constant_declarator(); + setState(1792); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1788); + match(COMMA); + setState(1789); + constant_declarator(); + } + } + setState(1794); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Constant_declaratorContext extends ParserRuleContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Constant_declaratorContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_constant_declarator; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterConstant_declarator(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitConstant_declarator(this); + } + } + + public final Constant_declaratorContext constant_declarator() + throws RecognitionException { + Constant_declaratorContext _localctx = new Constant_declaratorContext( + _ctx, + getState() + ); + enterRule(_localctx, 266, RULE_constant_declarator); + try { + enterOuterAlt(_localctx, 1); + { + setState(1795); + identifier(); + setState(1796); + match(ASSIGNMENT); + setState(1797); + expression(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Variable_declaratorsContext extends ParserRuleContext { + + public List variable_declarator() { + return getRuleContexts(Variable_declaratorContext.class); + } + + public Variable_declaratorContext variable_declarator(int i) { + return getRuleContext(Variable_declaratorContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Variable_declaratorsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_variable_declarators; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterVariable_declarators(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitVariable_declarators(this); + } + } + + public final Variable_declaratorsContext variable_declarators() + throws RecognitionException { + Variable_declaratorsContext _localctx = new Variable_declaratorsContext( + _ctx, + getState() + ); + enterRule(_localctx, 268, RULE_variable_declarators); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1799); + variable_declarator(); + setState(1804); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(1800); + match(COMMA); + setState(1801); + variable_declarator(); + } + } + setState(1806); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Variable_declaratorContext extends ParserRuleContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public Variable_initializerContext variable_initializer() { + return getRuleContext(Variable_initializerContext.class, 0); + } + + public Variable_declaratorContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_variable_declarator; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterVariable_declarator(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitVariable_declarator(this); + } + } + + public final Variable_declaratorContext variable_declarator() + throws RecognitionException { + Variable_declaratorContext _localctx = new Variable_declaratorContext( + _ctx, + getState() + ); + enterRule(_localctx, 270, RULE_variable_declarator); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1807); + identifier(); + setState(1810); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == ASSIGNMENT) { + { + setState(1808); + match(ASSIGNMENT); + setState(1809); + variable_initializer(); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Variable_initializerContext extends ParserRuleContext { + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Array_initializerContext array_initializer() { + return getRuleContext(Array_initializerContext.class, 0); + } + + public Variable_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_variable_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterVariable_initializer(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitVariable_initializer(this); + } + } + + public final Variable_initializerContext variable_initializer() + throws RecognitionException { + Variable_initializerContext _localctx = new Variable_initializerContext( + _ctx, + getState() + ); + enterRule(_localctx, 272, RULE_variable_initializer); + try { + setState(1814); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REF: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case THIS: + case TRUE: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case USHORT: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + enterOuterAlt(_localctx, 1); + { + setState(1812); + expression(); + } + break; + case OPEN_BRACE: + enterOuterAlt(_localctx, 2); + { + setState(1813); + array_initializer(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Return_typeContext extends ParserRuleContext { + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public TerminalNode VOID() { + return getToken(CSharpParser.VOID, 0); + } + + public Return_typeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_return_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterReturn_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitReturn_type(this); + } + } + + public final Return_typeContext return_type() throws RecognitionException { + Return_typeContext _localctx = new Return_typeContext(_ctx, getState()); + enterRule(_localctx, 274, RULE_return_type); + try { + setState(1818); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 206, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1816); + type_(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1817); + match(VOID); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Member_nameContext extends ParserRuleContext { + + public Namespace_or_type_nameContext namespace_or_type_name() { + return getRuleContext(Namespace_or_type_nameContext.class, 0); + } + + public Member_nameContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_member_name; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMember_name(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMember_name(this); + } + } + + public final Member_nameContext member_name() throws RecognitionException { + Member_nameContext _localctx = new Member_nameContext(_ctx, getState()); + enterRule(_localctx, 276, RULE_member_name); + try { + enterOuterAlt(_localctx, 1); + { + setState(1820); + namespace_or_type_name(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Method_bodyContext extends ParserRuleContext { + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Method_bodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_method_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMethod_body(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMethod_body(this); + } + } + + public final Method_bodyContext method_body() throws RecognitionException { + Method_bodyContext _localctx = new Method_bodyContext(_ctx, getState()); + enterRule(_localctx, 278, RULE_method_body); + try { + setState(1824); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACE: + enterOuterAlt(_localctx, 1); + { + setState(1822); + block(); + } + break; + case SEMICOLON: + enterOuterAlt(_localctx, 2); + { + setState(1823); + match(SEMICOLON); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Formal_parameter_listContext extends ParserRuleContext { + + public Parameter_arrayContext parameter_array() { + return getRuleContext(Parameter_arrayContext.class, 0); + } + + public Fixed_parametersContext fixed_parameters() { + return getRuleContext(Fixed_parametersContext.class, 0); + } + + public TerminalNode COMMA() { + return getToken(CSharpParser.COMMA, 0); + } + + public Formal_parameter_listContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_formal_parameter_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFormal_parameter_list(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFormal_parameter_list(this); + } + } + + public final Formal_parameter_listContext formal_parameter_list() + throws RecognitionException { + Formal_parameter_listContext _localctx = new Formal_parameter_listContext( + _ctx, + getState() + ); + enterRule(_localctx, 280, RULE_formal_parameter_list); + int _la; + try { + setState(1832); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 209, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1826); + parameter_array(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1827); + fixed_parameters(); + setState(1830); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(1828); + match(COMMA); + setState(1829); + parameter_array(); + } + } + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Fixed_parametersContext extends ParserRuleContext { + + public List fixed_parameter() { + return getRuleContexts(Fixed_parameterContext.class); + } + + public Fixed_parameterContext fixed_parameter(int i) { + return getRuleContext(Fixed_parameterContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Fixed_parametersContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_fixed_parameters; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFixed_parameters(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFixed_parameters(this); + } + } + + public final Fixed_parametersContext fixed_parameters() + throws RecognitionException { + Fixed_parametersContext _localctx = new Fixed_parametersContext( + _ctx, + getState() + ); + enterRule(_localctx, 282, RULE_fixed_parameters); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(1834); + fixed_parameter(); + setState(1839); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 210, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(1835); + match(COMMA); + setState(1836); + fixed_parameter(); + } + } + } + setState(1841); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 210, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Fixed_parameterContext extends ParserRuleContext { + + public Arg_declarationContext arg_declaration() { + return getRuleContext(Arg_declarationContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public Parameter_modifierContext parameter_modifier() { + return getRuleContext(Parameter_modifierContext.class, 0); + } + + public TerminalNode ARGLIST() { + return getToken(CSharpParser.ARGLIST, 0); + } + + public Fixed_parameterContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_fixed_parameter; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFixed_parameter(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFixed_parameter(this); + } + } + + public final Fixed_parameterContext fixed_parameter() + throws RecognitionException { + Fixed_parameterContext _localctx = new Fixed_parameterContext( + _ctx, + getState() + ); + enterRule(_localctx, 284, RULE_fixed_parameter); + int _la; + try { + setState(1850); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 213, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1843); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1842); + attributes(); + } + } + + setState(1846); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 54)) & ~0x3f) == 0 && + ((1L << (_la - 54)) & + ((1L << (IN - 54)) | + (1L << (OUT - 54)) | + (1L << (REF - 54)) | + (1L << (THIS - 54)))) != + 0) + ) { + { + setState(1845); + parameter_modifier(); + } + } + + setState(1848); + arg_declaration(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1849); + match(ARGLIST); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Parameter_modifierContext extends ParserRuleContext { + + public TerminalNode REF() { + return getToken(CSharpParser.REF, 0); + } + + public TerminalNode OUT() { + return getToken(CSharpParser.OUT, 0); + } + + public TerminalNode IN() { + return getToken(CSharpParser.IN, 0); + } + + public TerminalNode THIS() { + return getToken(CSharpParser.THIS, 0); + } + + public Parameter_modifierContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_parameter_modifier; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterParameter_modifier(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitParameter_modifier(this); + } + } + + public final Parameter_modifierContext parameter_modifier() + throws RecognitionException { + Parameter_modifierContext _localctx = new Parameter_modifierContext( + _ctx, + getState() + ); + enterRule(_localctx, 286, RULE_parameter_modifier); + try { + setState(1860); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 214, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1852); + match(REF); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1853); + match(OUT); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(1854); + match(IN); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(1855); + match(REF); + setState(1856); + match(THIS); + } + break; + case 5: + enterOuterAlt(_localctx, 5); + { + setState(1857); + match(IN); + setState(1858); + match(THIS); + } + break; + case 6: + enterOuterAlt(_localctx, 6); + { + setState(1859); + match(THIS); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Parameter_arrayContext extends ParserRuleContext { + + public TerminalNode PARAMS() { + return getToken(CSharpParser.PARAMS, 0); + } + + public Array_typeContext array_type() { + return getRuleContext(Array_typeContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public Parameter_arrayContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_parameter_array; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterParameter_array(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitParameter_array(this); + } + } + + public final Parameter_arrayContext parameter_array() + throws RecognitionException { + Parameter_arrayContext _localctx = new Parameter_arrayContext( + _ctx, + getState() + ); + enterRule(_localctx, 288, RULE_parameter_array); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1863); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1862); + attributes(); + } + } + + setState(1865); + match(PARAMS); + setState(1866); + array_type(); + setState(1867); + identifier(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Accessor_declarationsContext extends ParserRuleContext { + + public AttributesContext attrs; + public Accessor_modifierContext mods; + + public TerminalNode GET() { + return getToken(CSharpParser.GET, 0); + } + + public Accessor_bodyContext accessor_body() { + return getRuleContext(Accessor_bodyContext.class, 0); + } + + public TerminalNode SET() { + return getToken(CSharpParser.SET, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public Accessor_modifierContext accessor_modifier() { + return getRuleContext(Accessor_modifierContext.class, 0); + } + + public Set_accessor_declarationContext set_accessor_declaration() { + return getRuleContext(Set_accessor_declarationContext.class, 0); + } + + public Get_accessor_declarationContext get_accessor_declaration() { + return getRuleContext(Get_accessor_declarationContext.class, 0); + } + + public Accessor_declarationsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_accessor_declarations; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAccessor_declarations(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAccessor_declarations(this); + } + } + + public final Accessor_declarationsContext accessor_declarations() + throws RecognitionException { + Accessor_declarationsContext _localctx = new Accessor_declarationsContext( + _ctx, + getState() + ); + enterRule(_localctx, 290, RULE_accessor_declarations); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1870); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1869); + ((Accessor_declarationsContext) _localctx).attrs = attributes(); + } + } + + setState(1873); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 57)) & ~0x3f) == 0 && + ((1L << (_la - 57)) & + ((1L << (INTERNAL - 57)) | + (1L << (PRIVATE - 57)) | + (1L << (PROTECTED - 57)))) != + 0) + ) { + { + setState(1872); + ((Accessor_declarationsContext) _localctx).mods = + accessor_modifier(); + } + } + + setState(1885); + _errHandler.sync(this); + switch (_input.LA(1)) { + case GET: + { + setState(1875); + match(GET); + setState(1876); + accessor_body(); + setState(1878); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + _la == INTERNAL || + ((((_la - 76)) & ~0x3f) == 0 && + ((1L << (_la - 76)) & + ((1L << (PRIVATE - 76)) | + (1L << (PROTECTED - 76)) | + (1L << (SET - 76)) | + (1L << (OPEN_BRACKET - 76)))) != + 0) + ) { + { + setState(1877); + set_accessor_declaration(); + } + } + } + break; + case SET: + { + setState(1880); + match(SET); + setState(1881); + accessor_body(); + setState(1883); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + _la == GET || + _la == INTERNAL || + ((((_la - 76)) & ~0x3f) == 0 && + ((1L << (_la - 76)) & + ((1L << (PRIVATE - 76)) | + (1L << (PROTECTED - 76)) | + (1L << (OPEN_BRACKET - 76)))) != + 0) + ) { + { + setState(1882); + get_accessor_declaration(); + } + } + } + break; + default: + throw new NoViableAltException(this); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Get_accessor_declarationContext + extends ParserRuleContext { + + public TerminalNode GET() { + return getToken(CSharpParser.GET, 0); + } + + public Accessor_bodyContext accessor_body() { + return getRuleContext(Accessor_bodyContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public Accessor_modifierContext accessor_modifier() { + return getRuleContext(Accessor_modifierContext.class, 0); + } + + public Get_accessor_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_get_accessor_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterGet_accessor_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitGet_accessor_declaration(this); + } + } + + public final Get_accessor_declarationContext get_accessor_declaration() + throws RecognitionException { + Get_accessor_declarationContext _localctx = + new Get_accessor_declarationContext(_ctx, getState()); + enterRule(_localctx, 292, RULE_get_accessor_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1888); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1887); + attributes(); + } + } + + setState(1891); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 57)) & ~0x3f) == 0 && + ((1L << (_la - 57)) & + ((1L << (INTERNAL - 57)) | + (1L << (PRIVATE - 57)) | + (1L << (PROTECTED - 57)))) != + 0) + ) { + { + setState(1890); + accessor_modifier(); + } + } + + setState(1893); + match(GET); + setState(1894); + accessor_body(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Set_accessor_declarationContext + extends ParserRuleContext { + + public TerminalNode SET() { + return getToken(CSharpParser.SET, 0); + } + + public Accessor_bodyContext accessor_body() { + return getRuleContext(Accessor_bodyContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public Accessor_modifierContext accessor_modifier() { + return getRuleContext(Accessor_modifierContext.class, 0); + } + + public Set_accessor_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_set_accessor_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterSet_accessor_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitSet_accessor_declaration(this); + } + } + + public final Set_accessor_declarationContext set_accessor_declaration() + throws RecognitionException { + Set_accessor_declarationContext _localctx = + new Set_accessor_declarationContext(_ctx, getState()); + enterRule(_localctx, 294, RULE_set_accessor_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1897); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1896); + attributes(); + } + } + + setState(1900); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 57)) & ~0x3f) == 0 && + ((1L << (_la - 57)) & + ((1L << (INTERNAL - 57)) | + (1L << (PRIVATE - 57)) | + (1L << (PROTECTED - 57)))) != + 0) + ) { + { + setState(1899); + accessor_modifier(); + } + } + + setState(1902); + match(SET); + setState(1903); + accessor_body(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Accessor_modifierContext extends ParserRuleContext { + + public TerminalNode PROTECTED() { + return getToken(CSharpParser.PROTECTED, 0); + } + + public TerminalNode INTERNAL() { + return getToken(CSharpParser.INTERNAL, 0); + } + + public TerminalNode PRIVATE() { + return getToken(CSharpParser.PRIVATE, 0); + } + + public Accessor_modifierContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_accessor_modifier; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAccessor_modifier(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAccessor_modifier(this); + } + } + + public final Accessor_modifierContext accessor_modifier() + throws RecognitionException { + Accessor_modifierContext _localctx = new Accessor_modifierContext( + _ctx, + getState() + ); + enterRule(_localctx, 296, RULE_accessor_modifier); + try { + setState(1912); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 225, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1905); + match(PROTECTED); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1906); + match(INTERNAL); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(1907); + match(PRIVATE); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(1908); + match(PROTECTED); + setState(1909); + match(INTERNAL); + } + break; + case 5: + enterOuterAlt(_localctx, 5); + { + setState(1910); + match(INTERNAL); + setState(1911); + match(PROTECTED); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Accessor_bodyContext extends ParserRuleContext { + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Accessor_bodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_accessor_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAccessor_body(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAccessor_body(this); + } + } + + public final Accessor_bodyContext accessor_body() + throws RecognitionException { + Accessor_bodyContext _localctx = new Accessor_bodyContext(_ctx, getState()); + enterRule(_localctx, 298, RULE_accessor_body); + try { + setState(1916); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACE: + enterOuterAlt(_localctx, 1); + { + setState(1914); + block(); + } + break; + case SEMICOLON: + enterOuterAlt(_localctx, 2); + { + setState(1915); + match(SEMICOLON); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Event_accessor_declarationsContext + extends ParserRuleContext { + + public TerminalNode ADD() { + return getToken(CSharpParser.ADD, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public Remove_accessor_declarationContext remove_accessor_declaration() { + return getRuleContext(Remove_accessor_declarationContext.class, 0); + } + + public TerminalNode REMOVE() { + return getToken(CSharpParser.REMOVE, 0); + } + + public Add_accessor_declarationContext add_accessor_declaration() { + return getRuleContext(Add_accessor_declarationContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public Event_accessor_declarationsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_event_accessor_declarations; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterEvent_accessor_declarations( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitEvent_accessor_declarations(this); + } + } + + public final Event_accessor_declarationsContext event_accessor_declarations() + throws RecognitionException { + Event_accessor_declarationsContext _localctx = + new Event_accessor_declarationsContext(_ctx, getState()); + enterRule(_localctx, 300, RULE_event_accessor_declarations); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1919); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1918); + attributes(); + } + } + + setState(1929); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + { + setState(1921); + match(ADD); + setState(1922); + block(); + setState(1923); + remove_accessor_declaration(); + } + break; + case REMOVE: + { + setState(1925); + match(REMOVE); + setState(1926); + block(); + setState(1927); + add_accessor_declaration(); + } + break; + default: + throw new NoViableAltException(this); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Add_accessor_declarationContext + extends ParserRuleContext { + + public TerminalNode ADD() { + return getToken(CSharpParser.ADD, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public Add_accessor_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_add_accessor_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAdd_accessor_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAdd_accessor_declaration(this); + } + } + + public final Add_accessor_declarationContext add_accessor_declaration() + throws RecognitionException { + Add_accessor_declarationContext _localctx = + new Add_accessor_declarationContext(_ctx, getState()); + enterRule(_localctx, 302, RULE_add_accessor_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1932); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1931); + attributes(); + } + } + + setState(1934); + match(ADD); + setState(1935); + block(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Remove_accessor_declarationContext + extends ParserRuleContext { + + public TerminalNode REMOVE() { + return getToken(CSharpParser.REMOVE, 0); + } + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public Remove_accessor_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_remove_accessor_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterRemove_accessor_declaration( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitRemove_accessor_declaration(this); + } + } + + public final Remove_accessor_declarationContext remove_accessor_declaration() + throws RecognitionException { + Remove_accessor_declarationContext _localctx = + new Remove_accessor_declarationContext(_ctx, getState()); + enterRule(_localctx, 304, RULE_remove_accessor_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1938); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1937); + attributes(); + } + } + + setState(1940); + match(REMOVE); + setState(1941); + block(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Overloadable_operatorContext extends ParserRuleContext { + + public TerminalNode PLUS() { + return getToken(CSharpParser.PLUS, 0); + } + + public TerminalNode MINUS() { + return getToken(CSharpParser.MINUS, 0); + } + + public TerminalNode BANG() { + return getToken(CSharpParser.BANG, 0); + } + + public TerminalNode TILDE() { + return getToken(CSharpParser.TILDE, 0); + } + + public TerminalNode OP_INC() { + return getToken(CSharpParser.OP_INC, 0); + } + + public TerminalNode OP_DEC() { + return getToken(CSharpParser.OP_DEC, 0); + } + + public TerminalNode TRUE() { + return getToken(CSharpParser.TRUE, 0); + } + + public TerminalNode FALSE() { + return getToken(CSharpParser.FALSE, 0); + } + + public TerminalNode STAR() { + return getToken(CSharpParser.STAR, 0); + } + + public TerminalNode DIV() { + return getToken(CSharpParser.DIV, 0); + } + + public TerminalNode PERCENT() { + return getToken(CSharpParser.PERCENT, 0); + } + + public TerminalNode AMP() { + return getToken(CSharpParser.AMP, 0); + } + + public TerminalNode BITWISE_OR() { + return getToken(CSharpParser.BITWISE_OR, 0); + } + + public TerminalNode CARET() { + return getToken(CSharpParser.CARET, 0); + } + + public TerminalNode OP_LEFT_SHIFT() { + return getToken(CSharpParser.OP_LEFT_SHIFT, 0); + } + + public Right_shiftContext right_shift() { + return getRuleContext(Right_shiftContext.class, 0); + } + + public TerminalNode OP_EQ() { + return getToken(CSharpParser.OP_EQ, 0); + } + + public TerminalNode OP_NE() { + return getToken(CSharpParser.OP_NE, 0); + } + + public TerminalNode GT() { + return getToken(CSharpParser.GT, 0); + } + + public TerminalNode LT() { + return getToken(CSharpParser.LT, 0); + } + + public TerminalNode OP_GE() { + return getToken(CSharpParser.OP_GE, 0); + } + + public TerminalNode OP_LE() { + return getToken(CSharpParser.OP_LE, 0); + } + + public Overloadable_operatorContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_overloadable_operator; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterOverloadable_operator(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitOverloadable_operator(this); + } + } + + public final Overloadable_operatorContext overloadable_operator() + throws RecognitionException { + Overloadable_operatorContext _localctx = new Overloadable_operatorContext( + _ctx, + getState() + ); + enterRule(_localctx, 306, RULE_overloadable_operator); + try { + setState(1965); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 231, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(1943); + match(PLUS); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(1944); + match(MINUS); + } + break; + case 3: + enterOuterAlt(_localctx, 3); + { + setState(1945); + match(BANG); + } + break; + case 4: + enterOuterAlt(_localctx, 4); + { + setState(1946); + match(TILDE); + } + break; + case 5: + enterOuterAlt(_localctx, 5); + { + setState(1947); + match(OP_INC); + } + break; + case 6: + enterOuterAlt(_localctx, 6); + { + setState(1948); + match(OP_DEC); + } + break; + case 7: + enterOuterAlt(_localctx, 7); + { + setState(1949); + match(TRUE); + } + break; + case 8: + enterOuterAlt(_localctx, 8); + { + setState(1950); + match(FALSE); + } + break; + case 9: + enterOuterAlt(_localctx, 9); + { + setState(1951); + match(STAR); + } + break; + case 10: + enterOuterAlt(_localctx, 10); + { + setState(1952); + match(DIV); + } + break; + case 11: + enterOuterAlt(_localctx, 11); + { + setState(1953); + match(PERCENT); + } + break; + case 12: + enterOuterAlt(_localctx, 12); + { + setState(1954); + match(AMP); + } + break; + case 13: + enterOuterAlt(_localctx, 13); + { + setState(1955); + match(BITWISE_OR); + } + break; + case 14: + enterOuterAlt(_localctx, 14); + { + setState(1956); + match(CARET); + } + break; + case 15: + enterOuterAlt(_localctx, 15); + { + setState(1957); + match(OP_LEFT_SHIFT); + } + break; + case 16: + enterOuterAlt(_localctx, 16); + { + setState(1958); + right_shift(); + } + break; + case 17: + enterOuterAlt(_localctx, 17); + { + setState(1959); + match(OP_EQ); + } + break; + case 18: + enterOuterAlt(_localctx, 18); + { + setState(1960); + match(OP_NE); + } + break; + case 19: + enterOuterAlt(_localctx, 19); + { + setState(1961); + match(GT); + } + break; + case 20: + enterOuterAlt(_localctx, 20); + { + setState(1962); + match(LT); + } + break; + case 21: + enterOuterAlt(_localctx, 21); + { + setState(1963); + match(OP_GE); + } + break; + case 22: + enterOuterAlt(_localctx, 22); + { + setState(1964); + match(OP_LE); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Conversion_operator_declaratorContext + extends ParserRuleContext { + + public TerminalNode OPERATOR() { + return getToken(CSharpParser.OPERATOR, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public Arg_declarationContext arg_declaration() { + return getRuleContext(Arg_declarationContext.class, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public TerminalNode IMPLICIT() { + return getToken(CSharpParser.IMPLICIT, 0); + } + + public TerminalNode EXPLICIT() { + return getToken(CSharpParser.EXPLICIT, 0); + } + + public Conversion_operator_declaratorContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_conversion_operator_declarator; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterConversion_operator_declarator( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitConversion_operator_declarator( + this + ); + } + } + + public final Conversion_operator_declaratorContext conversion_operator_declarator() + throws RecognitionException { + Conversion_operator_declaratorContext _localctx = + new Conversion_operator_declaratorContext(_ctx, getState()); + enterRule(_localctx, 308, RULE_conversion_operator_declarator); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1967); + _la = _input.LA(1); + if (!(_la == EXPLICIT || _la == IMPLICIT)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(1968); + match(OPERATOR); + setState(1969); + type_(); + setState(1970); + match(OPEN_PARENS); + setState(1971); + arg_declaration(); + setState(1972); + match(CLOSE_PARENS); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Constructor_initializerContext extends ParserRuleContext { + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public TerminalNode BASE() { + return getToken(CSharpParser.BASE, 0); + } + + public TerminalNode THIS() { + return getToken(CSharpParser.THIS, 0); + } + + public Argument_listContext argument_list() { + return getRuleContext(Argument_listContext.class, 0); + } + + public Constructor_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_constructor_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterConstructor_initializer(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitConstructor_initializer(this); + } + } + + public final Constructor_initializerContext constructor_initializer() + throws RecognitionException { + Constructor_initializerContext _localctx = + new Constructor_initializerContext(_ctx, getState()); + enterRule(_localctx, 310, RULE_constructor_initializer); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1974); + match(COLON); + setState(1975); + _la = _input.LA(1); + if (!(_la == BASE || _la == THIS)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + setState(1976); + match(OPEN_PARENS); + setState(1978); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << IN) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (OUT - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (VOID - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(1977); + argument_list(); + } + } + + setState(1980); + match(CLOSE_PARENS); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class BodyContext extends ParserRuleContext { + + public BlockContext block() { + return getRuleContext(BlockContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public BodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterBody(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitBody(this); + } + } + + public final BodyContext body() throws RecognitionException { + BodyContext _localctx = new BodyContext(_ctx, getState()); + enterRule(_localctx, 312, RULE_body); + try { + setState(1984); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACE: + enterOuterAlt(_localctx, 1); + { + setState(1982); + block(); + } + break; + case SEMICOLON: + enterOuterAlt(_localctx, 2); + { + setState(1983); + match(SEMICOLON); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Struct_interfacesContext extends ParserRuleContext { + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public Interface_type_listContext interface_type_list() { + return getRuleContext(Interface_type_listContext.class, 0); + } + + public Struct_interfacesContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_struct_interfaces; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterStruct_interfaces(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitStruct_interfaces(this); + } + } + + public final Struct_interfacesContext struct_interfaces() + throws RecognitionException { + Struct_interfacesContext _localctx = new Struct_interfacesContext( + _ctx, + getState() + ); + enterRule(_localctx, 314, RULE_struct_interfaces); + try { + enterOuterAlt(_localctx, 1); + { + setState(1986); + match(COLON); + setState(1987); + interface_type_list(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Struct_bodyContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public List struct_member_declaration() { + return getRuleContexts(Struct_member_declarationContext.class); + } + + public Struct_member_declarationContext struct_member_declaration(int i) { + return getRuleContext(Struct_member_declarationContext.class, i); + } + + public Struct_bodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_struct_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterStruct_body(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitStruct_body(this); + } + } + + public final Struct_bodyContext struct_body() throws RecognitionException { + Struct_bodyContext _localctx = new Struct_bodyContext(_ctx, getState()); + enterRule(_localctx, 316, RULE_struct_body); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1989); + match(OPEN_BRACE); + setState(1993); + _errHandler.sync(this); + _la = _input.LA(1); + while ( + ((((_la - 9)) & ~0x3f) == 0 && + ((1L << (_la - 9)) & + ((1L << (ABSTRACT - 9)) | + (1L << (ADD - 9)) | + (1L << (ALIAS - 9)) | + (1L << (ARGLIST - 9)) | + (1L << (ASCENDING - 9)) | + (1L << (ASYNC - 9)) | + (1L << (AWAIT - 9)) | + (1L << (BOOL - 9)) | + (1L << (BY - 9)) | + (1L << (BYTE - 9)) | + (1L << (CHAR - 9)) | + (1L << (CLASS - 9)) | + (1L << (CONST - 9)) | + (1L << (DECIMAL - 9)) | + (1L << (DELEGATE - 9)) | + (1L << (DESCENDING - 9)) | + (1L << (DOUBLE - 9)) | + (1L << (DYNAMIC - 9)) | + (1L << (ENUM - 9)) | + (1L << (EQUALS - 9)) | + (1L << (EVENT - 9)) | + (1L << (EXPLICIT - 9)) | + (1L << (EXTERN - 9)) | + (1L << (FIXED - 9)) | + (1L << (FLOAT - 9)) | + (1L << (FROM - 9)) | + (1L << (GET - 9)) | + (1L << (GROUP - 9)) | + (1L << (IMPLICIT - 9)) | + (1L << (INT - 9)) | + (1L << (INTERFACE - 9)) | + (1L << (INTERNAL - 9)) | + (1L << (INTO - 9)) | + (1L << (JOIN - 9)) | + (1L << (LET - 9)) | + (1L << (LONG - 9)) | + (1L << (NAMEOF - 9)) | + (1L << (NEW - 9)) | + (1L << (OBJECT - 9)) | + (1L << (ON - 9)) | + (1L << (ORDERBY - 9)))) != + 0) || + ((((_la - 73)) & ~0x3f) == 0 && + ((1L << (_la - 73)) & + ((1L << (OVERRIDE - 73)) | + (1L << (PARTIAL - 73)) | + (1L << (PRIVATE - 73)) | + (1L << (PROTECTED - 73)) | + (1L << (PUBLIC - 73)) | + (1L << (READONLY - 73)) | + (1L << (REF - 73)) | + (1L << (REMOVE - 73)) | + (1L << (SBYTE - 73)) | + (1L << (SEALED - 73)) | + (1L << (SELECT - 73)) | + (1L << (SET - 73)) | + (1L << (SHORT - 73)) | + (1L << (STATIC - 73)) | + (1L << (STRING - 73)) | + (1L << (STRUCT - 73)) | + (1L << (UINT - 73)) | + (1L << (ULONG - 73)) | + (1L << (UNMANAGED - 73)) | + (1L << (UNSAFE - 73)) | + (1L << (USHORT - 73)) | + (1L << (VAR - 73)) | + (1L << (VIRTUAL - 73)) | + (1L << (VOID - 73)) | + (1L << (VOLATILE - 73)) | + (1L << (WHEN - 73)) | + (1L << (WHERE - 73)) | + (1L << (YIELD - 73)) | + (1L << (IDENTIFIER - 73)) | + (1L << (OPEN_BRACKET - 73)) | + (1L << (OPEN_PARENS - 73)))) != + 0) + ) { + { + { + setState(1990); + struct_member_declaration(); + } + } + setState(1995); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(1996); + match(CLOSE_BRACE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Struct_member_declarationContext + extends ParserRuleContext { + + public Common_member_declarationContext common_member_declaration() { + return getRuleContext(Common_member_declarationContext.class, 0); + } + + public TerminalNode FIXED() { + return getToken(CSharpParser.FIXED, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public All_member_modifiersContext all_member_modifiers() { + return getRuleContext(All_member_modifiersContext.class, 0); + } + + public List< + Fixed_size_buffer_declaratorContext + > fixed_size_buffer_declarator() { + return getRuleContexts(Fixed_size_buffer_declaratorContext.class); + } + + public Fixed_size_buffer_declaratorContext fixed_size_buffer_declarator( + int i + ) { + return getRuleContext(Fixed_size_buffer_declaratorContext.class, i); + } + + public Struct_member_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_struct_member_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterStruct_member_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitStruct_member_declaration(this); + } + } + + public final Struct_member_declarationContext struct_member_declaration() + throws RecognitionException { + Struct_member_declarationContext _localctx = + new Struct_member_declarationContext(_ctx, getState()); + enterRule(_localctx, 318, RULE_struct_member_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(1999); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(1998); + attributes(); + } + } + + setState(2002); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 236, _ctx)) { + case 1: + { + setState(2001); + all_member_modifiers(); + } + break; + } + setState(2014); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CLASS: + case CONST: + case DECIMAL: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case ENUM: + case EQUALS: + case EVENT: + case EXPLICIT: + case FLOAT: + case FROM: + case GET: + case GROUP: + case IMPLICIT: + case INT: + case INTERFACE: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case READONLY: + case REF: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case STRING: + case STRUCT: + case UINT: + case ULONG: + case UNMANAGED: + case USHORT: + case VAR: + case VOID: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case OPEN_PARENS: + { + setState(2004); + common_member_declaration(); + } + break; + case FIXED: + { + setState(2005); + match(FIXED); + setState(2006); + type_(); + setState(2008); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(2007); + fixed_size_buffer_declarator(); + } + } + setState(2010); + _errHandler.sync(this); + _la = _input.LA(1); + } while ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BY) | + (1L << DESCENDING) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)))) != + 0) + ); + setState(2012); + match(SEMICOLON); + } + break; + default: + throw new NoViableAltException(this); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Array_typeContext extends ParserRuleContext { + + public Base_typeContext base_type() { + return getRuleContext(Base_typeContext.class, 0); + } + + public List rank_specifier() { + return getRuleContexts(Rank_specifierContext.class); + } + + public Rank_specifierContext rank_specifier(int i) { + return getRuleContext(Rank_specifierContext.class, i); + } + + public List STAR() { + return getTokens(CSharpParser.STAR); + } + + public TerminalNode STAR(int i) { + return getToken(CSharpParser.STAR, i); + } + + public List INTERR() { + return getTokens(CSharpParser.INTERR); + } + + public TerminalNode INTERR(int i) { + return getToken(CSharpParser.INTERR, i); + } + + public Array_typeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_array_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterArray_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitArray_type(this); + } + } + + public final Array_typeContext array_type() throws RecognitionException { + Array_typeContext _localctx = new Array_typeContext(_ctx, getState()); + enterRule(_localctx, 320, RULE_array_type); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2016); + base_type(); + setState(2024); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(2020); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == STAR || _la == INTERR) { + { + { + setState(2017); + _la = _input.LA(1); + if (!(_la == STAR || _la == INTERR)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + setState(2022); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(2023); + rank_specifier(); + } + } + setState(2026); + _errHandler.sync(this); + _la = _input.LA(1); + } while ( + ((((_la - 127)) & ~0x3f) == 0 && + ((1L << (_la - 127)) & + ((1L << (OPEN_BRACKET - 127)) | + (1L << (STAR - 127)) | + (1L << (INTERR - 127)))) != + 0) + ); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Rank_specifierContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACKET() { + return getToken(CSharpParser.OPEN_BRACKET, 0); + } + + public TerminalNode CLOSE_BRACKET() { + return getToken(CSharpParser.CLOSE_BRACKET, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Rank_specifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_rank_specifier; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterRank_specifier(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitRank_specifier(this); + } + } + + public final Rank_specifierContext rank_specifier() + throws RecognitionException { + Rank_specifierContext _localctx = new Rank_specifierContext( + _ctx, + getState() + ); + enterRule(_localctx, 322, RULE_rank_specifier); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2028); + match(OPEN_BRACKET); + setState(2032); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(2029); + match(COMMA); + } + } + setState(2034); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(2035); + match(CLOSE_BRACKET); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Array_initializerContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public List variable_initializer() { + return getRuleContexts(Variable_initializerContext.class); + } + + public Variable_initializerContext variable_initializer(int i) { + return getRuleContext(Variable_initializerContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Array_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_array_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterArray_initializer(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitArray_initializer(this); + } + } + + public final Array_initializerContext array_initializer() + throws RecognitionException { + Array_initializerContext _localctx = new Array_initializerContext( + _ctx, + getState() + ); + enterRule(_localctx, 324, RULE_array_initializer); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(2037); + match(OPEN_BRACE); + setState(2049); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)) | + (1L << (OPEN_BRACE - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(2038); + variable_initializer(); + setState(2043); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 242, _ctx); + while ( + _alt != 2 && + _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(2039); + match(COMMA); + setState(2040); + variable_initializer(); + } + } + } + setState(2045); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 242, _ctx); + } + setState(2047); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(2046); + match(COMMA); + } + } + } + } + + setState(2051); + match(CLOSE_BRACE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Variant_type_parameter_listContext + extends ParserRuleContext { + + public TerminalNode LT() { + return getToken(CSharpParser.LT, 0); + } + + public List variant_type_parameter() { + return getRuleContexts(Variant_type_parameterContext.class); + } + + public Variant_type_parameterContext variant_type_parameter(int i) { + return getRuleContext(Variant_type_parameterContext.class, i); + } + + public TerminalNode GT() { + return getToken(CSharpParser.GT, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Variant_type_parameter_listContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_variant_type_parameter_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterVariant_type_parameter_list( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitVariant_type_parameter_list(this); + } + } + + public final Variant_type_parameter_listContext variant_type_parameter_list() + throws RecognitionException { + Variant_type_parameter_listContext _localctx = + new Variant_type_parameter_listContext(_ctx, getState()); + enterRule(_localctx, 326, RULE_variant_type_parameter_list); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2053); + match(LT); + setState(2054); + variant_type_parameter(); + setState(2059); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(2055); + match(COMMA); + setState(2056); + variant_type_parameter(); + } + } + setState(2061); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(2062); + match(GT); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Variant_type_parameterContext extends ParserRuleContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public Variance_annotationContext variance_annotation() { + return getRuleContext(Variance_annotationContext.class, 0); + } + + public Variant_type_parameterContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_variant_type_parameter; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterVariant_type_parameter(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitVariant_type_parameter(this); + } + } + + public final Variant_type_parameterContext variant_type_parameter() + throws RecognitionException { + Variant_type_parameterContext _localctx = new Variant_type_parameterContext( + _ctx, + getState() + ); + enterRule(_localctx, 328, RULE_variant_type_parameter); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2065); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(2064); + attributes(); + } + } + + setState(2068); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == IN || _la == OUT) { + { + setState(2067); + variance_annotation(); + } + } + + setState(2070); + identifier(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Variance_annotationContext extends ParserRuleContext { + + public TerminalNode IN() { + return getToken(CSharpParser.IN, 0); + } + + public TerminalNode OUT() { + return getToken(CSharpParser.OUT, 0); + } + + public Variance_annotationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_variance_annotation; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterVariance_annotation(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitVariance_annotation(this); + } + } + + public final Variance_annotationContext variance_annotation() + throws RecognitionException { + Variance_annotationContext _localctx = new Variance_annotationContext( + _ctx, + getState() + ); + enterRule(_localctx, 330, RULE_variance_annotation); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2072); + _la = _input.LA(1); + if (!(_la == IN || _la == OUT)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Interface_baseContext extends ParserRuleContext { + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public Interface_type_listContext interface_type_list() { + return getRuleContext(Interface_type_listContext.class, 0); + } + + public Interface_baseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_interface_base; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInterface_base(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInterface_base(this); + } + } + + public final Interface_baseContext interface_base() + throws RecognitionException { + Interface_baseContext _localctx = new Interface_baseContext( + _ctx, + getState() + ); + enterRule(_localctx, 332, RULE_interface_base); + try { + enterOuterAlt(_localctx, 1); + { + setState(2074); + match(COLON); + setState(2075); + interface_type_list(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Interface_bodyContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public List< + Interface_member_declarationContext + > interface_member_declaration() { + return getRuleContexts(Interface_member_declarationContext.class); + } + + public Interface_member_declarationContext interface_member_declaration( + int i + ) { + return getRuleContext(Interface_member_declarationContext.class, i); + } + + public Interface_bodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_interface_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInterface_body(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInterface_body(this); + } + } + + public final Interface_bodyContext interface_body() + throws RecognitionException { + Interface_bodyContext _localctx = new Interface_bodyContext( + _ctx, + getState() + ); + enterRule(_localctx, 334, RULE_interface_body); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2077); + match(OPEN_BRACE); + setState(2081); + _errHandler.sync(this); + _la = _input.LA(1); + while ( + ((((_la - 10)) & ~0x3f) == 0 && + ((1L << (_la - 10)) & + ((1L << (ADD - 10)) | + (1L << (ALIAS - 10)) | + (1L << (ARGLIST - 10)) | + (1L << (ASCENDING - 10)) | + (1L << (ASYNC - 10)) | + (1L << (AWAIT - 10)) | + (1L << (BOOL - 10)) | + (1L << (BY - 10)) | + (1L << (BYTE - 10)) | + (1L << (CHAR - 10)) | + (1L << (DECIMAL - 10)) | + (1L << (DESCENDING - 10)) | + (1L << (DOUBLE - 10)) | + (1L << (DYNAMIC - 10)) | + (1L << (EQUALS - 10)) | + (1L << (EVENT - 10)) | + (1L << (FLOAT - 10)) | + (1L << (FROM - 10)) | + (1L << (GET - 10)) | + (1L << (GROUP - 10)) | + (1L << (INT - 10)) | + (1L << (INTO - 10)) | + (1L << (JOIN - 10)) | + (1L << (LET - 10)) | + (1L << (LONG - 10)) | + (1L << (NAMEOF - 10)) | + (1L << (NEW - 10)) | + (1L << (OBJECT - 10)) | + (1L << (ON - 10)) | + (1L << (ORDERBY - 10)))) != + 0) || + ((((_la - 75)) & ~0x3f) == 0 && + ((1L << (_la - 75)) & + ((1L << (PARTIAL - 75)) | + (1L << (READONLY - 75)) | + (1L << (REF - 75)) | + (1L << (REMOVE - 75)) | + (1L << (SBYTE - 75)) | + (1L << (SELECT - 75)) | + (1L << (SET - 75)) | + (1L << (SHORT - 75)) | + (1L << (STRING - 75)) | + (1L << (UINT - 75)) | + (1L << (ULONG - 75)) | + (1L << (UNMANAGED - 75)) | + (1L << (UNSAFE - 75)) | + (1L << (USHORT - 75)) | + (1L << (VAR - 75)) | + (1L << (VOID - 75)) | + (1L << (WHEN - 75)) | + (1L << (WHERE - 75)) | + (1L << (YIELD - 75)) | + (1L << (IDENTIFIER - 75)) | + (1L << (OPEN_BRACKET - 75)) | + (1L << (OPEN_PARENS - 75)))) != + 0) + ) { + { + { + setState(2078); + interface_member_declaration(); + } + } + setState(2083); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(2084); + match(CLOSE_BRACE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Interface_member_declarationContext + extends ParserRuleContext { + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public TerminalNode VOID() { + return getToken(CSharpParser.VOID, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public TerminalNode EVENT() { + return getToken(CSharpParser.EVENT, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public TerminalNode NEW() { + return getToken(CSharpParser.NEW, 0); + } + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public Interface_accessorsContext interface_accessors() { + return getRuleContext(Interface_accessorsContext.class, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public TerminalNode THIS() { + return getToken(CSharpParser.THIS, 0); + } + + public TerminalNode OPEN_BRACKET() { + return getToken(CSharpParser.OPEN_BRACKET, 0); + } + + public Formal_parameter_listContext formal_parameter_list() { + return getRuleContext(Formal_parameter_listContext.class, 0); + } + + public TerminalNode CLOSE_BRACKET() { + return getToken(CSharpParser.CLOSE_BRACKET, 0); + } + + public TerminalNode UNSAFE() { + return getToken(CSharpParser.UNSAFE, 0); + } + + public TerminalNode REF() { + return getToken(CSharpParser.REF, 0); + } + + public TerminalNode READONLY() { + return getToken(CSharpParser.READONLY, 0); + } + + public Type_parameter_listContext type_parameter_list() { + return getRuleContext(Type_parameter_listContext.class, 0); + } + + public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { + return getRuleContext(Type_parameter_constraints_clausesContext.class, 0); + } + + public Interface_member_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_interface_member_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInterface_member_declaration( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInterface_member_declaration( + this + ); + } + } + + public final Interface_member_declarationContext interface_member_declaration() + throws RecognitionException { + Interface_member_declarationContext _localctx = + new Interface_member_declarationContext(_ctx, getState()); + enterRule(_localctx, 336, RULE_interface_member_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2087); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(2086); + attributes(); + } + } + + setState(2090); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == NEW) { + { + setState(2089); + match(NEW); + } + } + + setState(2155); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 261, _ctx)) { + case 1: + { + setState(2093); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == UNSAFE) { + { + setState(2092); + match(UNSAFE); + } + } + + setState(2100); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 252, _ctx)) { + case 1: + { + setState(2095); + match(REF); + } + break; + case 2: + { + setState(2096); + match(REF); + setState(2097); + match(READONLY); + } + break; + case 3: + { + setState(2098); + match(READONLY); + setState(2099); + match(REF); + } + break; + } + setState(2102); + type_(); + setState(2130); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 256, _ctx)) { + case 1: + { + setState(2103); + identifier(); + setState(2105); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(2104); + type_parameter_list(); + } + } + + setState(2107); + match(OPEN_PARENS); + setState(2109); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 10)) & ~0x3f) == 0 && + ((1L << (_la - 10)) & + ((1L << (ADD - 10)) | + (1L << (ALIAS - 10)) | + (1L << (ARGLIST - 10)) | + (1L << (ASCENDING - 10)) | + (1L << (ASYNC - 10)) | + (1L << (AWAIT - 10)) | + (1L << (BOOL - 10)) | + (1L << (BY - 10)) | + (1L << (BYTE - 10)) | + (1L << (CHAR - 10)) | + (1L << (DECIMAL - 10)) | + (1L << (DESCENDING - 10)) | + (1L << (DOUBLE - 10)) | + (1L << (DYNAMIC - 10)) | + (1L << (EQUALS - 10)) | + (1L << (FLOAT - 10)) | + (1L << (FROM - 10)) | + (1L << (GET - 10)) | + (1L << (GROUP - 10)) | + (1L << (IN - 10)) | + (1L << (INT - 10)) | + (1L << (INTO - 10)) | + (1L << (JOIN - 10)) | + (1L << (LET - 10)) | + (1L << (LONG - 10)) | + (1L << (NAMEOF - 10)) | + (1L << (OBJECT - 10)) | + (1L << (ON - 10)) | + (1L << (ORDERBY - 10)) | + (1L << (OUT - 10)))) != + 0) || + ((((_la - 74)) & ~0x3f) == 0 && + ((1L << (_la - 74)) & + ((1L << (PARAMS - 74)) | + (1L << (PARTIAL - 74)) | + (1L << (REF - 74)) | + (1L << (REMOVE - 74)) | + (1L << (SBYTE - 74)) | + (1L << (SELECT - 74)) | + (1L << (SET - 74)) | + (1L << (SHORT - 74)) | + (1L << (STRING - 74)) | + (1L << (THIS - 74)) | + (1L << (UINT - 74)) | + (1L << (ULONG - 74)) | + (1L << (UNMANAGED - 74)) | + (1L << (USHORT - 74)) | + (1L << (VAR - 74)) | + (1L << (VOID - 74)) | + (1L << (WHEN - 74)) | + (1L << (WHERE - 74)) | + (1L << (YIELD - 74)) | + (1L << (IDENTIFIER - 74)) | + (1L << (OPEN_BRACKET - 74)) | + (1L << (OPEN_PARENS - 74)))) != + 0) + ) { + { + setState(2108); + formal_parameter_list(); + } + } + + setState(2111); + match(CLOSE_PARENS); + setState(2113); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHERE) { + { + setState(2112); + type_parameter_constraints_clauses(); + } + } + + setState(2115); + match(SEMICOLON); + } + break; + case 2: + { + setState(2117); + identifier(); + setState(2118); + match(OPEN_BRACE); + setState(2119); + interface_accessors(); + setState(2120); + match(CLOSE_BRACE); + } + break; + case 3: + { + setState(2122); + match(THIS); + setState(2123); + match(OPEN_BRACKET); + setState(2124); + formal_parameter_list(); + setState(2125); + match(CLOSE_BRACKET); + setState(2126); + match(OPEN_BRACE); + setState(2127); + interface_accessors(); + setState(2128); + match(CLOSE_BRACE); + } + break; + } + } + break; + case 2: + { + setState(2133); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == UNSAFE) { + { + setState(2132); + match(UNSAFE); + } + } + + setState(2135); + match(VOID); + setState(2136); + identifier(); + setState(2138); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(2137); + type_parameter_list(); + } + } + + setState(2140); + match(OPEN_PARENS); + setState(2142); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 10)) & ~0x3f) == 0 && + ((1L << (_la - 10)) & + ((1L << (ADD - 10)) | + (1L << (ALIAS - 10)) | + (1L << (ARGLIST - 10)) | + (1L << (ASCENDING - 10)) | + (1L << (ASYNC - 10)) | + (1L << (AWAIT - 10)) | + (1L << (BOOL - 10)) | + (1L << (BY - 10)) | + (1L << (BYTE - 10)) | + (1L << (CHAR - 10)) | + (1L << (DECIMAL - 10)) | + (1L << (DESCENDING - 10)) | + (1L << (DOUBLE - 10)) | + (1L << (DYNAMIC - 10)) | + (1L << (EQUALS - 10)) | + (1L << (FLOAT - 10)) | + (1L << (FROM - 10)) | + (1L << (GET - 10)) | + (1L << (GROUP - 10)) | + (1L << (IN - 10)) | + (1L << (INT - 10)) | + (1L << (INTO - 10)) | + (1L << (JOIN - 10)) | + (1L << (LET - 10)) | + (1L << (LONG - 10)) | + (1L << (NAMEOF - 10)) | + (1L << (OBJECT - 10)) | + (1L << (ON - 10)) | + (1L << (ORDERBY - 10)) | + (1L << (OUT - 10)))) != + 0) || + ((((_la - 74)) & ~0x3f) == 0 && + ((1L << (_la - 74)) & + ((1L << (PARAMS - 74)) | + (1L << (PARTIAL - 74)) | + (1L << (REF - 74)) | + (1L << (REMOVE - 74)) | + (1L << (SBYTE - 74)) | + (1L << (SELECT - 74)) | + (1L << (SET - 74)) | + (1L << (SHORT - 74)) | + (1L << (STRING - 74)) | + (1L << (THIS - 74)) | + (1L << (UINT - 74)) | + (1L << (ULONG - 74)) | + (1L << (UNMANAGED - 74)) | + (1L << (USHORT - 74)) | + (1L << (VAR - 74)) | + (1L << (VOID - 74)) | + (1L << (WHEN - 74)) | + (1L << (WHERE - 74)) | + (1L << (YIELD - 74)) | + (1L << (IDENTIFIER - 74)) | + (1L << (OPEN_BRACKET - 74)) | + (1L << (OPEN_PARENS - 74)))) != + 0) + ) { + { + setState(2141); + formal_parameter_list(); + } + } + + setState(2144); + match(CLOSE_PARENS); + setState(2146); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHERE) { + { + setState(2145); + type_parameter_constraints_clauses(); + } + } + + setState(2148); + match(SEMICOLON); + } + break; + case 3: + { + setState(2150); + match(EVENT); + setState(2151); + type_(); + setState(2152); + identifier(); + setState(2153); + match(SEMICOLON); + } + break; + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Interface_accessorsContext extends ParserRuleContext { + + public TerminalNode GET() { + return getToken(CSharpParser.GET, 0); + } + + public List SEMICOLON() { + return getTokens(CSharpParser.SEMICOLON); + } + + public TerminalNode SEMICOLON(int i) { + return getToken(CSharpParser.SEMICOLON, i); + } + + public TerminalNode SET() { + return getToken(CSharpParser.SET, 0); + } + + public List attributes() { + return getRuleContexts(AttributesContext.class); + } + + public AttributesContext attributes(int i) { + return getRuleContext(AttributesContext.class, i); + } + + public Interface_accessorsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_interface_accessors; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInterface_accessors(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInterface_accessors(this); + } + } + + public final Interface_accessorsContext interface_accessors() + throws RecognitionException { + Interface_accessorsContext _localctx = new Interface_accessorsContext( + _ctx, + getState() + ); + enterRule(_localctx, 338, RULE_interface_accessors); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2158); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(2157); + attributes(); + } + } + + setState(2178); + _errHandler.sync(this); + switch (_input.LA(1)) { + case GET: + { + setState(2160); + match(GET); + setState(2161); + match(SEMICOLON); + setState(2167); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == SET || _la == OPEN_BRACKET) { + { + setState(2163); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(2162); + attributes(); + } + } + + setState(2165); + match(SET); + setState(2166); + match(SEMICOLON); + } + } + } + break; + case SET: + { + setState(2169); + match(SET); + setState(2170); + match(SEMICOLON); + setState(2176); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == GET || _la == OPEN_BRACKET) { + { + setState(2172); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(2171); + attributes(); + } + } + + setState(2174); + match(GET); + setState(2175); + match(SEMICOLON); + } + } + } + break; + default: + throw new NoViableAltException(this); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Enum_baseContext extends ParserRuleContext { + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public Enum_baseContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_enum_base; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterEnum_base(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitEnum_base(this); + } + } + + public final Enum_baseContext enum_base() throws RecognitionException { + Enum_baseContext _localctx = new Enum_baseContext(_ctx, getState()); + enterRule(_localctx, 340, RULE_enum_base); + try { + enterOuterAlt(_localctx, 1); + { + setState(2180); + match(COLON); + setState(2181); + type_(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Enum_bodyContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public List enum_member_declaration() { + return getRuleContexts(Enum_member_declarationContext.class); + } + + public Enum_member_declarationContext enum_member_declaration(int i) { + return getRuleContext(Enum_member_declarationContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Enum_bodyContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_enum_body; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterEnum_body(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitEnum_body(this); + } + } + + public final Enum_bodyContext enum_body() throws RecognitionException { + Enum_bodyContext _localctx = new Enum_bodyContext(_ctx, getState()); + enterRule(_localctx, 342, RULE_enum_body); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(2183); + match(OPEN_BRACE); + setState(2195); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BY) | + (1L << DESCENDING) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (OPEN_BRACKET - 64)))) != + 0) + ) { + { + setState(2184); + enum_member_declaration(); + setState(2189); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 268, _ctx); + while ( + _alt != 2 && + _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(2185); + match(COMMA); + setState(2186); + enum_member_declaration(); + } + } + } + setState(2191); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 268, _ctx); + } + setState(2193); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(2192); + match(COMMA); + } + } + } + } + + setState(2197); + match(CLOSE_BRACE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Enum_member_declarationContext extends ParserRuleContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public AttributesContext attributes() { + return getRuleContext(AttributesContext.class, 0); + } + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Enum_member_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_enum_member_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterEnum_member_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitEnum_member_declaration(this); + } + } + + public final Enum_member_declarationContext enum_member_declaration() + throws RecognitionException { + Enum_member_declarationContext _localctx = + new Enum_member_declarationContext(_ctx, getState()); + enterRule(_localctx, 344, RULE_enum_member_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2200); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACKET) { + { + setState(2199); + attributes(); + } + } + + setState(2202); + identifier(); + setState(2205); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == ASSIGNMENT) { + { + setState(2203); + match(ASSIGNMENT); + setState(2204); + expression(); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Global_attribute_sectionContext + extends ParserRuleContext { + + public TerminalNode OPEN_BRACKET() { + return getToken(CSharpParser.OPEN_BRACKET, 0); + } + + public Global_attribute_targetContext global_attribute_target() { + return getRuleContext(Global_attribute_targetContext.class, 0); + } + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public Attribute_listContext attribute_list() { + return getRuleContext(Attribute_listContext.class, 0); + } + + public TerminalNode CLOSE_BRACKET() { + return getToken(CSharpParser.CLOSE_BRACKET, 0); + } + + public TerminalNode COMMA() { + return getToken(CSharpParser.COMMA, 0); + } + + public Global_attribute_sectionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_global_attribute_section; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterGlobal_attribute_section(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitGlobal_attribute_section(this); + } + } + + public final Global_attribute_sectionContext global_attribute_section() + throws RecognitionException { + Global_attribute_sectionContext _localctx = + new Global_attribute_sectionContext(_ctx, getState()); + enterRule(_localctx, 346, RULE_global_attribute_section); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2207); + match(OPEN_BRACKET); + setState(2208); + global_attribute_target(); + setState(2209); + match(COLON); + setState(2210); + attribute_list(); + setState(2212); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(2211); + match(COMMA); + } + } + + setState(2214); + match(CLOSE_BRACKET); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Global_attribute_targetContext extends ParserRuleContext { + + public KeywordContext keyword() { + return getRuleContext(KeywordContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Global_attribute_targetContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_global_attribute_target; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterGlobal_attribute_target(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitGlobal_attribute_target(this); + } + } + + public final Global_attribute_targetContext global_attribute_target() + throws RecognitionException { + Global_attribute_targetContext _localctx = + new Global_attribute_targetContext(_ctx, getState()); + enterRule(_localctx, 348, RULE_global_attribute_target); + try { + setState(2218); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 274, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(2216); + keyword(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(2217); + identifier(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class AttributesContext extends ParserRuleContext { + + public List attribute_section() { + return getRuleContexts(Attribute_sectionContext.class); + } + + public Attribute_sectionContext attribute_section(int i) { + return getRuleContext(Attribute_sectionContext.class, i); + } + + public AttributesContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_attributes; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAttributes(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAttributes(this); + } + } + + public final AttributesContext attributes() throws RecognitionException { + AttributesContext _localctx = new AttributesContext(_ctx, getState()); + enterRule(_localctx, 350, RULE_attributes); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2221); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(2220); + attribute_section(); + } + } + setState(2223); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == OPEN_BRACKET); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Attribute_sectionContext extends ParserRuleContext { + + public TerminalNode OPEN_BRACKET() { + return getToken(CSharpParser.OPEN_BRACKET, 0); + } + + public Attribute_listContext attribute_list() { + return getRuleContext(Attribute_listContext.class, 0); + } + + public TerminalNode CLOSE_BRACKET() { + return getToken(CSharpParser.CLOSE_BRACKET, 0); + } + + public Attribute_targetContext attribute_target() { + return getRuleContext(Attribute_targetContext.class, 0); + } + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public TerminalNode COMMA() { + return getToken(CSharpParser.COMMA, 0); + } + + public Attribute_sectionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_attribute_section; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAttribute_section(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAttribute_section(this); + } + } + + public final Attribute_sectionContext attribute_section() + throws RecognitionException { + Attribute_sectionContext _localctx = new Attribute_sectionContext( + _ctx, + getState() + ); + enterRule(_localctx, 352, RULE_attribute_section); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2225); + match(OPEN_BRACKET); + setState(2229); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 276, _ctx)) { + case 1: + { + setState(2226); + attribute_target(); + setState(2227); + match(COLON); + } + break; + } + setState(2231); + attribute_list(); + setState(2233); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(2232); + match(COMMA); + } + } + + setState(2235); + match(CLOSE_BRACKET); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Attribute_targetContext extends ParserRuleContext { + + public KeywordContext keyword() { + return getRuleContext(KeywordContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Attribute_targetContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_attribute_target; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAttribute_target(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAttribute_target(this); + } + } + + public final Attribute_targetContext attribute_target() + throws RecognitionException { + Attribute_targetContext _localctx = new Attribute_targetContext( + _ctx, + getState() + ); + enterRule(_localctx, 354, RULE_attribute_target); + try { + setState(2239); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 278, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(2237); + keyword(); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(2238); + identifier(); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Attribute_listContext extends ParserRuleContext { + + public List attribute() { + return getRuleContexts(AttributeContext.class); + } + + public AttributeContext attribute(int i) { + return getRuleContext(AttributeContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Attribute_listContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_attribute_list; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAttribute_list(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAttribute_list(this); + } + } + + public final Attribute_listContext attribute_list() + throws RecognitionException { + Attribute_listContext _localctx = new Attribute_listContext( + _ctx, + getState() + ); + enterRule(_localctx, 356, RULE_attribute_list); + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(2241); + attribute(); + setState(2246); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 279, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(2242); + match(COMMA); + setState(2243); + attribute(); + } + } + } + setState(2248); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 279, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class AttributeContext extends ParserRuleContext { + + public Namespace_or_type_nameContext namespace_or_type_name() { + return getRuleContext(Namespace_or_type_nameContext.class, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public List attribute_argument() { + return getRuleContexts(Attribute_argumentContext.class); + } + + public Attribute_argumentContext attribute_argument(int i) { + return getRuleContext(Attribute_argumentContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public AttributeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_attribute; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAttribute(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAttribute(this); + } + } + + public final AttributeContext attribute() throws RecognitionException { + AttributeContext _localctx = new AttributeContext(_ctx, getState()); + enterRule(_localctx, 358, RULE_attribute); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2249); + namespace_or_type_name(); + setState(2262); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_PARENS) { + { + setState(2250); + match(OPEN_PARENS); + setState(2259); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(2251); + attribute_argument(); + setState(2256); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(2252); + match(COMMA); + setState(2253); + attribute_argument(); + } + } + setState(2258); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } + + setState(2261); + match(CLOSE_PARENS); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Attribute_argumentContext extends ParserRuleContext { + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public Attribute_argumentContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_attribute_argument; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterAttribute_argument(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitAttribute_argument(this); + } + } + + public final Attribute_argumentContext attribute_argument() + throws RecognitionException { + Attribute_argumentContext _localctx = new Attribute_argumentContext( + _ctx, + getState() + ); + enterRule(_localctx, 360, RULE_attribute_argument); + try { + enterOuterAlt(_localctx, 1); + { + setState(2267); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 283, _ctx)) { + case 1: + { + setState(2264); + identifier(); + setState(2265); + match(COLON); + } + break; + } + setState(2269); + expression(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Pointer_typeContext extends ParserRuleContext { + + public TerminalNode STAR() { + return getToken(CSharpParser.STAR, 0); + } + + public Simple_typeContext simple_type() { + return getRuleContext(Simple_typeContext.class, 0); + } + + public Class_typeContext class_type() { + return getRuleContext(Class_typeContext.class, 0); + } + + public List rank_specifier() { + return getRuleContexts(Rank_specifierContext.class); + } + + public Rank_specifierContext rank_specifier(int i) { + return getRuleContext(Rank_specifierContext.class, i); + } + + public List INTERR() { + return getTokens(CSharpParser.INTERR); + } + + public TerminalNode INTERR(int i) { + return getToken(CSharpParser.INTERR, i); + } + + public TerminalNode VOID() { + return getToken(CSharpParser.VOID, 0); + } + + public Pointer_typeContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_pointer_type; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterPointer_type(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitPointer_type(this); + } + } + + public final Pointer_typeContext pointer_type() throws RecognitionException { + Pointer_typeContext _localctx = new Pointer_typeContext(_ctx, getState()); + enterRule(_localctx, 362, RULE_pointer_type); + int _la; + try { + setState(2286); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BOOL: + case BY: + case BYTE: + case CHAR: + case DECIMAL: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case STRING: + case UINT: + case ULONG: + case UNMANAGED: + case USHORT: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + enterOuterAlt(_localctx, 1); + { + setState(2273); + _errHandler.sync(this); + switch (_input.LA(1)) { + case BOOL: + case BYTE: + case CHAR: + case DECIMAL: + case DOUBLE: + case FLOAT: + case INT: + case LONG: + case SBYTE: + case SHORT: + case UINT: + case ULONG: + case USHORT: + { + setState(2271); + simple_type(); + } + break; + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BY: + case DESCENDING: + case DYNAMIC: + case EQUALS: + case FROM: + case GET: + case GROUP: + case INTO: + case JOIN: + case LET: + case NAMEOF: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REMOVE: + case SELECT: + case SET: + case STRING: + case UNMANAGED: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + { + setState(2272); + class_type(); + } + break; + default: + throw new NoViableAltException(this); + } + setState(2279); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == OPEN_BRACKET || _la == INTERR) { + { + setState(2277); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACKET: + { + setState(2275); + rank_specifier(); + } + break; + case INTERR: + { + setState(2276); + match(INTERR); + } + break; + default: + throw new NoViableAltException(this); + } + } + setState(2281); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(2282); + match(STAR); + } + break; + case VOID: + enterOuterAlt(_localctx, 2); + { + setState(2284); + match(VOID); + setState(2285); + match(STAR); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Fixed_pointer_declaratorsContext + extends ParserRuleContext { + + public List fixed_pointer_declarator() { + return getRuleContexts(Fixed_pointer_declaratorContext.class); + } + + public Fixed_pointer_declaratorContext fixed_pointer_declarator(int i) { + return getRuleContext(Fixed_pointer_declaratorContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Fixed_pointer_declaratorsContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_fixed_pointer_declarators; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFixed_pointer_declarators(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFixed_pointer_declarators(this); + } + } + + public final Fixed_pointer_declaratorsContext fixed_pointer_declarators() + throws RecognitionException { + Fixed_pointer_declaratorsContext _localctx = + new Fixed_pointer_declaratorsContext(_ctx, getState()); + enterRule(_localctx, 364, RULE_fixed_pointer_declarators); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2288); + fixed_pointer_declarator(); + setState(2293); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(2289); + match(COMMA); + setState(2290); + fixed_pointer_declarator(); + } + } + setState(2295); + _errHandler.sync(this); + _la = _input.LA(1); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Fixed_pointer_declaratorContext + extends ParserRuleContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public Fixed_pointer_initializerContext fixed_pointer_initializer() { + return getRuleContext(Fixed_pointer_initializerContext.class, 0); + } + + public Fixed_pointer_declaratorContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_fixed_pointer_declarator; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFixed_pointer_declarator(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFixed_pointer_declarator(this); + } + } + + public final Fixed_pointer_declaratorContext fixed_pointer_declarator() + throws RecognitionException { + Fixed_pointer_declaratorContext _localctx = + new Fixed_pointer_declaratorContext(_ctx, getState()); + enterRule(_localctx, 366, RULE_fixed_pointer_declarator); + try { + enterOuterAlt(_localctx, 1); + { + setState(2296); + identifier(); + setState(2297); + match(ASSIGNMENT); + setState(2298); + fixed_pointer_initializer(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Fixed_pointer_initializerContext + extends ParserRuleContext { + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode AMP() { + return getToken(CSharpParser.AMP, 0); + } + + public Stackalloc_initializerContext stackalloc_initializer() { + return getRuleContext(Stackalloc_initializerContext.class, 0); + } + + public Fixed_pointer_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_fixed_pointer_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFixed_pointer_initializer(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFixed_pointer_initializer(this); + } + } + + public final Fixed_pointer_initializerContext fixed_pointer_initializer() + throws RecognitionException { + Fixed_pointer_initializerContext _localctx = + new Fixed_pointer_initializerContext(_ctx, getState()); + enterRule(_localctx, 368, RULE_fixed_pointer_initializer); + try { + setState(2305); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REF: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case THIS: + case TRUE: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case USHORT: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + enterOuterAlt(_localctx, 1); + { + setState(2301); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 289, _ctx)) { + case 1: + { + setState(2300); + match(AMP); + } + break; + } + setState(2303); + expression(); + } + break; + case STACKALLOC: + enterOuterAlt(_localctx, 2); + { + setState(2304); + stackalloc_initializer(); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Fixed_size_buffer_declaratorContext + extends ParserRuleContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode OPEN_BRACKET() { + return getToken(CSharpParser.OPEN_BRACKET, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public TerminalNode CLOSE_BRACKET() { + return getToken(CSharpParser.CLOSE_BRACKET, 0); + } + + public Fixed_size_buffer_declaratorContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_fixed_size_buffer_declarator; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterFixed_size_buffer_declarator( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitFixed_size_buffer_declarator( + this + ); + } + } + + public final Fixed_size_buffer_declaratorContext fixed_size_buffer_declarator() + throws RecognitionException { + Fixed_size_buffer_declaratorContext _localctx = + new Fixed_size_buffer_declaratorContext(_ctx, getState()); + enterRule(_localctx, 370, RULE_fixed_size_buffer_declarator); + try { + enterOuterAlt(_localctx, 1); + { + setState(2307); + identifier(); + setState(2308); + match(OPEN_BRACKET); + setState(2309); + expression(); + setState(2310); + match(CLOSE_BRACKET); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Stackalloc_initializerContext extends ParserRuleContext { + + public TerminalNode STACKALLOC() { + return getToken(CSharpParser.STACKALLOC, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public TerminalNode OPEN_BRACKET() { + return getToken(CSharpParser.OPEN_BRACKET, 0); + } + + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class, i); + } + + public TerminalNode CLOSE_BRACKET() { + return getToken(CSharpParser.CLOSE_BRACKET, 0); + } + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public Stackalloc_initializerContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_stackalloc_initializer; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterStackalloc_initializer(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitStackalloc_initializer(this); + } + } + + public final Stackalloc_initializerContext stackalloc_initializer() + throws RecognitionException { + Stackalloc_initializerContext _localctx = new Stackalloc_initializerContext( + _ctx, + getState() + ); + enterRule(_localctx, 372, RULE_stackalloc_initializer); + int _la; + try { + int _alt; + setState(2341); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 295, _ctx)) { + case 1: + enterOuterAlt(_localctx, 1); + { + setState(2312); + match(STACKALLOC); + setState(2313); + type_(); + setState(2314); + match(OPEN_BRACKET); + setState(2315); + expression(); + setState(2316); + match(CLOSE_BRACKET); + } + break; + case 2: + enterOuterAlt(_localctx, 2); + { + setState(2318); + match(STACKALLOC); + setState(2320); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 10)) & ~0x3f) == 0 && + ((1L << (_la - 10)) & + ((1L << (ADD - 10)) | + (1L << (ALIAS - 10)) | + (1L << (ARGLIST - 10)) | + (1L << (ASCENDING - 10)) | + (1L << (ASYNC - 10)) | + (1L << (AWAIT - 10)) | + (1L << (BOOL - 10)) | + (1L << (BY - 10)) | + (1L << (BYTE - 10)) | + (1L << (CHAR - 10)) | + (1L << (DECIMAL - 10)) | + (1L << (DESCENDING - 10)) | + (1L << (DOUBLE - 10)) | + (1L << (DYNAMIC - 10)) | + (1L << (EQUALS - 10)) | + (1L << (FLOAT - 10)) | + (1L << (FROM - 10)) | + (1L << (GET - 10)) | + (1L << (GROUP - 10)) | + (1L << (INT - 10)) | + (1L << (INTO - 10)) | + (1L << (JOIN - 10)) | + (1L << (LET - 10)) | + (1L << (LONG - 10)) | + (1L << (NAMEOF - 10)) | + (1L << (OBJECT - 10)) | + (1L << (ON - 10)) | + (1L << (ORDERBY - 10)))) != + 0) || + ((((_la - 75)) & ~0x3f) == 0 && + ((1L << (_la - 75)) & + ((1L << (PARTIAL - 75)) | + (1L << (REMOVE - 75)) | + (1L << (SBYTE - 75)) | + (1L << (SELECT - 75)) | + (1L << (SET - 75)) | + (1L << (SHORT - 75)) | + (1L << (STRING - 75)) | + (1L << (UINT - 75)) | + (1L << (ULONG - 75)) | + (1L << (UNMANAGED - 75)) | + (1L << (USHORT - 75)) | + (1L << (VAR - 75)) | + (1L << (VOID - 75)) | + (1L << (WHEN - 75)) | + (1L << (WHERE - 75)) | + (1L << (YIELD - 75)) | + (1L << (IDENTIFIER - 75)) | + (1L << (OPEN_PARENS - 75)))) != + 0) + ) { + { + setState(2319); + type_(); + } + } + + setState(2322); + match(OPEN_BRACKET); + setState(2324); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(2323); + expression(); + } + } + + setState(2326); + match(CLOSE_BRACKET); + setState(2327); + match(OPEN_BRACE); + setState(2328); + expression(); + setState(2333); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 293, _ctx); + while ( + _alt != 2 && + _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(2329); + match(COMMA); + setState(2330); + expression(); + } + } + } + setState(2335); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 293, _ctx); + } + setState(2337); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(2336); + match(COMMA); + } + } + + setState(2339); + match(CLOSE_BRACE); + } + break; + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Right_arrowContext extends ParserRuleContext { + + public Token first; + public Token second; + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public TerminalNode GT() { + return getToken(CSharpParser.GT, 0); + } + + public Right_arrowContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_right_arrow; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterRight_arrow(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitRight_arrow(this); + } + } + + public final Right_arrowContext right_arrow() throws RecognitionException { + Right_arrowContext _localctx = new Right_arrowContext(_ctx, getState()); + enterRule(_localctx, 374, RULE_right_arrow); + try { + enterOuterAlt(_localctx, 1); + { + setState(2343); + ((Right_arrowContext) _localctx).first = match(ASSIGNMENT); + setState(2344); + ((Right_arrowContext) _localctx).second = match(GT); + setState(2345); + if ( + !((((Right_arrowContext) _localctx).first != null + ? ((Right_arrowContext) _localctx).first.getTokenIndex() + : 0) + + 1 == + (((Right_arrowContext) _localctx).second != null + ? ((Right_arrowContext) _localctx).second.getTokenIndex() + : 0)) + ) throw new FailedPredicateException( + this, + "$first.index + 1 == $second.index" + ); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Right_shiftContext extends ParserRuleContext { + + public Token first; + public Token second; + + public List GT() { + return getTokens(CSharpParser.GT); + } + + public TerminalNode GT(int i) { + return getToken(CSharpParser.GT, i); + } + + public Right_shiftContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_right_shift; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterRight_shift(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitRight_shift(this); + } + } + + public final Right_shiftContext right_shift() throws RecognitionException { + Right_shiftContext _localctx = new Right_shiftContext(_ctx, getState()); + enterRule(_localctx, 376, RULE_right_shift); + try { + enterOuterAlt(_localctx, 1); + { + setState(2347); + ((Right_shiftContext) _localctx).first = match(GT); + setState(2348); + ((Right_shiftContext) _localctx).second = match(GT); + setState(2349); + if ( + !((((Right_shiftContext) _localctx).first != null + ? ((Right_shiftContext) _localctx).first.getTokenIndex() + : 0) + + 1 == + (((Right_shiftContext) _localctx).second != null + ? ((Right_shiftContext) _localctx).second.getTokenIndex() + : 0)) + ) throw new FailedPredicateException( + this, + "$first.index + 1 == $second.index" + ); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Right_shift_assignmentContext extends ParserRuleContext { + + public Token first; + public Token second; + + public TerminalNode GT() { + return getToken(CSharpParser.GT, 0); + } + + public TerminalNode OP_GE() { + return getToken(CSharpParser.OP_GE, 0); + } + + public Right_shift_assignmentContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_right_shift_assignment; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterRight_shift_assignment(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitRight_shift_assignment(this); + } + } + + public final Right_shift_assignmentContext right_shift_assignment() + throws RecognitionException { + Right_shift_assignmentContext _localctx = new Right_shift_assignmentContext( + _ctx, + getState() + ); + enterRule(_localctx, 378, RULE_right_shift_assignment); + try { + enterOuterAlt(_localctx, 1); + { + setState(2351); + ((Right_shift_assignmentContext) _localctx).first = match(GT); + setState(2352); + ((Right_shift_assignmentContext) _localctx).second = match(OP_GE); + setState(2353); + if ( + !((((Right_shift_assignmentContext) _localctx).first != null + ? ((Right_shift_assignmentContext) _localctx).first.getTokenIndex() + : 0) + + 1 == + (((Right_shift_assignmentContext) _localctx).second != null + ? ((Right_shift_assignmentContext) _localctx).second.getTokenIndex() + : 0)) + ) throw new FailedPredicateException( + this, + "$first.index + 1 == $second.index" + ); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class LiteralContext extends ParserRuleContext { + + public Boolean_literalContext boolean_literal() { + return getRuleContext(Boolean_literalContext.class, 0); + } + + public String_literalContext string_literal() { + return getRuleContext(String_literalContext.class, 0); + } + + public TerminalNode INTEGER_LITERAL() { + return getToken(CSharpParser.INTEGER_LITERAL, 0); + } + + public TerminalNode HEX_INTEGER_LITERAL() { + return getToken(CSharpParser.HEX_INTEGER_LITERAL, 0); + } + + public TerminalNode BIN_INTEGER_LITERAL() { + return getToken(CSharpParser.BIN_INTEGER_LITERAL, 0); + } + + public TerminalNode REAL_LITERAL() { + return getToken(CSharpParser.REAL_LITERAL, 0); + } + + public TerminalNode CHARACTER_LITERAL() { + return getToken(CSharpParser.CHARACTER_LITERAL, 0); + } + + public TerminalNode NULL_() { + return getToken(CSharpParser.NULL_, 0); + } + + public LiteralContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_literal; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterLiteral(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitLiteral(this); + } + } + + public final LiteralContext literal() throws RecognitionException { + LiteralContext _localctx = new LiteralContext(_ctx, getState()); + enterRule(_localctx, 380, RULE_literal); + try { + setState(2363); + _errHandler.sync(this); + switch (_input.LA(1)) { + case FALSE: + case TRUE: + enterOuterAlt(_localctx, 1); + { + setState(2355); + boolean_literal(); + } + break; + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + enterOuterAlt(_localctx, 2); + { + setState(2356); + string_literal(); + } + break; + case INTEGER_LITERAL: + enterOuterAlt(_localctx, 3); + { + setState(2357); + match(INTEGER_LITERAL); + } + break; + case HEX_INTEGER_LITERAL: + enterOuterAlt(_localctx, 4); + { + setState(2358); + match(HEX_INTEGER_LITERAL); + } + break; + case BIN_INTEGER_LITERAL: + enterOuterAlt(_localctx, 5); + { + setState(2359); + match(BIN_INTEGER_LITERAL); + } + break; + case REAL_LITERAL: + enterOuterAlt(_localctx, 6); + { + setState(2360); + match(REAL_LITERAL); + } + break; + case CHARACTER_LITERAL: + enterOuterAlt(_localctx, 7); + { + setState(2361); + match(CHARACTER_LITERAL); + } + break; + case NULL_: + enterOuterAlt(_localctx, 8); + { + setState(2362); + match(NULL_); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Boolean_literalContext extends ParserRuleContext { + + public TerminalNode TRUE() { + return getToken(CSharpParser.TRUE, 0); + } + + public TerminalNode FALSE() { + return getToken(CSharpParser.FALSE, 0); + } + + public Boolean_literalContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_boolean_literal; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterBoolean_literal(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitBoolean_literal(this); + } + } + + public final Boolean_literalContext boolean_literal() + throws RecognitionException { + Boolean_literalContext _localctx = new Boolean_literalContext( + _ctx, + getState() + ); + enterRule(_localctx, 382, RULE_boolean_literal); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2365); + _la = _input.LA(1); + if (!(_la == FALSE || _la == TRUE)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class String_literalContext extends ParserRuleContext { + + public Interpolated_regular_stringContext interpolated_regular_string() { + return getRuleContext(Interpolated_regular_stringContext.class, 0); + } + + public Interpolated_verbatium_stringContext interpolated_verbatium_string() { + return getRuleContext(Interpolated_verbatium_stringContext.class, 0); + } + + public TerminalNode REGULAR_STRING() { + return getToken(CSharpParser.REGULAR_STRING, 0); + } + + public TerminalNode VERBATIUM_STRING() { + return getToken(CSharpParser.VERBATIUM_STRING, 0); + } + + public String_literalContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_string_literal; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterString_literal(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitString_literal(this); + } + } + + public final String_literalContext string_literal() + throws RecognitionException { + String_literalContext _localctx = new String_literalContext( + _ctx, + getState() + ); + enterRule(_localctx, 384, RULE_string_literal); + try { + setState(2371); + _errHandler.sync(this); + switch (_input.LA(1)) { + case INTERPOLATED_REGULAR_STRING_START: + enterOuterAlt(_localctx, 1); + { + setState(2367); + interpolated_regular_string(); + } + break; + case INTERPOLATED_VERBATIUM_STRING_START: + enterOuterAlt(_localctx, 2); + { + setState(2368); + interpolated_verbatium_string(); + } + break; + case REGULAR_STRING: + enterOuterAlt(_localctx, 3); + { + setState(2369); + match(REGULAR_STRING); + } + break; + case VERBATIUM_STRING: + enterOuterAlt(_localctx, 4); + { + setState(2370); + match(VERBATIUM_STRING); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Interpolated_regular_stringContext + extends ParserRuleContext { + + public TerminalNode INTERPOLATED_REGULAR_STRING_START() { + return getToken(CSharpParser.INTERPOLATED_REGULAR_STRING_START, 0); + } + + public TerminalNode DOUBLE_QUOTE_INSIDE() { + return getToken(CSharpParser.DOUBLE_QUOTE_INSIDE, 0); + } + + public List< + Interpolated_regular_string_partContext + > interpolated_regular_string_part() { + return getRuleContexts(Interpolated_regular_string_partContext.class); + } + + public Interpolated_regular_string_partContext interpolated_regular_string_part( + int i + ) { + return getRuleContext(Interpolated_regular_string_partContext.class, i); + } + + public Interpolated_regular_stringContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_interpolated_regular_string; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInterpolated_regular_string( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInterpolated_regular_string(this); + } + } + + public final Interpolated_regular_stringContext interpolated_regular_string() + throws RecognitionException { + Interpolated_regular_stringContext _localctx = + new Interpolated_regular_stringContext(_ctx, getState()); + enterRule(_localctx, 386, RULE_interpolated_regular_string); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2373); + match(INTERPOLATED_REGULAR_STRING_START); + setState(2377); + _errHandler.sync(this); + _la = _input.LA(1); + while ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)) | + (1L << (DOUBLE_CURLY_INSIDE - 129)) | + (1L << (REGULAR_CHAR_INSIDE - 129)) | + (1L << (REGULAR_STRING_INSIDE - 129)))) != + 0) + ) { + { + { + setState(2374); + interpolated_regular_string_part(); + } + } + setState(2379); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(2380); + match(DOUBLE_QUOTE_INSIDE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Interpolated_verbatium_stringContext + extends ParserRuleContext { + + public TerminalNode INTERPOLATED_VERBATIUM_STRING_START() { + return getToken(CSharpParser.INTERPOLATED_VERBATIUM_STRING_START, 0); + } + + public TerminalNode DOUBLE_QUOTE_INSIDE() { + return getToken(CSharpParser.DOUBLE_QUOTE_INSIDE, 0); + } + + public List< + Interpolated_verbatium_string_partContext + > interpolated_verbatium_string_part() { + return getRuleContexts(Interpolated_verbatium_string_partContext.class); + } + + public Interpolated_verbatium_string_partContext interpolated_verbatium_string_part( + int i + ) { + return getRuleContext(Interpolated_verbatium_string_partContext.class, i); + } + + public Interpolated_verbatium_stringContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_interpolated_verbatium_string; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInterpolated_verbatium_string( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInterpolated_verbatium_string( + this + ); + } + } + + public final Interpolated_verbatium_stringContext interpolated_verbatium_string() + throws RecognitionException { + Interpolated_verbatium_stringContext _localctx = + new Interpolated_verbatium_stringContext(_ctx, getState()); + enterRule(_localctx, 388, RULE_interpolated_verbatium_string); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2382); + match(INTERPOLATED_VERBATIUM_STRING_START); + setState(2386); + _errHandler.sync(this); + _la = _input.LA(1); + while ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)) | + (1L << (DOUBLE_CURLY_INSIDE - 129)) | + (1L << (VERBATIUM_DOUBLE_QUOTE_INSIDE - 129)) | + (1L << (VERBATIUM_INSIDE_STRING - 129)))) != + 0) + ) { + { + { + setState(2383); + interpolated_verbatium_string_part(); + } + } + setState(2388); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(2389); + match(DOUBLE_QUOTE_INSIDE); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Interpolated_regular_string_partContext + extends ParserRuleContext { + + public Interpolated_string_expressionContext interpolated_string_expression() { + return getRuleContext(Interpolated_string_expressionContext.class, 0); + } + + public TerminalNode DOUBLE_CURLY_INSIDE() { + return getToken(CSharpParser.DOUBLE_CURLY_INSIDE, 0); + } + + public TerminalNode REGULAR_CHAR_INSIDE() { + return getToken(CSharpParser.REGULAR_CHAR_INSIDE, 0); + } + + public TerminalNode REGULAR_STRING_INSIDE() { + return getToken(CSharpParser.REGULAR_STRING_INSIDE, 0); + } + + public Interpolated_regular_string_partContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_interpolated_regular_string_part; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInterpolated_regular_string_part( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInterpolated_regular_string_part( + this + ); + } + } + + public final Interpolated_regular_string_partContext interpolated_regular_string_part() + throws RecognitionException { + Interpolated_regular_string_partContext _localctx = + new Interpolated_regular_string_partContext(_ctx, getState()); + enterRule(_localctx, 390, RULE_interpolated_regular_string_part); + try { + setState(2395); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REF: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case THIS: + case TRUE: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case USHORT: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + enterOuterAlt(_localctx, 1); + { + setState(2391); + interpolated_string_expression(); + } + break; + case DOUBLE_CURLY_INSIDE: + enterOuterAlt(_localctx, 2); + { + setState(2392); + match(DOUBLE_CURLY_INSIDE); + } + break; + case REGULAR_CHAR_INSIDE: + enterOuterAlt(_localctx, 3); + { + setState(2393); + match(REGULAR_CHAR_INSIDE); + } + break; + case REGULAR_STRING_INSIDE: + enterOuterAlt(_localctx, 4); + { + setState(2394); + match(REGULAR_STRING_INSIDE); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Interpolated_verbatium_string_partContext + extends ParserRuleContext { + + public Interpolated_string_expressionContext interpolated_string_expression() { + return getRuleContext(Interpolated_string_expressionContext.class, 0); + } + + public TerminalNode DOUBLE_CURLY_INSIDE() { + return getToken(CSharpParser.DOUBLE_CURLY_INSIDE, 0); + } + + public TerminalNode VERBATIUM_DOUBLE_QUOTE_INSIDE() { + return getToken(CSharpParser.VERBATIUM_DOUBLE_QUOTE_INSIDE, 0); + } + + public TerminalNode VERBATIUM_INSIDE_STRING() { + return getToken(CSharpParser.VERBATIUM_INSIDE_STRING, 0); + } + + public Interpolated_verbatium_string_partContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_interpolated_verbatium_string_part; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInterpolated_verbatium_string_part( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInterpolated_verbatium_string_part( + this + ); + } + } + + public final Interpolated_verbatium_string_partContext interpolated_verbatium_string_part() + throws RecognitionException { + Interpolated_verbatium_string_partContext _localctx = + new Interpolated_verbatium_string_partContext(_ctx, getState()); + enterRule(_localctx, 392, RULE_interpolated_verbatium_string_part); + try { + setState(2401); + _errHandler.sync(this); + switch (_input.LA(1)) { + case ADD: + case ALIAS: + case ARGLIST: + case ASCENDING: + case ASYNC: + case AWAIT: + case BASE: + case BOOL: + case BY: + case BYTE: + case CHAR: + case CHECKED: + case DECIMAL: + case DEFAULT: + case DELEGATE: + case DESCENDING: + case DOUBLE: + case DYNAMIC: + case EQUALS: + case FALSE: + case FLOAT: + case FROM: + case GET: + case GROUP: + case INT: + case INTO: + case JOIN: + case LET: + case LONG: + case NAMEOF: + case NEW: + case NULL_: + case OBJECT: + case ON: + case ORDERBY: + case PARTIAL: + case REF: + case REMOVE: + case SBYTE: + case SELECT: + case SET: + case SHORT: + case SIZEOF: + case STRING: + case THIS: + case TRUE: + case TYPEOF: + case UINT: + case ULONG: + case UNCHECKED: + case UNMANAGED: + case USHORT: + case VAR: + case WHEN: + case WHERE: + case YIELD: + case IDENTIFIER: + case LITERAL_ACCESS: + case INTEGER_LITERAL: + case HEX_INTEGER_LITERAL: + case BIN_INTEGER_LITERAL: + case REAL_LITERAL: + case CHARACTER_LITERAL: + case REGULAR_STRING: + case VERBATIUM_STRING: + case INTERPOLATED_REGULAR_STRING_START: + case INTERPOLATED_VERBATIUM_STRING_START: + case OPEN_PARENS: + case PLUS: + case MINUS: + case STAR: + case AMP: + case CARET: + case BANG: + case TILDE: + case OP_INC: + case OP_DEC: + case OP_RANGE: + enterOuterAlt(_localctx, 1); + { + setState(2397); + interpolated_string_expression(); + } + break; + case DOUBLE_CURLY_INSIDE: + enterOuterAlt(_localctx, 2); + { + setState(2398); + match(DOUBLE_CURLY_INSIDE); + } + break; + case VERBATIUM_DOUBLE_QUOTE_INSIDE: + enterOuterAlt(_localctx, 3); + { + setState(2399); + match(VERBATIUM_DOUBLE_QUOTE_INSIDE); + } + break; + case VERBATIUM_INSIDE_STRING: + enterOuterAlt(_localctx, 4); + { + setState(2400); + match(VERBATIUM_INSIDE_STRING); + } + break; + default: + throw new NoViableAltException(this); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Interpolated_string_expressionContext + extends ParserRuleContext { + + public List expression() { + return getRuleContexts(ExpressionContext.class); + } + + public ExpressionContext expression(int i) { + return getRuleContext(ExpressionContext.class, i); + } + + public List COMMA() { + return getTokens(CSharpParser.COMMA); + } + + public TerminalNode COMMA(int i) { + return getToken(CSharpParser.COMMA, i); + } + + public TerminalNode COLON() { + return getToken(CSharpParser.COLON, 0); + } + + public List FORMAT_STRING() { + return getTokens(CSharpParser.FORMAT_STRING); + } + + public TerminalNode FORMAT_STRING(int i) { + return getToken(CSharpParser.FORMAT_STRING, i); + } + + public Interpolated_string_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_interpolated_string_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInterpolated_string_expression( + this + ); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInterpolated_string_expression( + this + ); + } + } + + public final Interpolated_string_expressionContext interpolated_string_expression() + throws RecognitionException { + Interpolated_string_expressionContext _localctx = + new Interpolated_string_expressionContext(_ctx, getState()); + enterRule(_localctx, 394, RULE_interpolated_string_expression); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2403); + expression(); + setState(2408); + _errHandler.sync(this); + _la = _input.LA(1); + while (_la == COMMA) { + { + { + setState(2404); + match(COMMA); + setState(2405); + expression(); + } + } + setState(2410); + _errHandler.sync(this); + _la = _input.LA(1); + } + setState(2417); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COLON) { + { + setState(2411); + match(COLON); + setState(2413); + _errHandler.sync(this); + _la = _input.LA(1); + do { + { + { + setState(2412); + match(FORMAT_STRING); + } + } + setState(2415); + _errHandler.sync(this); + _la = _input.LA(1); + } while (_la == FORMAT_STRING); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class KeywordContext extends ParserRuleContext { + + public TerminalNode ABSTRACT() { + return getToken(CSharpParser.ABSTRACT, 0); + } + + public TerminalNode AS() { + return getToken(CSharpParser.AS, 0); + } + + public TerminalNode BASE() { + return getToken(CSharpParser.BASE, 0); + } + + public TerminalNode BOOL() { + return getToken(CSharpParser.BOOL, 0); + } + + public TerminalNode BREAK() { + return getToken(CSharpParser.BREAK, 0); + } + + public TerminalNode BYTE() { + return getToken(CSharpParser.BYTE, 0); + } + + public TerminalNode CASE() { + return getToken(CSharpParser.CASE, 0); + } + + public TerminalNode CATCH() { + return getToken(CSharpParser.CATCH, 0); + } + + public TerminalNode CHAR() { + return getToken(CSharpParser.CHAR, 0); + } + + public TerminalNode CHECKED() { + return getToken(CSharpParser.CHECKED, 0); + } + + public TerminalNode CLASS() { + return getToken(CSharpParser.CLASS, 0); + } + + public TerminalNode CONST() { + return getToken(CSharpParser.CONST, 0); + } + + public TerminalNode CONTINUE() { + return getToken(CSharpParser.CONTINUE, 0); + } + + public TerminalNode DECIMAL() { + return getToken(CSharpParser.DECIMAL, 0); + } + + public TerminalNode DEFAULT() { + return getToken(CSharpParser.DEFAULT, 0); + } + + public TerminalNode DELEGATE() { + return getToken(CSharpParser.DELEGATE, 0); + } + + public TerminalNode DO() { + return getToken(CSharpParser.DO, 0); + } + + public TerminalNode DOUBLE() { + return getToken(CSharpParser.DOUBLE, 0); + } + + public TerminalNode ELSE() { + return getToken(CSharpParser.ELSE, 0); + } + + public TerminalNode ENUM() { + return getToken(CSharpParser.ENUM, 0); + } + + public TerminalNode EVENT() { + return getToken(CSharpParser.EVENT, 0); + } + + public TerminalNode EXPLICIT() { + return getToken(CSharpParser.EXPLICIT, 0); + } + + public TerminalNode EXTERN() { + return getToken(CSharpParser.EXTERN, 0); + } + + public TerminalNode FALSE() { + return getToken(CSharpParser.FALSE, 0); + } + + public TerminalNode FINALLY() { + return getToken(CSharpParser.FINALLY, 0); + } + + public TerminalNode FIXED() { + return getToken(CSharpParser.FIXED, 0); + } + + public TerminalNode FLOAT() { + return getToken(CSharpParser.FLOAT, 0); + } + + public TerminalNode FOR() { + return getToken(CSharpParser.FOR, 0); + } + + public TerminalNode FOREACH() { + return getToken(CSharpParser.FOREACH, 0); + } + + public TerminalNode GOTO() { + return getToken(CSharpParser.GOTO, 0); + } + + public TerminalNode IF() { + return getToken(CSharpParser.IF, 0); + } + + public TerminalNode IMPLICIT() { + return getToken(CSharpParser.IMPLICIT, 0); + } + + public TerminalNode IN() { + return getToken(CSharpParser.IN, 0); + } + + public TerminalNode INT() { + return getToken(CSharpParser.INT, 0); + } + + public TerminalNode INTERFACE() { + return getToken(CSharpParser.INTERFACE, 0); + } + + public TerminalNode INTERNAL() { + return getToken(CSharpParser.INTERNAL, 0); + } + + public TerminalNode IS() { + return getToken(CSharpParser.IS, 0); + } + + public TerminalNode LOCK() { + return getToken(CSharpParser.LOCK, 0); + } + + public TerminalNode LONG() { + return getToken(CSharpParser.LONG, 0); + } + + public TerminalNode NAMESPACE() { + return getToken(CSharpParser.NAMESPACE, 0); + } + + public TerminalNode NEW() { + return getToken(CSharpParser.NEW, 0); + } + + public TerminalNode NULL_() { + return getToken(CSharpParser.NULL_, 0); + } + + public TerminalNode OBJECT() { + return getToken(CSharpParser.OBJECT, 0); + } + + public TerminalNode OPERATOR() { + return getToken(CSharpParser.OPERATOR, 0); + } + + public TerminalNode OUT() { + return getToken(CSharpParser.OUT, 0); + } + + public TerminalNode OVERRIDE() { + return getToken(CSharpParser.OVERRIDE, 0); + } + + public TerminalNode PARAMS() { + return getToken(CSharpParser.PARAMS, 0); + } + + public TerminalNode PRIVATE() { + return getToken(CSharpParser.PRIVATE, 0); + } + + public TerminalNode PROTECTED() { + return getToken(CSharpParser.PROTECTED, 0); + } + + public TerminalNode PUBLIC() { + return getToken(CSharpParser.PUBLIC, 0); + } + + public TerminalNode READONLY() { + return getToken(CSharpParser.READONLY, 0); + } + + public TerminalNode REF() { + return getToken(CSharpParser.REF, 0); + } + + public TerminalNode RETURN() { + return getToken(CSharpParser.RETURN, 0); + } + + public TerminalNode SBYTE() { + return getToken(CSharpParser.SBYTE, 0); + } + + public TerminalNode SEALED() { + return getToken(CSharpParser.SEALED, 0); + } + + public TerminalNode SHORT() { + return getToken(CSharpParser.SHORT, 0); + } + + public TerminalNode SIZEOF() { + return getToken(CSharpParser.SIZEOF, 0); + } + + public TerminalNode STACKALLOC() { + return getToken(CSharpParser.STACKALLOC, 0); + } + + public TerminalNode STATIC() { + return getToken(CSharpParser.STATIC, 0); + } + + public TerminalNode STRING() { + return getToken(CSharpParser.STRING, 0); + } + + public TerminalNode STRUCT() { + return getToken(CSharpParser.STRUCT, 0); + } + + public TerminalNode SWITCH() { + return getToken(CSharpParser.SWITCH, 0); + } + + public TerminalNode THIS() { + return getToken(CSharpParser.THIS, 0); + } + + public TerminalNode THROW() { + return getToken(CSharpParser.THROW, 0); + } + + public TerminalNode TRUE() { + return getToken(CSharpParser.TRUE, 0); + } + + public TerminalNode TRY() { + return getToken(CSharpParser.TRY, 0); + } + + public TerminalNode TYPEOF() { + return getToken(CSharpParser.TYPEOF, 0); + } + + public TerminalNode UINT() { + return getToken(CSharpParser.UINT, 0); + } + + public TerminalNode ULONG() { + return getToken(CSharpParser.ULONG, 0); + } + + public TerminalNode UNCHECKED() { + return getToken(CSharpParser.UNCHECKED, 0); + } + + public TerminalNode UNMANAGED() { + return getToken(CSharpParser.UNMANAGED, 0); + } + + public TerminalNode UNSAFE() { + return getToken(CSharpParser.UNSAFE, 0); + } + + public TerminalNode USHORT() { + return getToken(CSharpParser.USHORT, 0); + } + + public TerminalNode USING() { + return getToken(CSharpParser.USING, 0); + } + + public TerminalNode VIRTUAL() { + return getToken(CSharpParser.VIRTUAL, 0); + } + + public TerminalNode VOID() { + return getToken(CSharpParser.VOID, 0); + } + + public TerminalNode VOLATILE() { + return getToken(CSharpParser.VOLATILE, 0); + } + + public TerminalNode WHILE() { + return getToken(CSharpParser.WHILE, 0); + } + + public KeywordContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_keyword; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterKeyword(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitKeyword(this); + } + } + + public final KeywordContext keyword() throws RecognitionException { + KeywordContext _localctx = new KeywordContext(_ctx, getState()); + enterRule(_localctx, 396, RULE_keyword); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2419); + _la = _input.LA(1); + if ( + !((((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ABSTRACT) | + (1L << AS) | + (1L << BASE) | + (1L << BOOL) | + (1L << BREAK) | + (1L << BYTE) | + (1L << CASE) | + (1L << CATCH) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << CLASS) | + (1L << CONST) | + (1L << CONTINUE) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DO) | + (1L << DOUBLE) | + (1L << ELSE) | + (1L << ENUM) | + (1L << EVENT) | + (1L << EXPLICIT) | + (1L << EXTERN) | + (1L << FALSE) | + (1L << FINALLY) | + (1L << FIXED) | + (1L << FLOAT) | + (1L << FOR) | + (1L << FOREACH) | + (1L << GOTO) | + (1L << IF) | + (1L << IMPLICIT) | + (1L << IN) | + (1L << INT) | + (1L << INTERFACE) | + (1L << INTERNAL) | + (1L << IS) | + (1L << LOCK) | + (1L << LONG))) != + 0) || + ((((_la - 65)) & ~0x3f) == 0 && + ((1L << (_la - 65)) & + ((1L << (NAMESPACE - 65)) | + (1L << (NEW - 65)) | + (1L << (NULL_ - 65)) | + (1L << (OBJECT - 65)) | + (1L << (OPERATOR - 65)) | + (1L << (OUT - 65)) | + (1L << (OVERRIDE - 65)) | + (1L << (PARAMS - 65)) | + (1L << (PRIVATE - 65)) | + (1L << (PROTECTED - 65)) | + (1L << (PUBLIC - 65)) | + (1L << (READONLY - 65)) | + (1L << (REF - 65)) | + (1L << (RETURN - 65)) | + (1L << (SBYTE - 65)) | + (1L << (SEALED - 65)) | + (1L << (SHORT - 65)) | + (1L << (SIZEOF - 65)) | + (1L << (STACKALLOC - 65)) | + (1L << (STATIC - 65)) | + (1L << (STRING - 65)) | + (1L << (STRUCT - 65)) | + (1L << (SWITCH - 65)) | + (1L << (THIS - 65)) | + (1L << (THROW - 65)) | + (1L << (TRUE - 65)) | + (1L << (TRY - 65)) | + (1L << (TYPEOF - 65)) | + (1L << (UINT - 65)) | + (1L << (ULONG - 65)) | + (1L << (UNCHECKED - 65)) | + (1L << (UNMANAGED - 65)) | + (1L << (UNSAFE - 65)) | + (1L << (USHORT - 65)) | + (1L << (USING - 65)) | + (1L << (VIRTUAL - 65)) | + (1L << (VOID - 65)) | + (1L << (VOLATILE - 65)) | + (1L << (WHILE - 65)))) != + 0)) + ) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Class_definitionContext extends ParserRuleContext { + + public TerminalNode CLASS() { + return getToken(CSharpParser.CLASS, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Class_bodyContext class_body() { + return getRuleContext(Class_bodyContext.class, 0); + } + + public Type_parameter_listContext type_parameter_list() { + return getRuleContext(Type_parameter_listContext.class, 0); + } + + public Class_baseContext class_base() { + return getRuleContext(Class_baseContext.class, 0); + } + + public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { + return getRuleContext(Type_parameter_constraints_clausesContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Class_definitionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_class_definition; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterClass_definition(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitClass_definition(this); + } + } + + public final Class_definitionContext class_definition() + throws RecognitionException { + Class_definitionContext _localctx = new Class_definitionContext( + _ctx, + getState() + ); + enterRule(_localctx, 398, RULE_class_definition); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2421); + match(CLASS); + setState(2422); + identifier(); + setState(2424); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(2423); + type_parameter_list(); + } + } + + setState(2427); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COLON) { + { + setState(2426); + class_base(); + } + } + + setState(2430); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHERE) { + { + setState(2429); + type_parameter_constraints_clauses(); + } + } + + setState(2432); + class_body(); + setState(2434); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == SEMICOLON) { + { + setState(2433); + match(SEMICOLON); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Struct_definitionContext extends ParserRuleContext { + + public TerminalNode STRUCT() { + return getToken(CSharpParser.STRUCT, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Struct_bodyContext struct_body() { + return getRuleContext(Struct_bodyContext.class, 0); + } + + public Type_parameter_listContext type_parameter_list() { + return getRuleContext(Type_parameter_listContext.class, 0); + } + + public Struct_interfacesContext struct_interfaces() { + return getRuleContext(Struct_interfacesContext.class, 0); + } + + public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { + return getRuleContext(Type_parameter_constraints_clausesContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public TerminalNode READONLY() { + return getToken(CSharpParser.READONLY, 0); + } + + public TerminalNode REF() { + return getToken(CSharpParser.REF, 0); + } + + public Struct_definitionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_struct_definition; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterStruct_definition(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitStruct_definition(this); + } + } + + public final Struct_definitionContext struct_definition() + throws RecognitionException { + Struct_definitionContext _localctx = new Struct_definitionContext( + _ctx, + getState() + ); + enterRule(_localctx, 400, RULE_struct_definition); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2437); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == READONLY || _la == REF) { + { + setState(2436); + _la = _input.LA(1); + if (!(_la == READONLY || _la == REF)) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } + + setState(2439); + match(STRUCT); + setState(2440); + identifier(); + setState(2442); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(2441); + type_parameter_list(); + } + } + + setState(2445); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COLON) { + { + setState(2444); + struct_interfaces(); + } + } + + setState(2448); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHERE) { + { + setState(2447); + type_parameter_constraints_clauses(); + } + } + + setState(2450); + struct_body(); + setState(2452); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == SEMICOLON) { + { + setState(2451); + match(SEMICOLON); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Interface_definitionContext extends ParserRuleContext { + + public TerminalNode INTERFACE() { + return getToken(CSharpParser.INTERFACE, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Class_bodyContext class_body() { + return getRuleContext(Class_bodyContext.class, 0); + } + + public Variant_type_parameter_listContext variant_type_parameter_list() { + return getRuleContext(Variant_type_parameter_listContext.class, 0); + } + + public Interface_baseContext interface_base() { + return getRuleContext(Interface_baseContext.class, 0); + } + + public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { + return getRuleContext(Type_parameter_constraints_clausesContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Interface_definitionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_interface_definition; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterInterface_definition(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitInterface_definition(this); + } + } + + public final Interface_definitionContext interface_definition() + throws RecognitionException { + Interface_definitionContext _localctx = new Interface_definitionContext( + _ctx, + getState() + ); + enterRule(_localctx, 402, RULE_interface_definition); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2454); + match(INTERFACE); + setState(2455); + identifier(); + setState(2457); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(2456); + variant_type_parameter_list(); + } + } + + setState(2460); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COLON) { + { + setState(2459); + interface_base(); + } + } + + setState(2463); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHERE) { + { + setState(2462); + type_parameter_constraints_clauses(); + } + } + + setState(2465); + class_body(); + setState(2467); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == SEMICOLON) { + { + setState(2466); + match(SEMICOLON); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Enum_definitionContext extends ParserRuleContext { + + public TerminalNode ENUM() { + return getToken(CSharpParser.ENUM, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public Enum_bodyContext enum_body() { + return getRuleContext(Enum_bodyContext.class, 0); + } + + public Enum_baseContext enum_base() { + return getRuleContext(Enum_baseContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Enum_definitionContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_enum_definition; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterEnum_definition(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitEnum_definition(this); + } + } + + public final Enum_definitionContext enum_definition() + throws RecognitionException { + Enum_definitionContext _localctx = new Enum_definitionContext( + _ctx, + getState() + ); + enterRule(_localctx, 404, RULE_enum_definition); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2469); + match(ENUM); + setState(2470); + identifier(); + setState(2472); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COLON) { + { + setState(2471); + enum_base(); + } + } + + setState(2474); + enum_body(); + setState(2476); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == SEMICOLON) { + { + setState(2475); + match(SEMICOLON); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Delegate_definitionContext extends ParserRuleContext { + + public TerminalNode DELEGATE() { + return getToken(CSharpParser.DELEGATE, 0); + } + + public Return_typeContext return_type() { + return getRuleContext(Return_typeContext.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Variant_type_parameter_listContext variant_type_parameter_list() { + return getRuleContext(Variant_type_parameter_listContext.class, 0); + } + + public Formal_parameter_listContext formal_parameter_list() { + return getRuleContext(Formal_parameter_listContext.class, 0); + } + + public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { + return getRuleContext(Type_parameter_constraints_clausesContext.class, 0); + } + + public Delegate_definitionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_delegate_definition; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterDelegate_definition(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitDelegate_definition(this); + } + } + + public final Delegate_definitionContext delegate_definition() + throws RecognitionException { + Delegate_definitionContext _localctx = new Delegate_definitionContext( + _ctx, + getState() + ); + enterRule(_localctx, 406, RULE_delegate_definition); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2478); + match(DELEGATE); + setState(2479); + return_type(); + setState(2480); + identifier(); + setState(2482); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(2481); + variant_type_parameter_list(); + } + } + + setState(2484); + match(OPEN_PARENS); + setState(2486); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 10)) & ~0x3f) == 0 && + ((1L << (_la - 10)) & + ((1L << (ADD - 10)) | + (1L << (ALIAS - 10)) | + (1L << (ARGLIST - 10)) | + (1L << (ASCENDING - 10)) | + (1L << (ASYNC - 10)) | + (1L << (AWAIT - 10)) | + (1L << (BOOL - 10)) | + (1L << (BY - 10)) | + (1L << (BYTE - 10)) | + (1L << (CHAR - 10)) | + (1L << (DECIMAL - 10)) | + (1L << (DESCENDING - 10)) | + (1L << (DOUBLE - 10)) | + (1L << (DYNAMIC - 10)) | + (1L << (EQUALS - 10)) | + (1L << (FLOAT - 10)) | + (1L << (FROM - 10)) | + (1L << (GET - 10)) | + (1L << (GROUP - 10)) | + (1L << (IN - 10)) | + (1L << (INT - 10)) | + (1L << (INTO - 10)) | + (1L << (JOIN - 10)) | + (1L << (LET - 10)) | + (1L << (LONG - 10)) | + (1L << (NAMEOF - 10)) | + (1L << (OBJECT - 10)) | + (1L << (ON - 10)) | + (1L << (ORDERBY - 10)) | + (1L << (OUT - 10)))) != + 0) || + ((((_la - 74)) & ~0x3f) == 0 && + ((1L << (_la - 74)) & + ((1L << (PARAMS - 74)) | + (1L << (PARTIAL - 74)) | + (1L << (REF - 74)) | + (1L << (REMOVE - 74)) | + (1L << (SBYTE - 74)) | + (1L << (SELECT - 74)) | + (1L << (SET - 74)) | + (1L << (SHORT - 74)) | + (1L << (STRING - 74)) | + (1L << (THIS - 74)) | + (1L << (UINT - 74)) | + (1L << (ULONG - 74)) | + (1L << (UNMANAGED - 74)) | + (1L << (USHORT - 74)) | + (1L << (VAR - 74)) | + (1L << (VOID - 74)) | + (1L << (WHEN - 74)) | + (1L << (WHERE - 74)) | + (1L << (YIELD - 74)) | + (1L << (IDENTIFIER - 74)) | + (1L << (OPEN_BRACKET - 74)) | + (1L << (OPEN_PARENS - 74)))) != + 0) + ) { + { + setState(2485); + formal_parameter_list(); + } + } + + setState(2488); + match(CLOSE_PARENS); + setState(2490); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHERE) { + { + setState(2489); + type_parameter_constraints_clauses(); + } + } + + setState(2492); + match(SEMICOLON); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Event_declarationContext extends ParserRuleContext { + + public TerminalNode EVENT() { + return getToken(CSharpParser.EVENT, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public Variable_declaratorsContext variable_declarators() { + return getRuleContext(Variable_declaratorsContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Member_nameContext member_name() { + return getRuleContext(Member_nameContext.class, 0); + } + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public Event_accessor_declarationsContext event_accessor_declarations() { + return getRuleContext(Event_accessor_declarationsContext.class, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public Event_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_event_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterEvent_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitEvent_declaration(this); + } + } + + public final Event_declarationContext event_declaration() + throws RecognitionException { + Event_declarationContext _localctx = new Event_declarationContext( + _ctx, + getState() + ); + enterRule(_localctx, 408, RULE_event_declaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(2494); + match(EVENT); + setState(2495); + type_(); + setState(2504); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 323, _ctx)) { + case 1: + { + setState(2496); + variable_declarators(); + setState(2497); + match(SEMICOLON); + } + break; + case 2: + { + setState(2499); + member_name(); + setState(2500); + match(OPEN_BRACE); + setState(2501); + event_accessor_declarations(); + setState(2502); + match(CLOSE_BRACE); + } + break; + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Field_declarationContext extends ParserRuleContext { + + public Variable_declaratorsContext variable_declarators() { + return getRuleContext(Variable_declaratorsContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Field_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_field_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterField_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitField_declaration(this); + } + } + + public final Field_declarationContext field_declaration() + throws RecognitionException { + Field_declarationContext _localctx = new Field_declarationContext( + _ctx, + getState() + ); + enterRule(_localctx, 410, RULE_field_declaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(2506); + variable_declarators(); + setState(2507); + match(SEMICOLON); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Property_declarationContext extends ParserRuleContext { + + public Member_nameContext member_name() { + return getRuleContext(Member_nameContext.class, 0); + } + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public Accessor_declarationsContext accessor_declarations() { + return getRuleContext(Accessor_declarationsContext.class, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public Right_arrowContext right_arrow() { + return getRuleContext(Right_arrowContext.class, 0); + } + + public Throwable_expressionContext throwable_expression() { + return getRuleContext(Throwable_expressionContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public Variable_initializerContext variable_initializer() { + return getRuleContext(Variable_initializerContext.class, 0); + } + + public Property_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_property_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterProperty_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitProperty_declaration(this); + } + } + + public final Property_declarationContext property_declaration() + throws RecognitionException { + Property_declarationContext _localctx = new Property_declarationContext( + _ctx, + getState() + ); + enterRule(_localctx, 412, RULE_property_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2509); + member_name(); + setState(2523); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACE: + { + setState(2510); + match(OPEN_BRACE); + setState(2511); + accessor_declarations(); + setState(2512); + match(CLOSE_BRACE); + setState(2517); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == ASSIGNMENT) { + { + setState(2513); + match(ASSIGNMENT); + setState(2514); + variable_initializer(); + setState(2515); + match(SEMICOLON); + } + } + } + break; + case ASSIGNMENT: + { + setState(2519); + right_arrow(); + setState(2520); + throwable_expression(); + setState(2521); + match(SEMICOLON); + } + break; + default: + throw new NoViableAltException(this); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Constant_declarationContext extends ParserRuleContext { + + public TerminalNode CONST() { + return getToken(CSharpParser.CONST, 0); + } + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public Constant_declaratorsContext constant_declarators() { + return getRuleContext(Constant_declaratorsContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Constant_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_constant_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterConstant_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitConstant_declaration(this); + } + } + + public final Constant_declarationContext constant_declaration() + throws RecognitionException { + Constant_declarationContext _localctx = new Constant_declarationContext( + _ctx, + getState() + ); + enterRule(_localctx, 414, RULE_constant_declaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(2525); + match(CONST); + setState(2526); + type_(); + setState(2527); + constant_declarators(); + setState(2528); + match(SEMICOLON); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Indexer_declarationContext extends ParserRuleContext { + + public TerminalNode THIS() { + return getToken(CSharpParser.THIS, 0); + } + + public TerminalNode OPEN_BRACKET() { + return getToken(CSharpParser.OPEN_BRACKET, 0); + } + + public Formal_parameter_listContext formal_parameter_list() { + return getRuleContext(Formal_parameter_listContext.class, 0); + } + + public TerminalNode CLOSE_BRACKET() { + return getToken(CSharpParser.CLOSE_BRACKET, 0); + } + + public TerminalNode OPEN_BRACE() { + return getToken(CSharpParser.OPEN_BRACE, 0); + } + + public Accessor_declarationsContext accessor_declarations() { + return getRuleContext(Accessor_declarationsContext.class, 0); + } + + public TerminalNode CLOSE_BRACE() { + return getToken(CSharpParser.CLOSE_BRACE, 0); + } + + public Right_arrowContext right_arrow() { + return getRuleContext(Right_arrowContext.class, 0); + } + + public Throwable_expressionContext throwable_expression() { + return getRuleContext(Throwable_expressionContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Indexer_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_indexer_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterIndexer_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitIndexer_declaration(this); + } + } + + public final Indexer_declarationContext indexer_declaration() + throws RecognitionException { + Indexer_declarationContext _localctx = new Indexer_declarationContext( + _ctx, + getState() + ); + enterRule(_localctx, 416, RULE_indexer_declaration); + try { + enterOuterAlt(_localctx, 1); + { + setState(2530); + match(THIS); + setState(2531); + match(OPEN_BRACKET); + setState(2532); + formal_parameter_list(); + setState(2533); + match(CLOSE_BRACKET); + setState(2542); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACE: + { + setState(2534); + match(OPEN_BRACE); + setState(2535); + accessor_declarations(); + setState(2536); + match(CLOSE_BRACE); + } + break; + case ASSIGNMENT: + { + setState(2538); + right_arrow(); + setState(2539); + throwable_expression(); + setState(2540); + match(SEMICOLON); + } + break; + default: + throw new NoViableAltException(this); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Destructor_definitionContext extends ParserRuleContext { + + public TerminalNode TILDE() { + return getToken(CSharpParser.TILDE, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public BodyContext body() { + return getRuleContext(BodyContext.class, 0); + } + + public Destructor_definitionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_destructor_definition; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterDestructor_definition(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitDestructor_definition(this); + } + } + + public final Destructor_definitionContext destructor_definition() + throws RecognitionException { + Destructor_definitionContext _localctx = new Destructor_definitionContext( + _ctx, + getState() + ); + enterRule(_localctx, 418, RULE_destructor_definition); + try { + enterOuterAlt(_localctx, 1); + { + setState(2544); + match(TILDE); + setState(2545); + identifier(); + setState(2546); + match(OPEN_PARENS); + setState(2547); + match(CLOSE_PARENS); + setState(2548); + body(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Constructor_declarationContext extends ParserRuleContext { + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public BodyContext body() { + return getRuleContext(BodyContext.class, 0); + } + + public Formal_parameter_listContext formal_parameter_list() { + return getRuleContext(Formal_parameter_listContext.class, 0); + } + + public Constructor_initializerContext constructor_initializer() { + return getRuleContext(Constructor_initializerContext.class, 0); + } + + public Constructor_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_constructor_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterConstructor_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitConstructor_declaration(this); + } + } + + public final Constructor_declarationContext constructor_declaration() + throws RecognitionException { + Constructor_declarationContext _localctx = + new Constructor_declarationContext(_ctx, getState()); + enterRule(_localctx, 420, RULE_constructor_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2550); + identifier(); + setState(2551); + match(OPEN_PARENS); + setState(2553); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 10)) & ~0x3f) == 0 && + ((1L << (_la - 10)) & + ((1L << (ADD - 10)) | + (1L << (ALIAS - 10)) | + (1L << (ARGLIST - 10)) | + (1L << (ASCENDING - 10)) | + (1L << (ASYNC - 10)) | + (1L << (AWAIT - 10)) | + (1L << (BOOL - 10)) | + (1L << (BY - 10)) | + (1L << (BYTE - 10)) | + (1L << (CHAR - 10)) | + (1L << (DECIMAL - 10)) | + (1L << (DESCENDING - 10)) | + (1L << (DOUBLE - 10)) | + (1L << (DYNAMIC - 10)) | + (1L << (EQUALS - 10)) | + (1L << (FLOAT - 10)) | + (1L << (FROM - 10)) | + (1L << (GET - 10)) | + (1L << (GROUP - 10)) | + (1L << (IN - 10)) | + (1L << (INT - 10)) | + (1L << (INTO - 10)) | + (1L << (JOIN - 10)) | + (1L << (LET - 10)) | + (1L << (LONG - 10)) | + (1L << (NAMEOF - 10)) | + (1L << (OBJECT - 10)) | + (1L << (ON - 10)) | + (1L << (ORDERBY - 10)) | + (1L << (OUT - 10)))) != + 0) || + ((((_la - 74)) & ~0x3f) == 0 && + ((1L << (_la - 74)) & + ((1L << (PARAMS - 74)) | + (1L << (PARTIAL - 74)) | + (1L << (REF - 74)) | + (1L << (REMOVE - 74)) | + (1L << (SBYTE - 74)) | + (1L << (SELECT - 74)) | + (1L << (SET - 74)) | + (1L << (SHORT - 74)) | + (1L << (STRING - 74)) | + (1L << (THIS - 74)) | + (1L << (UINT - 74)) | + (1L << (ULONG - 74)) | + (1L << (UNMANAGED - 74)) | + (1L << (USHORT - 74)) | + (1L << (VAR - 74)) | + (1L << (VOID - 74)) | + (1L << (WHEN - 74)) | + (1L << (WHERE - 74)) | + (1L << (YIELD - 74)) | + (1L << (IDENTIFIER - 74)) | + (1L << (OPEN_BRACKET - 74)) | + (1L << (OPEN_PARENS - 74)))) != + 0) + ) { + { + setState(2552); + formal_parameter_list(); + } + } + + setState(2555); + match(CLOSE_PARENS); + setState(2557); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COLON) { + { + setState(2556); + constructor_initializer(); + } + } + + setState(2559); + body(); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Method_declarationContext extends ParserRuleContext { + + public Method_member_nameContext method_member_name() { + return getRuleContext(Method_member_nameContext.class, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Method_bodyContext method_body() { + return getRuleContext(Method_bodyContext.class, 0); + } + + public Right_arrowContext right_arrow() { + return getRuleContext(Right_arrowContext.class, 0); + } + + public Throwable_expressionContext throwable_expression() { + return getRuleContext(Throwable_expressionContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public Type_parameter_listContext type_parameter_list() { + return getRuleContext(Type_parameter_listContext.class, 0); + } + + public Formal_parameter_listContext formal_parameter_list() { + return getRuleContext(Formal_parameter_listContext.class, 0); + } + + public Type_parameter_constraints_clausesContext type_parameter_constraints_clauses() { + return getRuleContext(Type_parameter_constraints_clausesContext.class, 0); + } + + public Method_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_method_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMethod_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMethod_declaration(this); + } + } + + public final Method_declarationContext method_declaration() + throws RecognitionException { + Method_declarationContext _localctx = new Method_declarationContext( + _ctx, + getState() + ); + enterRule(_localctx, 422, RULE_method_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2561); + method_member_name(); + setState(2563); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(2562); + type_parameter_list(); + } + } + + setState(2565); + match(OPEN_PARENS); + setState(2567); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + ((((_la - 10)) & ~0x3f) == 0 && + ((1L << (_la - 10)) & + ((1L << (ADD - 10)) | + (1L << (ALIAS - 10)) | + (1L << (ARGLIST - 10)) | + (1L << (ASCENDING - 10)) | + (1L << (ASYNC - 10)) | + (1L << (AWAIT - 10)) | + (1L << (BOOL - 10)) | + (1L << (BY - 10)) | + (1L << (BYTE - 10)) | + (1L << (CHAR - 10)) | + (1L << (DECIMAL - 10)) | + (1L << (DESCENDING - 10)) | + (1L << (DOUBLE - 10)) | + (1L << (DYNAMIC - 10)) | + (1L << (EQUALS - 10)) | + (1L << (FLOAT - 10)) | + (1L << (FROM - 10)) | + (1L << (GET - 10)) | + (1L << (GROUP - 10)) | + (1L << (IN - 10)) | + (1L << (INT - 10)) | + (1L << (INTO - 10)) | + (1L << (JOIN - 10)) | + (1L << (LET - 10)) | + (1L << (LONG - 10)) | + (1L << (NAMEOF - 10)) | + (1L << (OBJECT - 10)) | + (1L << (ON - 10)) | + (1L << (ORDERBY - 10)) | + (1L << (OUT - 10)))) != + 0) || + ((((_la - 74)) & ~0x3f) == 0 && + ((1L << (_la - 74)) & + ((1L << (PARAMS - 74)) | + (1L << (PARTIAL - 74)) | + (1L << (REF - 74)) | + (1L << (REMOVE - 74)) | + (1L << (SBYTE - 74)) | + (1L << (SELECT - 74)) | + (1L << (SET - 74)) | + (1L << (SHORT - 74)) | + (1L << (STRING - 74)) | + (1L << (THIS - 74)) | + (1L << (UINT - 74)) | + (1L << (ULONG - 74)) | + (1L << (UNMANAGED - 74)) | + (1L << (USHORT - 74)) | + (1L << (VAR - 74)) | + (1L << (VOID - 74)) | + (1L << (WHEN - 74)) | + (1L << (WHERE - 74)) | + (1L << (YIELD - 74)) | + (1L << (IDENTIFIER - 74)) | + (1L << (OPEN_BRACKET - 74)) | + (1L << (OPEN_PARENS - 74)))) != + 0) + ) { + { + setState(2566); + formal_parameter_list(); + } + } + + setState(2569); + match(CLOSE_PARENS); + setState(2571); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == WHERE) { + { + setState(2570); + type_parameter_constraints_clauses(); + } + } + + setState(2578); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACE: + case SEMICOLON: + { + setState(2573); + method_body(); + } + break; + case ASSIGNMENT: + { + setState(2574); + right_arrow(); + setState(2575); + throwable_expression(); + setState(2576); + match(SEMICOLON); + } + break; + default: + throw new NoViableAltException(this); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Method_member_nameContext extends ParserRuleContext { + + public List identifier() { + return getRuleContexts(IdentifierContext.class); + } + + public IdentifierContext identifier(int i) { + return getRuleContext(IdentifierContext.class, i); + } + + public TerminalNode DOUBLE_COLON() { + return getToken(CSharpParser.DOUBLE_COLON, 0); + } + + public List DOT() { + return getTokens(CSharpParser.DOT); + } + + public TerminalNode DOT(int i) { + return getToken(CSharpParser.DOT, i); + } + + public List type_argument_list() { + return getRuleContexts(Type_argument_listContext.class); + } + + public Type_argument_listContext type_argument_list(int i) { + return getRuleContext(Type_argument_listContext.class, i); + } + + public Method_member_nameContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_method_member_name; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMethod_member_name(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMethod_member_name(this); + } + } + + public final Method_member_nameContext method_member_name() + throws RecognitionException { + Method_member_nameContext _localctx = new Method_member_nameContext( + _ctx, + getState() + ); + enterRule(_localctx, 424, RULE_method_member_name); + int _la; + try { + int _alt; + enterOuterAlt(_localctx, 1); + { + setState(2585); + _errHandler.sync(this); + switch (getInterpreter().adaptivePredict(_input, 333, _ctx)) { + case 1: + { + setState(2580); + identifier(); + } + break; + case 2: + { + setState(2581); + identifier(); + setState(2582); + match(DOUBLE_COLON); + setState(2583); + identifier(); + } + break; + } + setState(2594); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 335, _ctx); + while ( + _alt != 2 && _alt != org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER + ) { + if (_alt == 1) { + { + { + setState(2588); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == LT) { + { + setState(2587); + type_argument_list(); + } + } + + setState(2590); + match(DOT); + setState(2591); + identifier(); + } + } + } + setState(2596); + _errHandler.sync(this); + _alt = getInterpreter().adaptivePredict(_input, 335, _ctx); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Operator_declarationContext extends ParserRuleContext { + + public TerminalNode OPERATOR() { + return getToken(CSharpParser.OPERATOR, 0); + } + + public Overloadable_operatorContext overloadable_operator() { + return getRuleContext(Overloadable_operatorContext.class, 0); + } + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public List arg_declaration() { + return getRuleContexts(Arg_declarationContext.class); + } + + public Arg_declarationContext arg_declaration(int i) { + return getRuleContext(Arg_declarationContext.class, i); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public BodyContext body() { + return getRuleContext(BodyContext.class, 0); + } + + public Right_arrowContext right_arrow() { + return getRuleContext(Right_arrowContext.class, 0); + } + + public Throwable_expressionContext throwable_expression() { + return getRuleContext(Throwable_expressionContext.class, 0); + } + + public TerminalNode SEMICOLON() { + return getToken(CSharpParser.SEMICOLON, 0); + } + + public List IN() { + return getTokens(CSharpParser.IN); + } + + public TerminalNode IN(int i) { + return getToken(CSharpParser.IN, i); + } + + public TerminalNode COMMA() { + return getToken(CSharpParser.COMMA, 0); + } + + public Operator_declarationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_operator_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterOperator_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitOperator_declaration(this); + } + } + + public final Operator_declarationContext operator_declaration() + throws RecognitionException { + Operator_declarationContext _localctx = new Operator_declarationContext( + _ctx, + getState() + ); + enterRule(_localctx, 426, RULE_operator_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2597); + match(OPERATOR); + setState(2598); + overloadable_operator(); + setState(2599); + match(OPEN_PARENS); + setState(2601); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == IN) { + { + setState(2600); + match(IN); + } + } + + setState(2603); + arg_declaration(); + setState(2609); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == COMMA) { + { + setState(2604); + match(COMMA); + setState(2606); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == IN) { + { + setState(2605); + match(IN); + } + } + + setState(2608); + arg_declaration(); + } + } + + setState(2611); + match(CLOSE_PARENS); + setState(2617); + _errHandler.sync(this); + switch (_input.LA(1)) { + case OPEN_BRACE: + case SEMICOLON: + { + setState(2612); + body(); + } + break; + case ASSIGNMENT: + { + setState(2613); + right_arrow(); + setState(2614); + throwable_expression(); + setState(2615); + match(SEMICOLON); + } + break; + default: + throw new NoViableAltException(this); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Arg_declarationContext extends ParserRuleContext { + + public Type_Context type_() { + return getRuleContext(Type_Context.class, 0); + } + + public IdentifierContext identifier() { + return getRuleContext(IdentifierContext.class, 0); + } + + public TerminalNode ASSIGNMENT() { + return getToken(CSharpParser.ASSIGNMENT, 0); + } + + public ExpressionContext expression() { + return getRuleContext(ExpressionContext.class, 0); + } + + public Arg_declarationContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_arg_declaration; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterArg_declaration(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitArg_declaration(this); + } + } + + public final Arg_declarationContext arg_declaration() + throws RecognitionException { + Arg_declarationContext _localctx = new Arg_declarationContext( + _ctx, + getState() + ); + enterRule(_localctx, 428, RULE_arg_declaration); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2619); + type_(); + setState(2620); + identifier(); + setState(2623); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == ASSIGNMENT) { + { + setState(2621); + match(ASSIGNMENT); + setState(2622); + expression(); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Method_invocationContext extends ParserRuleContext { + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Argument_listContext argument_list() { + return getRuleContext(Argument_listContext.class, 0); + } + + public Method_invocationContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_method_invocation; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterMethod_invocation(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitMethod_invocation(this); + } + } + + public final Method_invocationContext method_invocation() + throws RecognitionException { + Method_invocationContext _localctx = new Method_invocationContext( + _ctx, + getState() + ); + enterRule(_localctx, 430, RULE_method_invocation); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2625); + match(OPEN_PARENS); + setState(2627); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << IN) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (OUT - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (VOID - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(2626); + argument_list(); + } + } + + setState(2629); + match(CLOSE_PARENS); + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class Object_creation_expressionContext + extends ParserRuleContext { + + public TerminalNode OPEN_PARENS() { + return getToken(CSharpParser.OPEN_PARENS, 0); + } + + public TerminalNode CLOSE_PARENS() { + return getToken(CSharpParser.CLOSE_PARENS, 0); + } + + public Argument_listContext argument_list() { + return getRuleContext(Argument_listContext.class, 0); + } + + public Object_or_collection_initializerContext object_or_collection_initializer() { + return getRuleContext(Object_or_collection_initializerContext.class, 0); + } + + public Object_creation_expressionContext( + ParserRuleContext parent, + int invokingState + ) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_object_creation_expression; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterObject_creation_expression(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitObject_creation_expression(this); + } + } + + public final Object_creation_expressionContext object_creation_expression() + throws RecognitionException { + Object_creation_expressionContext _localctx = + new Object_creation_expressionContext(_ctx, getState()); + enterRule(_localctx, 432, RULE_object_creation_expression); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2631); + match(OPEN_PARENS); + setState(2633); + _errHandler.sync(this); + _la = _input.LA(1); + if ( + (((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BASE) | + (1L << BOOL) | + (1L << BY) | + (1L << BYTE) | + (1L << CHAR) | + (1L << CHECKED) | + (1L << DECIMAL) | + (1L << DEFAULT) | + (1L << DELEGATE) | + (1L << DESCENDING) | + (1L << DOUBLE) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FALSE) | + (1L << FLOAT) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << IN) | + (1L << INT) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET) | + (1L << LONG))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (NEW - 64)) | + (1L << (NULL_ - 64)) | + (1L << (OBJECT - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (OUT - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REF - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SBYTE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (SHORT - 64)) | + (1L << (SIZEOF - 64)) | + (1L << (STRING - 64)) | + (1L << (THIS - 64)) | + (1L << (TRUE - 64)) | + (1L << (TYPEOF - 64)) | + (1L << (UINT - 64)) | + (1L << (ULONG - 64)) | + (1L << (UNCHECKED - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (USHORT - 64)) | + (1L << (VAR - 64)) | + (1L << (VOID - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)) | + (1L << (LITERAL_ACCESS - 64)) | + (1L << (INTEGER_LITERAL - 64)) | + (1L << (HEX_INTEGER_LITERAL - 64)) | + (1L << (BIN_INTEGER_LITERAL - 64)) | + (1L << (REAL_LITERAL - 64)) | + (1L << (CHARACTER_LITERAL - 64)) | + (1L << (REGULAR_STRING - 64)) | + (1L << (VERBATIUM_STRING - 64)) | + (1L << (INTERPOLATED_REGULAR_STRING_START - 64)) | + (1L << (INTERPOLATED_VERBATIUM_STRING_START - 64)))) != + 0) || + ((((_la - 129)) & ~0x3f) == 0 && + ((1L << (_la - 129)) & + ((1L << (OPEN_PARENS - 129)) | + (1L << (PLUS - 129)) | + (1L << (MINUS - 129)) | + (1L << (STAR - 129)) | + (1L << (AMP - 129)) | + (1L << (CARET - 129)) | + (1L << (BANG - 129)) | + (1L << (TILDE - 129)) | + (1L << (OP_INC - 129)) | + (1L << (OP_DEC - 129)) | + (1L << (OP_RANGE - 129)))) != + 0) + ) { + { + setState(2632); + argument_list(); + } + } + + setState(2635); + match(CLOSE_PARENS); + setState(2637); + _errHandler.sync(this); + _la = _input.LA(1); + if (_la == OPEN_BRACE) { + { + setState(2636); + object_or_collection_initializer(); + } + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public static class IdentifierContext extends ParserRuleContext { + + public TerminalNode IDENTIFIER() { + return getToken(CSharpParser.IDENTIFIER, 0); + } + + public TerminalNode ADD() { + return getToken(CSharpParser.ADD, 0); + } + + public TerminalNode ALIAS() { + return getToken(CSharpParser.ALIAS, 0); + } + + public TerminalNode ARGLIST() { + return getToken(CSharpParser.ARGLIST, 0); + } + + public TerminalNode ASCENDING() { + return getToken(CSharpParser.ASCENDING, 0); + } + + public TerminalNode ASYNC() { + return getToken(CSharpParser.ASYNC, 0); + } + + public TerminalNode AWAIT() { + return getToken(CSharpParser.AWAIT, 0); + } + + public TerminalNode BY() { + return getToken(CSharpParser.BY, 0); + } + + public TerminalNode DESCENDING() { + return getToken(CSharpParser.DESCENDING, 0); + } + + public TerminalNode DYNAMIC() { + return getToken(CSharpParser.DYNAMIC, 0); + } + + public TerminalNode EQUALS() { + return getToken(CSharpParser.EQUALS, 0); + } + + public TerminalNode FROM() { + return getToken(CSharpParser.FROM, 0); + } + + public TerminalNode GET() { + return getToken(CSharpParser.GET, 0); + } + + public TerminalNode GROUP() { + return getToken(CSharpParser.GROUP, 0); + } + + public TerminalNode INTO() { + return getToken(CSharpParser.INTO, 0); + } + + public TerminalNode JOIN() { + return getToken(CSharpParser.JOIN, 0); + } + + public TerminalNode LET() { + return getToken(CSharpParser.LET, 0); + } + + public TerminalNode NAMEOF() { + return getToken(CSharpParser.NAMEOF, 0); + } + + public TerminalNode ON() { + return getToken(CSharpParser.ON, 0); + } + + public TerminalNode ORDERBY() { + return getToken(CSharpParser.ORDERBY, 0); + } + + public TerminalNode PARTIAL() { + return getToken(CSharpParser.PARTIAL, 0); + } + + public TerminalNode REMOVE() { + return getToken(CSharpParser.REMOVE, 0); + } + + public TerminalNode SELECT() { + return getToken(CSharpParser.SELECT, 0); + } + + public TerminalNode SET() { + return getToken(CSharpParser.SET, 0); + } + + public TerminalNode UNMANAGED() { + return getToken(CSharpParser.UNMANAGED, 0); + } + + public TerminalNode VAR() { + return getToken(CSharpParser.VAR, 0); + } + + public TerminalNode WHEN() { + return getToken(CSharpParser.WHEN, 0); + } + + public TerminalNode WHERE() { + return getToken(CSharpParser.WHERE, 0); + } + + public TerminalNode YIELD() { + return getToken(CSharpParser.YIELD, 0); + } + + public IdentifierContext(ParserRuleContext parent, int invokingState) { + super(parent, invokingState); + } + + @Override + public int getRuleIndex() { + return RULE_identifier; + } + + @Override + public void enterRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).enterIdentifier(this); + } + + @Override + public void exitRule(ParseTreeListener listener) { + if ( + listener instanceof CSharpParserListener + ) ((CSharpParserListener) listener).exitIdentifier(this); + } + } + + public final IdentifierContext identifier() throws RecognitionException { + IdentifierContext _localctx = new IdentifierContext(_ctx, getState()); + enterRule(_localctx, 434, RULE_identifier); + int _la; + try { + enterOuterAlt(_localctx, 1); + { + setState(2639); + _la = _input.LA(1); + if ( + !((((_la) & ~0x3f) == 0 && + ((1L << _la) & + ((1L << ADD) | + (1L << ALIAS) | + (1L << ARGLIST) | + (1L << ASCENDING) | + (1L << ASYNC) | + (1L << AWAIT) | + (1L << BY) | + (1L << DESCENDING) | + (1L << DYNAMIC) | + (1L << EQUALS) | + (1L << FROM) | + (1L << GET) | + (1L << GROUP) | + (1L << INTO) | + (1L << JOIN) | + (1L << LET))) != + 0) || + ((((_la - 64)) & ~0x3f) == 0 && + ((1L << (_la - 64)) & + ((1L << (NAMEOF - 64)) | + (1L << (ON - 64)) | + (1L << (ORDERBY - 64)) | + (1L << (PARTIAL - 64)) | + (1L << (REMOVE - 64)) | + (1L << (SELECT - 64)) | + (1L << (SET - 64)) | + (1L << (UNMANAGED - 64)) | + (1L << (VAR - 64)) | + (1L << (WHEN - 64)) | + (1L << (WHERE - 64)) | + (1L << (YIELD - 64)) | + (1L << (IDENTIFIER - 64)))) != + 0)) + ) { + _errHandler.recoverInline(this); + } else { + if (_input.LA(1) == Token.EOF) matchedEOF = true; + _errHandler.reportMatch(this); + consume(); + } + } + } catch (RecognitionException re) { + _localctx.exception = re; + _errHandler.reportError(this, re); + _errHandler.recover(this, re); + } finally { + exitRule(); + } + return _localctx; + } + + public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) { + switch (ruleIndex) { + case 187: + return right_arrow_sempred((Right_arrowContext) _localctx, predIndex); + case 188: + return right_shift_sempred((Right_shiftContext) _localctx, predIndex); + case 189: + return right_shift_assignment_sempred( + (Right_shift_assignmentContext) _localctx, + predIndex + ); + } + return true; + } + + private boolean right_arrow_sempred( + Right_arrowContext _localctx, + int predIndex + ) { + switch (predIndex) { + case 0: + return ( + (((Right_arrowContext) _localctx).first != null + ? ((Right_arrowContext) _localctx).first.getTokenIndex() + : 0) + + 1 == + (((Right_arrowContext) _localctx).second != null + ? ((Right_arrowContext) _localctx).second.getTokenIndex() + : 0) + ); + } + return true; + } + + private boolean right_shift_sempred( + Right_shiftContext _localctx, + int predIndex + ) { + switch (predIndex) { + case 1: + return ( + (((Right_shiftContext) _localctx).first != null + ? ((Right_shiftContext) _localctx).first.getTokenIndex() + : 0) + + 1 == + (((Right_shiftContext) _localctx).second != null + ? ((Right_shiftContext) _localctx).second.getTokenIndex() + : 0) + ); + } + return true; + } + + private boolean right_shift_assignment_sempred( + Right_shift_assignmentContext _localctx, + int predIndex + ) { + switch (predIndex) { + case 2: + return ( + (((Right_shift_assignmentContext) _localctx).first != null + ? ((Right_shift_assignmentContext) _localctx).first.getTokenIndex() + : 0) + + 1 == + (((Right_shift_assignmentContext) _localctx).second != null + ? ((Right_shift_assignmentContext) _localctx).second.getTokenIndex() + : 0) + ); + } + return true; + } + + private static final int _serializedATNSegments = 2; + private static final String _serializedATNSegment0 = + "\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3\u00c8\u0a54\4\2\t" + + "\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13" + + "\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22" + + "\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31" + + "\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t \4!" + + "\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4" + + ",\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64\t" + + "\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t=" + + "\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I" + + "\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT" + + "\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4_\t_\4" + + "`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h\th\4i\ti\4j\tj\4k\t" + + "k\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4q\tq\4r\tr\4s\ts\4t\tt\4u\tu\4v\tv\4" + + "w\tw\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177\t\177\4\u0080\t\u0080" + + "\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083\4\u0084\t\u0084\4\u0085" + + "\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087\4\u0088\t\u0088\4\u0089\t\u0089" + + "\4\u008a\t\u008a\4\u008b\t\u008b\4\u008c\t\u008c\4\u008d\t\u008d\4\u008e" + + "\t\u008e\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091\t\u0091\4\u0092\t\u0092" + + "\4\u0093\t\u0093\4\u0094\t\u0094\4\u0095\t\u0095\4\u0096\t\u0096\4\u0097" + + "\t\u0097\4\u0098\t\u0098\4\u0099\t\u0099\4\u009a\t\u009a\4\u009b\t\u009b" + + "\4\u009c\t\u009c\4\u009d\t\u009d\4\u009e\t\u009e\4\u009f\t\u009f\4\u00a0" + + "\t\u00a0\4\u00a1\t\u00a1\4\u00a2\t\u00a2\4\u00a3\t\u00a3\4\u00a4\t\u00a4" + + "\4\u00a5\t\u00a5\4\u00a6\t\u00a6\4\u00a7\t\u00a7\4\u00a8\t\u00a8\4\u00a9" + + "\t\u00a9\4\u00aa\t\u00aa\4\u00ab\t\u00ab\4\u00ac\t\u00ac\4\u00ad\t\u00ad" + + "\4\u00ae\t\u00ae\4\u00af\t\u00af\4\u00b0\t\u00b0\4\u00b1\t\u00b1\4\u00b2" + + "\t\u00b2\4\u00b3\t\u00b3\4\u00b4\t\u00b4\4\u00b5\t\u00b5\4\u00b6\t\u00b6" + + "\4\u00b7\t\u00b7\4\u00b8\t\u00b8\4\u00b9\t\u00b9\4\u00ba\t\u00ba\4\u00bb" + + "\t\u00bb\4\u00bc\t\u00bc\4\u00bd\t\u00bd\4\u00be\t\u00be\4\u00bf\t\u00bf" + + "\4\u00c0\t\u00c0\4\u00c1\t\u00c1\4\u00c2\t\u00c2\4\u00c3\t\u00c3\4\u00c4" + + "\t\u00c4\4\u00c5\t\u00c5\4\u00c6\t\u00c6\4\u00c7\t\u00c7\4\u00c8\t\u00c8" + + "\4\u00c9\t\u00c9\4\u00ca\t\u00ca\4\u00cb\t\u00cb\4\u00cc\t\u00cc\4\u00cd" + + "\t\u00cd\4\u00ce\t\u00ce\4\u00cf\t\u00cf\4\u00d0\t\u00d0\4\u00d1\t\u00d1" + + "\4\u00d2\t\u00d2\4\u00d3\t\u00d3\4\u00d4\t\u00d4\4\u00d5\t\u00d5\4\u00d6" + + "\t\u00d6\4\u00d7\t\u00d7\4\u00d8\t\u00d8\4\u00d9\t\u00d9\4\u00da\t\u00da" + + "\4\u00db\t\u00db\3\2\5\2\u01b8\n\2\3\2\5\2\u01bb\n\2\3\2\5\2\u01be\n\2" + + "\3\2\7\2\u01c1\n\2\f\2\16\2\u01c4\13\2\3\2\5\2\u01c7\n\2\3\2\3\2\3\3\3" + + "\3\5\3\u01cd\n\3\3\3\5\3\u01d0\n\3\3\3\3\3\3\3\5\3\u01d5\n\3\7\3\u01d7" + + "\n\3\f\3\16\3\u01da\13\3\3\4\3\4\3\4\3\4\7\4\u01e0\n\4\f\4\16\4\u01e3" + + "\13\4\3\5\3\5\3\5\3\5\3\5\5\5\u01ea\n\5\3\6\3\6\3\6\3\6\6\6\u01f0\n\6" + + "\r\6\16\6\u01f1\3\6\3\6\3\7\3\7\5\7\u01f8\n\7\3\b\3\b\5\b\u01fc\n\b\3" + + "\t\3\t\3\t\5\t\u0201\n\t\3\n\3\n\3\13\3\13\3\f\3\f\3\f\3\f\5\f\u020b\n" + + "\f\3\r\3\r\3\r\3\r\7\r\u0211\n\r\f\r\16\r\u0214\13\r\3\r\3\r\3\16\3\16" + + "\3\16\7\16\u021b\n\16\f\16\16\16\u021e\13\16\3\17\3\17\3\17\5\17\u0223" + + "\n\17\3\17\5\17\u0226\n\17\3\17\3\17\5\17\u022a\n\17\3\17\3\17\3\20\3" + + "\20\3\20\3\20\5\20\u0232\n\20\3\21\3\21\3\21\5\21\u0237\n\21\3\22\3\22" + + "\3\22\3\22\3\22\3\22\3\22\3\22\5\22\u0241\n\22\3\23\3\23\3\23\3\23\3\23" + + "\3\23\3\23\3\23\3\23\3\23\3\23\5\23\u024e\n\23\3\24\3\24\3\24\3\24\3\24" + + "\3\24\5\24\u0256\n\24\3\25\3\25\3\25\3\25\5\25\u025c\n\25\5\25\u025e\n" + + "\25\3\26\3\26\3\26\7\26\u0263\n\26\f\26\16\26\u0266\13\26\3\27\3\27\3" + + "\27\7\27\u026b\n\27\f\27\16\27\u026e\13\27\3\30\3\30\3\30\7\30\u0273\n" + + "\30\f\30\16\30\u0276\13\30\3\31\3\31\3\31\7\31\u027b\n\31\f\31\16\31\u027e" + + "\13\31\3\32\3\32\3\32\7\32\u0283\n\32\f\32\16\32\u0286\13\32\3\33\3\33" + + "\3\33\7\33\u028b\n\33\f\33\16\33\u028e\13\33\3\34\3\34\3\34\3\34\3\34" + + "\3\34\3\34\7\34\u0297\n\34\f\34\16\34\u029a\13\34\3\35\3\35\3\35\5\35" + + "\u029f\n\35\3\35\7\35\u02a2\n\35\f\35\16\35\u02a5\13\35\3\36\3\36\3\36" + + "\7\36\u02aa\n\36\f\36\16\36\u02ad\13\36\3\37\3\37\3\37\7\37\u02b2\n\37" + + "\f\37\16\37\u02b5\13\37\3 \3 \3 \3 \3 \5 \u02bc\n \5 \u02be\n \3 \5 \u02c1" + + "\n \3!\3!\3!\7!\u02c6\n!\f!\16!\u02c9\13!\3\"\3\"\5\"\u02cd\n\"\3\"\3" + + "\"\3\"\3#\3#\5#\u02d4\n#\3#\3#\5#\u02d8\n#\5#\u02da\n#\3$\3$\3$\3$\3$" + + "\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\3$\5$\u02f6" + + "\n$\3%\3%\5%\u02fa\n%\3%\7%\u02fd\n%\f%\16%\u0300\13%\3%\5%\u0303\n%\3" + + "%\3%\3%\3%\3%\3%\5%\u030b\n%\3%\5%\u030e\n%\3%\7%\u0311\n%\f%\16%\u0314" + + "\13%\3%\5%\u0317\n%\7%\u0319\n%\f%\16%\u031c\13%\3&\3&\3&\5&\u0321\n&" + + "\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\5&\u032f\n&\3&\3&\3&\3&\5&\u0335" + + "\n&\3&\3&\3&\3&\3&\3&\3&\3&\7&\u033f\n&\f&\16&\u0342\13&\3&\5&\u0345\n" + + "&\3&\6&\u0348\n&\r&\16&\u0349\3&\3&\5&\u034e\n&\3&\3&\3&\3&\5&\u0354\n" + + "&\3&\3&\3&\3&\6&\u035a\n&\r&\16&\u035b\3&\3&\3&\3&\3&\3&\3&\5&\u0365\n" + + "&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&\5&\u0377\n&\3&\5&\u037a" + + "\n&\3&\3&\3&\5&\u037f\n&\3&\5&\u0382\n&\3&\3&\3&\3&\3&\3&\3&\3&\3&\3&" + + "\3&\7&\u038f\n&\f&\16&\u0392\13&\3&\3&\3&\5&\u0397\n&\3\'\3\'\5\'\u039b" + + "\n\'\3(\3(\3(\3)\5)\u03a1\n)\3)\3)\3)\5)\u03a6\n)\3*\5*\u03a9\n*\3*\3" + + "*\3*\3*\7*\u03af\n*\f*\16*\u03b2\13*\3*\3*\3+\3+\3+\5+\u03b9\n+\3+\3+" + + "\3,\3,\3-\3-\3-\7-\u03c2\n-\f-\16-\u03c5\13-\3.\3.\5.\u03c9\n.\3/\3/\3" + + "/\5/\u03ce\n/\5/\u03d0\n/\3/\3/\3\60\3\60\3\60\7\60\u03d7\n\60\f\60\16" + + "\60\u03da\13\60\3\61\3\61\3\61\3\61\3\61\5\61\u03e1\n\61\3\61\3\61\3\61" + + "\3\62\3\62\5\62\u03e8\n\62\3\63\3\63\3\63\3\63\7\63\u03ee\n\63\f\63\16" + + "\63\u03f1\13\63\3\63\5\63\u03f4\n\63\3\63\3\63\3\64\3\64\3\64\3\64\3\64" + + "\5\64\u03fd\n\64\3\65\3\65\3\65\5\65\u0402\n\65\5\65\u0404\n\65\3\65\3" + + "\65\3\66\3\66\3\66\7\66\u040b\n\66\f\66\16\66\u040e\13\66\3\67\3\67\3" + + "\67\3\67\3\67\5\67\u0415\n\67\38\38\58\u0419\n8\38\38\38\58\u041e\n8\5" + + "8\u0420\n8\38\38\38\58\u0425\n8\78\u0427\n8\f8\168\u042a\138\39\39\79" + + "\u042e\n9\f9\169\u0431\139\39\39\3:\3:\3:\7:\u0438\n:\f:\16:\u043b\13" + + ":\3:\5:\u043e\n:\3:\5:\u0441\n:\3:\5:\u0444\n:\3;\3;\3;\3;\7;\u044a\n" + + ";\f;\16;\u044d\13;\3;\3;\3<\3<\3<\3<\3=\5=\u0456\n=\3=\3=\3=\3=\3>\3>" + + "\3>\3>\3>\3>\3>\3>\3>\3>\3>\5>\u0467\n>\3?\3?\3?\7?\u046c\n?\f?\16?\u046f" + + "\13?\3@\5@\u0472\n@\3@\3@\3@\3A\3A\3A\7A\u047a\nA\fA\16A\u047d\13A\3B" + + "\3B\5B\u0481\nB\3C\3C\3C\3D\3D\5D\u0488\nD\3D\3D\3D\3D\3E\7E\u048f\nE" + + "\fE\16E\u0492\13E\3E\3E\5E\u0496\nE\3F\3F\3F\3F\3F\5F\u049d\nF\3G\3G\3" + + "G\3G\3G\3H\3H\3H\3I\3I\5I\u04a9\nI\3I\3I\3I\3I\3I\3I\3I\3I\3I\5I\u04b4" + + "\nI\3J\3J\3J\3J\7J\u04ba\nJ\fJ\16J\u04bd\13J\3K\3K\5K\u04c1\nK\3L\3L\3" + + "L\3L\3L\3L\3L\5L\u04ca\nL\3M\3M\3M\3M\3N\3N\3N\5N\u04d3\nN\3O\3O\3O\3" + + "O\3O\3O\3O\5O\u04dc\nO\3P\3P\3P\3Q\5Q\u04e2\nQ\3Q\3Q\3Q\5Q\u04e7\nQ\3" + + "Q\3Q\5Q\u04eb\nQ\3Q\3Q\5Q\u04ef\nQ\3R\3R\5R\u04f3\nR\3R\3R\5R\u04f7\n" + + "R\3S\3S\3S\3S\3S\5S\u04fe\nS\3T\3T\3T\3T\3U\3U\5U\u0506\nU\3V\3V\3V\3" + + "V\3V\3V\3V\3V\3V\3V\3V\5V\u0513\nV\3V\3V\3V\3V\3V\3V\7V\u051b\nV\fV\16" + + "V\u051e\13V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\5" + + "V\u0533\nV\3V\3V\5V\u0537\nV\3V\3V\5V\u053b\nV\3V\3V\3V\5V\u0540\nV\3" + + "V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\5V\u0554\nV\3V\3" + + "V\3V\5V\u0559\nV\3V\3V\3V\5V\u055e\nV\3V\3V\3V\3V\3V\5V\u0565\nV\3V\5" + + "V\u0568\nV\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\3" + + "V\5V\u057e\nV\3V\3V\3V\3V\3V\3V\3V\3V\3V\3V\5V\u058a\nV\3W\3W\5W\u058e" + + "\nW\3W\3W\3X\3X\3X\3X\5X\u0596\nX\3X\3X\3X\3X\7X\u059c\nX\fX\16X\u059f" + + "\13X\3X\3X\3X\3X\5X\u05a5\nX\3Y\3Y\5Y\u05a9\nY\3Z\3Z\3Z\5Z\u05ae\nZ\3" + + "Z\5Z\u05b1\nZ\3[\3[\3[\5[\u05b6\n[\3\\\3\\\3\\\3\\\3]\3]\5]\u05be\n]\3" + + "^\6^\u05c1\n^\r^\16^\u05c2\3^\3^\3_\3_\3_\5_\u05ca\n_\3_\3_\3_\3_\5_\u05d0" + + "\n_\3`\3`\3`\3a\6a\u05d6\na\ra\16a\u05d7\3b\3b\3b\3b\7b\u05de\nb\fb\16" + + "b\u05e1\13b\5b\u05e3\nb\3c\3c\3c\7c\u05e8\nc\fc\16c\u05eb\13c\3d\3d\7" + + "d\u05ef\nd\fd\16d\u05f2\13d\3d\5d\u05f5\nd\3d\5d\u05f8\nd\3e\3e\3e\3e" + + "\5e\u05fe\ne\3e\3e\5e\u0602\ne\3e\3e\3f\3f\5f\u0608\nf\3f\3f\3g\3g\3g" + + "\3g\3g\3h\3h\3h\3i\3i\5i\u0616\ni\3j\3j\3j\3j\5j\u061c\nj\3k\3k\3k\7k" + + "\u0621\nk\fk\16k\u0624\13k\3l\3l\5l\u0628\nl\3l\5l\u062b\nl\3l\5l\u062e" + + "\nl\3l\3l\3m\6m\u0633\nm\rm\16m\u0634\3n\3n\3n\3n\3n\3o\6o\u063d\no\r" + + "o\16o\u063e\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\3p\5p\u0650\np\3" + + "q\6q\u0653\nq\rq\16q\u0654\3r\3r\5r\u0659\nr\3s\5s\u065c\ns\3s\5s\u065f" + + "\ns\3s\3s\3s\3s\3s\5s\u0666\ns\3t\3t\3t\3t\5t\u066c\nt\3u\3u\3u\3u\7u" + + "\u0672\nu\fu\16u\u0675\13u\3u\3u\3v\5v\u067a\nv\3v\3v\3w\3w\3w\3w\7w\u0682" + + "\nw\fw\16w\u0685\13w\3x\3x\3x\7x\u068a\nx\fx\16x\u068d\13x\3y\6y\u0690" + + "\ny\ry\16y\u0691\3z\3z\3z\3z\3z\3{\3{\3{\3{\5{\u069d\n{\3{\3{\5{\u06a1" + + "\n{\5{\u06a3\n{\3|\3|\3|\5|\u06a8\n|\3|\3|\5|\u06ac\n|\3}\3}\3}\7}\u06b1" + + "\n}\f}\16}\u06b4\13}\3~\3~\3~\3~\3\177\3\177\5\177\u06bc\n\177\3\177\3" + + "\177\3\u0080\6\u0080\u06c1\n\u0080\r\u0080\16\u0080\u06c2\3\u0081\5\u0081" + + "\u06c6\n\u0081\3\u0081\5\u0081\u06c9\n\u0081\3\u0081\3\u0081\5\u0081\u06cd" + + "\n\u0081\3\u0082\6\u0082\u06d0\n\u0082\r\u0082\16\u0082\u06d1\3\u0083" + + "\3\u0083\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084" + + "\3\u0084\5\u0084\u06df\n\u0084\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084" + + "\3\u0084\3\u0084\3\u0084\5\u0084\u06e9\n\u0084\3\u0085\3\u0085\3\u0085" + + "\3\u0085\3\u0085\5\u0085\u06f0\n\u0085\3\u0085\3\u0085\3\u0085\3\u0085" + + "\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\5\u0085\u06fc\n\u0085" + + "\3\u0086\3\u0086\3\u0086\7\u0086\u0701\n\u0086\f\u0086\16\u0086\u0704" + + "\13\u0086\3\u0087\3\u0087\3\u0087\3\u0087\3\u0088\3\u0088\3\u0088\7\u0088" + + "\u070d\n\u0088\f\u0088\16\u0088\u0710\13\u0088\3\u0089\3\u0089\3\u0089" + + "\5\u0089\u0715\n\u0089\3\u008a\3\u008a\5\u008a\u0719\n\u008a\3\u008b\3" + + "\u008b\5\u008b\u071d\n\u008b\3\u008c\3\u008c\3\u008d\3\u008d\5\u008d\u0723" + + "\n\u008d\3\u008e\3\u008e\3\u008e\3\u008e\5\u008e\u0729\n\u008e\5\u008e" + + "\u072b\n\u008e\3\u008f\3\u008f\3\u008f\7\u008f\u0730\n\u008f\f\u008f\16" + + "\u008f\u0733\13\u008f\3\u0090\5\u0090\u0736\n\u0090\3\u0090\5\u0090\u0739" + + "\n\u0090\3\u0090\3\u0090\5\u0090\u073d\n\u0090\3\u0091\3\u0091\3\u0091" + + "\3\u0091\3\u0091\3\u0091\3\u0091\3\u0091\5\u0091\u0747\n\u0091\3\u0092" + + "\5\u0092\u074a\n\u0092\3\u0092\3\u0092\3\u0092\3\u0092\3\u0093\5\u0093" + + "\u0751\n\u0093\3\u0093\5\u0093\u0754\n\u0093\3\u0093\3\u0093\3\u0093\5" + + "\u0093\u0759\n\u0093\3\u0093\3\u0093\3\u0093\5\u0093\u075e\n\u0093\5\u0093" + + "\u0760\n\u0093\3\u0094\5\u0094\u0763\n\u0094\3\u0094\5\u0094\u0766\n\u0094" + + "\3\u0094\3\u0094\3\u0094\3\u0095\5\u0095\u076c\n\u0095\3\u0095\5\u0095" + + "\u076f\n\u0095\3\u0095\3\u0095\3\u0095\3\u0096\3\u0096\3\u0096\3\u0096" + + "\3\u0096\3\u0096\3\u0096\5\u0096\u077b\n\u0096\3\u0097\3\u0097\5\u0097" + + "\u077f\n\u0097\3\u0098\5\u0098\u0782\n\u0098\3\u0098\3\u0098\3\u0098\3" + + "\u0098\3\u0098\3\u0098\3\u0098\3\u0098\5\u0098\u078c\n\u0098\3\u0099\5" + + "\u0099\u078f\n\u0099\3\u0099\3\u0099\3\u0099\3\u009a\5\u009a\u0795\n\u009a" + + "\3\u009a\3\u009a\3\u009a\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b" + + "\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b" + + "\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\5\u009b\u07b0" + + "\n\u009b\3\u009c\3\u009c\3\u009c\3\u009c\3\u009c\3\u009c\3\u009c\3\u009d" + + "\3\u009d\3\u009d\3\u009d\5\u009d\u07bd\n\u009d\3\u009d\3\u009d\3\u009e" + + "\3\u009e\5\u009e\u07c3\n\u009e\3\u009f\3\u009f\3\u009f\3\u00a0\3\u00a0" + + "\7\u00a0\u07ca\n\u00a0\f\u00a0\16\u00a0\u07cd\13\u00a0\3\u00a0\3\u00a0" + + "\3\u00a1\5\u00a1\u07d2\n\u00a1\3\u00a1\5\u00a1\u07d5\n\u00a1\3\u00a1\3" + + "\u00a1\3\u00a1\3\u00a1\6\u00a1\u07db\n\u00a1\r\u00a1\16\u00a1\u07dc\3" + + "\u00a1\3\u00a1\5\u00a1\u07e1\n\u00a1\3\u00a2\3\u00a2\7\u00a2\u07e5\n\u00a2" + + "\f\u00a2\16\u00a2\u07e8\13\u00a2\3\u00a2\6\u00a2\u07eb\n\u00a2\r\u00a2" + + "\16\u00a2\u07ec\3\u00a3\3\u00a3\7\u00a3\u07f1\n\u00a3\f\u00a3\16\u00a3" + + "\u07f4\13\u00a3\3\u00a3\3\u00a3\3\u00a4\3\u00a4\3\u00a4\3\u00a4\7\u00a4" + + "\u07fc\n\u00a4\f\u00a4\16\u00a4\u07ff\13\u00a4\3\u00a4\5\u00a4\u0802\n" + + "\u00a4\5\u00a4\u0804\n\u00a4\3\u00a4\3\u00a4\3\u00a5\3\u00a5\3\u00a5\3" + + "\u00a5\7\u00a5\u080c\n\u00a5\f\u00a5\16\u00a5\u080f\13\u00a5\3\u00a5\3" + + "\u00a5\3\u00a6\5\u00a6\u0814\n\u00a6\3\u00a6\5\u00a6\u0817\n\u00a6\3\u00a6" + + "\3\u00a6\3\u00a7\3\u00a7\3\u00a8\3\u00a8\3\u00a8\3\u00a9\3\u00a9\7\u00a9" + + "\u0822\n\u00a9\f\u00a9\16\u00a9\u0825\13\u00a9\3\u00a9\3\u00a9\3\u00aa" + + "\5\u00aa\u082a\n\u00aa\3\u00aa\5\u00aa\u082d\n\u00aa\3\u00aa\5\u00aa\u0830" + + "\n\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\5\u00aa\u0837\n\u00aa" + + "\3\u00aa\3\u00aa\3\u00aa\5\u00aa\u083c\n\u00aa\3\u00aa\3\u00aa\5\u00aa" + + "\u0840\n\u00aa\3\u00aa\3\u00aa\5\u00aa\u0844\n\u00aa\3\u00aa\3\u00aa\3" + + "\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa" + + "\3\u00aa\3\u00aa\3\u00aa\3\u00aa\5\u00aa\u0855\n\u00aa\3\u00aa\5\u00aa" + + "\u0858\n\u00aa\3\u00aa\3\u00aa\3\u00aa\5\u00aa\u085d\n\u00aa\3\u00aa\3" + + "\u00aa\5\u00aa\u0861\n\u00aa\3\u00aa\3\u00aa\5\u00aa\u0865\n\u00aa\3\u00aa" + + "\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\3\u00aa\5\u00aa\u086e\n\u00aa" + + "\3\u00ab\5\u00ab\u0871\n\u00ab\3\u00ab\3\u00ab\3\u00ab\5\u00ab\u0876\n" + + "\u00ab\3\u00ab\3\u00ab\5\u00ab\u087a\n\u00ab\3\u00ab\3\u00ab\3\u00ab\5" + + "\u00ab\u087f\n\u00ab\3\u00ab\3\u00ab\5\u00ab\u0883\n\u00ab\5\u00ab\u0885" + + "\n\u00ab\3\u00ac\3\u00ac\3\u00ac\3\u00ad\3\u00ad\3\u00ad\3\u00ad\7\u00ad" + + "\u088e\n\u00ad\f\u00ad\16\u00ad\u0891\13\u00ad\3\u00ad\5\u00ad\u0894\n" + + "\u00ad\5\u00ad\u0896\n\u00ad\3\u00ad\3\u00ad\3\u00ae\5\u00ae\u089b\n\u00ae" + + "\3\u00ae\3\u00ae\3\u00ae\5\u00ae\u08a0\n\u00ae\3\u00af\3\u00af\3\u00af" + + "\3\u00af\3\u00af\5\u00af\u08a7\n\u00af\3\u00af\3\u00af\3\u00b0\3\u00b0" + + "\5\u00b0\u08ad\n\u00b0\3\u00b1\6\u00b1\u08b0\n\u00b1\r\u00b1\16\u00b1" + + "\u08b1\3\u00b2\3\u00b2\3\u00b2\3\u00b2\5\u00b2\u08b8\n\u00b2\3\u00b2\3" + + "\u00b2\5\u00b2\u08bc\n\u00b2\3\u00b2\3\u00b2\3\u00b3\3\u00b3\5\u00b3\u08c2" + + "\n\u00b3\3\u00b4\3\u00b4\3\u00b4\7\u00b4\u08c7\n\u00b4\f\u00b4\16\u00b4" + + "\u08ca\13\u00b4\3\u00b5\3\u00b5\3\u00b5\3\u00b5\3\u00b5\7\u00b5\u08d1" + + "\n\u00b5\f\u00b5\16\u00b5\u08d4\13\u00b5\5\u00b5\u08d6\n\u00b5\3\u00b5" + + "\5\u00b5\u08d9\n\u00b5\3\u00b6\3\u00b6\3\u00b6\5\u00b6\u08de\n\u00b6\3" + + "\u00b6\3\u00b6\3\u00b7\3\u00b7\5\u00b7\u08e4\n\u00b7\3\u00b7\3\u00b7\7" + + "\u00b7\u08e8\n\u00b7\f\u00b7\16\u00b7\u08eb\13\u00b7\3\u00b7\3\u00b7\3" + + "\u00b7\3\u00b7\5\u00b7\u08f1\n\u00b7\3\u00b8\3\u00b8\3\u00b8\7\u00b8\u08f6" + + "\n\u00b8\f\u00b8\16\u00b8\u08f9\13\u00b8\3\u00b9\3\u00b9\3\u00b9\3\u00b9" + + "\3\u00ba\5\u00ba\u0900\n\u00ba\3\u00ba\3\u00ba\5\u00ba\u0904\n\u00ba\3" + + "\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bb\3\u00bc\3\u00bc\3\u00bc\3\u00bc" + + "\3\u00bc\3\u00bc\3\u00bc\3\u00bc\5\u00bc\u0913\n\u00bc\3\u00bc\3\u00bc" + + "\5\u00bc\u0917\n\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\3\u00bc\7\u00bc" + + "\u091e\n\u00bc\f\u00bc\16\u00bc\u0921\13\u00bc\3\u00bc\5\u00bc\u0924\n" + + "\u00bc\3\u00bc\3\u00bc\5\u00bc\u0928\n\u00bc\3\u00bd\3\u00bd\3\u00bd\3" + + "\u00bd\3\u00be\3\u00be\3\u00be\3\u00be\3\u00bf\3\u00bf\3\u00bf\3\u00bf" + + "\3\u00c0\3\u00c0\3\u00c0\3\u00c0\3\u00c0\3\u00c0\3\u00c0\3\u00c0\5\u00c0" + + "\u093e\n\u00c0\3\u00c1\3\u00c1\3\u00c2\3\u00c2\3\u00c2\3\u00c2\5\u00c2" + + "\u0946\n\u00c2\3\u00c3\3\u00c3\7\u00c3\u094a\n\u00c3\f\u00c3\16\u00c3" + + "\u094d\13\u00c3\3\u00c3\3\u00c3\3\u00c4\3\u00c4\7\u00c4\u0953\n\u00c4" + + "\f\u00c4\16\u00c4\u0956\13\u00c4\3\u00c4\3\u00c4\3\u00c5\3\u00c5\3\u00c5" + + "\3\u00c5\5\u00c5\u095e\n\u00c5\3\u00c6\3\u00c6\3\u00c6\3\u00c6\5\u00c6" + + "\u0964\n\u00c6\3\u00c7\3\u00c7\3\u00c7\7\u00c7\u0969\n\u00c7\f\u00c7\16" + + "\u00c7\u096c\13\u00c7\3\u00c7\3\u00c7\6\u00c7\u0970\n\u00c7\r\u00c7\16" + + "\u00c7\u0971\5\u00c7\u0974\n\u00c7\3\u00c8\3\u00c8\3\u00c9\3\u00c9\3\u00c9" + + "\5\u00c9\u097b\n\u00c9\3\u00c9\5\u00c9\u097e\n\u00c9\3\u00c9\5\u00c9\u0981" + + "\n\u00c9\3\u00c9\3\u00c9\5\u00c9\u0985\n\u00c9\3\u00ca\5\u00ca\u0988\n" + + "\u00ca\3\u00ca\3\u00ca\3\u00ca\5\u00ca\u098d\n\u00ca\3\u00ca\5\u00ca\u0990" + + "\n\u00ca\3\u00ca\5\u00ca\u0993\n\u00ca\3\u00ca\3\u00ca\5\u00ca\u0997\n" + + "\u00ca\3\u00cb\3\u00cb\3\u00cb\5\u00cb\u099c\n\u00cb\3\u00cb\5\u00cb\u099f" + + "\n\u00cb\3\u00cb\5\u00cb\u09a2\n\u00cb\3\u00cb\3\u00cb\5\u00cb\u09a6\n" + + "\u00cb\3\u00cc\3\u00cc\3\u00cc\5\u00cc\u09ab\n\u00cc\3\u00cc\3\u00cc\5" + + "\u00cc\u09af\n\u00cc\3\u00cd\3\u00cd\3\u00cd\3\u00cd\5\u00cd\u09b5\n\u00cd" + + "\3\u00cd\3\u00cd\5\u00cd\u09b9\n\u00cd\3\u00cd\3\u00cd\5\u00cd\u09bd\n" + + "\u00cd\3\u00cd\3\u00cd\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00ce\3\u00ce" + + "\3\u00ce\3\u00ce\3\u00ce\3\u00ce\5\u00ce\u09cb\n\u00ce\3\u00cf\3\u00cf" + + "\3\u00cf\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0" + + "\5\u00d0\u09d8\n\u00d0\3\u00d0\3\u00d0\3\u00d0\3\u00d0\5\u00d0\u09de\n" + + "\u00d0\3\u00d1\3\u00d1\3\u00d1\3\u00d1\3\u00d1\3\u00d2\3\u00d2\3\u00d2" + + "\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d2\3\u00d2" + + "\5\u00d2\u09f1\n\u00d2\3\u00d3\3\u00d3\3\u00d3\3\u00d3\3\u00d3\3\u00d3" + + "\3\u00d4\3\u00d4\3\u00d4\5\u00d4\u09fc\n\u00d4\3\u00d4\3\u00d4\5\u00d4" + + "\u0a00\n\u00d4\3\u00d4\3\u00d4\3\u00d5\3\u00d5\5\u00d5\u0a06\n\u00d5\3" + + "\u00d5\3\u00d5\5\u00d5\u0a0a\n\u00d5\3\u00d5\3\u00d5\5\u00d5\u0a0e\n\u00d5" + + "\3\u00d5\3\u00d5\3\u00d5\3\u00d5\3\u00d5\5\u00d5\u0a15\n\u00d5\3\u00d6" + + "\3\u00d6\3\u00d6\3\u00d6\3\u00d6\5\u00d6\u0a1c\n\u00d6\3\u00d6\5\u00d6" + + "\u0a1f\n\u00d6\3\u00d6\3\u00d6\7\u00d6\u0a23\n\u00d6\f\u00d6\16\u00d6" + + "\u0a26\13\u00d6\3\u00d7\3\u00d7\3\u00d7\3\u00d7\5\u00d7\u0a2c\n\u00d7" + + "\3\u00d7\3\u00d7\3\u00d7\5\u00d7\u0a31\n\u00d7\3\u00d7\5\u00d7\u0a34\n" + + "\u00d7\3\u00d7\3\u00d7\3\u00d7\3\u00d7\3\u00d7\3\u00d7\5\u00d7\u0a3c\n" + + "\u00d7\3\u00d8\3\u00d8\3\u00d8\3\u00d8\5\u00d8\u0a42\n\u00d8\3\u00d9\3" + + "\u00d9\5\u00d9\u0a46\n\u00d9\3\u00d9\3\u00d9\3\u00da\3\u00da\5\u00da\u0a4c" + + "\n\u00da\3\u00da\3\u00da\5\u00da\u0a50\n\u00da\3\u00db\3\u00db\3\u00db" + + "\2\2\u00dc\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 \"$&(*,.\60\62\64\66" + + "8:<>@BDFHJLNPRTVXZ\\^`bdfhjlnprtvxz|~\u0080\u0082\u0084\u0086\u0088\u008a" + + "\u008c\u008e\u0090\u0092\u0094\u0096\u0098\u009a\u009c\u009e\u00a0\u00a2" + + "\u00a4\u00a6\u00a8\u00aa\u00ac\u00ae\u00b0\u00b2\u00b4\u00b6\u00b8\u00ba" + + "\u00bc\u00be\u00c0\u00c2\u00c4\u00c6\u00c8\u00ca\u00cc\u00ce\u00d0\u00d2" + + "\u00d4\u00d6\u00d8\u00da\u00dc\u00de\u00e0\u00e2\u00e4\u00e6\u00e8\u00ea" + + "\u00ec\u00ee\u00f0\u00f2\u00f4\u00f6\u00f8\u00fa\u00fc\u00fe\u0100\u0102" + + "\u0104\u0106\u0108\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a" + + "\u011c\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132" + + "\u0134\u0136\u0138\u013a\u013c\u013e\u0140\u0142\u0144\u0146\u0148\u014a" + + "\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162" + + "\u0164\u0166\u0168\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178\u017a" + + "\u017c\u017e\u0180\u0182\u0184\u0186\u0188\u018a\u018c\u018e\u0190\u0192" + + "\u0194\u0196\u0198\u019a\u019c\u019e\u01a0\u01a2\u01a4\u01a6\u01a8\u01aa" + + "\u01ac\u01ae\u01b0\u01b2\u01b4\2\25\n\2\27\27\32\3299AAUUYYefjj\4\2$$" + + "//\5\288JJRR\3\2\u009e\u009f\4\2\u0094\u0095\u00a0\u00a1\3\2\u0089\u008a" + + "\3\2\u008b\u008d\20\2\24\24\27\27\32\32\37\37$$//99AAFFUUYY]]efjj\4\2" + + "\20\20\"\"\4\2\21\21ii\16\2\13\13\21\21++;;DDKKMQVV\\\\iimmoo\4\2**\67" + + "\67\4\2\23\23``\4\2\u008b\u008b\u0096\u0096\4\288JJ\4\2,,bb\25\2\13\13" + + "\17\17\23\25\27!#$&\')\61\64\64\66;==@ACFHHJLNRTVYkmorr\3\2QR\26\2\f\16" + + "\20\22\26\26\"\"%%((\62\63\65\65<<>?BBGGIIMMSSWXhhllpqst\2\u0b62\2\u01b7" + + "\3\2\2\2\4\u01cf\3\2\2\2\6\u01db\3\2\2\2\b\u01e9\3\2\2\2\n\u01eb\3\2\2" + + "\2\f\u01f5\3\2\2\2\16\u01fb\3\2\2\2\20\u0200\3\2\2\2\22\u0202\3\2\2\2" + + "\24\u0204\3\2\2\2\26\u020a\3\2\2\2\30\u020c\3\2\2\2\32\u0217\3\2\2\2\34" + + "\u0222\3\2\2\2\36\u0231\3\2\2\2 \u0236\3\2\2\2\"\u0240\3\2\2\2$\u024d" + + "\3\2\2\2&\u024f\3\2\2\2(\u0257\3\2\2\2*\u025f\3\2\2\2,\u0267\3\2\2\2." + + "\u026f\3\2\2\2\60\u0277\3\2\2\2\62\u027f\3\2\2\2\64\u0287\3\2\2\2\66\u028f" + + "\3\2\2\28\u029b\3\2\2\2:\u02a6\3\2\2\2<\u02ae\3\2\2\2>\u02b6\3\2\2\2@" + + "\u02c2\3\2\2\2B\u02ca\3\2\2\2D\u02d9\3\2\2\2F\u02f5\3\2\2\2H\u02f7\3\2" + + "\2\2J\u0396\3\2\2\2L\u039a\3\2\2\2N\u039c\3\2\2\2P\u03a0\3\2\2\2R\u03a8" + + "\3\2\2\2T\u03b8\3\2\2\2V\u03bc\3\2\2\2X\u03be\3\2\2\2Z\u03c8\3\2\2\2\\" + + "\u03ca\3\2\2\2^\u03d3\3\2\2\2`\u03e0\3\2\2\2b\u03e7\3\2\2\2d\u03e9\3\2" + + "\2\2f\u03fc\3\2\2\2h\u03fe\3\2\2\2j\u0407\3\2\2\2l\u0414\3\2\2\2n\u0416" + + "\3\2\2\2p\u042b\3\2\2\2r\u0434\3\2\2\2t\u0445\3\2\2\2v\u0450\3\2\2\2x" + + "\u0455\3\2\2\2z\u0466\3\2\2\2|\u0468\3\2\2\2~\u0471\3\2\2\2\u0080\u0476" + + "\3\2\2\2\u0082\u0480\3\2\2\2\u0084\u0482\3\2\2\2\u0086\u0485\3\2\2\2\u0088" + + "\u0490\3\2\2\2\u008a\u049c\3\2\2\2\u008c\u049e\3\2\2\2\u008e\u04a3\3\2" + + "\2\2\u0090\u04a6\3\2\2\2\u0092\u04b5\3\2\2\2\u0094\u04be\3\2\2\2\u0096" + + "\u04c9\3\2\2\2\u0098\u04cb\3\2\2\2\u009a\u04d2\3\2\2\2\u009c\u04db\3\2" + + "\2\2\u009e\u04dd\3\2\2\2\u00a0\u04e1\3\2\2\2\u00a2\u04f6\3\2\2\2\u00a4" + + "\u04fd\3\2\2\2\u00a6\u04ff\3\2\2\2\u00a8\u0505\3\2\2\2\u00aa\u0589\3\2" + + "\2\2\u00ac\u058b\3\2\2\2\u00ae\u05a4\3\2\2\2\u00b0\u05a8\3\2\2\2\u00b2" + + "\u05aa\3\2\2\2\u00b4\u05b5\3\2\2\2\u00b6\u05b7\3\2\2\2\u00b8\u05bd\3\2" + + "\2\2\u00ba\u05c0\3\2\2\2\u00bc\u05cf\3\2\2\2\u00be\u05d1\3\2\2\2\u00c0" + + "\u05d5\3\2\2\2\u00c2\u05e2\3\2\2\2\u00c4\u05e4\3\2\2\2\u00c6\u05f7\3\2" + + "\2\2\u00c8\u05f9\3\2\2\2\u00ca\u0605\3\2\2\2\u00cc\u060b\3\2\2\2\u00ce" + + "\u0610\3\2\2\2\u00d0\u0615\3\2\2\2\u00d2\u0617\3\2\2\2\u00d4\u061d\3\2" + + "\2\2\u00d6\u0625\3\2\2\2\u00d8\u0632\3\2\2\2\u00da\u0636\3\2\2\2\u00dc" + + "\u063c\3\2\2\2\u00de\u064f\3\2\2\2\u00e0\u0652\3\2\2\2\u00e2\u0658\3\2" + + "\2\2\u00e4\u065b\3\2\2\2\u00e6\u0667\3\2\2\2\u00e8\u066d\3\2\2\2\u00ea" + + "\u0679\3\2\2\2\u00ec\u067d\3\2\2\2\u00ee\u0686\3\2\2\2\u00f0\u068f\3\2" + + "\2\2\u00f2\u0693\3\2\2\2\u00f4\u06a2\3\2\2\2\u00f6\u06ab\3\2\2\2\u00f8" + + "\u06ad\3\2\2\2\u00fa\u06b5\3\2\2\2\u00fc\u06b9\3\2\2\2\u00fe\u06c0\3\2" + + "\2\2\u0100\u06c5\3\2\2\2\u0102\u06cf\3\2\2\2\u0104\u06d3\3\2\2\2\u0106" + + "\u06e8\3\2\2\2\u0108\u06ef\3\2\2\2\u010a\u06fd\3\2\2\2\u010c\u0705\3\2" + + "\2\2\u010e\u0709\3\2\2\2\u0110\u0711\3\2\2\2\u0112\u0718\3\2\2\2\u0114" + + "\u071c\3\2\2\2\u0116\u071e\3\2\2\2\u0118\u0722\3\2\2\2\u011a\u072a\3\2" + + "\2\2\u011c\u072c\3\2\2\2\u011e\u073c\3\2\2\2\u0120\u0746\3\2\2\2\u0122" + + "\u0749\3\2\2\2\u0124\u0750\3\2\2\2\u0126\u0762\3\2\2\2\u0128\u076b\3\2" + + "\2\2\u012a\u077a\3\2\2\2\u012c\u077e\3\2\2\2\u012e\u0781\3\2\2\2\u0130" + + "\u078e\3\2\2\2\u0132\u0794\3\2\2\2\u0134\u07af\3\2\2\2\u0136\u07b1\3\2" + + "\2\2\u0138\u07b8\3\2\2\2\u013a\u07c2\3\2\2\2\u013c\u07c4\3\2\2\2\u013e" + + "\u07c7\3\2\2\2\u0140\u07d1\3\2\2\2\u0142\u07e2\3\2\2\2\u0144\u07ee\3\2" + + "\2\2\u0146\u07f7\3\2\2\2\u0148\u0807\3\2\2\2\u014a\u0813\3\2\2\2\u014c" + + "\u081a\3\2\2\2\u014e\u081c\3\2\2\2\u0150\u081f\3\2\2\2\u0152\u0829\3\2" + + "\2\2\u0154\u0870\3\2\2\2\u0156\u0886\3\2\2\2\u0158\u0889\3\2\2\2\u015a" + + "\u089a\3\2\2\2\u015c\u08a1\3\2\2\2\u015e\u08ac\3\2\2\2\u0160\u08af\3\2" + + "\2\2\u0162\u08b3\3\2\2\2\u0164\u08c1\3\2\2\2\u0166\u08c3\3\2\2\2\u0168" + + "\u08cb\3\2\2\2\u016a\u08dd\3\2\2\2\u016c\u08f0\3\2\2\2\u016e\u08f2\3\2" + + "\2\2\u0170\u08fa\3\2\2\2\u0172\u0903\3\2\2\2\u0174\u0905\3\2\2\2\u0176" + + "\u0927\3\2\2\2\u0178\u0929\3\2\2\2\u017a\u092d\3\2\2\2\u017c\u0931\3\2" + + "\2\2\u017e\u093d\3\2\2\2\u0180\u093f\3\2\2\2\u0182\u0945\3\2\2\2\u0184" + + "\u0947\3\2\2\2\u0186\u0950\3\2\2\2\u0188\u095d\3\2\2\2\u018a\u0963\3\2" + + "\2\2\u018c\u0965\3\2\2\2\u018e\u0975\3\2\2\2\u0190\u0977\3\2\2\2\u0192" + + "\u0987\3\2\2\2\u0194\u0998\3\2\2\2\u0196\u09a7\3\2\2\2\u0198\u09b0\3\2" + + "\2\2\u019a\u09c0\3\2\2\2\u019c\u09cc\3\2\2\2\u019e\u09cf\3\2\2\2\u01a0" + + "\u09df\3\2\2\2\u01a2\u09e4\3\2\2\2\u01a4\u09f2\3\2\2\2\u01a6\u09f8\3\2" + + "\2\2\u01a8\u0a03\3\2\2\2\u01aa\u0a1b\3\2\2\2\u01ac\u0a27\3\2\2\2\u01ae" + + "\u0a3d\3\2\2\2\u01b0\u0a43\3\2\2\2\u01b2\u0a49\3\2\2\2\u01b4\u0a51\3\2" + + "\2\2\u01b6\u01b8\7\3\2\2\u01b7\u01b6\3\2\2\2\u01b7\u01b8\3\2\2\2\u01b8" + + "\u01ba\3\2\2\2\u01b9\u01bb\5\u00d8m\2\u01ba\u01b9\3\2\2\2\u01ba\u01bb" + + "\3\2\2\2\u01bb\u01bd\3\2\2\2\u01bc\u01be\5\u00dco\2\u01bd\u01bc\3\2\2" + + "\2\u01bd\u01be\3\2\2\2\u01be\u01c2\3\2\2\2\u01bf\u01c1\5\u015c\u00af\2" + + "\u01c0\u01bf\3\2\2\2\u01c1\u01c4\3\2\2\2\u01c2\u01c0\3\2\2\2\u01c2\u01c3" + + "\3\2\2\2\u01c3\u01c6\3\2\2\2\u01c4\u01c2\3\2\2\2\u01c5\u01c7\5\u00e0q" + + "\2\u01c6\u01c5\3\2\2\2\u01c6\u01c7\3\2\2\2\u01c7\u01c8\3\2\2\2\u01c8\u01c9" + + "\7\2\2\3\u01c9\3\3\2\2\2\u01ca\u01cc\5\u01b4\u00db\2\u01cb\u01cd\5\30" + + "\r\2\u01cc\u01cb\3\2\2\2\u01cc\u01cd\3\2\2\2\u01cd\u01d0\3\2\2\2\u01ce" + + "\u01d0\5\u00e6t\2\u01cf\u01ca\3\2\2\2\u01cf\u01ce\3\2\2\2\u01d0\u01d8" + + "\3\2\2\2\u01d1\u01d2\7\u0085\2\2\u01d2\u01d4\5\u01b4\u00db\2\u01d3\u01d5" + + "\5\30\r\2\u01d4\u01d3\3\2\2\2\u01d4\u01d5\3\2\2\2\u01d5\u01d7\3\2\2\2" + + "\u01d6\u01d1\3\2\2\2\u01d7\u01da\3\2\2\2\u01d8\u01d6\3\2\2\2\u01d8\u01d9" + + "\3\2\2\2\u01d9\5\3\2\2\2\u01da\u01d8\3\2\2\2\u01db\u01e1\5\b\5\2\u01dc" + + "\u01e0\7\u0096\2\2\u01dd\u01e0\5\u0144\u00a3\2\u01de\u01e0\7\u008b\2\2" + + "\u01df\u01dc\3\2\2\2\u01df\u01dd\3\2\2\2\u01df\u01de\3\2\2\2\u01e0\u01e3" + + "\3\2\2\2\u01e1\u01df\3\2\2\2\u01e1\u01e2\3\2\2\2\u01e2\7\3\2\2\2\u01e3" + + "\u01e1\3\2\2\2\u01e4\u01ea\5\16\b\2\u01e5\u01ea\5\26\f\2\u01e6\u01e7\7" + + "n\2\2\u01e7\u01ea\7\u008b\2\2\u01e8\u01ea\5\n\6\2\u01e9\u01e4\3\2\2\2" + + "\u01e9\u01e5\3\2\2\2\u01e9\u01e6\3\2\2\2\u01e9\u01e8\3\2\2\2\u01ea\t\3" + + "\2\2\2\u01eb\u01ec\7\u0083\2\2\u01ec\u01ef\5\f\7\2\u01ed\u01ee\7\u0086" + + "\2\2\u01ee\u01f0\5\f\7\2\u01ef\u01ed\3\2\2\2\u01f0\u01f1\3\2\2\2\u01f1" + + "\u01ef\3\2\2\2\u01f1\u01f2\3\2\2\2\u01f2\u01f3\3\2\2\2\u01f3\u01f4\7\u0084" + + "\2\2\u01f4\13\3\2\2\2\u01f5\u01f7\5\6\4\2\u01f6\u01f8\5\u01b4\u00db\2" + + "\u01f7\u01f6\3\2\2\2\u01f7\u01f8\3\2\2\2\u01f8\r\3\2\2\2\u01f9\u01fc\5" + + "\20\t\2\u01fa\u01fc\7\24\2\2\u01fb\u01f9\3\2\2\2\u01fb\u01fa\3\2\2\2\u01fc" + + "\17\3\2\2\2\u01fd\u0201\5\22\n\2\u01fe\u0201\5\24\13\2\u01ff\u0201\7\37" + + "\2\2\u0200\u01fd\3\2\2\2\u0200\u01fe\3\2\2\2\u0200\u01ff\3\2\2\2\u0201" + + "\21\3\2\2\2\u0202\u0203\t\2\2\2\u0203\23\3\2\2\2\u0204\u0205\t\3\2\2\u0205" + + "\25\3\2\2\2\u0206\u020b\5\4\3\2\u0207\u020b\7F\2\2\u0208\u020b\7%\2\2" + + "\u0209\u020b\7]\2\2\u020a\u0206\3\2\2\2\u020a\u0207\3\2\2\2\u020a\u0208" + + "\3\2\2\2\u020a\u0209\3\2\2\2\u020b\27\3\2\2\2\u020c\u020d\7\u0094\2\2" + + "\u020d\u0212\5\6\4\2\u020e\u020f\7\u0086\2\2\u020f\u0211\5\6\4\2\u0210" + + "\u020e\3\2\2\2\u0211\u0214\3\2\2\2\u0212\u0210\3\2\2\2\u0212\u0213\3\2" + + "\2\2\u0213\u0215\3\2\2\2\u0214\u0212\3\2\2\2\u0215\u0216\7\u0095\2\2\u0216" + + "\31\3\2\2\2\u0217\u021c\5\34\17\2\u0218\u0219\7\u0086\2\2\u0219\u021b" + + "\5\34\17\2\u021a\u0218\3\2\2\2\u021b\u021e\3\2\2\2\u021c\u021a\3\2\2\2" + + "\u021c\u021d\3\2\2\2\u021d\33\3\2\2\2\u021e\u021c\3\2\2\2\u021f\u0220" + + "\5\u01b4\u00db\2\u0220\u0221\7\u0087\2\2\u0221\u0223\3\2\2\2\u0222\u021f" + + "\3\2\2\2\u0222\u0223\3\2\2\2\u0223\u0225\3\2\2\2\u0224\u0226\t\4\2\2\u0225" + + "\u0224\3\2\2\2\u0225\u0226\3\2\2\2\u0226\u0229\3\2\2\2\u0227\u022a\7l" + + "\2\2\u0228\u022a\5\6\4\2\u0229\u0227\3\2\2\2\u0229\u0228\3\2\2\2\u0229" + + "\u022a\3\2\2\2\u022a\u022b\3\2\2\2\u022b\u022c\5\36\20\2\u022c\35\3\2" + + "\2\2\u022d\u0232\5\"\22\2\u022e\u0232\5 \21\2\u022f\u0230\7R\2\2\u0230" + + "\u0232\5 \21\2\u0231\u022d\3\2\2\2\u0231\u022e\3\2\2\2\u0231\u022f\3\2" + + "\2\2\u0232\37\3\2\2\2\u0233\u0237\5x=\2\u0234\u0237\5\u0084C\2\u0235\u0237" + + "\5&\24\2\u0236\u0233\3\2\2\2\u0236\u0234\3\2\2\2\u0236\u0235\3\2\2\2\u0237" + + "!\3\2\2\2\u0238\u0239\5F$\2\u0239\u023a\5$\23\2\u023a\u023b\5\36\20\2" + + "\u023b\u0241\3\2\2\2\u023c\u023d\5F$\2\u023d\u023e\7\u00ac\2\2\u023e\u023f" + + "\5L\'\2\u023f\u0241\3\2\2\2\u0240\u0238\3\2\2\2\u0240\u023c\3\2\2\2\u0241" + + "#\3\2\2\2\u0242\u024e\7\u0093\2\2\u0243\u024e\7\u00a2\2\2\u0244\u024e" + + "\7\u00a3\2\2\u0245\u024e\7\u00a4\2\2\u0246\u024e\7\u00a5\2\2\u0247\u024e" + + "\7\u00a6\2\2\u0248\u024e\7\u00a7\2\2\u0249\u024e\7\u00a8\2\2\u024a\u024e" + + "\7\u00a9\2\2\u024b\u024e\7\u00ab\2\2\u024c\u024e\5\u017c\u00bf\2\u024d" + + "\u0242\3\2\2\2\u024d\u0243\3\2\2\2\u024d\u0244\3\2\2\2\u024d\u0245\3\2" + + "\2\2\u024d\u0246\3\2\2\2\u024d\u0247\3\2\2\2\u024d\u0248\3\2\2\2\u024d" + + "\u0249\3\2\2\2\u024d\u024a\3\2\2\2\u024d\u024b\3\2\2\2\u024d\u024c\3\2" + + "\2\2\u024e%\3\2\2\2\u024f\u0255\5(\25\2\u0250\u0251\7\u0096\2\2\u0251" + + "\u0252\5L\'\2\u0252\u0253\7\u0087\2\2\u0253\u0254\5L\'\2\u0254\u0256\3" + + "\2\2\2\u0255\u0250\3\2\2\2\u0255\u0256\3\2\2\2\u0256\'\3\2\2\2\u0257\u025d" + + "\5*\26\2\u0258\u025b\7\u0098\2\2\u0259\u025c\5(\25\2\u025a\u025c\5N(\2" + + "\u025b\u0259\3\2\2\2\u025b\u025a\3\2\2\2\u025c\u025e\3\2\2\2\u025d\u0258" + + "\3\2\2\2\u025d\u025e\3\2\2\2\u025e)\3\2\2\2\u025f\u0264\5,\27\2\u0260" + + "\u0261\7\u009c\2\2\u0261\u0263\5,\27\2\u0262\u0260\3\2\2\2\u0263\u0266" + + "\3\2\2\2\u0264\u0262\3\2\2\2\u0264\u0265\3\2\2\2\u0265+\3\2\2\2\u0266" + + "\u0264\3\2\2\2\u0267\u026c\5.\30\2\u0268\u0269\7\u009b\2\2\u0269\u026b" + + "\5.\30\2\u026a\u0268\3\2\2\2\u026b\u026e\3\2\2\2\u026c\u026a\3\2\2\2\u026c" + + "\u026d\3\2\2\2\u026d-\3\2\2\2\u026e\u026c\3\2\2\2\u026f\u0274\5\60\31" + + "\2\u0270\u0271\7\u008f\2\2\u0271\u0273\5\60\31\2\u0272\u0270\3\2\2\2\u0273" + + "\u0276\3\2\2\2\u0274\u0272\3\2\2\2\u0274\u0275\3\2\2\2\u0275/\3\2\2\2" + + "\u0276\u0274\3\2\2\2\u0277\u027c\5\62\32\2\u0278\u0279\7\u0090\2\2\u0279" + + "\u027b\5\62\32\2\u027a\u0278\3\2\2\2\u027b\u027e\3\2\2\2\u027c\u027a\3" + + "\2\2\2\u027c\u027d\3\2\2\2\u027d\61\3\2\2\2\u027e\u027c\3\2\2\2\u027f" + + "\u0284\5\64\33\2\u0280\u0281\7\u008e\2\2\u0281\u0283\5\64\33\2\u0282\u0280" + + "\3\2\2\2\u0283\u0286\3\2\2\2\u0284\u0282\3\2\2\2\u0284\u0285\3\2\2\2\u0285" + + "\63\3\2\2\2\u0286\u0284\3\2\2\2\u0287\u028c\5\66\34\2\u0288\u0289\t\5" + + "\2\2\u0289\u028b\5\66\34\2\u028a\u0288\3\2\2\2\u028b\u028e\3\2\2\2\u028c" + + "\u028a\3\2\2\2\u028c\u028d\3\2\2\2\u028d\65\3\2\2\2\u028e\u028c\3\2\2" + + "\2\u028f\u0298\58\35\2\u0290\u0291\t\6\2\2\u0291\u0297\58\35\2\u0292\u0293" + + "\7=\2\2\u0293\u0297\5r:\2\u0294\u0295\7\17\2\2\u0295\u0297\5\6\4\2\u0296" + + "\u0290\3\2\2\2\u0296\u0292\3\2\2\2\u0296\u0294\3\2\2\2\u0297\u029a\3\2" + + "\2\2\u0298\u0296\3\2\2\2\u0298\u0299\3\2\2\2\u0299\67\3\2\2\2\u029a\u0298" + + "\3\2\2\2\u029b\u02a3\5:\36\2\u029c\u029f\7\u00aa\2\2\u029d\u029f\5\u017a" + + "\u00be\2\u029e\u029c\3\2\2\2\u029e\u029d\3\2\2\2\u029f\u02a0\3\2\2\2\u02a0" + + "\u02a2\5:\36\2\u02a1\u029e\3\2\2\2\u02a2\u02a5\3\2\2\2\u02a3\u02a1\3\2" + + "\2\2\u02a3\u02a4\3\2\2\2\u02a49\3\2\2\2\u02a5\u02a3\3\2\2\2\u02a6\u02ab" + + "\5<\37\2\u02a7\u02a8\t\7\2\2\u02a8\u02aa\5<\37\2\u02a9\u02a7\3\2\2\2\u02aa" + + "\u02ad\3\2\2\2\u02ab\u02a9\3\2\2\2\u02ab\u02ac\3\2\2\2\u02ac;\3\2\2\2" + + "\u02ad\u02ab\3\2\2\2\u02ae\u02b3\5> \2\u02af\u02b0\t\b\2\2\u02b0\u02b2" + + "\5> \2\u02b1\u02af\3\2\2\2\u02b2\u02b5\3\2\2\2\u02b3\u02b1\3\2\2\2\u02b3" + + "\u02b4\3\2\2\2\u02b4=\3\2\2\2\u02b5\u02b3\3\2\2\2\u02b6\u02c0\5D#\2\u02b7" + + "\u02b8\7_\2\2\u02b8\u02bd\7\177\2\2\u02b9\u02bb\5@!\2\u02ba\u02bc\7\u0086" + + "\2\2\u02bb\u02ba\3\2\2\2\u02bb\u02bc\3\2\2\2\u02bc\u02be\3\2\2\2\u02bd" + + "\u02b9\3\2\2\2\u02bd\u02be\3\2\2\2\u02be\u02bf\3\2\2\2\u02bf\u02c1\7\u0080" + + "\2\2\u02c0\u02b7\3\2\2\2\u02c0\u02c1\3\2\2\2\u02c1?\3\2\2\2\u02c2\u02c7" + + "\5B\"\2\u02c3\u02c4\7\u0086\2\2\u02c4\u02c6\5B\"\2\u02c5\u02c3\3\2\2\2" + + "\u02c6\u02c9\3\2\2\2\u02c7\u02c5\3\2\2\2\u02c7\u02c8\3\2\2\2\u02c8A\3" + + "\2\2\2\u02c9\u02c7\3\2\2\2\u02ca\u02cc\5\36\20\2\u02cb\u02cd\5\u00be`" + + "\2\u02cc\u02cb\3\2\2\2\u02cc\u02cd\3\2\2\2\u02cd\u02ce\3\2\2\2\u02ce\u02cf" + + "\5\u0178\u00bd\2\u02cf\u02d0\5L\'\2\u02d0C\3\2\2\2\u02d1\u02da\5F$\2\u02d2" + + "\u02d4\5F$\2\u02d3\u02d2\3\2\2\2\u02d3\u02d4\3\2\2\2\u02d4\u02d5\3\2\2" + + "\2\u02d5\u02d7\7\u00ad\2\2\u02d6\u02d8\5F$\2\u02d7\u02d6\3\2\2\2\u02d7" + + "\u02d8\3\2\2\2\u02d8\u02da\3\2\2\2\u02d9\u02d1\3\2\2\2\u02d9\u02d3\3\2" + + "\2\2\u02daE\3\2\2\2\u02db\u02f6\5H%\2\u02dc\u02dd\7\u0089\2\2\u02dd\u02f6" + + "\5F$\2\u02de\u02df\7\u008a\2\2\u02df\u02f6\5F$\2\u02e0\u02e1\7\u0091\2" + + "\2\u02e1\u02f6\5F$\2\u02e2\u02e3\7\u0092\2\2\u02e3\u02f6\5F$\2\u02e4\u02e5" + + "\7\u0099\2\2\u02e5\u02f6\5F$\2\u02e6\u02e7\7\u009a\2\2\u02e7\u02f6\5F" + + "$\2\u02e8\u02e9\7\u0083\2\2\u02e9\u02ea\5\6\4\2\u02ea\u02eb\7\u0084\2" + + "\2\u02eb\u02ec\5F$\2\u02ec\u02f6\3\2\2\2\u02ed\u02ee\7\22\2\2\u02ee\u02f6" + + "\5F$\2\u02ef\u02f0\7\u008e\2\2\u02f0\u02f6\5F$\2\u02f1\u02f2\7\u008b\2" + + "\2\u02f2\u02f6\5F$\2\u02f3\u02f4\7\u0090\2\2\u02f4\u02f6\5F$\2\u02f5\u02db" + + "\3\2\2\2\u02f5\u02dc\3\2\2\2\u02f5\u02de\3\2\2\2\u02f5\u02e0\3\2\2\2\u02f5" + + "\u02e2\3\2\2\2\u02f5\u02e4\3\2\2\2\u02f5\u02e6\3\2\2\2\u02f5\u02e8\3\2" + + "\2\2\u02f5\u02ed\3\2\2\2\u02f5\u02ef\3\2\2\2\u02f5\u02f1\3\2\2\2\u02f5" + + "\u02f3\3\2\2\2\u02f6G\3\2\2\2\u02f7\u02f9\5J&\2\u02f8\u02fa\7\u0091\2" + + "\2\u02f9\u02f8\3\2\2\2\u02f9\u02fa\3\2\2\2\u02fa\u02fe\3\2\2\2\u02fb\u02fd" + + "\5R*\2\u02fc\u02fb\3\2\2\2\u02fd\u0300\3\2\2\2\u02fe\u02fc\3\2\2\2\u02fe" + + "\u02ff\3\2\2\2\u02ff\u0302\3\2\2\2\u0300\u02fe\3\2\2\2\u0301\u0303\7\u0091" + + "\2\2\u0302\u0301\3\2\2\2\u0302\u0303\3\2\2\2\u0303\u031a\3\2\2\2\u0304" + + "\u030b\5P)\2\u0305\u030b\5\u01b0\u00d9\2\u0306\u030b\7\u0099\2\2\u0307" + + "\u030b\7\u009a\2\2\u0308\u0309\7\u009d\2\2\u0309\u030b\5\u01b4\u00db\2" + + "\u030a\u0304\3\2\2\2\u030a\u0305\3\2\2\2\u030a\u0306\3\2\2\2\u030a\u0307" + + "\3\2\2\2\u030a\u0308\3\2\2\2\u030b\u030d\3\2\2\2\u030c\u030e\7\u0091\2" + + "\2\u030d\u030c\3\2\2\2\u030d\u030e\3\2\2\2\u030e\u0312\3\2\2\2\u030f\u0311" + + "\5R*\2\u0310\u030f\3\2\2\2\u0311\u0314\3\2\2\2\u0312\u0310\3\2\2\2\u0312" + + "\u0313\3\2\2\2\u0313\u0316\3\2\2\2\u0314\u0312\3\2\2\2\u0315\u0317\7\u0091" + + "\2\2\u0316\u0315\3\2\2\2\u0316\u0317\3\2\2\2\u0317\u0319\3\2\2\2\u0318" + + "\u030a\3\2\2\2\u0319\u031c\3\2\2\2\u031a\u0318\3\2\2\2\u031a\u031b\3\2" + + "\2\2\u031bI\3\2\2\2\u031c\u031a\3\2\2\2\u031d\u0397\5\u017e\u00c0\2\u031e" + + "\u0320\5\u01b4\u00db\2\u031f\u0321\5\30\r\2\u0320\u031f\3\2\2\2\u0320" + + "\u0321\3\2\2\2\u0321\u0397\3\2\2\2\u0322\u0323\7\u0083\2\2\u0323\u0324" + + "\5\36\20\2\u0324\u0325\7\u0084\2\2\u0325\u0397\3\2\2\2\u0326\u0397\5V" + + ",\2\u0327\u0397\5\u00e6t\2\u0328\u0397\7u\2\2\u0329\u0397\7`\2\2\u032a" + + "\u0334\7\23\2\2\u032b\u032c\7\u0085\2\2\u032c\u032e\5\u01b4\u00db\2\u032d" + + "\u032f\5\30\r\2\u032e\u032d\3\2\2\2\u032e\u032f\3\2\2\2\u032f\u0335\3" + + "\2\2\2\u0330\u0331\7\u0081\2\2\u0331\u0332\5X-\2\u0332\u0333\7\u0082\2" + + "\2\u0333\u0335\3\2\2\2\u0334\u032b\3\2\2\2\u0334\u0330\3\2\2\2\u0335\u0397" + + "\3\2\2\2\u0336\u0353\7D\2\2\u0337\u034d\5\6\4\2\u0338\u034e\5\u01b2\u00da" + + "\2\u0339\u034e\5Z.\2\u033a\u033b\7\u0081\2\2\u033b\u033c\5X-\2\u033c\u0340" + + "\7\u0082\2\2\u033d\u033f\5\u0144\u00a3\2\u033e\u033d\3\2\2\2\u033f\u0342" + + "\3\2\2\2\u0340\u033e\3\2\2\2\u0340\u0341\3\2\2\2\u0341\u0344\3\2\2\2\u0342" + + "\u0340\3\2\2\2\u0343\u0345\5\u0146\u00a4\2\u0344\u0343\3\2\2\2\u0344\u0345" + + "\3\2\2\2\u0345\u034e\3\2\2\2\u0346\u0348\5\u0144\u00a3\2\u0347\u0346\3" + + "\2\2\2\u0348\u0349\3\2\2\2\u0349\u0347\3\2\2\2\u0349\u034a\3\2\2\2\u034a" + + "\u034b\3\2\2\2\u034b\u034c\5\u0146\u00a4\2\u034c\u034e\3\2\2\2\u034d\u0338" + + "\3\2\2\2\u034d\u0339\3\2\2\2\u034d\u033a\3\2\2\2\u034d\u0347\3\2\2\2\u034e" + + "\u0354\3\2\2\2\u034f\u0354\5h\65\2\u0350\u0351\5\u0144\u00a3\2\u0351\u0352" + + "\5\u0146\u00a4\2\u0352\u0354\3\2\2\2\u0353\u0337\3\2\2\2\u0353\u034f\3" + + "\2\2\2\u0353\u0350\3\2\2\2\u0354\u0397\3\2\2\2\u0355\u0356\7\u0083\2\2" + + "\u0356\u0359\5\34\17\2\u0357\u0358\7\u0086\2\2\u0358\u035a\5\34\17\2\u0359" + + "\u0357\3\2\2\2\u035a\u035b\3\2\2\2\u035b\u0359\3\2\2\2\u035b\u035c\3\2" + + "\2\2\u035c\u035d\3\2\2\2\u035d\u035e\7\u0084\2\2\u035e\u0397\3\2\2\2\u035f" + + "\u0360\7d\2\2\u0360\u0364\7\u0083\2\2\u0361\u0365\5n8\2\u0362\u0365\5" + + "\6\4\2\u0363\u0365\7n\2\2\u0364\u0361\3\2\2\2\u0364\u0362\3\2\2\2\u0364" + + "\u0363\3\2\2\2\u0365\u0366\3\2\2\2\u0366\u0397\7\u0084\2\2\u0367\u0368" + + "\7\33\2\2\u0368\u0369\7\u0083\2\2\u0369\u036a\5\36\20\2\u036a\u036b\7" + + "\u0084\2\2\u036b\u0397\3\2\2\2\u036c\u036d\7g\2\2\u036d\u036e\7\u0083" + + "\2\2\u036e\u036f\5\36\20\2\u036f\u0370\7\u0084\2\2\u0370\u0397\3\2\2\2" + + "\u0371\u0376\7 \2\2\u0372\u0373\7\u0083\2\2\u0373\u0374\5\6\4\2\u0374" + + "\u0375\7\u0084\2\2\u0375\u0377\3\2\2\2\u0376\u0372\3\2\2\2\u0376\u0377" + + "\3\2\2\2\u0377\u0397\3\2\2\2\u0378\u037a\7\21\2\2\u0379\u0378\3\2\2\2" + + "\u0379\u037a\3\2\2\2\u037a\u037b\3\2\2\2\u037b\u0381\7!\2\2\u037c\u037e" + + "\7\u0083\2\2\u037d\u037f\5|?\2\u037e\u037d\3\2\2\2\u037e\u037f\3\2\2\2" + + "\u037f\u0380\3\2\2\2\u0380\u0382\7\u0084\2\2\u0381\u037c\3\2\2\2\u0381" + + "\u0382\3\2\2\2\u0382\u0383\3\2\2\2\u0383\u0397\5\u00acW\2\u0384\u0385" + + "\7Z\2\2\u0385\u0386\7\u0083\2\2\u0386\u0387\5\6\4\2\u0387\u0388\7\u0084" + + "\2\2\u0388\u0397\3\2\2\2\u0389\u038a\7B\2\2\u038a\u0390\7\u0083\2\2\u038b" + + "\u038c\5\u01b4\u00db\2\u038c\u038d\7\u0085\2\2\u038d\u038f\3\2\2\2\u038e" + + "\u038b\3\2\2\2\u038f\u0392\3\2\2\2\u0390\u038e\3\2\2\2\u0390\u0391\3\2" + + "\2\2\u0391\u0393\3\2\2\2\u0392\u0390\3\2\2\2\u0393\u0394\5\u01b4\u00db" + + "\2\u0394\u0395\7\u0084\2\2\u0395\u0397\3\2\2\2\u0396\u031d\3\2\2\2\u0396" + + "\u031e\3\2\2\2\u0396\u0322\3\2\2\2\u0396\u0326\3\2\2\2\u0396\u0327\3\2" + + "\2\2\u0396\u0328\3\2\2\2\u0396\u0329\3\2\2\2\u0396\u032a\3\2\2\2\u0396" + + "\u0336\3\2\2\2\u0396\u0355\3\2\2\2\u0396\u035f\3\2\2\2\u0396\u0367\3\2" + + "\2\2\u0396\u036c\3\2\2\2\u0396\u0371\3\2\2\2\u0396\u0379\3\2\2\2\u0396" + + "\u0384\3\2\2\2\u0396\u0389\3\2\2\2\u0397K\3\2\2\2\u0398\u039b\5\36\20" + + "\2\u0399\u039b\5N(\2\u039a\u0398\3\2\2\2\u039a\u0399\3\2\2\2\u039bM\3" + + "\2\2\2\u039c\u039d\7a\2\2\u039d\u039e\5\36\20\2\u039eO\3\2\2\2\u039f\u03a1" + + "\7\u0096\2\2\u03a0\u039f\3\2\2\2\u03a0\u03a1\3\2\2\2\u03a1\u03a2\3\2\2" + + "\2\u03a2\u03a3\7\u0085\2\2\u03a3\u03a5\5\u01b4\u00db\2\u03a4\u03a6\5\30" + + "\r\2\u03a5\u03a4\3\2\2\2\u03a5\u03a6\3\2\2\2\u03a6Q\3\2\2\2\u03a7\u03a9" + + "\7\u0096\2\2\u03a8\u03a7\3\2\2\2\u03a8\u03a9\3\2\2\2\u03a9\u03aa\3\2\2" + + "\2\u03aa\u03ab\7\u0081\2\2\u03ab\u03b0\5T+\2\u03ac\u03ad\7\u0086\2\2\u03ad" + + "\u03af\5T+\2\u03ae\u03ac\3\2\2\2\u03af\u03b2\3\2\2\2\u03b0\u03ae\3\2\2" + + "\2\u03b0\u03b1\3\2\2\2\u03b1\u03b3\3\2\2\2\u03b2\u03b0\3\2\2\2\u03b3\u03b4" + + "\7\u0082\2\2\u03b4S\3\2\2\2\u03b5\u03b6\5\u01b4\u00db\2\u03b6\u03b7\7" + + "\u0087\2\2\u03b7\u03b9\3\2\2\2\u03b8\u03b5\3\2\2\2\u03b8\u03b9\3\2\2\2" + + "\u03b9\u03ba\3\2\2\2\u03ba\u03bb\5\36\20\2\u03bbU\3\2\2\2\u03bc\u03bd" + + "\t\t\2\2\u03bdW\3\2\2\2\u03be\u03c3\5\36\20\2\u03bf\u03c0\7\u0086\2\2" + + "\u03c0\u03c2\5\36\20\2\u03c1\u03bf\3\2\2\2\u03c2\u03c5\3\2\2\2\u03c3\u03c1" + + "\3\2\2\2\u03c3\u03c4\3\2\2\2\u03c4Y\3\2\2\2\u03c5\u03c3\3\2\2\2\u03c6" + + "\u03c9\5\\/\2\u03c7\u03c9\5d\63\2\u03c8\u03c6\3\2\2\2\u03c8\u03c7\3\2" + + "\2\2\u03c9[\3\2\2\2\u03ca\u03cf\7\177\2\2\u03cb\u03cd\5^\60\2\u03cc\u03ce" + + "\7\u0086\2\2\u03cd\u03cc\3\2\2\2\u03cd\u03ce\3\2\2\2\u03ce\u03d0\3\2\2" + + "\2\u03cf\u03cb\3\2\2\2\u03cf\u03d0\3\2\2\2\u03d0\u03d1\3\2\2\2\u03d1\u03d2" + + "\7\u0080\2\2\u03d2]\3\2\2\2\u03d3\u03d8\5`\61\2\u03d4\u03d5\7\u0086\2" + + "\2\u03d5\u03d7\5`\61\2\u03d6\u03d4\3\2\2\2\u03d7\u03da\3\2\2\2\u03d8\u03d6" + + "\3\2\2\2\u03d8\u03d9\3\2\2\2\u03d9_\3\2\2\2\u03da\u03d8\3\2\2\2\u03db" + + "\u03e1\5\u01b4\u00db\2\u03dc\u03dd\7\u0081\2\2\u03dd\u03de\5\36\20\2\u03de" + + "\u03df\7\u0082\2\2\u03df\u03e1\3\2\2\2\u03e0\u03db\3\2\2\2\u03e0\u03dc" + + "\3\2\2\2\u03e1\u03e2\3\2\2\2\u03e2\u03e3\7\u0093\2\2\u03e3\u03e4\5b\62" + + "\2\u03e4a\3\2\2\2\u03e5\u03e8\5\36\20\2\u03e6\u03e8\5Z.\2\u03e7\u03e5" + + "\3\2\2\2\u03e7\u03e6\3\2\2\2\u03e8c\3\2\2\2\u03e9\u03ea\7\177\2\2\u03ea" + + "\u03ef\5f\64\2\u03eb\u03ec\7\u0086\2\2\u03ec\u03ee\5f\64\2\u03ed\u03eb" + + "\3\2\2\2\u03ee\u03f1\3\2\2\2\u03ef\u03ed\3\2\2\2\u03ef\u03f0\3\2\2\2\u03f0" + + "\u03f3\3\2\2\2\u03f1\u03ef\3\2\2\2\u03f2\u03f4\7\u0086\2\2\u03f3\u03f2" + + "\3\2\2\2\u03f3\u03f4\3\2\2\2\u03f4\u03f5\3\2\2\2\u03f5\u03f6\7\u0080\2" + + "\2\u03f6e\3\2\2\2\u03f7\u03fd\5 \21\2\u03f8\u03f9\7\177\2\2\u03f9\u03fa" + + "\5X-\2\u03fa\u03fb\7\u0080\2\2\u03fb\u03fd\3\2\2\2\u03fc\u03f7\3\2\2\2" + + "\u03fc\u03f8\3\2\2\2\u03fdg\3\2\2\2\u03fe\u0403\7\177\2\2\u03ff\u0401" + + "\5j\66\2\u0400\u0402\7\u0086\2\2\u0401\u0400\3\2\2\2\u0401\u0402\3\2\2" + + "\2\u0402\u0404\3\2\2\2\u0403\u03ff\3\2\2\2\u0403\u0404\3\2\2\2\u0404\u0405" + + "\3\2\2\2\u0405\u0406\7\u0080\2\2\u0406i\3\2\2\2\u0407\u040c\5l\67\2\u0408" + + "\u0409\7\u0086\2\2\u0409\u040b\5l\67\2\u040a\u0408\3\2\2\2\u040b\u040e" + + "\3\2\2\2\u040c\u040a\3\2\2\2\u040c\u040d\3\2\2\2\u040dk\3\2\2\2\u040e" + + "\u040c\3\2\2\2\u040f\u0415\5H%\2\u0410\u0411\5\u01b4\u00db\2\u0411\u0412" + + "\7\u0093\2\2\u0412\u0413\5\36\20\2\u0413\u0415\3\2\2\2\u0414\u040f\3\2" + + "\2\2\u0414\u0410\3\2\2\2\u0415m\3\2\2\2\u0416\u041f\5\u01b4\u00db\2\u0417" + + "\u0419\5p9\2\u0418\u0417\3\2\2\2\u0418\u0419\3\2\2\2\u0419\u0420\3\2\2" + + "\2\u041a\u041b\7\u0097\2\2\u041b\u041d\5\u01b4\u00db\2\u041c\u041e\5p" + + "9\2\u041d\u041c\3\2\2\2\u041d\u041e\3\2\2\2\u041e\u0420\3\2\2\2\u041f" + + "\u0418\3\2\2\2\u041f\u041a\3\2\2\2\u0420\u0428\3\2\2\2\u0421\u0422\7\u0085" + + "\2\2\u0422\u0424\5\u01b4\u00db\2\u0423\u0425\5p9\2\u0424\u0423\3\2\2\2" + + "\u0424\u0425\3\2\2\2\u0425\u0427\3\2\2\2\u0426\u0421\3\2\2\2\u0427\u042a" + + "\3\2\2\2\u0428\u0426\3\2\2\2\u0428\u0429\3\2\2\2\u0429o\3\2\2\2\u042a" + + "\u0428\3\2\2\2\u042b\u042f\7\u0094\2\2\u042c\u042e\7\u0086\2\2\u042d\u042c" + + "\3\2\2\2\u042e\u0431\3\2\2\2\u042f\u042d\3\2\2\2\u042f\u0430\3\2\2\2\u0430" + + "\u0432\3\2\2\2\u0431\u042f\3\2\2\2\u0432\u0433\7\u0095\2\2\u0433q\3\2" + + "\2\2\u0434\u0439\5\b\5\2\u0435\u0438\5\u0144\u00a3\2\u0436\u0438\7\u008b" + + "\2\2\u0437\u0435\3\2\2\2\u0437\u0436\3\2\2\2\u0438\u043b\3\2\2\2\u0439" + + "\u0437\3\2\2\2\u0439\u043a\3\2\2\2\u043a\u043d\3\2\2\2\u043b\u0439\3\2" + + "\2\2\u043c\u043e\7\u0096\2\2\u043d\u043c\3\2\2\2\u043d\u043e\3\2\2\2\u043e" + + "\u0440\3\2\2\2\u043f\u0441\5t;\2\u0440\u043f\3\2\2\2\u0440\u0441\3\2\2" + + "\2\u0441\u0443\3\2\2\2\u0442\u0444\5\u01b4\u00db\2\u0443\u0442\3\2\2\2" + + "\u0443\u0444\3\2\2\2\u0444s\3\2\2\2\u0445\u0446\7\177\2\2\u0446\u044b" + + "\5v<\2\u0447\u0448\7\u0086\2\2\u0448\u044a\5v<\2\u0449\u0447\3\2\2\2\u044a" + + "\u044d\3\2\2\2\u044b\u0449\3\2\2\2\u044b\u044c\3\2\2\2\u044c\u044e\3\2" + + "\2\2\u044d\u044b\3\2\2\2\u044e\u044f\7\u0080\2\2\u044fu\3\2\2\2\u0450" + + "\u0451\5\u01b4\u00db\2\u0451\u0452\7\u0087\2\2\u0452\u0453\5\36\20\2\u0453" + + "w\3\2\2\2\u0454\u0456\7\21\2\2\u0455\u0454\3\2\2\2\u0455\u0456\3\2\2\2" + + "\u0456\u0457\3\2\2\2\u0457\u0458\5z>\2\u0458\u0459\5\u0178\u00bd\2\u0459" + + "\u045a\5\u0082B\2\u045ay\3\2\2\2\u045b\u045c\7\u0083\2\2\u045c\u0467\7" + + "\u0084\2\2\u045d\u045e\7\u0083\2\2\u045e\u045f\5|?\2\u045f\u0460\7\u0084" + + "\2\2\u0460\u0467\3\2\2\2\u0461\u0462\7\u0083\2\2\u0462\u0463\5\u0080A" + + "\2\u0463\u0464\7\u0084\2\2\u0464\u0467\3\2\2\2\u0465\u0467\5\u01b4\u00db" + + "\2\u0466\u045b\3\2\2\2\u0466\u045d\3\2\2\2\u0466\u0461\3\2\2\2\u0466\u0465" + + "\3\2\2\2\u0467{\3\2\2\2\u0468\u046d\5~@\2\u0469\u046a\7\u0086\2\2\u046a" + + "\u046c\5~@\2\u046b\u0469\3\2\2\2\u046c\u046f\3\2\2\2\u046d\u046b\3\2\2" + + "\2\u046d\u046e\3\2\2\2\u046e}\3\2\2\2\u046f\u046d\3\2\2\2\u0470\u0472" + + "\t\4\2\2\u0471\u0470\3\2\2\2\u0471\u0472\3\2\2\2\u0472\u0473\3\2\2\2\u0473" + + "\u0474\5\6\4\2\u0474\u0475\5\u01b4\u00db\2\u0475\177\3\2\2\2\u0476\u047b" + + "\5\u01b4\u00db\2\u0477\u0478\7\u0086\2\2\u0478\u047a\5\u01b4\u00db\2\u0479" + + "\u0477\3\2\2\2\u047a\u047d\3\2\2\2\u047b\u0479\3\2\2\2\u047b\u047c\3\2" + + "\2\2\u047c\u0081\3\2\2\2\u047d\u047b\3\2\2\2\u047e\u0481\5L\'\2\u047f" + + "\u0481\5\u00acW\2\u0480\u047e\3\2\2\2\u0480\u047f\3\2\2\2\u0481\u0083" + + "\3\2\2\2\u0482\u0483\5\u0086D\2\u0483\u0484\5\u0088E\2\u0484\u0085\3\2" + + "\2\2\u0485\u0487\7\62\2\2\u0486\u0488\5\6\4\2\u0487\u0486\3\2\2\2\u0487" + + "\u0488\3\2\2\2\u0488\u0489\3\2\2\2\u0489\u048a\5\u01b4\u00db\2\u048a\u048b" + + "\78\2\2\u048b\u048c\5\36\20\2\u048c\u0087\3\2\2\2\u048d\u048f\5\u008a" + + "F\2\u048e\u048d\3\2\2\2\u048f\u0492\3\2\2\2\u0490\u048e\3\2\2\2\u0490" + + "\u0491\3\2\2\2\u0491\u0493\3\2\2\2\u0492\u0490\3\2\2\2\u0493\u0495\5\u0096" + + "L\2\u0494\u0496\5\u0098M\2\u0495\u0494\3\2\2\2\u0495\u0496\3\2\2\2\u0496" + + "\u0089\3\2\2\2\u0497\u049d\5\u0086D\2\u0498\u049d\5\u008cG\2\u0499\u049d" + + "\5\u008eH\2\u049a\u049d\5\u0090I\2\u049b\u049d\5\u0092J\2\u049c\u0497" + + "\3\2\2\2\u049c\u0498\3\2\2\2\u049c\u0499\3\2\2\2\u049c\u049a\3\2\2\2\u049c" + + "\u049b\3\2\2\2\u049d\u008b\3\2\2\2\u049e\u049f\7?\2\2\u049f\u04a0\5\u01b4" + + "\u00db\2\u04a0\u04a1\7\u0093\2\2\u04a1\u04a2\5\36\20\2\u04a2\u008d\3\2" + + "\2\2\u04a3\u04a4\7q\2\2\u04a4\u04a5\5\36\20\2\u04a5\u008f\3\2\2\2\u04a6" + + "\u04a8\7>\2\2\u04a7\u04a9\5\6\4\2\u04a8\u04a7\3\2\2\2\u04a8\u04a9\3\2" + + "\2\2\u04a9\u04aa\3\2\2\2\u04aa\u04ab\5\u01b4\u00db\2\u04ab\u04ac\78\2" + + "\2\u04ac\u04ad\5\36\20\2\u04ad\u04ae\7G\2\2\u04ae\u04af\5\36\20\2\u04af" + + "\u04b0\7(\2\2\u04b0\u04b3\5\36\20\2\u04b1\u04b2\7<\2\2\u04b2\u04b4\5\u01b4" + + "\u00db\2\u04b3\u04b1\3\2\2\2\u04b3\u04b4\3\2\2\2\u04b4\u0091\3\2\2\2\u04b5" + + "\u04b6\7I\2\2\u04b6\u04bb\5\u0094K\2\u04b7\u04b8\7\u0086\2\2\u04b8\u04ba" + + "\5\u0094K\2\u04b9\u04b7\3\2\2\2\u04ba\u04bd\3\2\2\2\u04bb\u04b9\3\2\2" + + "\2\u04bb\u04bc\3\2\2\2\u04bc\u0093\3\2\2\2\u04bd\u04bb\3\2\2\2\u04be\u04c0" + + "\5\36\20\2\u04bf\u04c1\t\n\2\2\u04c0\u04bf\3\2\2\2\u04c0\u04c1\3\2\2\2" + + "\u04c1\u0095\3\2\2\2\u04c2\u04c3\7W\2\2\u04c3\u04ca\5\36\20\2\u04c4\u04c5" + + "\7\65\2\2\u04c5\u04c6\5\36\20\2\u04c6\u04c7\7\26\2\2\u04c7\u04c8\5\36" + + "\20\2\u04c8\u04ca\3\2\2\2\u04c9\u04c2\3\2\2\2\u04c9\u04c4\3\2\2\2\u04ca" + + "\u0097\3\2\2\2\u04cb\u04cc\7<\2\2\u04cc\u04cd\5\u01b4\u00db\2\u04cd\u04ce" + + "\5\u0088E\2\u04ce\u0099\3\2\2\2\u04cf\u04d3\5\u00a6T\2\u04d0\u04d3\5\u009c" + + "O\2\u04d1\u04d3\5\u00a8U\2\u04d2\u04cf\3\2\2\2\u04d2\u04d0\3\2\2\2\u04d2" + + "\u04d1\3\2\2\2\u04d3\u009b\3\2\2\2\u04d4\u04d5\5\u00aeX\2\u04d5\u04d6" + + "\7\u0088\2\2\u04d6\u04dc\3\2\2\2\u04d7\u04d8\5\u00b6\\\2\u04d8\u04d9\7" + + "\u0088\2\2\u04d9\u04dc\3\2\2\2\u04da\u04dc\5\u009eP\2\u04db\u04d4\3\2" + + "\2\2\u04db\u04d7\3\2\2\2\u04db\u04da\3\2\2\2\u04dc\u009d\3\2\2\2\u04dd" + + "\u04de\5\u00a0Q\2\u04de\u04df\5\u00a4S\2\u04df\u009f\3\2\2\2\u04e0\u04e2" + + "\5\u00a2R\2\u04e1\u04e0\3\2\2\2\u04e1\u04e2\3\2\2\2\u04e2\u04e3\3\2\2" + + "\2\u04e3\u04e4\5\u0114\u008b\2\u04e4\u04e6\5\u01b4\u00db\2\u04e5\u04e7" + + "\5\u00e8u\2\u04e6\u04e5\3\2\2\2\u04e6\u04e7\3\2\2\2\u04e7\u04e8\3\2\2" + + "\2\u04e8\u04ea\7\u0083\2\2\u04e9\u04eb\5\u011a\u008e\2\u04ea\u04e9\3\2" + + "\2\2\u04ea\u04eb\3\2\2\2\u04eb\u04ec\3\2\2\2\u04ec\u04ee\7\u0084\2\2\u04ed" + + "\u04ef\5\u00f0y\2\u04ee\u04ed\3\2\2\2\u04ee\u04ef\3\2\2\2\u04ef\u00a1" + + "\3\2\2\2\u04f0\u04f2\t\13\2\2\u04f1\u04f3\7\\\2\2\u04f2\u04f1\3\2\2\2" + + "\u04f2\u04f3\3\2\2\2\u04f3\u04f7\3\2\2\2\u04f4\u04f5\7\\\2\2\u04f5\u04f7" + + "\t\13\2\2\u04f6\u04f0\3\2\2\2\u04f6\u04f4\3\2\2\2\u04f7\u00a3\3\2\2\2" + + "\u04f8\u04fe\5\u00acW\2\u04f9\u04fa\5\u0178\u00bd\2\u04fa\u04fb\5L\'\2" + + "\u04fb\u04fc\7\u0088\2\2\u04fc\u04fe\3\2\2\2\u04fd\u04f8\3\2\2\2\u04fd" + + "\u04f9\3\2\2\2\u04fe\u00a5\3\2\2\2\u04ff\u0500\5\u01b4\u00db\2\u0500\u0501" + + "\7\u0087\2\2\u0501\u0502\5\u009aN\2\u0502\u00a7\3\2\2\2\u0503\u0506\5" + + "\u00acW\2\u0504\u0506\5\u00aaV\2\u0505\u0503\3\2\2\2\u0505\u0504\3\2\2" + + "\2\u0506\u00a9\3\2\2\2\u0507\u058a\7\u0088\2\2\u0508\u0509\5\36\20\2\u0509" + + "\u050a\7\u0088\2\2\u050a\u058a\3\2\2\2\u050b\u050c\7\66\2\2\u050c\u050d" + + "\7\u0083\2\2\u050d\u050e\5\36\20\2\u050e\u050f\7\u0084\2\2\u050f\u0512" + + "\5\u00b8]\2\u0510\u0511\7&\2\2\u0511\u0513\5\u00b8]\2\u0512\u0510\3\2" + + "\2\2\u0512\u0513\3\2\2\2\u0513\u058a\3\2\2\2\u0514\u0515\7_\2\2\u0515" + + "\u0516\7\u0083\2\2\u0516\u0517\5\36\20\2\u0517\u0518\7\u0084\2\2\u0518" + + "\u051c\7\177\2\2\u0519\u051b\5\u00ba^\2\u051a\u0519\3\2\2\2\u051b\u051e" + + "\3\2\2\2\u051c\u051a\3\2\2\2\u051c\u051d\3\2\2\2\u051d\u051f\3\2\2\2\u051e" + + "\u051c\3\2\2\2\u051f\u0520\7\u0080\2\2\u0520\u058a\3\2\2\2\u0521\u0522" + + "\7r\2\2\u0522\u0523\7\u0083\2\2\u0523\u0524\5\36\20\2\u0524\u0525\7\u0084" + + "\2\2\u0525\u0526\5\u00a8U\2\u0526\u058a\3\2\2\2\u0527\u0528\7#\2\2\u0528" + + "\u0529\5\u00a8U\2\u0529\u052a\7r\2\2\u052a\u052b\7\u0083\2\2\u052b\u052c" + + "\5\36\20\2\u052c\u052d\7\u0084\2\2\u052d\u052e\7\u0088\2\2\u052e\u058a" + + "\3\2\2\2\u052f\u0530\7\60\2\2\u0530\u0532\7\u0083\2\2\u0531\u0533\5\u00c2" + + "b\2\u0532\u0531\3\2\2\2\u0532\u0533\3\2\2\2\u0533\u0534\3\2\2\2\u0534" + + "\u0536\7\u0088\2\2\u0535\u0537\5\36\20\2\u0536\u0535\3\2\2\2\u0536\u0537" + + "\3\2\2\2\u0537\u0538\3\2\2\2\u0538\u053a\7\u0088\2\2\u0539\u053b\5\u00c4" + + "c\2\u053a\u0539\3\2\2\2\u053a\u053b\3\2\2\2\u053b\u053c\3\2\2\2\u053c" + + "\u053d\7\u0084\2\2\u053d\u058a\5\u00a8U\2\u053e\u0540\7\22\2\2\u053f\u053e" + + "\3\2\2\2\u053f\u0540\3\2\2\2\u0540\u0541\3\2\2\2\u0541\u0542\7\61\2\2" + + "\u0542\u0543\7\u0083\2\2\u0543\u0544\5\u00b0Y\2\u0544\u0545\5\u01b4\u00db" + + "\2\u0545\u0546\78\2\2\u0546\u0547\5\36\20\2\u0547\u0548\7\u0084\2\2\u0548" + + "\u0549\5\u00a8U\2\u0549\u058a\3\2\2\2\u054a\u054b\7\25\2\2\u054b\u058a" + + "\7\u0088\2\2\u054c\u054d\7\36\2\2\u054d\u058a\7\u0088\2\2\u054e\u0553" + + "\7\64\2\2\u054f\u0554\5\u01b4\u00db\2\u0550\u0551\7\30\2\2\u0551\u0554" + + "\5\36\20\2\u0552\u0554\7 \2\2\u0553\u054f\3\2\2\2\u0553\u0550\3\2\2\2" + + "\u0553\u0552\3\2\2\2\u0554\u0555\3\2\2\2\u0555\u058a\7\u0088\2\2\u0556" + + "\u0558\7T\2\2\u0557\u0559\5\36\20\2\u0558\u0557\3\2\2\2\u0558\u0559\3" + + "\2\2\2\u0559\u055a\3\2\2\2\u055a\u058a\7\u0088\2\2\u055b\u055d\7a\2\2" + + "\u055c\u055e\5\36\20\2\u055d\u055c\3\2\2\2\u055d\u055e\3\2\2\2\u055e\u055f" + + "\3\2\2\2\u055f\u058a\7\u0088\2\2\u0560\u0561\7c\2\2\u0561\u0567\5\u00ac" + + "W\2\u0562\u0564\5\u00c6d\2\u0563\u0565\5\u00ceh\2\u0564\u0563\3\2\2\2" + + "\u0564\u0565\3\2\2\2\u0565\u0568\3\2\2\2\u0566\u0568\5\u00ceh\2\u0567" + + "\u0562\3\2\2\2\u0567\u0566\3\2\2\2\u0568\u058a\3\2\2\2\u0569\u056a\7\33" + + "\2\2\u056a\u058a\5\u00acW\2\u056b\u056c\7g\2\2\u056c\u058a\5\u00acW\2" + + "\u056d\u056e\7@\2\2\u056e\u056f\7\u0083\2\2\u056f\u0570\5\36\20\2\u0570" + + "\u0571\7\u0084\2\2\u0571\u0572\5\u00a8U\2\u0572\u058a\3\2\2\2\u0573\u0574" + + "\7k\2\2\u0574\u0575\7\u0083\2\2\u0575\u0576\5\u00d0i\2\u0576\u0577\7\u0084" + + "\2\2\u0577\u0578\5\u00a8U\2\u0578\u058a\3\2\2\2\u0579\u057d\7s\2\2\u057a" + + "\u057b\7T\2\2\u057b\u057e\5\36\20\2\u057c\u057e\7\25\2\2\u057d\u057a\3" + + "\2\2\2\u057d\u057c\3\2\2\2\u057e\u057f\3\2\2\2\u057f\u058a\7\u0088\2\2" + + "\u0580\u0581\7i\2\2\u0581\u058a\5\u00acW\2\u0582\u0583\7.\2\2\u0583\u0584" + + "\7\u0083\2\2\u0584\u0585\5\u016c\u00b7\2\u0585\u0586\5\u016e\u00b8\2\u0586" + + "\u0587\7\u0084\2\2\u0587\u0588\5\u00a8U\2\u0588\u058a\3\2\2\2\u0589\u0507" + + "\3\2\2\2\u0589\u0508\3\2\2\2\u0589\u050b\3\2\2\2\u0589\u0514\3\2\2\2\u0589" + + "\u0521\3\2\2\2\u0589\u0527\3\2\2\2\u0589\u052f\3\2\2\2\u0589\u053f\3\2" + + "\2\2\u0589\u054a\3\2\2\2\u0589\u054c\3\2\2\2\u0589\u054e\3\2\2\2\u0589" + + "\u0556\3\2\2\2\u0589\u055b\3\2\2\2\u0589\u0560\3\2\2\2\u0589\u0569\3\2" + + "\2\2\u0589\u056b\3\2\2\2\u0589\u056d\3\2\2\2\u0589\u0573\3\2\2\2\u0589" + + "\u0579\3\2\2\2\u0589\u0580\3\2\2\2\u0589\u0582\3\2\2\2\u058a\u00ab\3\2" + + "\2\2\u058b\u058d\7\177\2\2\u058c\u058e\5\u00c0a\2\u058d\u058c\3\2\2\2" + + "\u058d\u058e\3\2\2\2\u058e\u058f\3\2\2\2\u058f\u0590\7\u0080\2\2\u0590" + + "\u00ad\3\2\2\2\u0591\u0596\7k\2\2\u0592\u0596\7R\2\2\u0593\u0594\7R\2" + + "\2\u0594\u0596\7Q\2\2\u0595\u0591\3\2\2\2\u0595\u0592\3\2\2\2\u0595\u0593" + + "\3\2\2\2\u0595\u0596\3\2\2\2\u0596\u0597\3\2\2\2\u0597\u0598\5\u00b0Y" + + "\2\u0598\u059d\5\u00b2Z\2\u0599\u059a\7\u0086\2\2\u059a\u059c\5\u00b2" + + "Z\2\u059b\u0599\3\2\2\2\u059c\u059f\3\2\2\2\u059d\u059b\3\2\2\2\u059d" + + "\u059e\3\2\2\2\u059e\u05a5\3\2\2\2\u059f\u059d\3\2\2\2\u05a0\u05a1\7." + + "\2\2\u05a1\u05a2\5\u016c\u00b7\2\u05a2\u05a3\5\u016e\u00b8\2\u05a3\u05a5" + + "\3\2\2\2\u05a4\u0595\3\2\2\2\u05a4\u05a0\3\2\2\2\u05a5\u00af\3\2\2\2\u05a6" + + "\u05a9\7l\2\2\u05a7\u05a9\5\6\4\2\u05a8\u05a6\3\2\2\2\u05a8\u05a7\3\2" + + "\2\2\u05a9\u00b1\3\2\2\2\u05aa\u05b0\5\u01b4\u00db\2\u05ab\u05ad\7\u0093" + + "\2\2\u05ac\u05ae\7R\2\2\u05ad\u05ac\3\2\2\2\u05ad\u05ae\3\2\2\2\u05ae" + + "\u05af\3\2\2\2\u05af\u05b1\5\u00b4[\2\u05b0\u05ab\3\2\2\2\u05b0\u05b1" + + "\3\2\2\2\u05b1\u00b3\3\2\2\2\u05b2\u05b6\5\36\20\2\u05b3\u05b6\5\u0146" + + "\u00a4\2\u05b4\u05b6\5\u0176\u00bc\2\u05b5\u05b2\3\2\2\2\u05b5\u05b3\3" + + "\2\2\2\u05b5\u05b4\3\2\2\2\u05b6\u00b5\3\2\2\2\u05b7\u05b8\7\35\2\2\u05b8" + + "\u05b9\5\6\4\2\u05b9\u05ba\5\u010a\u0086\2\u05ba\u00b7\3\2\2\2\u05bb\u05be" + + "\5\u00acW\2\u05bc\u05be\5\u00aaV\2\u05bd\u05bb\3\2\2\2\u05bd\u05bc\3\2" + + "\2\2\u05be\u00b9\3\2\2\2\u05bf\u05c1\5\u00bc_\2\u05c0\u05bf\3\2\2\2\u05c1" + + "\u05c2\3\2\2\2\u05c2\u05c0\3\2\2\2\u05c2\u05c3\3\2\2\2\u05c3\u05c4\3\2" + + "\2\2\u05c4\u05c5\5\u00c0a\2\u05c5\u00bb\3\2\2\2\u05c6\u05c7\7\30\2\2\u05c7" + + "\u05c9\5\36\20\2\u05c8\u05ca\5\u00be`\2\u05c9\u05c8\3\2\2\2\u05c9\u05ca" + + "\3\2\2\2\u05ca\u05cb\3\2\2\2\u05cb\u05cc\7\u0087\2\2\u05cc\u05d0\3\2\2" + + "\2\u05cd\u05ce\7 \2\2\u05ce\u05d0\7\u0087\2\2\u05cf\u05c6\3\2\2\2\u05cf" + + "\u05cd\3\2\2\2\u05d0\u00bd\3\2\2\2\u05d1\u05d2\7p\2\2\u05d2\u05d3\5\36" + + "\20\2\u05d3\u00bf\3\2\2\2\u05d4\u05d6\5\u009aN\2\u05d5\u05d4\3\2\2\2\u05d6" + + "\u05d7\3\2\2\2\u05d7\u05d5\3\2\2\2\u05d7\u05d8\3\2\2\2\u05d8\u00c1\3\2" + + "\2\2\u05d9\u05e3\5\u00aeX\2\u05da\u05df\5\36\20\2\u05db\u05dc\7\u0086" + + "\2\2\u05dc\u05de\5\36\20\2\u05dd\u05db\3\2\2\2\u05de\u05e1\3\2\2\2\u05df" + + "\u05dd\3\2\2\2\u05df\u05e0\3\2\2\2\u05e0\u05e3\3\2\2\2\u05e1\u05df\3\2" + + "\2\2\u05e2\u05d9\3\2\2\2\u05e2\u05da\3\2\2\2\u05e3\u00c3\3\2\2\2\u05e4" + + "\u05e9\5\36\20\2\u05e5\u05e6\7\u0086\2\2\u05e6\u05e8\5\36\20\2\u05e7\u05e5" + + "\3\2\2\2\u05e8\u05eb\3\2\2\2\u05e9\u05e7\3\2\2\2\u05e9\u05ea\3\2\2\2\u05ea" + + "\u00c5\3\2\2\2\u05eb\u05e9\3\2\2\2\u05ec\u05f0\5\u00c8e\2\u05ed\u05ef" + + "\5\u00c8e\2\u05ee\u05ed\3\2\2\2\u05ef\u05f2\3\2\2\2\u05f0\u05ee\3\2\2" + + "\2\u05f0\u05f1\3\2\2\2\u05f1\u05f4\3\2\2\2\u05f2\u05f0\3\2\2\2\u05f3\u05f5" + + "\5\u00caf\2\u05f4\u05f3\3\2\2\2\u05f4\u05f5\3\2\2\2\u05f5\u05f8\3\2\2" + + "\2\u05f6\u05f8\5\u00caf\2\u05f7\u05ec\3\2\2\2\u05f7\u05f6\3\2\2\2\u05f8" + + "\u00c7\3\2\2\2\u05f9\u05fa\7\31\2\2\u05fa\u05fb\7\u0083\2\2\u05fb\u05fd" + + "\5\26\f\2\u05fc\u05fe\5\u01b4\u00db\2\u05fd\u05fc\3\2\2\2\u05fd\u05fe" + + "\3\2\2\2\u05fe\u05ff\3\2\2\2\u05ff\u0601\7\u0084\2\2\u0600\u0602\5\u00cc" + + "g\2\u0601\u0600\3\2\2\2\u0601\u0602\3\2\2\2\u0602\u0603\3\2\2\2\u0603" + + "\u0604\5\u00acW\2\u0604\u00c9\3\2\2\2\u0605\u0607\7\31\2\2\u0606\u0608" + + "\5\u00ccg\2\u0607\u0606\3\2\2\2\u0607\u0608\3\2\2\2\u0608\u0609\3\2\2" + + "\2\u0609\u060a\5\u00acW\2\u060a\u00cb\3\2\2\2\u060b\u060c\7p\2\2\u060c" + + "\u060d\7\u0083\2\2\u060d\u060e\5\36\20\2\u060e\u060f\7\u0084\2\2\u060f" + + "\u00cd\3\2\2\2\u0610\u0611\7-\2\2\u0611\u0612\5\u00acW\2\u0612\u00cf\3" + + "\2\2\2\u0613\u0616\5\u00aeX\2\u0614\u0616\5\36\20\2\u0615\u0613\3\2\2" + + "\2\u0615\u0614\3\2\2\2\u0616\u00d1\3\2\2\2\u0617\u0618\7C\2\2\u0618\u0619" + + "\5\u00d4k\2\u0619\u061b\5\u00d6l\2\u061a\u061c\7\u0088\2\2\u061b\u061a" + + "\3\2\2\2\u061b\u061c\3\2\2\2\u061c\u00d3\3\2\2\2\u061d\u0622\5\u01b4\u00db" + + "\2\u061e\u061f\7\u0085\2\2\u061f\u0621\5\u01b4\u00db\2\u0620\u061e\3\2" + + "\2\2\u0621\u0624\3\2\2\2\u0622\u0620\3\2\2\2\u0622\u0623\3\2\2\2\u0623" + + "\u00d5\3\2\2\2\u0624\u0622\3\2\2\2\u0625\u0627\7\177\2\2\u0626\u0628\5" + + "\u00d8m\2\u0627\u0626\3\2\2\2\u0627\u0628\3\2\2\2\u0628\u062a\3\2\2\2" + + "\u0629\u062b\5\u00dco\2\u062a\u0629\3\2\2\2\u062a\u062b\3\2\2\2\u062b" + + "\u062d\3\2\2\2\u062c\u062e\5\u00e0q\2\u062d\u062c\3\2\2\2\u062d\u062e" + + "\3\2\2\2\u062e\u062f\3\2\2\2\u062f\u0630\7\u0080\2\2\u0630\u00d7\3\2\2" + + "\2\u0631\u0633\5\u00dan\2\u0632\u0631\3\2\2\2\u0633\u0634\3\2\2\2\u0634" + + "\u0632\3\2\2\2\u0634\u0635\3\2\2\2\u0635\u00d9\3\2\2\2\u0636\u0637\7+" + + "\2\2\u0637\u0638\7\r\2\2\u0638\u0639\5\u01b4\u00db\2\u0639\u063a\7\u0088" + + "\2\2\u063a\u00db\3\2\2\2\u063b\u063d\5\u00dep\2\u063c\u063b\3\2\2\2\u063d" + + "\u063e\3\2\2\2\u063e\u063c\3\2\2\2\u063e\u063f\3\2\2\2\u063f\u00dd\3\2" + + "\2\2\u0640\u0641\7k\2\2\u0641\u0642\5\u01b4\u00db\2\u0642\u0643\7\u0093" + + "\2\2\u0643\u0644\5\4\3\2\u0644\u0645\7\u0088\2\2\u0645\u0650\3\2\2\2\u0646" + + "\u0647\7k\2\2\u0647\u0648\5\4\3\2\u0648\u0649\7\u0088\2\2\u0649\u0650" + + "\3\2\2\2\u064a\u064b\7k\2\2\u064b\u064c\7\\\2\2\u064c\u064d\5\4\3\2\u064d" + + "\u064e\7\u0088\2\2\u064e\u0650\3\2\2\2\u064f\u0640\3\2\2\2\u064f\u0646" + + "\3\2\2\2\u064f\u064a\3\2\2\2\u0650\u00df\3\2\2\2\u0651\u0653\5\u00e2r" + + "\2\u0652\u0651\3\2\2\2\u0653\u0654\3\2\2\2\u0654\u0652\3\2\2\2\u0654\u0655" + + "\3\2\2\2\u0655\u00e1\3\2\2\2\u0656\u0659\5\u00d2j\2\u0657\u0659\5\u00e4" + + "s\2\u0658\u0656\3\2\2\2\u0658\u0657\3\2\2\2\u0659\u00e3\3\2\2\2\u065a" + + "\u065c\5\u0160\u00b1\2\u065b\u065a\3\2\2\2\u065b\u065c\3\2\2\2\u065c\u065e" + + "\3\2\2\2\u065d\u065f\5\u0102\u0082\2\u065e\u065d\3\2\2\2\u065e\u065f\3" + + "\2\2\2\u065f\u0665\3\2\2\2\u0660\u0666\5\u0190\u00c9\2\u0661\u0666\5\u0192" + + "\u00ca\2\u0662\u0666\5\u0194\u00cb\2\u0663\u0666\5\u0196\u00cc\2\u0664" + + "\u0666\5\u0198\u00cd\2\u0665\u0660\3\2\2\2\u0665\u0661\3\2\2\2\u0665\u0662" + + "\3\2\2\2\u0665\u0663\3\2\2\2\u0665\u0664\3\2\2\2\u0666\u00e5\3\2\2\2\u0667" + + "\u0668\5\u01b4\u00db\2\u0668\u0669\7\u0097\2\2\u0669\u066b\5\u01b4\u00db" + + "\2\u066a\u066c\5\30\r\2\u066b\u066a\3\2\2\2\u066b\u066c\3\2\2\2\u066c" + + "\u00e7\3\2\2\2\u066d\u066e\7\u0094\2\2\u066e\u0673\5\u00eav\2\u066f\u0670" + + "\7\u0086\2\2\u0670\u0672\5\u00eav\2\u0671\u066f\3\2\2\2\u0672\u0675\3" + + "\2\2\2\u0673\u0671\3\2\2\2\u0673\u0674\3\2\2\2\u0674\u0676\3\2\2\2\u0675" + + "\u0673\3\2\2\2\u0676\u0677\7\u0095\2\2\u0677\u00e9\3\2\2\2\u0678\u067a" + + "\5\u0160\u00b1\2\u0679\u0678\3\2\2\2\u0679\u067a\3\2\2\2\u067a\u067b\3" + + "\2\2\2\u067b\u067c\5\u01b4\u00db\2\u067c\u00eb\3\2\2\2\u067d\u067e\7\u0087" + + "\2\2\u067e\u0683\5\26\f\2\u067f\u0680\7\u0086\2\2\u0680\u0682\5\4\3\2" + + "\u0681\u067f\3\2\2\2\u0682\u0685\3\2\2\2\u0683\u0681\3\2\2\2\u0683\u0684" + + "\3\2\2\2\u0684\u00ed\3\2\2\2\u0685\u0683\3\2\2\2\u0686\u068b\5\4\3\2\u0687" + + "\u0688\7\u0086\2\2\u0688\u068a\5\4\3\2\u0689\u0687\3\2\2\2\u068a\u068d" + + "\3\2\2\2\u068b\u0689\3\2\2\2\u068b\u068c\3\2\2\2\u068c\u00ef\3\2\2\2\u068d" + + "\u068b\3\2\2\2\u068e\u0690\5\u00f2z\2\u068f\u068e\3\2\2\2\u0690\u0691" + + "\3\2\2\2\u0691\u068f\3\2\2\2\u0691\u0692\3\2\2\2\u0692\u00f1\3\2\2\2\u0693" + + "\u0694\7q\2\2\u0694\u0695\5\u01b4\u00db\2\u0695\u0696\7\u0087\2\2\u0696" + + "\u0697\5\u00f4{\2\u0697\u00f3\3\2\2\2\u0698\u06a3\5\u00fa~\2\u0699\u069c" + + "\5\u00f6|\2\u069a\u069b\7\u0086\2\2\u069b\u069d\5\u00f8}\2\u069c\u069a" + + "\3\2\2\2\u069c\u069d\3\2\2\2\u069d\u06a0\3\2\2\2\u069e\u069f\7\u0086\2" + + "\2\u069f\u06a1\5\u00fa~\2\u06a0\u069e\3\2\2\2\u06a0\u06a1\3\2\2\2\u06a1" + + "\u06a3\3\2\2\2\u06a2\u0698\3\2\2\2\u06a2\u0699\3\2\2\2\u06a3\u00f5\3\2" + + "\2\2\u06a4\u06ac\5\26\f\2\u06a5\u06a7\7\34\2\2\u06a6\u06a8\7\u0096\2\2" + + "\u06a7\u06a6\3\2\2\2\u06a7\u06a8\3\2\2\2\u06a8\u06ac\3\2\2\2\u06a9\u06ac" + + "\7^\2\2\u06aa\u06ac\7h\2\2\u06ab\u06a4\3\2\2\2\u06ab\u06a5\3\2\2\2\u06ab" + + "\u06a9\3\2\2\2\u06ab\u06aa\3\2\2\2\u06ac\u00f7\3\2\2\2\u06ad\u06b2\5\4" + + "\3\2\u06ae\u06af\7\u0086\2\2\u06af\u06b1\5\4\3\2\u06b0\u06ae\3\2\2\2\u06b1" + + "\u06b4\3\2\2\2\u06b2\u06b0\3\2\2\2\u06b2\u06b3\3\2\2\2\u06b3\u00f9\3\2" + + "\2\2\u06b4\u06b2\3\2\2\2\u06b5\u06b6\7D\2\2\u06b6\u06b7\7\u0083\2\2\u06b7" + + "\u06b8\7\u0084\2\2\u06b8\u00fb\3\2\2\2\u06b9\u06bb\7\177\2\2\u06ba\u06bc" + + "\5\u00fe\u0080\2\u06bb\u06ba\3\2\2\2\u06bb\u06bc\3\2\2\2\u06bc\u06bd\3" + + "\2\2\2\u06bd\u06be\7\u0080\2\2\u06be\u00fd\3\2\2\2\u06bf\u06c1\5\u0100" + + "\u0081\2\u06c0\u06bf\3\2\2\2\u06c1\u06c2\3\2\2\2\u06c2\u06c0\3\2\2\2\u06c2" + + "\u06c3\3\2\2\2\u06c3\u00ff\3\2\2\2\u06c4\u06c6\5\u0160\u00b1\2\u06c5\u06c4" + + "\3\2\2\2\u06c5\u06c6\3\2\2\2\u06c6\u06c8\3\2\2\2\u06c7\u06c9\5\u0102\u0082" + + "\2\u06c8\u06c7\3\2\2\2\u06c8\u06c9\3\2\2\2\u06c9\u06cc\3\2\2\2\u06ca\u06cd" + + "\5\u0106\u0084\2\u06cb\u06cd\5\u01a4\u00d3\2\u06cc\u06ca\3\2\2\2\u06cc" + + "\u06cb\3\2\2\2\u06cd\u0101\3\2\2\2\u06ce\u06d0\5\u0104\u0083\2\u06cf\u06ce" + + "\3\2\2\2\u06d0\u06d1\3\2\2\2\u06d1\u06cf\3\2\2\2\u06d1\u06d2\3\2\2\2\u06d2" + + "\u0103\3\2\2\2\u06d3\u06d4\t\f\2\2\u06d4\u0105\3\2\2\2\u06d5\u06e9\5\u01a0" + + "\u00d1\2\u06d6\u06e9\5\u0108\u0085\2\u06d7\u06e9\5\u019a\u00ce\2\u06d8" + + "\u06de\5\u0136\u009c\2\u06d9\u06df\5\u013a\u009e\2\u06da\u06db\5\u0178" + + "\u00bd\2\u06db\u06dc\5L\'\2\u06dc\u06dd\7\u0088\2\2\u06dd\u06df\3\2\2" + + "\2\u06de\u06d9\3\2\2\2\u06de\u06da\3\2\2\2\u06df\u06e9\3\2\2\2\u06e0\u06e9" + + "\5\u01a6\u00d4\2\u06e1\u06e2\7n\2\2\u06e2\u06e9\5\u01a8\u00d5\2\u06e3" + + "\u06e9\5\u0190\u00c9\2\u06e4\u06e9\5\u0192\u00ca\2\u06e5\u06e9\5\u0194" + + "\u00cb\2\u06e6\u06e9\5\u0196\u00cc\2\u06e7\u06e9\5\u0198\u00cd\2\u06e8" + + "\u06d5\3\2\2\2\u06e8\u06d6\3\2\2\2\u06e8\u06d7\3\2\2\2\u06e8\u06d8\3\2" + + "\2\2\u06e8\u06e0\3\2\2\2\u06e8\u06e1\3\2\2\2\u06e8\u06e3\3\2\2\2\u06e8" + + "\u06e4\3\2\2\2\u06e8\u06e5\3\2\2\2\u06e8\u06e6\3\2\2\2\u06e8\u06e7\3\2" + + "\2\2\u06e9\u0107\3\2\2\2\u06ea\u06f0\7R\2\2\u06eb\u06ec\7Q\2\2\u06ec\u06f0" + + "\7R\2\2\u06ed\u06ee\7R\2\2\u06ee\u06f0\7Q\2\2\u06ef\u06ea\3\2\2\2\u06ef" + + "\u06eb\3\2\2\2\u06ef\u06ed\3\2\2\2\u06ef\u06f0\3\2\2\2\u06f0\u06f1\3\2" + + "\2\2\u06f1\u06fb\5\6\4\2\u06f2\u06f3\5\4\3\2\u06f3\u06f4\7\u0085\2\2\u06f4" + + "\u06f5\5\u01a2\u00d2\2\u06f5\u06fc\3\2\2\2\u06f6\u06fc\5\u01a8\u00d5\2" + + "\u06f7\u06fc\5\u019e\u00d0\2\u06f8\u06fc\5\u01a2\u00d2\2\u06f9\u06fc\5" + + "\u01ac\u00d7\2\u06fa\u06fc\5\u019c\u00cf\2\u06fb\u06f2\3\2\2\2\u06fb\u06f6" + + "\3\2\2\2\u06fb\u06f7\3\2\2\2\u06fb\u06f8\3\2\2\2\u06fb\u06f9\3\2\2\2\u06fb" + + "\u06fa\3\2\2\2\u06fc\u0109\3\2\2\2\u06fd\u0702\5\u010c\u0087\2\u06fe\u06ff" + + "\7\u0086\2\2\u06ff\u0701\5\u010c\u0087\2\u0700\u06fe\3\2\2\2\u0701\u0704" + + "\3\2\2\2\u0702\u0700\3\2\2\2\u0702\u0703\3\2\2\2\u0703\u010b\3\2\2\2\u0704" + + "\u0702\3\2\2\2\u0705\u0706\5\u01b4\u00db\2\u0706\u0707\7\u0093\2\2\u0707" + + "\u0708\5\36\20\2\u0708\u010d\3\2\2\2\u0709\u070e\5\u0110\u0089\2\u070a" + + "\u070b\7\u0086\2\2\u070b\u070d\5\u0110\u0089\2\u070c\u070a\3\2\2\2\u070d" + + "\u0710\3\2\2\2\u070e\u070c\3\2\2\2\u070e\u070f\3\2\2\2\u070f\u010f\3\2" + + "\2\2\u0710\u070e\3\2\2\2\u0711\u0714\5\u01b4\u00db\2\u0712\u0713\7\u0093" + + "\2\2\u0713\u0715\5\u0112\u008a\2\u0714\u0712\3\2\2\2\u0714\u0715\3\2\2" + + "\2\u0715\u0111\3\2\2\2\u0716\u0719\5\36\20\2\u0717\u0719\5\u0146\u00a4" + + "\2\u0718\u0716\3\2\2\2\u0718\u0717\3\2\2\2\u0719\u0113\3\2\2\2\u071a\u071d" + + "\5\6\4\2\u071b\u071d\7n\2\2\u071c\u071a\3\2\2\2\u071c\u071b\3\2\2\2\u071d" + + "\u0115\3\2\2\2\u071e\u071f\5\4\3\2\u071f\u0117\3\2\2\2\u0720\u0723\5\u00ac" + + "W\2\u0721\u0723\7\u0088\2\2\u0722\u0720\3\2\2\2\u0722\u0721\3\2\2\2\u0723" + + "\u0119\3\2\2\2\u0724\u072b\5\u0122\u0092\2\u0725\u0728\5\u011c\u008f\2" + + "\u0726\u0727\7\u0086\2\2\u0727\u0729\5\u0122\u0092\2\u0728\u0726\3\2\2" + + "\2\u0728\u0729\3\2\2\2\u0729\u072b\3\2\2\2\u072a\u0724\3\2\2\2\u072a\u0725" + + "\3\2\2\2\u072b\u011b\3\2\2\2\u072c\u0731\5\u011e\u0090\2\u072d\u072e\7" + + "\u0086\2\2\u072e\u0730\5\u011e\u0090\2\u072f\u072d\3\2\2\2\u0730\u0733" + + "\3\2\2\2\u0731\u072f\3\2\2\2\u0731\u0732\3\2\2\2\u0732\u011d\3\2\2\2\u0733" + + "\u0731\3\2\2\2\u0734\u0736\5\u0160\u00b1\2\u0735\u0734\3\2\2\2\u0735\u0736" + + "\3\2\2\2\u0736\u0738\3\2\2\2\u0737\u0739\5\u0120\u0091\2\u0738\u0737\3" + + "\2\2\2\u0738\u0739\3\2\2\2\u0739\u073a\3\2\2\2\u073a\u073d\5\u01ae\u00d8" + + "\2\u073b\u073d\7\16\2\2\u073c\u0735\3\2\2\2\u073c\u073b\3\2\2\2\u073d" + + "\u011f\3\2\2\2\u073e\u0747\7R\2\2\u073f\u0747\7J\2\2\u0740\u0747\78\2" + + "\2\u0741\u0742\7R\2\2\u0742\u0747\7`\2\2\u0743\u0744\78\2\2\u0744\u0747" + + "\7`\2\2\u0745\u0747\7`\2\2\u0746\u073e\3\2\2\2\u0746\u073f\3\2\2\2\u0746" + + "\u0740\3\2\2\2\u0746\u0741\3\2\2\2\u0746\u0743\3\2\2\2\u0746\u0745\3\2" + + "\2\2\u0747\u0121\3\2\2\2\u0748\u074a\5\u0160\u00b1\2\u0749\u0748\3\2\2" + + "\2\u0749\u074a\3\2\2\2\u074a\u074b\3\2\2\2\u074b\u074c\7L\2\2\u074c\u074d" + + "\5\u0142\u00a2\2\u074d\u074e\5\u01b4\u00db\2\u074e\u0123\3\2\2\2\u074f" + + "\u0751\5\u0160\u00b1\2\u0750\u074f\3\2\2\2\u0750\u0751\3\2\2\2\u0751\u0753" + + "\3\2\2\2\u0752\u0754\5\u012a\u0096\2\u0753\u0752\3\2\2\2\u0753\u0754\3" + + "\2\2\2\u0754\u075f\3\2\2\2\u0755\u0756\7\63\2\2\u0756\u0758\5\u012c\u0097" + + "\2\u0757\u0759\5\u0128\u0095\2\u0758\u0757\3\2\2\2\u0758\u0759\3\2\2\2" + + "\u0759\u0760\3\2\2\2\u075a\u075b\7X\2\2\u075b\u075d\5\u012c\u0097\2\u075c" + + "\u075e\5\u0126\u0094\2\u075d\u075c\3\2\2\2\u075d\u075e\3\2\2\2\u075e\u0760" + + "\3\2\2\2\u075f\u0755\3\2\2\2\u075f\u075a\3\2\2\2\u0760\u0125\3\2\2\2\u0761" + + "\u0763\5\u0160\u00b1\2\u0762\u0761\3\2\2\2\u0762\u0763\3\2\2\2\u0763\u0765" + + "\3\2\2\2\u0764\u0766\5\u012a\u0096\2\u0765\u0764\3\2\2\2\u0765\u0766\3" + + "\2\2\2\u0766\u0767\3\2\2\2\u0767\u0768\7\63\2\2\u0768\u0769\5\u012c\u0097" + + "\2\u0769\u0127\3\2\2\2\u076a\u076c\5\u0160\u00b1\2\u076b\u076a\3\2\2\2" + + "\u076b\u076c\3\2\2\2\u076c\u076e\3\2\2\2\u076d\u076f\5\u012a\u0096\2\u076e" + + "\u076d\3\2\2\2\u076e\u076f\3\2\2\2\u076f\u0770\3\2\2\2\u0770\u0771\7X" + + "\2\2\u0771\u0772\5\u012c\u0097\2\u0772\u0129\3\2\2\2\u0773\u077b\7O\2" + + "\2\u0774\u077b\7;\2\2\u0775\u077b\7N\2\2\u0776\u0777\7O\2\2\u0777\u077b" + + "\7;\2\2\u0778\u0779\7;\2\2\u0779\u077b\7O\2\2\u077a\u0773\3\2\2\2\u077a" + + "\u0774\3\2\2\2\u077a\u0775\3\2\2\2\u077a\u0776\3\2\2\2\u077a\u0778\3\2" + + "\2\2\u077b\u012b\3\2\2\2\u077c\u077f\5\u00acW\2\u077d\u077f\7\u0088\2" + + "\2\u077e\u077c\3\2\2\2\u077e\u077d\3\2\2\2\u077f\u012d\3\2\2\2\u0780\u0782" + + "\5\u0160\u00b1\2\u0781\u0780\3\2\2\2\u0781\u0782\3\2\2\2\u0782\u078b\3" + + "\2\2\2\u0783\u0784\7\f\2\2\u0784\u0785\5\u00acW\2\u0785\u0786\5\u0132" + + "\u009a\2\u0786\u078c\3\2\2\2\u0787\u0788\7S\2\2\u0788\u0789\5\u00acW\2" + + "\u0789\u078a\5\u0130\u0099\2\u078a\u078c\3\2\2\2\u078b\u0783\3\2\2\2\u078b" + + "\u0787\3\2\2\2\u078c\u012f\3\2\2\2\u078d\u078f\5\u0160\u00b1\2\u078e\u078d" + + "\3\2\2\2\u078e\u078f\3\2\2\2\u078f\u0790\3\2\2\2\u0790\u0791\7\f\2\2\u0791" + + "\u0792\5\u00acW\2\u0792\u0131\3\2\2\2\u0793\u0795\5\u0160\u00b1\2\u0794" + + "\u0793\3\2\2\2\u0794\u0795\3\2\2\2\u0795\u0796\3\2\2\2\u0796\u0797\7S" + + "\2\2\u0797\u0798\5\u00acW\2\u0798\u0133\3\2\2\2\u0799\u07b0\7\u0089\2" + + "\2\u079a\u07b0\7\u008a\2\2\u079b\u07b0\7\u0091\2\2\u079c\u07b0\7\u0092" + + "\2\2\u079d\u07b0\7\u0099\2\2\u079e\u07b0\7\u009a\2\2\u079f\u07b0\7b\2" + + "\2\u07a0\u07b0\7,\2\2\u07a1\u07b0\7\u008b\2\2\u07a2\u07b0\7\u008c\2\2" + + "\u07a3\u07b0\7\u008d\2\2\u07a4\u07b0\7\u008e\2\2\u07a5\u07b0\7\u008f\2" + + "\2\u07a6\u07b0\7\u0090\2\2\u07a7\u07b0\7\u00aa\2\2\u07a8\u07b0\5\u017a" + + "\u00be\2\u07a9\u07b0\7\u009e\2\2\u07aa\u07b0\7\u009f\2\2\u07ab\u07b0\7" + + "\u0095\2\2\u07ac\u07b0\7\u0094\2\2\u07ad\u07b0\7\u00a1\2\2\u07ae\u07b0" + + "\7\u00a0\2\2\u07af\u0799\3\2\2\2\u07af\u079a\3\2\2\2\u07af\u079b\3\2\2" + + "\2\u07af\u079c\3\2\2\2\u07af\u079d\3\2\2\2\u07af\u079e\3\2\2\2\u07af\u079f" + + "\3\2\2\2\u07af\u07a0\3\2\2\2\u07af\u07a1\3\2\2\2\u07af\u07a2\3\2\2\2\u07af" + + "\u07a3\3\2\2\2\u07af\u07a4\3\2\2\2\u07af\u07a5\3\2\2\2\u07af\u07a6\3\2" + + "\2\2\u07af\u07a7\3\2\2\2\u07af\u07a8\3\2\2\2\u07af\u07a9\3\2\2\2\u07af" + + "\u07aa\3\2\2\2\u07af\u07ab\3\2\2\2\u07af\u07ac\3\2\2\2\u07af\u07ad\3\2" + + "\2\2\u07af\u07ae\3\2\2\2\u07b0\u0135\3\2\2\2\u07b1\u07b2\t\r\2\2\u07b2" + + "\u07b3\7H\2\2\u07b3\u07b4\5\6\4\2\u07b4\u07b5\7\u0083\2\2\u07b5\u07b6" + + "\5\u01ae\u00d8\2\u07b6\u07b7\7\u0084\2\2\u07b7\u0137\3\2\2\2\u07b8\u07b9" + + "\7\u0087\2\2\u07b9\u07ba\t\16\2\2\u07ba\u07bc\7\u0083\2\2\u07bb\u07bd" + + "\5\32\16\2\u07bc\u07bb\3\2\2\2\u07bc\u07bd\3\2\2\2\u07bd\u07be\3\2\2\2" + + "\u07be\u07bf\7\u0084\2\2\u07bf\u0139\3\2\2\2\u07c0\u07c3\5\u00acW\2\u07c1" + + "\u07c3\7\u0088\2\2\u07c2\u07c0\3\2\2\2\u07c2\u07c1\3\2\2\2\u07c3\u013b" + + "\3\2\2\2\u07c4\u07c5\7\u0087\2\2\u07c5\u07c6\5\u00eex\2\u07c6\u013d\3" + + "\2\2\2\u07c7\u07cb\7\177\2\2\u07c8\u07ca\5\u0140\u00a1\2\u07c9\u07c8\3" + + "\2\2\2\u07ca\u07cd\3\2\2\2\u07cb\u07c9\3\2\2\2\u07cb\u07cc\3\2\2\2\u07cc" + + "\u07ce\3\2\2\2\u07cd\u07cb\3\2\2\2\u07ce\u07cf\7\u0080\2\2\u07cf\u013f" + + "\3\2\2\2\u07d0\u07d2\5\u0160\u00b1\2\u07d1\u07d0\3\2\2\2\u07d1\u07d2\3" + + "\2\2\2\u07d2\u07d4\3\2\2\2\u07d3\u07d5\5\u0102\u0082\2\u07d4\u07d3\3\2" + + "\2\2\u07d4\u07d5\3\2\2\2\u07d5\u07e0\3\2\2\2\u07d6\u07e1\5\u0106\u0084" + + "\2\u07d7\u07d8\7.\2\2\u07d8\u07da\5\6\4\2\u07d9\u07db\5\u0174\u00bb\2" + + "\u07da\u07d9\3\2\2\2\u07db\u07dc\3\2\2\2\u07dc\u07da\3\2\2\2\u07dc\u07dd" + + "\3\2\2\2\u07dd\u07de\3\2\2\2\u07de\u07df\7\u0088\2\2\u07df\u07e1\3\2\2" + + "\2\u07e0\u07d6\3\2\2\2\u07e0\u07d7\3\2\2\2\u07e1\u0141\3\2\2\2\u07e2\u07ea" + + "\5\b\5\2\u07e3\u07e5\t\17\2\2\u07e4\u07e3\3\2\2\2\u07e5\u07e8\3\2\2\2" + + "\u07e6\u07e4\3\2\2\2\u07e6\u07e7\3\2\2\2\u07e7\u07e9\3\2\2\2\u07e8\u07e6" + + "\3\2\2\2\u07e9\u07eb\5\u0144\u00a3\2\u07ea\u07e6\3\2\2\2\u07eb\u07ec\3" + + "\2\2\2\u07ec\u07ea\3\2\2\2\u07ec\u07ed\3\2\2\2\u07ed\u0143\3\2\2\2\u07ee" + + "\u07f2\7\u0081\2\2\u07ef\u07f1\7\u0086\2\2\u07f0\u07ef\3\2\2\2\u07f1\u07f4" + + "\3\2\2\2\u07f2\u07f0\3\2\2\2\u07f2\u07f3\3\2\2\2\u07f3\u07f5\3\2\2\2\u07f4" + + "\u07f2\3\2\2\2\u07f5\u07f6\7\u0082\2\2\u07f6\u0145\3\2\2\2\u07f7\u0803" + + "\7\177\2\2\u07f8\u07fd\5\u0112\u008a\2\u07f9\u07fa\7\u0086\2\2\u07fa\u07fc" + + "\5\u0112\u008a\2\u07fb\u07f9\3\2\2\2\u07fc\u07ff\3\2\2\2\u07fd\u07fb\3" + + "\2\2\2\u07fd\u07fe\3\2\2\2\u07fe\u0801\3\2\2\2\u07ff\u07fd\3\2\2\2\u0800" + + "\u0802\7\u0086\2\2\u0801\u0800\3\2\2\2\u0801\u0802\3\2\2\2\u0802\u0804" + + "\3\2\2\2\u0803\u07f8\3\2\2\2\u0803\u0804\3\2\2\2\u0804\u0805\3\2\2\2\u0805" + + "\u0806\7\u0080\2\2\u0806\u0147\3\2\2\2\u0807\u0808\7\u0094\2\2\u0808\u080d" + + "\5\u014a\u00a6\2\u0809\u080a\7\u0086\2\2\u080a\u080c\5\u014a\u00a6\2\u080b" + + "\u0809\3\2\2\2\u080c\u080f\3\2\2\2\u080d\u080b\3\2\2\2\u080d\u080e\3\2" + + "\2\2\u080e\u0810\3\2\2\2\u080f\u080d\3\2\2\2\u0810\u0811\7\u0095\2\2\u0811" + + "\u0149\3\2\2\2\u0812\u0814\5\u0160\u00b1\2\u0813\u0812\3\2\2\2\u0813\u0814" + + "\3\2\2\2\u0814\u0816\3\2\2\2\u0815\u0817\5\u014c\u00a7\2\u0816\u0815\3" + + "\2\2\2\u0816\u0817\3\2\2\2\u0817\u0818\3\2\2\2\u0818\u0819\5\u01b4\u00db" + + "\2\u0819\u014b\3\2\2\2\u081a\u081b\t\20\2\2\u081b\u014d\3\2\2\2\u081c" + + "\u081d\7\u0087\2\2\u081d\u081e\5\u00eex\2\u081e\u014f\3\2\2\2\u081f\u0823" + + "\7\177\2\2\u0820\u0822\5\u0152\u00aa\2\u0821\u0820\3\2\2\2\u0822\u0825" + + "\3\2\2\2\u0823\u0821\3\2\2\2\u0823\u0824\3\2\2\2\u0824\u0826\3\2\2\2\u0825" + + "\u0823\3\2\2\2\u0826\u0827\7\u0080\2\2\u0827\u0151\3\2\2\2\u0828\u082a" + + "\5\u0160\u00b1\2\u0829\u0828\3\2\2\2\u0829\u082a\3\2\2\2\u082a\u082c\3" + + "\2\2\2\u082b\u082d\7D\2\2\u082c\u082b\3\2\2\2\u082c\u082d\3\2\2\2\u082d" + + "\u086d\3\2\2\2\u082e\u0830\7i\2\2\u082f\u082e\3\2\2\2\u082f\u0830\3\2" + + "\2\2\u0830\u0836\3\2\2\2\u0831\u0837\7R\2\2\u0832\u0833\7R\2\2\u0833\u0837" + + "\7Q\2\2\u0834\u0835\7Q\2\2\u0835\u0837\7R\2\2\u0836\u0831\3\2\2\2\u0836" + + "\u0832\3\2\2\2\u0836\u0834\3\2\2\2\u0836\u0837\3\2\2\2\u0837\u0838\3\2" + + "\2\2\u0838\u0854\5\6\4\2\u0839\u083b\5\u01b4\u00db\2\u083a\u083c\5\u00e8" + + "u\2\u083b\u083a\3\2\2\2\u083b\u083c\3\2\2\2\u083c\u083d\3\2\2\2\u083d" + + "\u083f\7\u0083\2\2\u083e\u0840\5\u011a\u008e\2\u083f\u083e\3\2\2\2\u083f" + + "\u0840\3\2\2\2\u0840\u0841\3\2\2\2\u0841\u0843\7\u0084\2\2\u0842\u0844" + + "\5\u00f0y\2\u0843\u0842\3\2\2\2\u0843\u0844\3\2\2\2\u0844\u0845\3\2\2" + + "\2\u0845\u0846\7\u0088\2\2\u0846\u0855\3\2\2\2\u0847\u0848\5\u01b4\u00db" + + "\2\u0848\u0849\7\177\2\2\u0849\u084a\5\u0154\u00ab\2\u084a\u084b\7\u0080" + + "\2\2\u084b\u0855\3\2\2\2\u084c\u084d\7`\2\2\u084d\u084e\7\u0081\2\2\u084e" + + "\u084f\5\u011a\u008e\2\u084f\u0850\7\u0082\2\2\u0850\u0851\7\177\2\2\u0851" + + "\u0852\5\u0154\u00ab\2\u0852\u0853\7\u0080\2\2\u0853\u0855\3\2\2\2\u0854" + + "\u0839\3\2\2\2\u0854\u0847\3\2\2\2\u0854\u084c\3\2\2\2\u0855\u086e\3\2" + + "\2\2\u0856\u0858\7i\2\2\u0857\u0856\3\2\2\2\u0857\u0858\3\2\2\2\u0858" + + "\u0859\3\2\2\2\u0859\u085a\7n\2\2\u085a\u085c\5\u01b4\u00db\2\u085b\u085d" + + "\5\u00e8u\2\u085c\u085b\3\2\2\2\u085c\u085d\3\2\2\2\u085d\u085e\3\2\2" + + "\2\u085e\u0860\7\u0083\2\2\u085f\u0861\5\u011a\u008e\2\u0860\u085f\3\2" + + "\2\2\u0860\u0861\3\2\2\2\u0861\u0862\3\2\2\2\u0862\u0864\7\u0084\2\2\u0863" + + "\u0865\5\u00f0y\2\u0864\u0863\3\2\2\2\u0864\u0865\3\2\2\2\u0865\u0866" + + "\3\2\2\2\u0866\u0867\7\u0088\2\2\u0867\u086e\3\2\2\2\u0868\u0869\7)\2" + + "\2\u0869\u086a\5\6\4\2\u086a\u086b\5\u01b4\u00db\2\u086b\u086c\7\u0088" + + "\2\2\u086c\u086e\3\2\2\2\u086d\u082f\3\2\2\2\u086d\u0857\3\2\2\2\u086d" + + "\u0868\3\2\2\2\u086e\u0153\3\2\2\2\u086f\u0871\5\u0160\u00b1\2\u0870\u086f" + + "\3\2\2\2\u0870\u0871\3\2\2\2\u0871\u0884\3\2\2\2\u0872\u0873\7\63\2\2" + + "\u0873\u0879\7\u0088\2\2\u0874\u0876\5\u0160\u00b1\2\u0875\u0874\3\2\2" + + "\2\u0875\u0876\3\2\2\2\u0876\u0877\3\2\2\2\u0877\u0878\7X\2\2\u0878\u087a" + + "\7\u0088\2\2\u0879\u0875\3\2\2\2\u0879\u087a\3\2\2\2\u087a\u0885\3\2\2" + + "\2\u087b\u087c\7X\2\2\u087c\u0882\7\u0088\2\2\u087d\u087f\5\u0160\u00b1" + + "\2\u087e\u087d\3\2\2\2\u087e\u087f\3\2\2\2\u087f\u0880\3\2\2\2\u0880\u0881" + + "\7\63\2\2\u0881\u0883\7\u0088\2\2\u0882\u087e\3\2\2\2\u0882\u0883\3\2" + + "\2\2\u0883\u0885\3\2\2\2\u0884\u0872\3\2\2\2\u0884\u087b\3\2\2\2\u0885" + + "\u0155\3\2\2\2\u0886\u0887\7\u0087\2\2\u0887\u0888\5\6\4\2\u0888\u0157" + + "\3\2\2\2\u0889\u0895\7\177\2\2\u088a\u088f\5\u015a\u00ae\2\u088b\u088c" + + "\7\u0086\2\2\u088c\u088e\5\u015a\u00ae\2\u088d\u088b\3\2\2\2\u088e\u0891" + + "\3\2\2\2\u088f\u088d\3\2\2\2\u088f\u0890\3\2\2\2\u0890\u0893\3\2\2\2\u0891" + + "\u088f\3\2\2\2\u0892\u0894\7\u0086\2\2\u0893\u0892\3\2\2\2\u0893\u0894" + + "\3\2\2\2\u0894\u0896\3\2\2\2\u0895\u088a\3\2\2\2\u0895\u0896\3\2\2\2\u0896" + + "\u0897\3\2\2\2\u0897\u0898\7\u0080\2\2\u0898\u0159\3\2\2\2\u0899\u089b" + + "\5\u0160\u00b1\2\u089a\u0899\3\2\2\2\u089a\u089b\3\2\2\2\u089b\u089c\3" + + "\2\2\2\u089c\u089f\5\u01b4\u00db\2\u089d\u089e\7\u0093\2\2\u089e\u08a0" + + "\5\36\20\2\u089f\u089d\3\2\2\2\u089f\u08a0\3\2\2\2\u08a0\u015b\3\2\2\2" + + "\u08a1\u08a2\7\u0081\2\2\u08a2\u08a3\5\u015e\u00b0\2\u08a3\u08a4\7\u0087" + + "\2\2\u08a4\u08a6\5\u0166\u00b4\2\u08a5\u08a7\7\u0086\2\2\u08a6\u08a5\3" + + "\2\2\2\u08a6\u08a7\3\2\2\2\u08a7\u08a8\3\2\2\2\u08a8\u08a9\7\u0082\2\2" + + "\u08a9\u015d\3\2\2\2\u08aa\u08ad\5\u018e\u00c8\2\u08ab\u08ad\5\u01b4\u00db" + + "\2\u08ac\u08aa\3\2\2\2\u08ac\u08ab\3\2\2\2\u08ad\u015f\3\2\2\2\u08ae\u08b0" + + "\5\u0162\u00b2\2\u08af\u08ae\3\2\2\2\u08b0\u08b1\3\2\2\2\u08b1\u08af\3" + + "\2\2\2\u08b1\u08b2\3\2\2\2\u08b2\u0161\3\2\2\2\u08b3\u08b7\7\u0081\2\2" + + "\u08b4\u08b5\5\u0164\u00b3\2\u08b5\u08b6\7\u0087\2\2\u08b6\u08b8\3\2\2" + + "\2\u08b7\u08b4\3\2\2\2\u08b7\u08b8\3\2\2\2\u08b8\u08b9\3\2\2\2\u08b9\u08bb" + + "\5\u0166\u00b4\2\u08ba\u08bc\7\u0086\2\2\u08bb\u08ba\3\2\2\2\u08bb\u08bc" + + "\3\2\2\2\u08bc\u08bd\3\2\2\2\u08bd\u08be\7\u0082\2\2\u08be\u0163\3\2\2" + + "\2\u08bf\u08c2\5\u018e\u00c8\2\u08c0\u08c2\5\u01b4\u00db\2\u08c1\u08bf" + + "\3\2\2\2\u08c1\u08c0\3\2\2\2\u08c2\u0165\3\2\2\2\u08c3\u08c8\5\u0168\u00b5" + + "\2\u08c4\u08c5\7\u0086\2\2\u08c5\u08c7\5\u0168\u00b5\2\u08c6\u08c4\3\2" + + "\2\2\u08c7\u08ca\3\2\2\2\u08c8\u08c6\3\2\2\2\u08c8\u08c9\3\2\2\2\u08c9" + + "\u0167\3\2\2\2\u08ca\u08c8\3\2\2\2\u08cb\u08d8\5\4\3\2\u08cc\u08d5\7\u0083" + + "\2\2\u08cd\u08d2\5\u016a\u00b6\2\u08ce\u08cf\7\u0086\2\2\u08cf\u08d1\5" + + "\u016a\u00b6\2\u08d0\u08ce\3\2\2\2\u08d1\u08d4\3\2\2\2\u08d2\u08d0\3\2" + + "\2\2\u08d2\u08d3\3\2\2\2\u08d3\u08d6\3\2\2\2\u08d4\u08d2\3\2\2\2\u08d5" + + "\u08cd\3\2\2\2\u08d5\u08d6\3\2\2\2\u08d6\u08d7\3\2\2\2\u08d7\u08d9\7\u0084" + + "\2\2\u08d8\u08cc\3\2\2\2\u08d8\u08d9\3\2\2\2\u08d9\u0169\3\2\2\2\u08da" + + "\u08db\5\u01b4\u00db\2\u08db\u08dc\7\u0087\2\2\u08dc\u08de\3\2\2\2\u08dd" + + "\u08da\3\2\2\2\u08dd\u08de\3\2\2\2\u08de\u08df\3\2\2\2\u08df\u08e0\5\36" + + "\20\2\u08e0\u016b\3\2\2\2\u08e1\u08e4\5\16\b\2\u08e2\u08e4\5\26\f\2\u08e3" + + "\u08e1\3\2\2\2\u08e3\u08e2\3\2\2\2\u08e4\u08e9\3\2\2\2\u08e5\u08e8\5\u0144" + + "\u00a3\2\u08e6\u08e8\7\u0096\2\2\u08e7\u08e5\3\2\2\2\u08e7\u08e6\3\2\2" + + "\2\u08e8\u08eb\3\2\2\2\u08e9\u08e7\3\2\2\2\u08e9\u08ea\3\2\2\2\u08ea\u08ec" + + "\3\2\2\2\u08eb\u08e9\3\2\2\2\u08ec\u08ed\7\u008b\2\2\u08ed\u08f1\3\2\2" + + "\2\u08ee\u08ef\7n\2\2\u08ef\u08f1\7\u008b\2\2\u08f0\u08e3\3\2\2\2\u08f0" + + "\u08ee\3\2\2\2\u08f1\u016d\3\2\2\2\u08f2\u08f7\5\u0170\u00b9\2\u08f3\u08f4" + + "\7\u0086\2\2\u08f4\u08f6\5\u0170\u00b9\2\u08f5\u08f3\3\2\2\2\u08f6\u08f9" + + "\3\2\2\2\u08f7\u08f5\3\2\2\2\u08f7\u08f8\3\2\2\2\u08f8\u016f\3\2\2\2\u08f9" + + "\u08f7\3\2\2\2\u08fa\u08fb\5\u01b4\u00db\2\u08fb\u08fc\7\u0093\2\2\u08fc" + + "\u08fd\5\u0172\u00ba\2\u08fd\u0171\3\2\2\2\u08fe\u0900\7\u008e\2\2\u08ff" + + "\u08fe\3\2\2\2\u08ff\u0900\3\2\2\2\u0900\u0901\3\2\2\2\u0901\u0904\5\36" + + "\20\2\u0902\u0904\5\u0176\u00bc\2\u0903\u08ff\3\2\2\2\u0903\u0902\3\2" + + "\2\2\u0904\u0173\3\2\2\2\u0905\u0906\5\u01b4\u00db\2\u0906\u0907\7\u0081" + + "\2\2\u0907\u0908\5\36\20\2\u0908\u0909\7\u0082\2\2\u0909\u0175\3\2\2\2" + + "\u090a\u090b\7[\2\2\u090b\u090c\5\6\4\2\u090c\u090d\7\u0081\2\2\u090d" + + "\u090e\5\36\20\2\u090e\u090f\7\u0082\2\2\u090f\u0928\3\2\2\2\u0910\u0912" + + "\7[\2\2\u0911\u0913\5\6\4\2\u0912\u0911\3\2\2\2\u0912\u0913\3\2\2\2\u0913" + + "\u0914\3\2\2\2\u0914\u0916\7\u0081\2\2\u0915\u0917\5\36\20\2\u0916\u0915" + + "\3\2\2\2\u0916\u0917\3\2\2\2\u0917\u0918\3\2\2\2\u0918\u0919\7\u0082\2" + + "\2\u0919\u091a\7\177\2\2\u091a\u091f\5\36\20\2\u091b\u091c\7\u0086\2\2" + + "\u091c\u091e\5\36\20\2\u091d\u091b\3\2\2\2\u091e\u0921\3\2\2\2\u091f\u091d" + + "\3\2\2\2\u091f\u0920\3\2\2\2\u0920\u0923\3\2\2\2\u0921\u091f\3\2\2\2\u0922" + + "\u0924\7\u0086\2\2\u0923\u0922\3\2\2\2\u0923\u0924\3\2\2\2\u0924\u0925" + + "\3\2\2\2\u0925\u0926\7\u0080\2\2\u0926\u0928\3\2\2\2\u0927\u090a\3\2\2" + + "\2\u0927\u0910\3\2\2\2\u0928\u0177\3\2\2\2\u0929\u092a\7\u0093\2\2\u092a" + + "\u092b\7\u0095\2\2\u092b\u092c\6\u00bd\2\3\u092c\u0179\3\2\2\2\u092d\u092e" + + "\7\u0095\2\2\u092e\u092f\7\u0095\2\2\u092f\u0930\6\u00be\3\3\u0930\u017b" + + "\3\2\2\2\u0931\u0932\7\u0095\2\2\u0932\u0933\7\u00a1\2\2\u0933\u0934\6" + + "\u00bf\4\3\u0934\u017d\3\2\2\2\u0935\u093e\5\u0180\u00c1\2\u0936\u093e" + + "\5\u0182\u00c2\2\u0937\u093e\7v\2\2\u0938\u093e\7w\2\2\u0939\u093e\7x" + + "\2\2\u093a\u093e\7y\2\2\u093b\u093e\7z\2\2\u093c\u093e\7E\2\2\u093d\u0935" + + "\3\2\2\2\u093d\u0936\3\2\2\2\u093d\u0937\3\2\2\2\u093d\u0938\3\2\2\2\u093d" + + "\u0939\3\2\2\2\u093d\u093a\3\2\2\2\u093d\u093b\3\2\2\2\u093d\u093c\3\2" + + "\2\2\u093e\u017f\3\2\2\2\u093f\u0940\t\21\2\2\u0940\u0181\3\2\2\2\u0941" + + "\u0946\5\u0184\u00c3\2\u0942\u0946\5\u0186\u00c4\2\u0943\u0946\7{\2\2" + + "\u0944\u0946\7|\2\2\u0945\u0941\3\2\2\2\u0945\u0942\3\2\2\2\u0945\u0943" + + "\3\2\2\2\u0945\u0944\3\2\2\2\u0946\u0183\3\2\2\2\u0947\u094b\7}\2\2\u0948" + + "\u094a\5\u0188\u00c5\2\u0949\u0948\3\2\2\2\u094a\u094d\3\2\2\2\u094b\u0949" + + "\3\2\2\2\u094b\u094c\3\2\2\2\u094c\u094e\3\2\2\2\u094d\u094b\3\2\2\2\u094e" + + "\u094f\7\u00b2\2\2\u094f\u0185\3\2\2\2\u0950\u0954\7~\2\2\u0951\u0953" + + "\5\u018a\u00c6\2\u0952\u0951\3\2\2\2\u0953\u0956\3\2\2\2\u0954\u0952\3" + + "\2\2\2\u0954\u0955\3\2\2\2\u0955\u0957\3\2\2\2\u0956\u0954\3\2\2\2"; + private static final String _serializedATNSegment1 = + "\u0957\u0958\7\u00b2\2\2\u0958\u0187\3\2\2\2\u0959\u095e\5\u018c\u00c7" + + "\2\u095a\u095e\7\u00ae\2\2\u095b\u095e\7\u00b0\2\2\u095c\u095e\7\u00b3" + + "\2\2\u095d\u0959\3\2\2\2\u095d\u095a\3\2\2\2\u095d\u095b\3\2\2\2\u095d" + + "\u095c\3\2\2\2\u095e\u0189\3\2\2\2\u095f\u0964\5\u018c\u00c7\2\u0960\u0964" + + "\7\u00ae\2\2\u0961\u0964\7\u00b1\2\2\u0962\u0964\7\u00b4\2\2\u0963\u095f" + + "\3\2\2\2\u0963\u0960\3\2\2\2\u0963\u0961\3\2\2\2\u0963\u0962\3\2\2\2\u0964" + + "\u018b\3\2\2\2\u0965\u096a\5\36\20\2\u0966\u0967\7\u0086\2\2\u0967\u0969" + + "\5\36\20\2\u0968\u0966\3\2\2\2\u0969\u096c\3\2\2\2\u096a\u0968\3\2\2\2" + + "\u096a\u096b\3\2\2\2\u096b\u0973\3\2\2\2\u096c\u096a\3\2\2\2\u096d\u096f" + + "\7\u0087\2\2\u096e\u0970\7\u00b6\2\2\u096f\u096e\3\2\2\2\u0970\u0971\3" + + "\2\2\2\u0971\u096f\3\2\2\2\u0971\u0972\3\2\2\2\u0972\u0974\3\2\2\2\u0973" + + "\u096d\3\2\2\2\u0973\u0974\3\2\2\2\u0974\u018d\3\2\2\2\u0975\u0976\t\22" + + "\2\2\u0976\u018f\3\2\2\2\u0977\u0978\7\34\2\2\u0978\u097a\5\u01b4\u00db" + + "\2\u0979\u097b\5\u00e8u\2\u097a\u0979\3\2\2\2\u097a\u097b\3\2\2\2\u097b" + + "\u097d\3\2\2\2\u097c\u097e\5\u00ecw\2\u097d\u097c\3\2\2\2\u097d\u097e" + + "\3\2\2\2\u097e\u0980\3\2\2\2\u097f\u0981\5\u00f0y\2\u0980\u097f\3\2\2" + + "\2\u0980\u0981\3\2\2\2\u0981\u0982\3\2\2\2\u0982\u0984\5\u00fc\177\2\u0983" + + "\u0985\7\u0088\2\2\u0984\u0983\3\2\2\2\u0984\u0985\3\2\2\2\u0985\u0191" + + "\3\2\2\2\u0986\u0988\t\23\2\2\u0987\u0986\3\2\2\2\u0987\u0988\3\2\2\2" + + "\u0988\u0989\3\2\2\2\u0989\u098a\7^\2\2\u098a\u098c\5\u01b4\u00db\2\u098b" + + "\u098d\5\u00e8u\2\u098c\u098b\3\2\2\2\u098c\u098d\3\2\2\2\u098d\u098f" + + "\3\2\2\2\u098e\u0990\5\u013c\u009f\2\u098f\u098e\3\2\2\2\u098f\u0990\3" + + "\2\2\2\u0990\u0992\3\2\2\2\u0991\u0993\5\u00f0y\2\u0992\u0991\3\2\2\2" + + "\u0992\u0993\3\2\2\2\u0993\u0994\3\2\2\2\u0994\u0996\5\u013e\u00a0\2\u0995" + + "\u0997\7\u0088\2\2\u0996\u0995\3\2\2\2\u0996\u0997\3\2\2\2\u0997\u0193" + + "\3\2\2\2\u0998\u0999\7:\2\2\u0999\u099b\5\u01b4\u00db\2\u099a\u099c\5" + + "\u0148\u00a5\2\u099b\u099a\3\2\2\2\u099b\u099c\3\2\2\2\u099c\u099e\3\2" + + "\2\2\u099d\u099f\5\u014e\u00a8\2\u099e\u099d\3\2\2\2\u099e\u099f\3\2\2" + + "\2\u099f\u09a1\3\2\2\2\u09a0\u09a2\5\u00f0y\2\u09a1\u09a0\3\2\2\2\u09a1" + + "\u09a2\3\2\2\2\u09a2\u09a3\3\2\2\2\u09a3\u09a5\5\u00fc\177\2\u09a4\u09a6" + + "\7\u0088\2\2\u09a5\u09a4\3\2\2\2\u09a5\u09a6\3\2\2\2\u09a6\u0195\3\2\2" + + "\2\u09a7\u09a8\7\'\2\2\u09a8\u09aa\5\u01b4\u00db\2\u09a9\u09ab\5\u0156" + + "\u00ac\2\u09aa\u09a9\3\2\2\2\u09aa\u09ab\3\2\2\2\u09ab\u09ac\3\2\2\2\u09ac" + + "\u09ae\5\u0158\u00ad\2\u09ad\u09af\7\u0088\2\2\u09ae\u09ad\3\2\2\2\u09ae" + + "\u09af\3\2\2\2\u09af\u0197\3\2\2\2\u09b0\u09b1\7!\2\2\u09b1\u09b2\5\u0114" + + "\u008b\2\u09b2\u09b4\5\u01b4\u00db\2\u09b3\u09b5\5\u0148\u00a5\2\u09b4" + + "\u09b3\3\2\2\2\u09b4\u09b5\3\2\2\2\u09b5\u09b6\3\2\2\2\u09b6\u09b8\7\u0083" + + "\2\2\u09b7\u09b9\5\u011a\u008e\2\u09b8\u09b7\3\2\2\2\u09b8\u09b9\3\2\2" + + "\2\u09b9\u09ba\3\2\2\2\u09ba\u09bc\7\u0084\2\2\u09bb\u09bd\5\u00f0y\2" + + "\u09bc\u09bb\3\2\2\2\u09bc\u09bd\3\2\2\2\u09bd\u09be\3\2\2\2\u09be\u09bf" + + "\7\u0088\2\2\u09bf\u0199\3\2\2\2\u09c0\u09c1\7)\2\2\u09c1\u09ca\5\6\4" + + "\2\u09c2\u09c3\5\u010e\u0088\2\u09c3\u09c4\7\u0088\2\2\u09c4\u09cb\3\2" + + "\2\2\u09c5\u09c6\5\u0116\u008c\2\u09c6\u09c7\7\177\2\2\u09c7\u09c8\5\u012e" + + "\u0098\2\u09c8\u09c9\7\u0080\2\2\u09c9\u09cb\3\2\2\2\u09ca\u09c2\3\2\2" + + "\2\u09ca\u09c5\3\2\2\2\u09cb\u019b\3\2\2\2\u09cc\u09cd\5\u010e\u0088\2" + + "\u09cd\u09ce\7\u0088\2\2\u09ce\u019d\3\2\2\2\u09cf\u09dd\5\u0116\u008c" + + "\2\u09d0\u09d1\7\177\2\2\u09d1\u09d2\5\u0124\u0093\2\u09d2\u09d7\7\u0080" + + "\2\2\u09d3\u09d4\7\u0093\2\2\u09d4\u09d5\5\u0112\u008a\2\u09d5\u09d6\7" + + "\u0088\2\2\u09d6\u09d8\3\2\2\2\u09d7\u09d3\3\2\2\2\u09d7\u09d8\3\2\2\2" + + "\u09d8\u09de\3\2\2\2\u09d9\u09da\5\u0178\u00bd\2\u09da\u09db\5L\'\2\u09db" + + "\u09dc\7\u0088\2\2\u09dc\u09de\3\2\2\2\u09dd\u09d0\3\2\2\2\u09dd\u09d9" + + "\3\2\2\2\u09de\u019f\3\2\2\2\u09df\u09e0\7\35\2\2\u09e0\u09e1\5\6\4\2" + + "\u09e1\u09e2\5\u010a\u0086\2\u09e2\u09e3\7\u0088\2\2\u09e3\u01a1\3\2\2" + + "\2\u09e4\u09e5\7`\2\2\u09e5\u09e6\7\u0081\2\2\u09e6\u09e7\5\u011a\u008e" + + "\2\u09e7\u09f0\7\u0082\2\2\u09e8\u09e9\7\177\2\2\u09e9\u09ea\5\u0124\u0093" + + "\2\u09ea\u09eb\7\u0080\2\2\u09eb\u09f1\3\2\2\2\u09ec\u09ed\5\u0178\u00bd" + + "\2\u09ed\u09ee\5L\'\2\u09ee\u09ef\7\u0088\2\2\u09ef\u09f1\3\2\2\2\u09f0" + + "\u09e8\3\2\2\2\u09f0\u09ec\3\2\2\2\u09f1\u01a3\3\2\2\2\u09f2\u09f3\7\u0092" + + "\2\2\u09f3\u09f4\5\u01b4\u00db\2\u09f4\u09f5\7\u0083\2\2\u09f5\u09f6\7" + + "\u0084\2\2\u09f6\u09f7\5\u013a\u009e\2\u09f7\u01a5\3\2\2\2\u09f8\u09f9" + + "\5\u01b4\u00db\2\u09f9\u09fb\7\u0083\2\2\u09fa\u09fc\5\u011a\u008e\2\u09fb" + + "\u09fa\3\2\2\2\u09fb\u09fc\3\2\2\2\u09fc\u09fd\3\2\2\2\u09fd\u09ff\7\u0084" + + "\2\2\u09fe\u0a00\5\u0138\u009d\2\u09ff\u09fe\3\2\2\2\u09ff\u0a00\3\2\2" + + "\2\u0a00\u0a01\3\2\2\2\u0a01\u0a02\5\u013a\u009e\2\u0a02\u01a7\3\2\2\2" + + "\u0a03\u0a05\5\u01aa\u00d6\2\u0a04\u0a06\5\u00e8u\2\u0a05\u0a04\3\2\2" + + "\2\u0a05\u0a06\3\2\2\2\u0a06\u0a07\3\2\2\2\u0a07\u0a09\7\u0083\2\2\u0a08" + + "\u0a0a\5\u011a\u008e\2\u0a09\u0a08\3\2\2\2\u0a09\u0a0a\3\2\2\2\u0a0a\u0a0b" + + "\3\2\2\2\u0a0b\u0a0d\7\u0084\2\2\u0a0c\u0a0e\5\u00f0y\2\u0a0d\u0a0c\3" + + "\2\2\2\u0a0d\u0a0e\3\2\2\2\u0a0e\u0a14\3\2\2\2\u0a0f\u0a15\5\u0118\u008d" + + "\2\u0a10\u0a11\5\u0178\u00bd\2\u0a11\u0a12\5L\'\2\u0a12\u0a13\7\u0088" + + "\2\2\u0a13\u0a15\3\2\2\2\u0a14\u0a0f\3\2\2\2\u0a14\u0a10\3\2\2\2\u0a15" + + "\u01a9\3\2\2\2\u0a16\u0a1c\5\u01b4\u00db\2\u0a17\u0a18\5\u01b4\u00db\2" + + "\u0a18\u0a19\7\u0097\2\2\u0a19\u0a1a\5\u01b4\u00db\2\u0a1a\u0a1c\3\2\2" + + "\2\u0a1b\u0a16\3\2\2\2\u0a1b\u0a17\3\2\2\2\u0a1c\u0a24\3\2\2\2\u0a1d\u0a1f" + + "\5\30\r\2\u0a1e\u0a1d\3\2\2\2\u0a1e\u0a1f\3\2\2\2\u0a1f\u0a20\3\2\2\2" + + "\u0a20\u0a21\7\u0085\2\2\u0a21\u0a23\5\u01b4\u00db\2\u0a22\u0a1e\3\2\2" + + "\2\u0a23\u0a26\3\2\2\2\u0a24\u0a22\3\2\2\2\u0a24\u0a25\3\2\2\2\u0a25\u01ab" + + "\3\2\2\2\u0a26\u0a24\3\2\2\2\u0a27\u0a28\7H\2\2\u0a28\u0a29\5\u0134\u009b" + + "\2\u0a29\u0a2b\7\u0083\2\2\u0a2a\u0a2c\78\2\2\u0a2b\u0a2a\3\2\2\2\u0a2b" + + "\u0a2c\3\2\2\2\u0a2c\u0a2d\3\2\2\2\u0a2d\u0a33\5\u01ae\u00d8\2\u0a2e\u0a30" + + "\7\u0086\2\2\u0a2f\u0a31\78\2\2\u0a30\u0a2f\3\2\2\2\u0a30\u0a31\3\2\2" + + "\2\u0a31\u0a32\3\2\2\2\u0a32\u0a34\5\u01ae\u00d8\2\u0a33\u0a2e\3\2\2\2" + + "\u0a33\u0a34\3\2\2\2\u0a34\u0a35\3\2\2\2\u0a35\u0a3b\7\u0084\2\2\u0a36" + + "\u0a3c\5\u013a\u009e\2\u0a37\u0a38\5\u0178\u00bd\2\u0a38\u0a39\5L\'\2" + + "\u0a39\u0a3a\7\u0088\2\2\u0a3a\u0a3c\3\2\2\2\u0a3b\u0a36\3\2\2\2\u0a3b" + + "\u0a37\3\2\2\2\u0a3c\u01ad\3\2\2\2\u0a3d\u0a3e\5\6\4\2\u0a3e\u0a41\5\u01b4" + + "\u00db\2\u0a3f\u0a40\7\u0093\2\2\u0a40\u0a42\5\36\20\2\u0a41\u0a3f\3\2" + + "\2\2\u0a41\u0a42\3\2\2\2\u0a42\u01af\3\2\2\2\u0a43\u0a45\7\u0083\2\2\u0a44" + + "\u0a46\5\32\16\2\u0a45\u0a44\3\2\2\2\u0a45\u0a46\3\2\2\2\u0a46\u0a47\3" + + "\2\2\2\u0a47\u0a48\7\u0084\2\2\u0a48\u01b1\3\2\2\2\u0a49\u0a4b\7\u0083" + + "\2\2\u0a4a\u0a4c\5\32\16\2\u0a4b\u0a4a\3\2\2\2\u0a4b\u0a4c\3\2\2\2\u0a4c" + + "\u0a4d\3\2\2\2\u0a4d\u0a4f\7\u0084\2\2\u0a4e\u0a50\5Z.\2\u0a4f\u0a4e\3" + + "\2\2\2\u0a4f\u0a50\3\2\2\2\u0a50\u01b3\3\2\2\2\u0a51\u0a52\t\24\2\2\u0a52" + + "\u01b5\3\2\2\2\u015a\u01b7\u01ba\u01bd\u01c2\u01c6\u01cc\u01cf\u01d4\u01d8" + + "\u01df\u01e1\u01e9\u01f1\u01f7\u01fb\u0200\u020a\u0212\u021c\u0222\u0225" + + "\u0229\u0231\u0236\u0240\u024d\u0255\u025b\u025d\u0264\u026c\u0274\u027c" + + "\u0284\u028c\u0296\u0298\u029e\u02a3\u02ab\u02b3\u02bb\u02bd\u02c0\u02c7" + + "\u02cc\u02d3\u02d7\u02d9\u02f5\u02f9\u02fe\u0302\u030a\u030d\u0312\u0316" + + "\u031a\u0320\u032e\u0334\u0340\u0344\u0349\u034d\u0353\u035b\u0364\u0376" + + "\u0379\u037e\u0381\u0390\u0396\u039a\u03a0\u03a5\u03a8\u03b0\u03b8\u03c3" + + "\u03c8\u03cd\u03cf\u03d8\u03e0\u03e7\u03ef\u03f3\u03fc\u0401\u0403\u040c" + + "\u0414\u0418\u041d\u041f\u0424\u0428\u042f\u0437\u0439\u043d\u0440\u0443" + + "\u044b\u0455\u0466\u046d\u0471\u047b\u0480\u0487\u0490\u0495\u049c\u04a8" + + "\u04b3\u04bb\u04c0\u04c9\u04d2\u04db\u04e1\u04e6\u04ea\u04ee\u04f2\u04f6" + + "\u04fd\u0505\u0512\u051c\u0532\u0536\u053a\u053f\u0553\u0558\u055d\u0564" + + "\u0567\u057d\u0589\u058d\u0595\u059d\u05a4\u05a8\u05ad\u05b0\u05b5\u05bd" + + "\u05c2\u05c9\u05cf\u05d7\u05df\u05e2\u05e9\u05f0\u05f4\u05f7\u05fd\u0601" + + "\u0607\u0615\u061b\u0622\u0627\u062a\u062d\u0634\u063e\u064f\u0654\u0658" + + "\u065b\u065e\u0665\u066b\u0673\u0679\u0683\u068b\u0691\u069c\u06a0\u06a2" + + "\u06a7\u06ab\u06b2\u06bb\u06c2\u06c5\u06c8\u06cc\u06d1\u06de\u06e8\u06ef" + + "\u06fb\u0702\u070e\u0714\u0718\u071c\u0722\u0728\u072a\u0731\u0735\u0738" + + "\u073c\u0746\u0749\u0750\u0753\u0758\u075d\u075f\u0762\u0765\u076b\u076e" + + "\u077a\u077e\u0781\u078b\u078e\u0794\u07af\u07bc\u07c2\u07cb\u07d1\u07d4" + + "\u07dc\u07e0\u07e6\u07ec\u07f2\u07fd\u0801\u0803\u080d\u0813\u0816\u0823" + + "\u0829\u082c\u082f\u0836\u083b\u083f\u0843\u0854\u0857\u085c\u0860\u0864" + + "\u086d\u0870\u0875\u0879\u087e\u0882\u0884\u088f\u0893\u0895\u089a\u089f" + + "\u08a6\u08ac\u08b1\u08b7\u08bb\u08c1\u08c8\u08d2\u08d5\u08d8\u08dd\u08e3" + + "\u08e7\u08e9\u08f0\u08f7\u08ff\u0903\u0912\u0916\u091f\u0923\u0927\u093d" + + "\u0945\u094b\u0954\u095d\u0963\u096a\u0971\u0973\u097a\u097d\u0980\u0984" + + "\u0987\u098c\u098f\u0992\u0996\u099b\u099e\u09a1\u09a5\u09aa\u09ae\u09b4" + + "\u09b8\u09bc\u09ca\u09d7\u09dd\u09f0\u09fb\u09ff\u0a05\u0a09\u0a0d\u0a14" + + "\u0a1b\u0a1e\u0a24\u0a2b\u0a30\u0a33\u0a3b\u0a41\u0a45\u0a4b\u0a4f"; + public static final String _serializedATN = Utils.join( + new String[] { _serializedATNSegment0, _serializedATNSegment1 }, + "" + ); + public static final ATN _ATN = new ATNDeserializer() + .deserialize(_serializedATN.toCharArray()); + + static { + _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; + for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { + _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); + } + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParserBaseListener.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParserBaseListener.java index 7ac5d6f0c1..61142ce423 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParserBaseListener.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParserBaseListener.java @@ -15,3089 +15,4736 @@ * of the available methods. */ public class CSharpParserBaseListener implements CSharpParserListener { - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCompilation_unit(CSharpParser.Compilation_unitContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCompilation_unit(CSharpParser.Compilation_unitContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNamespace_or_type_name(CSharpParser.Namespace_or_type_nameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNamespace_or_type_name(CSharpParser.Namespace_or_type_nameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterType_(CSharpParser.Type_Context ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitType_(CSharpParser.Type_Context ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBase_type(CSharpParser.Base_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBase_type(CSharpParser.Base_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTuple_type(CSharpParser.Tuple_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTuple_type(CSharpParser.Tuple_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTuple_element(CSharpParser.Tuple_elementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTuple_element(CSharpParser.Tuple_elementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSimple_type(CSharpParser.Simple_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSimple_type(CSharpParser.Simple_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNumeric_type(CSharpParser.Numeric_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNumeric_type(CSharpParser.Numeric_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIntegral_type(CSharpParser.Integral_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIntegral_type(CSharpParser.Integral_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFloating_point_type(CSharpParser.Floating_point_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFloating_point_type(CSharpParser.Floating_point_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClass_type(CSharpParser.Class_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClass_type(CSharpParser.Class_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterType_argument_list(CSharpParser.Type_argument_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitType_argument_list(CSharpParser.Type_argument_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArgument_list(CSharpParser.Argument_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArgument_list(CSharpParser.Argument_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArgument(CSharpParser.ArgumentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArgument(CSharpParser.ArgumentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExpression(CSharpParser.ExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExpression(CSharpParser.ExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNon_assignment_expression(CSharpParser.Non_assignment_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNon_assignment_expression(CSharpParser.Non_assignment_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAssignment(CSharpParser.AssignmentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAssignment(CSharpParser.AssignmentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAssignment_operator(CSharpParser.Assignment_operatorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAssignment_operator(CSharpParser.Assignment_operatorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConditional_expression(CSharpParser.Conditional_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConditional_expression(CSharpParser.Conditional_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNull_coalescing_expression(CSharpParser.Null_coalescing_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNull_coalescing_expression(CSharpParser.Null_coalescing_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConditional_or_expression(CSharpParser.Conditional_or_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConditional_or_expression(CSharpParser.Conditional_or_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConditional_and_expression(CSharpParser.Conditional_and_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConditional_and_expression(CSharpParser.Conditional_and_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInclusive_or_expression(CSharpParser.Inclusive_or_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInclusive_or_expression(CSharpParser.Inclusive_or_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExclusive_or_expression(CSharpParser.Exclusive_or_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExclusive_or_expression(CSharpParser.Exclusive_or_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAnd_expression(CSharpParser.And_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAnd_expression(CSharpParser.And_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEquality_expression(CSharpParser.Equality_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEquality_expression(CSharpParser.Equality_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterRelational_expression(CSharpParser.Relational_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitRelational_expression(CSharpParser.Relational_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterShift_expression(CSharpParser.Shift_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitShift_expression(CSharpParser.Shift_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAdditive_expression(CSharpParser.Additive_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAdditive_expression(CSharpParser.Additive_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMultiplicative_expression(CSharpParser.Multiplicative_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMultiplicative_expression(CSharpParser.Multiplicative_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSwitch_expression(CSharpParser.Switch_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSwitch_expression(CSharpParser.Switch_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSwitch_expression_arms(CSharpParser.Switch_expression_armsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSwitch_expression_arms(CSharpParser.Switch_expression_armsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSwitch_expression_arm(CSharpParser.Switch_expression_armContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSwitch_expression_arm(CSharpParser.Switch_expression_armContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterRange_expression(CSharpParser.Range_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitRange_expression(CSharpParser.Range_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnary_expression(CSharpParser.Unary_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnary_expression(CSharpParser.Unary_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimary_expression(CSharpParser.Primary_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimary_expression(CSharpParser.Primary_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLiteralExpression(CSharpParser.LiteralExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLiteralExpression(CSharpParser.LiteralExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSimpleNameExpression(CSharpParser.SimpleNameExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSimpleNameExpression(CSharpParser.SimpleNameExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterParenthesisExpressions(CSharpParser.ParenthesisExpressionsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitParenthesisExpressions(CSharpParser.ParenthesisExpressionsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMemberAccessExpression(CSharpParser.MemberAccessExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMemberAccessExpression(CSharpParser.MemberAccessExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLiteralAccessExpression(CSharpParser.LiteralAccessExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLiteralAccessExpression(CSharpParser.LiteralAccessExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterThisReferenceExpression(CSharpParser.ThisReferenceExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitThisReferenceExpression(CSharpParser.ThisReferenceExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBaseAccessExpression(CSharpParser.BaseAccessExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBaseAccessExpression(CSharpParser.BaseAccessExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterObjectCreationExpression(CSharpParser.ObjectCreationExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitObjectCreationExpression(CSharpParser.ObjectCreationExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTupleExpression(CSharpParser.TupleExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTupleExpression(CSharpParser.TupleExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTypeofExpression(CSharpParser.TypeofExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTypeofExpression(CSharpParser.TypeofExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCheckedExpression(CSharpParser.CheckedExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCheckedExpression(CSharpParser.CheckedExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUncheckedExpression(CSharpParser.UncheckedExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUncheckedExpression(CSharpParser.UncheckedExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterDefaultValueExpression(CSharpParser.DefaultValueExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitDefaultValueExpression(CSharpParser.DefaultValueExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAnonymousMethodExpression(CSharpParser.AnonymousMethodExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAnonymousMethodExpression(CSharpParser.AnonymousMethodExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSizeofExpression(CSharpParser.SizeofExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSizeofExpression(CSharpParser.SizeofExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNameofExpression(CSharpParser.NameofExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNameofExpression(CSharpParser.NameofExpressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterThrowable_expression(CSharpParser.Throwable_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitThrowable_expression(CSharpParser.Throwable_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterThrow_expression(CSharpParser.Throw_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitThrow_expression(CSharpParser.Throw_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMember_access(CSharpParser.Member_accessContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMember_access(CSharpParser.Member_accessContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBracket_expression(CSharpParser.Bracket_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBracket_expression(CSharpParser.Bracket_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIndexer_argument(CSharpParser.Indexer_argumentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIndexer_argument(CSharpParser.Indexer_argumentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPredefined_type(CSharpParser.Predefined_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPredefined_type(CSharpParser.Predefined_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExpression_list(CSharpParser.Expression_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExpression_list(CSharpParser.Expression_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterObject_or_collection_initializer(CSharpParser.Object_or_collection_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitObject_or_collection_initializer(CSharpParser.Object_or_collection_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterObject_initializer(CSharpParser.Object_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitObject_initializer(CSharpParser.Object_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMember_initializer_list(CSharpParser.Member_initializer_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMember_initializer_list(CSharpParser.Member_initializer_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMember_initializer(CSharpParser.Member_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMember_initializer(CSharpParser.Member_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInitializer_value(CSharpParser.Initializer_valueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInitializer_value(CSharpParser.Initializer_valueContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCollection_initializer(CSharpParser.Collection_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCollection_initializer(CSharpParser.Collection_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterElement_initializer(CSharpParser.Element_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitElement_initializer(CSharpParser.Element_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAnonymous_object_initializer(CSharpParser.Anonymous_object_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAnonymous_object_initializer(CSharpParser.Anonymous_object_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMember_declarator_list(CSharpParser.Member_declarator_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMember_declarator_list(CSharpParser.Member_declarator_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMember_declarator(CSharpParser.Member_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMember_declarator(CSharpParser.Member_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnbound_type_name(CSharpParser.Unbound_type_nameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnbound_type_name(CSharpParser.Unbound_type_nameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterGeneric_dimension_specifier(CSharpParser.Generic_dimension_specifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitGeneric_dimension_specifier(CSharpParser.Generic_dimension_specifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIsType(CSharpParser.IsTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIsType(CSharpParser.IsTypeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIsTypePatternArms(CSharpParser.IsTypePatternArmsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIsTypePatternArms(CSharpParser.IsTypePatternArmsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIsTypePatternArm(CSharpParser.IsTypePatternArmContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIsTypePatternArm(CSharpParser.IsTypePatternArmContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLambda_expression(CSharpParser.Lambda_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLambda_expression(CSharpParser.Lambda_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAnonymous_function_signature(CSharpParser.Anonymous_function_signatureContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAnonymous_function_signature(CSharpParser.Anonymous_function_signatureContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExplicit_anonymous_function_parameter_list(CSharpParser.Explicit_anonymous_function_parameter_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExplicit_anonymous_function_parameter_list(CSharpParser.Explicit_anonymous_function_parameter_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExplicit_anonymous_function_parameter(CSharpParser.Explicit_anonymous_function_parameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExplicit_anonymous_function_parameter(CSharpParser.Explicit_anonymous_function_parameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterImplicit_anonymous_function_parameter_list(CSharpParser.Implicit_anonymous_function_parameter_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitImplicit_anonymous_function_parameter_list(CSharpParser.Implicit_anonymous_function_parameter_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAnonymous_function_body(CSharpParser.Anonymous_function_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAnonymous_function_body(CSharpParser.Anonymous_function_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterQuery_expression(CSharpParser.Query_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitQuery_expression(CSharpParser.Query_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFrom_clause(CSharpParser.From_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFrom_clause(CSharpParser.From_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterQuery_body(CSharpParser.Query_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitQuery_body(CSharpParser.Query_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterQuery_body_clause(CSharpParser.Query_body_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitQuery_body_clause(CSharpParser.Query_body_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLet_clause(CSharpParser.Let_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLet_clause(CSharpParser.Let_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterWhere_clause(CSharpParser.Where_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitWhere_clause(CSharpParser.Where_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCombined_join_clause(CSharpParser.Combined_join_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCombined_join_clause(CSharpParser.Combined_join_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterOrderby_clause(CSharpParser.Orderby_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitOrderby_clause(CSharpParser.Orderby_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterOrdering(CSharpParser.OrderingContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitOrdering(CSharpParser.OrderingContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSelect_or_group_clause(CSharpParser.Select_or_group_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSelect_or_group_clause(CSharpParser.Select_or_group_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterQuery_continuation(CSharpParser.Query_continuationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitQuery_continuation(CSharpParser.Query_continuationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStatement(CSharpParser.StatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStatement(CSharpParser.StatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterDeclarationStatement(CSharpParser.DeclarationStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitDeclarationStatement(CSharpParser.DeclarationStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLocal_function_declaration(CSharpParser.Local_function_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLocal_function_declaration(CSharpParser.Local_function_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLocal_function_header(CSharpParser.Local_function_headerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLocal_function_header(CSharpParser.Local_function_headerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLocal_function_modifiers(CSharpParser.Local_function_modifiersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLocal_function_modifiers(CSharpParser.Local_function_modifiersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLocal_function_body(CSharpParser.Local_function_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLocal_function_body(CSharpParser.Local_function_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLabeled_Statement(CSharpParser.Labeled_StatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLabeled_Statement(CSharpParser.Labeled_StatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEmbedded_statement(CSharpParser.Embedded_statementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEmbedded_statement(CSharpParser.Embedded_statementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTheEmptyStatement(CSharpParser.TheEmptyStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTheEmptyStatement(CSharpParser.TheEmptyStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExpressionStatement(CSharpParser.ExpressionStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExpressionStatement(CSharpParser.ExpressionStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIfStatement(CSharpParser.IfStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIfStatement(CSharpParser.IfStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSwitchStatement(CSharpParser.SwitchStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSwitchStatement(CSharpParser.SwitchStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterWhileStatement(CSharpParser.WhileStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitWhileStatement(CSharpParser.WhileStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterDoStatement(CSharpParser.DoStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitDoStatement(CSharpParser.DoStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterForStatement(CSharpParser.ForStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitForStatement(CSharpParser.ForStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterForeachStatement(CSharpParser.ForeachStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitForeachStatement(CSharpParser.ForeachStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBreakStatement(CSharpParser.BreakStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBreakStatement(CSharpParser.BreakStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterContinueStatement(CSharpParser.ContinueStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitContinueStatement(CSharpParser.ContinueStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterGotoStatement(CSharpParser.GotoStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitGotoStatement(CSharpParser.GotoStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterReturnStatement(CSharpParser.ReturnStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitReturnStatement(CSharpParser.ReturnStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterThrowStatement(CSharpParser.ThrowStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitThrowStatement(CSharpParser.ThrowStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTryStatement(CSharpParser.TryStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTryStatement(CSharpParser.TryStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCheckedStatement(CSharpParser.CheckedStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCheckedStatement(CSharpParser.CheckedStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUncheckedStatement(CSharpParser.UncheckedStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUncheckedStatement(CSharpParser.UncheckedStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLockStatement(CSharpParser.LockStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLockStatement(CSharpParser.LockStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUsingStatement(CSharpParser.UsingStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUsingStatement(CSharpParser.UsingStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterYieldStatement(CSharpParser.YieldStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitYieldStatement(CSharpParser.YieldStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUnsafeStatement(CSharpParser.UnsafeStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUnsafeStatement(CSharpParser.UnsafeStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFixedStatement(CSharpParser.FixedStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFixedStatement(CSharpParser.FixedStatementContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBlock(CSharpParser.BlockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBlock(CSharpParser.BlockContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLocal_variable_declaration(CSharpParser.Local_variable_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLocal_variable_declaration(CSharpParser.Local_variable_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLocal_variable_type(CSharpParser.Local_variable_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLocal_variable_type(CSharpParser.Local_variable_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLocal_variable_declarator(CSharpParser.Local_variable_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLocal_variable_declarator(CSharpParser.Local_variable_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLocal_variable_initializer(CSharpParser.Local_variable_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLocal_variable_initializer(CSharpParser.Local_variable_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLocal_constant_declaration(CSharpParser.Local_constant_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLocal_constant_declaration(CSharpParser.Local_constant_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIf_body(CSharpParser.If_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIf_body(CSharpParser.If_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSwitch_section(CSharpParser.Switch_sectionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSwitch_section(CSharpParser.Switch_sectionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSwitch_label(CSharpParser.Switch_labelContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSwitch_label(CSharpParser.Switch_labelContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCase_guard(CSharpParser.Case_guardContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCase_guard(CSharpParser.Case_guardContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStatement_list(CSharpParser.Statement_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStatement_list(CSharpParser.Statement_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFor_initializer(CSharpParser.For_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFor_initializer(CSharpParser.For_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFor_iterator(CSharpParser.For_iteratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFor_iterator(CSharpParser.For_iteratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCatch_clauses(CSharpParser.Catch_clausesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCatch_clauses(CSharpParser.Catch_clausesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSpecific_catch_clause(CSharpParser.Specific_catch_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSpecific_catch_clause(CSharpParser.Specific_catch_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterGeneral_catch_clause(CSharpParser.General_catch_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitGeneral_catch_clause(CSharpParser.General_catch_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterException_filter(CSharpParser.Exception_filterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitException_filter(CSharpParser.Exception_filterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFinally_clause(CSharpParser.Finally_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFinally_clause(CSharpParser.Finally_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterResource_acquisition(CSharpParser.Resource_acquisitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitResource_acquisition(CSharpParser.Resource_acquisitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNamespace_declaration(CSharpParser.Namespace_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNamespace_declaration(CSharpParser.Namespace_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterQualified_identifier(CSharpParser.Qualified_identifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitQualified_identifier(CSharpParser.Qualified_identifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNamespace_body(CSharpParser.Namespace_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNamespace_body(CSharpParser.Namespace_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExtern_alias_directives(CSharpParser.Extern_alias_directivesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExtern_alias_directives(CSharpParser.Extern_alias_directivesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterExtern_alias_directive(CSharpParser.Extern_alias_directiveContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitExtern_alias_directive(CSharpParser.Extern_alias_directiveContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUsing_directives(CSharpParser.Using_directivesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUsing_directives(CSharpParser.Using_directivesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUsingAliasDirective(CSharpParser.UsingAliasDirectiveContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUsingAliasDirective(CSharpParser.UsingAliasDirectiveContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUsingNamespaceDirective(CSharpParser.UsingNamespaceDirectiveContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUsingNamespaceDirective(CSharpParser.UsingNamespaceDirectiveContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterUsingStaticDirective(CSharpParser.UsingStaticDirectiveContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitUsingStaticDirective(CSharpParser.UsingStaticDirectiveContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNamespace_member_declarations(CSharpParser.Namespace_member_declarationsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNamespace_member_declarations(CSharpParser.Namespace_member_declarationsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterNamespace_member_declaration(CSharpParser.Namespace_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitNamespace_member_declaration(CSharpParser.Namespace_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterType_declaration(CSharpParser.Type_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitType_declaration(CSharpParser.Type_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterQualified_alias_member(CSharpParser.Qualified_alias_memberContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitQualified_alias_member(CSharpParser.Qualified_alias_memberContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterType_parameter_list(CSharpParser.Type_parameter_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitType_parameter_list(CSharpParser.Type_parameter_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterType_parameter(CSharpParser.Type_parameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitType_parameter(CSharpParser.Type_parameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClass_base(CSharpParser.Class_baseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClass_base(CSharpParser.Class_baseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterface_type_list(CSharpParser.Interface_type_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterface_type_list(CSharpParser.Interface_type_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterType_parameter_constraints_clauses(CSharpParser.Type_parameter_constraints_clausesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitType_parameter_constraints_clauses(CSharpParser.Type_parameter_constraints_clausesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterType_parameter_constraints_clause(CSharpParser.Type_parameter_constraints_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitType_parameter_constraints_clause(CSharpParser.Type_parameter_constraints_clauseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterType_parameter_constraints(CSharpParser.Type_parameter_constraintsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitType_parameter_constraints(CSharpParser.Type_parameter_constraintsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPrimary_constraint(CSharpParser.Primary_constraintContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPrimary_constraint(CSharpParser.Primary_constraintContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSecondary_constraints(CSharpParser.Secondary_constraintsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSecondary_constraints(CSharpParser.Secondary_constraintsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstructor_constraint(CSharpParser.Constructor_constraintContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstructor_constraint(CSharpParser.Constructor_constraintContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClass_body(CSharpParser.Class_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClass_body(CSharpParser.Class_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClass_member_declarations(CSharpParser.Class_member_declarationsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClass_member_declarations(CSharpParser.Class_member_declarationsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClass_member_declaration(CSharpParser.Class_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClass_member_declaration(CSharpParser.Class_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAll_member_modifiers(CSharpParser.All_member_modifiersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAll_member_modifiers(CSharpParser.All_member_modifiersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAll_member_modifier(CSharpParser.All_member_modifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAll_member_modifier(CSharpParser.All_member_modifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterCommon_member_declaration(CSharpParser.Common_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitCommon_member_declaration(CSharpParser.Common_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterTyped_member_declaration(CSharpParser.Typed_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitTyped_member_declaration(CSharpParser.Typed_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstant_declarators(CSharpParser.Constant_declaratorsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstant_declarators(CSharpParser.Constant_declaratorsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstant_declarator(CSharpParser.Constant_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstant_declarator(CSharpParser.Constant_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariable_declarators(CSharpParser.Variable_declaratorsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariable_declarators(CSharpParser.Variable_declaratorsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariable_declarator(CSharpParser.Variable_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariable_declarator(CSharpParser.Variable_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariable_initializer(CSharpParser.Variable_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariable_initializer(CSharpParser.Variable_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterReturn_type(CSharpParser.Return_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitReturn_type(CSharpParser.Return_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMember_name(CSharpParser.Member_nameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMember_name(CSharpParser.Member_nameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethod_body(CSharpParser.Method_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethod_body(CSharpParser.Method_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFormal_parameter_list(CSharpParser.Formal_parameter_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFormal_parameter_list(CSharpParser.Formal_parameter_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFixed_parameters(CSharpParser.Fixed_parametersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFixed_parameters(CSharpParser.Fixed_parametersContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFixed_parameter(CSharpParser.Fixed_parameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFixed_parameter(CSharpParser.Fixed_parameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterParameter_modifier(CSharpParser.Parameter_modifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitParameter_modifier(CSharpParser.Parameter_modifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterParameter_array(CSharpParser.Parameter_arrayContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitParameter_array(CSharpParser.Parameter_arrayContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAccessor_declarations(CSharpParser.Accessor_declarationsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAccessor_declarations(CSharpParser.Accessor_declarationsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterGet_accessor_declaration(CSharpParser.Get_accessor_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitGet_accessor_declaration(CSharpParser.Get_accessor_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterSet_accessor_declaration(CSharpParser.Set_accessor_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitSet_accessor_declaration(CSharpParser.Set_accessor_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAccessor_modifier(CSharpParser.Accessor_modifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAccessor_modifier(CSharpParser.Accessor_modifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAccessor_body(CSharpParser.Accessor_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAccessor_body(CSharpParser.Accessor_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEvent_accessor_declarations(CSharpParser.Event_accessor_declarationsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEvent_accessor_declarations(CSharpParser.Event_accessor_declarationsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAdd_accessor_declaration(CSharpParser.Add_accessor_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAdd_accessor_declaration(CSharpParser.Add_accessor_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterRemove_accessor_declaration(CSharpParser.Remove_accessor_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitRemove_accessor_declaration(CSharpParser.Remove_accessor_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterOverloadable_operator(CSharpParser.Overloadable_operatorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitOverloadable_operator(CSharpParser.Overloadable_operatorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConversion_operator_declarator(CSharpParser.Conversion_operator_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConversion_operator_declarator(CSharpParser.Conversion_operator_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstructor_initializer(CSharpParser.Constructor_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstructor_initializer(CSharpParser.Constructor_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBody(CSharpParser.BodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBody(CSharpParser.BodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStruct_interfaces(CSharpParser.Struct_interfacesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStruct_interfaces(CSharpParser.Struct_interfacesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStruct_body(CSharpParser.Struct_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStruct_body(CSharpParser.Struct_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStruct_member_declaration(CSharpParser.Struct_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStruct_member_declaration(CSharpParser.Struct_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArray_type(CSharpParser.Array_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArray_type(CSharpParser.Array_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterRank_specifier(CSharpParser.Rank_specifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitRank_specifier(CSharpParser.Rank_specifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArray_initializer(CSharpParser.Array_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArray_initializer(CSharpParser.Array_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariant_type_parameter_list(CSharpParser.Variant_type_parameter_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariant_type_parameter_list(CSharpParser.Variant_type_parameter_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariant_type_parameter(CSharpParser.Variant_type_parameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariant_type_parameter(CSharpParser.Variant_type_parameterContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterVariance_annotation(CSharpParser.Variance_annotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitVariance_annotation(CSharpParser.Variance_annotationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterface_base(CSharpParser.Interface_baseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterface_base(CSharpParser.Interface_baseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterface_body(CSharpParser.Interface_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterface_body(CSharpParser.Interface_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterface_member_declaration(CSharpParser.Interface_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterface_member_declaration(CSharpParser.Interface_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterface_accessors(CSharpParser.Interface_accessorsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterface_accessors(CSharpParser.Interface_accessorsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnum_base(CSharpParser.Enum_baseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnum_base(CSharpParser.Enum_baseContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnum_body(CSharpParser.Enum_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnum_body(CSharpParser.Enum_bodyContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnum_member_declaration(CSharpParser.Enum_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnum_member_declaration(CSharpParser.Enum_member_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterGlobal_attribute_section(CSharpParser.Global_attribute_sectionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitGlobal_attribute_section(CSharpParser.Global_attribute_sectionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterGlobal_attribute_target(CSharpParser.Global_attribute_targetContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitGlobal_attribute_target(CSharpParser.Global_attribute_targetContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAttributes(CSharpParser.AttributesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAttributes(CSharpParser.AttributesContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAttribute_section(CSharpParser.Attribute_sectionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAttribute_section(CSharpParser.Attribute_sectionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAttribute_target(CSharpParser.Attribute_targetContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAttribute_target(CSharpParser.Attribute_targetContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAttribute_list(CSharpParser.Attribute_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAttribute_list(CSharpParser.Attribute_listContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAttribute(CSharpParser.AttributeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAttribute(CSharpParser.AttributeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterAttribute_argument(CSharpParser.Attribute_argumentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitAttribute_argument(CSharpParser.Attribute_argumentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterPointer_type(CSharpParser.Pointer_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitPointer_type(CSharpParser.Pointer_typeContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFixed_pointer_declarators(CSharpParser.Fixed_pointer_declaratorsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFixed_pointer_declarators(CSharpParser.Fixed_pointer_declaratorsContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFixed_pointer_declarator(CSharpParser.Fixed_pointer_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFixed_pointer_declarator(CSharpParser.Fixed_pointer_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFixed_pointer_initializer(CSharpParser.Fixed_pointer_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFixed_pointer_initializer(CSharpParser.Fixed_pointer_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterFixed_size_buffer_declarator(CSharpParser.Fixed_size_buffer_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitFixed_size_buffer_declarator(CSharpParser.Fixed_size_buffer_declaratorContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStackalloc_initializer(CSharpParser.Stackalloc_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStackalloc_initializer(CSharpParser.Stackalloc_initializerContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterRight_arrow(CSharpParser.Right_arrowContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitRight_arrow(CSharpParser.Right_arrowContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterRight_shift(CSharpParser.Right_shiftContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitRight_shift(CSharpParser.Right_shiftContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterRight_shift_assignment(CSharpParser.Right_shift_assignmentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitRight_shift_assignment(CSharpParser.Right_shift_assignmentContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterLiteral(CSharpParser.LiteralContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitLiteral(CSharpParser.LiteralContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterBoolean_literal(CSharpParser.Boolean_literalContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitBoolean_literal(CSharpParser.Boolean_literalContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterString_literal(CSharpParser.String_literalContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitString_literal(CSharpParser.String_literalContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterpolated_regular_string(CSharpParser.Interpolated_regular_stringContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterpolated_regular_string(CSharpParser.Interpolated_regular_stringContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterpolated_verbatium_string(CSharpParser.Interpolated_verbatium_stringContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterpolated_verbatium_string(CSharpParser.Interpolated_verbatium_stringContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterpolated_regular_string_part(CSharpParser.Interpolated_regular_string_partContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterpolated_regular_string_part(CSharpParser.Interpolated_regular_string_partContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterpolated_verbatium_string_part(CSharpParser.Interpolated_verbatium_string_partContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterpolated_verbatium_string_part(CSharpParser.Interpolated_verbatium_string_partContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterpolated_string_expression(CSharpParser.Interpolated_string_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterpolated_string_expression(CSharpParser.Interpolated_string_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterKeyword(CSharpParser.KeywordContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitKeyword(CSharpParser.KeywordContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterClass_definition(CSharpParser.Class_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitClass_definition(CSharpParser.Class_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterStruct_definition(CSharpParser.Struct_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitStruct_definition(CSharpParser.Struct_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterInterface_definition(CSharpParser.Interface_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitInterface_definition(CSharpParser.Interface_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEnum_definition(CSharpParser.Enum_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEnum_definition(CSharpParser.Enum_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterDelegate_definition(CSharpParser.Delegate_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitDelegate_definition(CSharpParser.Delegate_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEvent_declaration(CSharpParser.Event_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEvent_declaration(CSharpParser.Event_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterField_declaration(CSharpParser.Field_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitField_declaration(CSharpParser.Field_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterProperty_declaration(CSharpParser.Property_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitProperty_declaration(CSharpParser.Property_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstant_declaration(CSharpParser.Constant_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstant_declaration(CSharpParser.Constant_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIndexer_declaration(CSharpParser.Indexer_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIndexer_declaration(CSharpParser.Indexer_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterDestructor_definition(CSharpParser.Destructor_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitDestructor_definition(CSharpParser.Destructor_definitionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterConstructor_declaration(CSharpParser.Constructor_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitConstructor_declaration(CSharpParser.Constructor_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethod_declaration(CSharpParser.Method_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethod_declaration(CSharpParser.Method_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethod_member_name(CSharpParser.Method_member_nameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethod_member_name(CSharpParser.Method_member_nameContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterOperator_declaration(CSharpParser.Operator_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitOperator_declaration(CSharpParser.Operator_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterArg_declaration(CSharpParser.Arg_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitArg_declaration(CSharpParser.Arg_declarationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterMethod_invocation(CSharpParser.Method_invocationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitMethod_invocation(CSharpParser.Method_invocationContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterObject_creation_expression(CSharpParser.Object_creation_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitObject_creation_expression(CSharpParser.Object_creation_expressionContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterIdentifier(CSharpParser.IdentifierContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitIdentifier(CSharpParser.IdentifierContext ctx) { } - - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void enterEveryRule(ParserRuleContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void exitEveryRule(ParserRuleContext ctx) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void visitTerminal(TerminalNode node) { } - /** - * {@inheritDoc} - * - *

The default implementation does nothing.

- */ - @Override public void visitErrorNode(ErrorNode node) { } + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterCompilation_unit(CSharpParser.Compilation_unitContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitCompilation_unit(CSharpParser.Compilation_unitContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterNamespace_or_type_name( + CSharpParser.Namespace_or_type_nameContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitNamespace_or_type_name( + CSharpParser.Namespace_or_type_nameContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterType_(CSharpParser.Type_Context ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitType_(CSharpParser.Type_Context ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterBase_type(CSharpParser.Base_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitBase_type(CSharpParser.Base_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterTuple_type(CSharpParser.Tuple_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitTuple_type(CSharpParser.Tuple_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterTuple_element(CSharpParser.Tuple_elementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitTuple_element(CSharpParser.Tuple_elementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSimple_type(CSharpParser.Simple_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSimple_type(CSharpParser.Simple_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterNumeric_type(CSharpParser.Numeric_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitNumeric_type(CSharpParser.Numeric_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterIntegral_type(CSharpParser.Integral_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitIntegral_type(CSharpParser.Integral_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFloating_point_type( + CSharpParser.Floating_point_typeContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFloating_point_type( + CSharpParser.Floating_point_typeContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterClass_type(CSharpParser.Class_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitClass_type(CSharpParser.Class_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterType_argument_list( + CSharpParser.Type_argument_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitType_argument_list( + CSharpParser.Type_argument_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterArgument_list(CSharpParser.Argument_listContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitArgument_list(CSharpParser.Argument_listContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterArgument(CSharpParser.ArgumentContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitArgument(CSharpParser.ArgumentContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterExpression(CSharpParser.ExpressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitExpression(CSharpParser.ExpressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterNon_assignment_expression( + CSharpParser.Non_assignment_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitNon_assignment_expression( + CSharpParser.Non_assignment_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAssignment(CSharpParser.AssignmentContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAssignment(CSharpParser.AssignmentContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAssignment_operator( + CSharpParser.Assignment_operatorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAssignment_operator( + CSharpParser.Assignment_operatorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterConditional_expression( + CSharpParser.Conditional_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitConditional_expression( + CSharpParser.Conditional_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterNull_coalescing_expression( + CSharpParser.Null_coalescing_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitNull_coalescing_expression( + CSharpParser.Null_coalescing_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterConditional_or_expression( + CSharpParser.Conditional_or_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitConditional_or_expression( + CSharpParser.Conditional_or_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterConditional_and_expression( + CSharpParser.Conditional_and_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitConditional_and_expression( + CSharpParser.Conditional_and_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInclusive_or_expression( + CSharpParser.Inclusive_or_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInclusive_or_expression( + CSharpParser.Inclusive_or_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterExclusive_or_expression( + CSharpParser.Exclusive_or_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitExclusive_or_expression( + CSharpParser.Exclusive_or_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAnd_expression(CSharpParser.And_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAnd_expression(CSharpParser.And_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterEquality_expression( + CSharpParser.Equality_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitEquality_expression( + CSharpParser.Equality_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterRelational_expression( + CSharpParser.Relational_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitRelational_expression( + CSharpParser.Relational_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterShift_expression(CSharpParser.Shift_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitShift_expression(CSharpParser.Shift_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAdditive_expression( + CSharpParser.Additive_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAdditive_expression( + CSharpParser.Additive_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMultiplicative_expression( + CSharpParser.Multiplicative_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMultiplicative_expression( + CSharpParser.Multiplicative_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSwitch_expression( + CSharpParser.Switch_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSwitch_expression( + CSharpParser.Switch_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSwitch_expression_arms( + CSharpParser.Switch_expression_armsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSwitch_expression_arms( + CSharpParser.Switch_expression_armsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSwitch_expression_arm( + CSharpParser.Switch_expression_armContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSwitch_expression_arm( + CSharpParser.Switch_expression_armContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterRange_expression(CSharpParser.Range_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitRange_expression(CSharpParser.Range_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterUnary_expression(CSharpParser.Unary_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitUnary_expression(CSharpParser.Unary_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterPrimary_expression( + CSharpParser.Primary_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitPrimary_expression( + CSharpParser.Primary_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLiteralExpression( + CSharpParser.LiteralExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLiteralExpression( + CSharpParser.LiteralExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSimpleNameExpression( + CSharpParser.SimpleNameExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSimpleNameExpression( + CSharpParser.SimpleNameExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterParenthesisExpressions( + CSharpParser.ParenthesisExpressionsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitParenthesisExpressions( + CSharpParser.ParenthesisExpressionsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMemberAccessExpression( + CSharpParser.MemberAccessExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMemberAccessExpression( + CSharpParser.MemberAccessExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLiteralAccessExpression( + CSharpParser.LiteralAccessExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLiteralAccessExpression( + CSharpParser.LiteralAccessExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterThisReferenceExpression( + CSharpParser.ThisReferenceExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitThisReferenceExpression( + CSharpParser.ThisReferenceExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterBaseAccessExpression( + CSharpParser.BaseAccessExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitBaseAccessExpression( + CSharpParser.BaseAccessExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterObjectCreationExpression( + CSharpParser.ObjectCreationExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitObjectCreationExpression( + CSharpParser.ObjectCreationExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterTupleExpression(CSharpParser.TupleExpressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitTupleExpression(CSharpParser.TupleExpressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterTypeofExpression(CSharpParser.TypeofExpressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitTypeofExpression(CSharpParser.TypeofExpressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterCheckedExpression( + CSharpParser.CheckedExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitCheckedExpression( + CSharpParser.CheckedExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterUncheckedExpression( + CSharpParser.UncheckedExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitUncheckedExpression( + CSharpParser.UncheckedExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterDefaultValueExpression( + CSharpParser.DefaultValueExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitDefaultValueExpression( + CSharpParser.DefaultValueExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAnonymousMethodExpression( + CSharpParser.AnonymousMethodExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAnonymousMethodExpression( + CSharpParser.AnonymousMethodExpressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSizeofExpression(CSharpParser.SizeofExpressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSizeofExpression(CSharpParser.SizeofExpressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterNameofExpression(CSharpParser.NameofExpressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitNameofExpression(CSharpParser.NameofExpressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterThrowable_expression( + CSharpParser.Throwable_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitThrowable_expression( + CSharpParser.Throwable_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterThrow_expression(CSharpParser.Throw_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitThrow_expression(CSharpParser.Throw_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMember_access(CSharpParser.Member_accessContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMember_access(CSharpParser.Member_accessContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterBracket_expression( + CSharpParser.Bracket_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitBracket_expression( + CSharpParser.Bracket_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterIndexer_argument(CSharpParser.Indexer_argumentContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitIndexer_argument(CSharpParser.Indexer_argumentContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterPredefined_type(CSharpParser.Predefined_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitPredefined_type(CSharpParser.Predefined_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterExpression_list(CSharpParser.Expression_listContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitExpression_list(CSharpParser.Expression_listContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterObject_or_collection_initializer( + CSharpParser.Object_or_collection_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitObject_or_collection_initializer( + CSharpParser.Object_or_collection_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterObject_initializer( + CSharpParser.Object_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitObject_initializer( + CSharpParser.Object_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMember_initializer_list( + CSharpParser.Member_initializer_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMember_initializer_list( + CSharpParser.Member_initializer_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMember_initializer( + CSharpParser.Member_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMember_initializer( + CSharpParser.Member_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInitializer_value( + CSharpParser.Initializer_valueContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInitializer_value( + CSharpParser.Initializer_valueContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterCollection_initializer( + CSharpParser.Collection_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitCollection_initializer( + CSharpParser.Collection_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterElement_initializer( + CSharpParser.Element_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitElement_initializer( + CSharpParser.Element_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAnonymous_object_initializer( + CSharpParser.Anonymous_object_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAnonymous_object_initializer( + CSharpParser.Anonymous_object_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMember_declarator_list( + CSharpParser.Member_declarator_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMember_declarator_list( + CSharpParser.Member_declarator_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMember_declarator( + CSharpParser.Member_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMember_declarator( + CSharpParser.Member_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterUnbound_type_name( + CSharpParser.Unbound_type_nameContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitUnbound_type_name( + CSharpParser.Unbound_type_nameContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterGeneric_dimension_specifier( + CSharpParser.Generic_dimension_specifierContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitGeneric_dimension_specifier( + CSharpParser.Generic_dimension_specifierContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterIsType(CSharpParser.IsTypeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitIsType(CSharpParser.IsTypeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterIsTypePatternArms( + CSharpParser.IsTypePatternArmsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitIsTypePatternArms( + CSharpParser.IsTypePatternArmsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterIsTypePatternArm(CSharpParser.IsTypePatternArmContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitIsTypePatternArm(CSharpParser.IsTypePatternArmContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLambda_expression( + CSharpParser.Lambda_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLambda_expression( + CSharpParser.Lambda_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAnonymous_function_signature( + CSharpParser.Anonymous_function_signatureContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAnonymous_function_signature( + CSharpParser.Anonymous_function_signatureContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterExplicit_anonymous_function_parameter_list( + CSharpParser.Explicit_anonymous_function_parameter_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitExplicit_anonymous_function_parameter_list( + CSharpParser.Explicit_anonymous_function_parameter_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterExplicit_anonymous_function_parameter( + CSharpParser.Explicit_anonymous_function_parameterContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitExplicit_anonymous_function_parameter( + CSharpParser.Explicit_anonymous_function_parameterContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterImplicit_anonymous_function_parameter_list( + CSharpParser.Implicit_anonymous_function_parameter_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitImplicit_anonymous_function_parameter_list( + CSharpParser.Implicit_anonymous_function_parameter_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAnonymous_function_body( + CSharpParser.Anonymous_function_bodyContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAnonymous_function_body( + CSharpParser.Anonymous_function_bodyContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterQuery_expression(CSharpParser.Query_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitQuery_expression(CSharpParser.Query_expressionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFrom_clause(CSharpParser.From_clauseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFrom_clause(CSharpParser.From_clauseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterQuery_body(CSharpParser.Query_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitQuery_body(CSharpParser.Query_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterQuery_body_clause( + CSharpParser.Query_body_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitQuery_body_clause( + CSharpParser.Query_body_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLet_clause(CSharpParser.Let_clauseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLet_clause(CSharpParser.Let_clauseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterWhere_clause(CSharpParser.Where_clauseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitWhere_clause(CSharpParser.Where_clauseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterCombined_join_clause( + CSharpParser.Combined_join_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitCombined_join_clause( + CSharpParser.Combined_join_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterOrderby_clause(CSharpParser.Orderby_clauseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitOrderby_clause(CSharpParser.Orderby_clauseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterOrdering(CSharpParser.OrderingContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitOrdering(CSharpParser.OrderingContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSelect_or_group_clause( + CSharpParser.Select_or_group_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSelect_or_group_clause( + CSharpParser.Select_or_group_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterQuery_continuation( + CSharpParser.Query_continuationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitQuery_continuation( + CSharpParser.Query_continuationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterStatement(CSharpParser.StatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitStatement(CSharpParser.StatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterDeclarationStatement( + CSharpParser.DeclarationStatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitDeclarationStatement( + CSharpParser.DeclarationStatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLocal_function_declaration( + CSharpParser.Local_function_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLocal_function_declaration( + CSharpParser.Local_function_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLocal_function_header( + CSharpParser.Local_function_headerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLocal_function_header( + CSharpParser.Local_function_headerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLocal_function_modifiers( + CSharpParser.Local_function_modifiersContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLocal_function_modifiers( + CSharpParser.Local_function_modifiersContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLocal_function_body( + CSharpParser.Local_function_bodyContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLocal_function_body( + CSharpParser.Local_function_bodyContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLabeled_Statement( + CSharpParser.Labeled_StatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLabeled_Statement( + CSharpParser.Labeled_StatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterEmbedded_statement( + CSharpParser.Embedded_statementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitEmbedded_statement( + CSharpParser.Embedded_statementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterTheEmptyStatement( + CSharpParser.TheEmptyStatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitTheEmptyStatement( + CSharpParser.TheEmptyStatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterExpressionStatement( + CSharpParser.ExpressionStatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitExpressionStatement( + CSharpParser.ExpressionStatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterIfStatement(CSharpParser.IfStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitIfStatement(CSharpParser.IfStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSwitchStatement(CSharpParser.SwitchStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSwitchStatement(CSharpParser.SwitchStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterWhileStatement(CSharpParser.WhileStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitWhileStatement(CSharpParser.WhileStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterDoStatement(CSharpParser.DoStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitDoStatement(CSharpParser.DoStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterForStatement(CSharpParser.ForStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitForStatement(CSharpParser.ForStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterForeachStatement(CSharpParser.ForeachStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitForeachStatement(CSharpParser.ForeachStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterBreakStatement(CSharpParser.BreakStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitBreakStatement(CSharpParser.BreakStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterContinueStatement( + CSharpParser.ContinueStatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitContinueStatement( + CSharpParser.ContinueStatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterGotoStatement(CSharpParser.GotoStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitGotoStatement(CSharpParser.GotoStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterReturnStatement(CSharpParser.ReturnStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitReturnStatement(CSharpParser.ReturnStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterThrowStatement(CSharpParser.ThrowStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitThrowStatement(CSharpParser.ThrowStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterTryStatement(CSharpParser.TryStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitTryStatement(CSharpParser.TryStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterCheckedStatement(CSharpParser.CheckedStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitCheckedStatement(CSharpParser.CheckedStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterUncheckedStatement( + CSharpParser.UncheckedStatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitUncheckedStatement( + CSharpParser.UncheckedStatementContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLockStatement(CSharpParser.LockStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLockStatement(CSharpParser.LockStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterUsingStatement(CSharpParser.UsingStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitUsingStatement(CSharpParser.UsingStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterYieldStatement(CSharpParser.YieldStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitYieldStatement(CSharpParser.YieldStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterUnsafeStatement(CSharpParser.UnsafeStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitUnsafeStatement(CSharpParser.UnsafeStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFixedStatement(CSharpParser.FixedStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFixedStatement(CSharpParser.FixedStatementContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterBlock(CSharpParser.BlockContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitBlock(CSharpParser.BlockContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLocal_variable_declaration( + CSharpParser.Local_variable_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLocal_variable_declaration( + CSharpParser.Local_variable_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLocal_variable_type( + CSharpParser.Local_variable_typeContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLocal_variable_type( + CSharpParser.Local_variable_typeContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLocal_variable_declarator( + CSharpParser.Local_variable_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLocal_variable_declarator( + CSharpParser.Local_variable_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLocal_variable_initializer( + CSharpParser.Local_variable_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLocal_variable_initializer( + CSharpParser.Local_variable_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLocal_constant_declaration( + CSharpParser.Local_constant_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLocal_constant_declaration( + CSharpParser.Local_constant_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterIf_body(CSharpParser.If_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitIf_body(CSharpParser.If_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSwitch_section(CSharpParser.Switch_sectionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSwitch_section(CSharpParser.Switch_sectionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSwitch_label(CSharpParser.Switch_labelContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSwitch_label(CSharpParser.Switch_labelContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterCase_guard(CSharpParser.Case_guardContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitCase_guard(CSharpParser.Case_guardContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterStatement_list(CSharpParser.Statement_listContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitStatement_list(CSharpParser.Statement_listContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFor_initializer(CSharpParser.For_initializerContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFor_initializer(CSharpParser.For_initializerContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFor_iterator(CSharpParser.For_iteratorContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFor_iterator(CSharpParser.For_iteratorContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterCatch_clauses(CSharpParser.Catch_clausesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitCatch_clauses(CSharpParser.Catch_clausesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSpecific_catch_clause( + CSharpParser.Specific_catch_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSpecific_catch_clause( + CSharpParser.Specific_catch_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterGeneral_catch_clause( + CSharpParser.General_catch_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitGeneral_catch_clause( + CSharpParser.General_catch_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterException_filter(CSharpParser.Exception_filterContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitException_filter(CSharpParser.Exception_filterContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFinally_clause(CSharpParser.Finally_clauseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFinally_clause(CSharpParser.Finally_clauseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterResource_acquisition( + CSharpParser.Resource_acquisitionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitResource_acquisition( + CSharpParser.Resource_acquisitionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterNamespace_declaration( + CSharpParser.Namespace_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitNamespace_declaration( + CSharpParser.Namespace_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterQualified_identifier( + CSharpParser.Qualified_identifierContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitQualified_identifier( + CSharpParser.Qualified_identifierContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterNamespace_body(CSharpParser.Namespace_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitNamespace_body(CSharpParser.Namespace_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterExtern_alias_directives( + CSharpParser.Extern_alias_directivesContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitExtern_alias_directives( + CSharpParser.Extern_alias_directivesContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterExtern_alias_directive( + CSharpParser.Extern_alias_directiveContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitExtern_alias_directive( + CSharpParser.Extern_alias_directiveContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterUsing_directives(CSharpParser.Using_directivesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitUsing_directives(CSharpParser.Using_directivesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterUsingAliasDirective( + CSharpParser.UsingAliasDirectiveContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitUsingAliasDirective( + CSharpParser.UsingAliasDirectiveContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterUsingNamespaceDirective( + CSharpParser.UsingNamespaceDirectiveContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitUsingNamespaceDirective( + CSharpParser.UsingNamespaceDirectiveContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterUsingStaticDirective( + CSharpParser.UsingStaticDirectiveContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitUsingStaticDirective( + CSharpParser.UsingStaticDirectiveContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterNamespace_member_declarations( + CSharpParser.Namespace_member_declarationsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitNamespace_member_declarations( + CSharpParser.Namespace_member_declarationsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterNamespace_member_declaration( + CSharpParser.Namespace_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitNamespace_member_declaration( + CSharpParser.Namespace_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterType_declaration(CSharpParser.Type_declarationContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitType_declaration(CSharpParser.Type_declarationContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterQualified_alias_member( + CSharpParser.Qualified_alias_memberContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitQualified_alias_member( + CSharpParser.Qualified_alias_memberContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterType_parameter_list( + CSharpParser.Type_parameter_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitType_parameter_list( + CSharpParser.Type_parameter_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterType_parameter(CSharpParser.Type_parameterContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitType_parameter(CSharpParser.Type_parameterContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterClass_base(CSharpParser.Class_baseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitClass_base(CSharpParser.Class_baseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInterface_type_list( + CSharpParser.Interface_type_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInterface_type_list( + CSharpParser.Interface_type_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterType_parameter_constraints_clauses( + CSharpParser.Type_parameter_constraints_clausesContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitType_parameter_constraints_clauses( + CSharpParser.Type_parameter_constraints_clausesContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterType_parameter_constraints_clause( + CSharpParser.Type_parameter_constraints_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitType_parameter_constraints_clause( + CSharpParser.Type_parameter_constraints_clauseContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterType_parameter_constraints( + CSharpParser.Type_parameter_constraintsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitType_parameter_constraints( + CSharpParser.Type_parameter_constraintsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterPrimary_constraint( + CSharpParser.Primary_constraintContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitPrimary_constraint( + CSharpParser.Primary_constraintContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSecondary_constraints( + CSharpParser.Secondary_constraintsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSecondary_constraints( + CSharpParser.Secondary_constraintsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterConstructor_constraint( + CSharpParser.Constructor_constraintContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitConstructor_constraint( + CSharpParser.Constructor_constraintContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterClass_body(CSharpParser.Class_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitClass_body(CSharpParser.Class_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterClass_member_declarations( + CSharpParser.Class_member_declarationsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitClass_member_declarations( + CSharpParser.Class_member_declarationsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterClass_member_declaration( + CSharpParser.Class_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitClass_member_declaration( + CSharpParser.Class_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAll_member_modifiers( + CSharpParser.All_member_modifiersContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAll_member_modifiers( + CSharpParser.All_member_modifiersContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAll_member_modifier( + CSharpParser.All_member_modifierContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAll_member_modifier( + CSharpParser.All_member_modifierContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterCommon_member_declaration( + CSharpParser.Common_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitCommon_member_declaration( + CSharpParser.Common_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterTyped_member_declaration( + CSharpParser.Typed_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitTyped_member_declaration( + CSharpParser.Typed_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterConstant_declarators( + CSharpParser.Constant_declaratorsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitConstant_declarators( + CSharpParser.Constant_declaratorsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterConstant_declarator( + CSharpParser.Constant_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitConstant_declarator( + CSharpParser.Constant_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterVariable_declarators( + CSharpParser.Variable_declaratorsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitVariable_declarators( + CSharpParser.Variable_declaratorsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterVariable_declarator( + CSharpParser.Variable_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitVariable_declarator( + CSharpParser.Variable_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterVariable_initializer( + CSharpParser.Variable_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitVariable_initializer( + CSharpParser.Variable_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterReturn_type(CSharpParser.Return_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitReturn_type(CSharpParser.Return_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMember_name(CSharpParser.Member_nameContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMember_name(CSharpParser.Member_nameContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMethod_body(CSharpParser.Method_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMethod_body(CSharpParser.Method_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFormal_parameter_list( + CSharpParser.Formal_parameter_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFormal_parameter_list( + CSharpParser.Formal_parameter_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFixed_parameters(CSharpParser.Fixed_parametersContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFixed_parameters(CSharpParser.Fixed_parametersContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFixed_parameter(CSharpParser.Fixed_parameterContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFixed_parameter(CSharpParser.Fixed_parameterContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterParameter_modifier( + CSharpParser.Parameter_modifierContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitParameter_modifier( + CSharpParser.Parameter_modifierContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterParameter_array(CSharpParser.Parameter_arrayContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitParameter_array(CSharpParser.Parameter_arrayContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAccessor_declarations( + CSharpParser.Accessor_declarationsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAccessor_declarations( + CSharpParser.Accessor_declarationsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterGet_accessor_declaration( + CSharpParser.Get_accessor_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitGet_accessor_declaration( + CSharpParser.Get_accessor_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterSet_accessor_declaration( + CSharpParser.Set_accessor_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitSet_accessor_declaration( + CSharpParser.Set_accessor_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAccessor_modifier( + CSharpParser.Accessor_modifierContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAccessor_modifier( + CSharpParser.Accessor_modifierContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAccessor_body(CSharpParser.Accessor_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAccessor_body(CSharpParser.Accessor_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterEvent_accessor_declarations( + CSharpParser.Event_accessor_declarationsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitEvent_accessor_declarations( + CSharpParser.Event_accessor_declarationsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAdd_accessor_declaration( + CSharpParser.Add_accessor_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAdd_accessor_declaration( + CSharpParser.Add_accessor_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterRemove_accessor_declaration( + CSharpParser.Remove_accessor_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitRemove_accessor_declaration( + CSharpParser.Remove_accessor_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterOverloadable_operator( + CSharpParser.Overloadable_operatorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitOverloadable_operator( + CSharpParser.Overloadable_operatorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterConversion_operator_declarator( + CSharpParser.Conversion_operator_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitConversion_operator_declarator( + CSharpParser.Conversion_operator_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterConstructor_initializer( + CSharpParser.Constructor_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitConstructor_initializer( + CSharpParser.Constructor_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterBody(CSharpParser.BodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitBody(CSharpParser.BodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterStruct_interfaces( + CSharpParser.Struct_interfacesContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitStruct_interfaces( + CSharpParser.Struct_interfacesContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterStruct_body(CSharpParser.Struct_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitStruct_body(CSharpParser.Struct_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterStruct_member_declaration( + CSharpParser.Struct_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitStruct_member_declaration( + CSharpParser.Struct_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterArray_type(CSharpParser.Array_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitArray_type(CSharpParser.Array_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterRank_specifier(CSharpParser.Rank_specifierContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitRank_specifier(CSharpParser.Rank_specifierContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterArray_initializer( + CSharpParser.Array_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitArray_initializer( + CSharpParser.Array_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterVariant_type_parameter_list( + CSharpParser.Variant_type_parameter_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitVariant_type_parameter_list( + CSharpParser.Variant_type_parameter_listContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterVariant_type_parameter( + CSharpParser.Variant_type_parameterContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitVariant_type_parameter( + CSharpParser.Variant_type_parameterContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterVariance_annotation( + CSharpParser.Variance_annotationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitVariance_annotation( + CSharpParser.Variance_annotationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInterface_base(CSharpParser.Interface_baseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInterface_base(CSharpParser.Interface_baseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInterface_body(CSharpParser.Interface_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInterface_body(CSharpParser.Interface_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInterface_member_declaration( + CSharpParser.Interface_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInterface_member_declaration( + CSharpParser.Interface_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInterface_accessors( + CSharpParser.Interface_accessorsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInterface_accessors( + CSharpParser.Interface_accessorsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterEnum_base(CSharpParser.Enum_baseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitEnum_base(CSharpParser.Enum_baseContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterEnum_body(CSharpParser.Enum_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitEnum_body(CSharpParser.Enum_bodyContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterEnum_member_declaration( + CSharpParser.Enum_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitEnum_member_declaration( + CSharpParser.Enum_member_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterGlobal_attribute_section( + CSharpParser.Global_attribute_sectionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitGlobal_attribute_section( + CSharpParser.Global_attribute_sectionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterGlobal_attribute_target( + CSharpParser.Global_attribute_targetContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitGlobal_attribute_target( + CSharpParser.Global_attribute_targetContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAttributes(CSharpParser.AttributesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAttributes(CSharpParser.AttributesContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAttribute_section( + CSharpParser.Attribute_sectionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAttribute_section( + CSharpParser.Attribute_sectionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAttribute_target(CSharpParser.Attribute_targetContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAttribute_target(CSharpParser.Attribute_targetContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAttribute_list(CSharpParser.Attribute_listContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAttribute_list(CSharpParser.Attribute_listContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAttribute(CSharpParser.AttributeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAttribute(CSharpParser.AttributeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterAttribute_argument( + CSharpParser.Attribute_argumentContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitAttribute_argument( + CSharpParser.Attribute_argumentContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterPointer_type(CSharpParser.Pointer_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitPointer_type(CSharpParser.Pointer_typeContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFixed_pointer_declarators( + CSharpParser.Fixed_pointer_declaratorsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFixed_pointer_declarators( + CSharpParser.Fixed_pointer_declaratorsContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFixed_pointer_declarator( + CSharpParser.Fixed_pointer_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFixed_pointer_declarator( + CSharpParser.Fixed_pointer_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFixed_pointer_initializer( + CSharpParser.Fixed_pointer_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFixed_pointer_initializer( + CSharpParser.Fixed_pointer_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterFixed_size_buffer_declarator( + CSharpParser.Fixed_size_buffer_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitFixed_size_buffer_declarator( + CSharpParser.Fixed_size_buffer_declaratorContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterStackalloc_initializer( + CSharpParser.Stackalloc_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitStackalloc_initializer( + CSharpParser.Stackalloc_initializerContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterRight_arrow(CSharpParser.Right_arrowContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitRight_arrow(CSharpParser.Right_arrowContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterRight_shift(CSharpParser.Right_shiftContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitRight_shift(CSharpParser.Right_shiftContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterRight_shift_assignment( + CSharpParser.Right_shift_assignmentContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitRight_shift_assignment( + CSharpParser.Right_shift_assignmentContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterLiteral(CSharpParser.LiteralContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitLiteral(CSharpParser.LiteralContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterBoolean_literal(CSharpParser.Boolean_literalContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitBoolean_literal(CSharpParser.Boolean_literalContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterString_literal(CSharpParser.String_literalContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitString_literal(CSharpParser.String_literalContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInterpolated_regular_string( + CSharpParser.Interpolated_regular_stringContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInterpolated_regular_string( + CSharpParser.Interpolated_regular_stringContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInterpolated_verbatium_string( + CSharpParser.Interpolated_verbatium_stringContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInterpolated_verbatium_string( + CSharpParser.Interpolated_verbatium_stringContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInterpolated_regular_string_part( + CSharpParser.Interpolated_regular_string_partContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInterpolated_regular_string_part( + CSharpParser.Interpolated_regular_string_partContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInterpolated_verbatium_string_part( + CSharpParser.Interpolated_verbatium_string_partContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInterpolated_verbatium_string_part( + CSharpParser.Interpolated_verbatium_string_partContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInterpolated_string_expression( + CSharpParser.Interpolated_string_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInterpolated_string_expression( + CSharpParser.Interpolated_string_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterKeyword(CSharpParser.KeywordContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitKeyword(CSharpParser.KeywordContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterClass_definition(CSharpParser.Class_definitionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitClass_definition(CSharpParser.Class_definitionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterStruct_definition( + CSharpParser.Struct_definitionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitStruct_definition( + CSharpParser.Struct_definitionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterInterface_definition( + CSharpParser.Interface_definitionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitInterface_definition( + CSharpParser.Interface_definitionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterEnum_definition(CSharpParser.Enum_definitionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitEnum_definition(CSharpParser.Enum_definitionContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterDelegate_definition( + CSharpParser.Delegate_definitionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitDelegate_definition( + CSharpParser.Delegate_definitionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterEvent_declaration( + CSharpParser.Event_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitEvent_declaration( + CSharpParser.Event_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterField_declaration( + CSharpParser.Field_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitField_declaration( + CSharpParser.Field_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterProperty_declaration( + CSharpParser.Property_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitProperty_declaration( + CSharpParser.Property_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterConstant_declaration( + CSharpParser.Constant_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitConstant_declaration( + CSharpParser.Constant_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterIndexer_declaration( + CSharpParser.Indexer_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitIndexer_declaration( + CSharpParser.Indexer_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterDestructor_definition( + CSharpParser.Destructor_definitionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitDestructor_definition( + CSharpParser.Destructor_definitionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterConstructor_declaration( + CSharpParser.Constructor_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitConstructor_declaration( + CSharpParser.Constructor_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMethod_declaration( + CSharpParser.Method_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMethod_declaration( + CSharpParser.Method_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMethod_member_name( + CSharpParser.Method_member_nameContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMethod_member_name( + CSharpParser.Method_member_nameContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterOperator_declaration( + CSharpParser.Operator_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitOperator_declaration( + CSharpParser.Operator_declarationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterArg_declaration(CSharpParser.Arg_declarationContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitArg_declaration(CSharpParser.Arg_declarationContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterMethod_invocation( + CSharpParser.Method_invocationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitMethod_invocation( + CSharpParser.Method_invocationContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterObject_creation_expression( + CSharpParser.Object_creation_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitObject_creation_expression( + CSharpParser.Object_creation_expressionContext ctx + ) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterIdentifier(CSharpParser.IdentifierContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitIdentifier(CSharpParser.IdentifierContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void enterEveryRule(ParserRuleContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void exitEveryRule(ParserRuleContext ctx) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void visitTerminal(TerminalNode node) {} + + /** + * {@inheritDoc} + * + *

The default implementation does nothing.

+ */ + @Override + public void visitErrorNode(ErrorNode node) {} } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParserListener.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParserListener.java index cf9321a748..e17dbb942d 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParserListener.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/antlr/CSharpParserListener.java @@ -11,2634 +11,2958 @@ * {@link CSharpParser}. */ public interface CSharpParserListener extends ParseTreeListener { - /** - * Enter a parse tree produced by {@link CSharpParser#compilation_unit}. - * @param ctx the parse tree - */ - void enterCompilation_unit(CSharpParser.Compilation_unitContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#compilation_unit}. - * @param ctx the parse tree - */ - void exitCompilation_unit(CSharpParser.Compilation_unitContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#namespace_or_type_name}. - * @param ctx the parse tree - */ - void enterNamespace_or_type_name(CSharpParser.Namespace_or_type_nameContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#namespace_or_type_name}. - * @param ctx the parse tree - */ - void exitNamespace_or_type_name(CSharpParser.Namespace_or_type_nameContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#type_}. - * @param ctx the parse tree - */ - void enterType_(CSharpParser.Type_Context ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#type_}. - * @param ctx the parse tree - */ - void exitType_(CSharpParser.Type_Context ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#base_type}. - * @param ctx the parse tree - */ - void enterBase_type(CSharpParser.Base_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#base_type}. - * @param ctx the parse tree - */ - void exitBase_type(CSharpParser.Base_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#tuple_type}. - * @param ctx the parse tree - */ - void enterTuple_type(CSharpParser.Tuple_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#tuple_type}. - * @param ctx the parse tree - */ - void exitTuple_type(CSharpParser.Tuple_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#tuple_element}. - * @param ctx the parse tree - */ - void enterTuple_element(CSharpParser.Tuple_elementContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#tuple_element}. - * @param ctx the parse tree - */ - void exitTuple_element(CSharpParser.Tuple_elementContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#simple_type}. - * @param ctx the parse tree - */ - void enterSimple_type(CSharpParser.Simple_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#simple_type}. - * @param ctx the parse tree - */ - void exitSimple_type(CSharpParser.Simple_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#numeric_type}. - * @param ctx the parse tree - */ - void enterNumeric_type(CSharpParser.Numeric_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#numeric_type}. - * @param ctx the parse tree - */ - void exitNumeric_type(CSharpParser.Numeric_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#integral_type}. - * @param ctx the parse tree - */ - void enterIntegral_type(CSharpParser.Integral_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#integral_type}. - * @param ctx the parse tree - */ - void exitIntegral_type(CSharpParser.Integral_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#floating_point_type}. - * @param ctx the parse tree - */ - void enterFloating_point_type(CSharpParser.Floating_point_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#floating_point_type}. - * @param ctx the parse tree - */ - void exitFloating_point_type(CSharpParser.Floating_point_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#class_type}. - * @param ctx the parse tree - */ - void enterClass_type(CSharpParser.Class_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#class_type}. - * @param ctx the parse tree - */ - void exitClass_type(CSharpParser.Class_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#type_argument_list}. - * @param ctx the parse tree - */ - void enterType_argument_list(CSharpParser.Type_argument_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#type_argument_list}. - * @param ctx the parse tree - */ - void exitType_argument_list(CSharpParser.Type_argument_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#argument_list}. - * @param ctx the parse tree - */ - void enterArgument_list(CSharpParser.Argument_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#argument_list}. - * @param ctx the parse tree - */ - void exitArgument_list(CSharpParser.Argument_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#argument}. - * @param ctx the parse tree - */ - void enterArgument(CSharpParser.ArgumentContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#argument}. - * @param ctx the parse tree - */ - void exitArgument(CSharpParser.ArgumentContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#expression}. - * @param ctx the parse tree - */ - void enterExpression(CSharpParser.ExpressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#expression}. - * @param ctx the parse tree - */ - void exitExpression(CSharpParser.ExpressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#non_assignment_expression}. - * @param ctx the parse tree - */ - void enterNon_assignment_expression(CSharpParser.Non_assignment_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#non_assignment_expression}. - * @param ctx the parse tree - */ - void exitNon_assignment_expression(CSharpParser.Non_assignment_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#assignment}. - * @param ctx the parse tree - */ - void enterAssignment(CSharpParser.AssignmentContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#assignment}. - * @param ctx the parse tree - */ - void exitAssignment(CSharpParser.AssignmentContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#assignment_operator}. - * @param ctx the parse tree - */ - void enterAssignment_operator(CSharpParser.Assignment_operatorContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#assignment_operator}. - * @param ctx the parse tree - */ - void exitAssignment_operator(CSharpParser.Assignment_operatorContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#conditional_expression}. - * @param ctx the parse tree - */ - void enterConditional_expression(CSharpParser.Conditional_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#conditional_expression}. - * @param ctx the parse tree - */ - void exitConditional_expression(CSharpParser.Conditional_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#null_coalescing_expression}. - * @param ctx the parse tree - */ - void enterNull_coalescing_expression(CSharpParser.Null_coalescing_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#null_coalescing_expression}. - * @param ctx the parse tree - */ - void exitNull_coalescing_expression(CSharpParser.Null_coalescing_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#conditional_or_expression}. - * @param ctx the parse tree - */ - void enterConditional_or_expression(CSharpParser.Conditional_or_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#conditional_or_expression}. - * @param ctx the parse tree - */ - void exitConditional_or_expression(CSharpParser.Conditional_or_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#conditional_and_expression}. - * @param ctx the parse tree - */ - void enterConditional_and_expression(CSharpParser.Conditional_and_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#conditional_and_expression}. - * @param ctx the parse tree - */ - void exitConditional_and_expression(CSharpParser.Conditional_and_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#inclusive_or_expression}. - * @param ctx the parse tree - */ - void enterInclusive_or_expression(CSharpParser.Inclusive_or_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#inclusive_or_expression}. - * @param ctx the parse tree - */ - void exitInclusive_or_expression(CSharpParser.Inclusive_or_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#exclusive_or_expression}. - * @param ctx the parse tree - */ - void enterExclusive_or_expression(CSharpParser.Exclusive_or_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#exclusive_or_expression}. - * @param ctx the parse tree - */ - void exitExclusive_or_expression(CSharpParser.Exclusive_or_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#and_expression}. - * @param ctx the parse tree - */ - void enterAnd_expression(CSharpParser.And_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#and_expression}. - * @param ctx the parse tree - */ - void exitAnd_expression(CSharpParser.And_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#equality_expression}. - * @param ctx the parse tree - */ - void enterEquality_expression(CSharpParser.Equality_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#equality_expression}. - * @param ctx the parse tree - */ - void exitEquality_expression(CSharpParser.Equality_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#relational_expression}. - * @param ctx the parse tree - */ - void enterRelational_expression(CSharpParser.Relational_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#relational_expression}. - * @param ctx the parse tree - */ - void exitRelational_expression(CSharpParser.Relational_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#shift_expression}. - * @param ctx the parse tree - */ - void enterShift_expression(CSharpParser.Shift_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#shift_expression}. - * @param ctx the parse tree - */ - void exitShift_expression(CSharpParser.Shift_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#additive_expression}. - * @param ctx the parse tree - */ - void enterAdditive_expression(CSharpParser.Additive_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#additive_expression}. - * @param ctx the parse tree - */ - void exitAdditive_expression(CSharpParser.Additive_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#multiplicative_expression}. - * @param ctx the parse tree - */ - void enterMultiplicative_expression(CSharpParser.Multiplicative_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#multiplicative_expression}. - * @param ctx the parse tree - */ - void exitMultiplicative_expression(CSharpParser.Multiplicative_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#switch_expression}. - * @param ctx the parse tree - */ - void enterSwitch_expression(CSharpParser.Switch_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#switch_expression}. - * @param ctx the parse tree - */ - void exitSwitch_expression(CSharpParser.Switch_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#switch_expression_arms}. - * @param ctx the parse tree - */ - void enterSwitch_expression_arms(CSharpParser.Switch_expression_armsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#switch_expression_arms}. - * @param ctx the parse tree - */ - void exitSwitch_expression_arms(CSharpParser.Switch_expression_armsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#switch_expression_arm}. - * @param ctx the parse tree - */ - void enterSwitch_expression_arm(CSharpParser.Switch_expression_armContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#switch_expression_arm}. - * @param ctx the parse tree - */ - void exitSwitch_expression_arm(CSharpParser.Switch_expression_armContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#range_expression}. - * @param ctx the parse tree - */ - void enterRange_expression(CSharpParser.Range_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#range_expression}. - * @param ctx the parse tree - */ - void exitRange_expression(CSharpParser.Range_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#unary_expression}. - * @param ctx the parse tree - */ - void enterUnary_expression(CSharpParser.Unary_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#unary_expression}. - * @param ctx the parse tree - */ - void exitUnary_expression(CSharpParser.Unary_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#primary_expression}. - * @param ctx the parse tree - */ - void enterPrimary_expression(CSharpParser.Primary_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#primary_expression}. - * @param ctx the parse tree - */ - void exitPrimary_expression(CSharpParser.Primary_expressionContext ctx); - /** - * Enter a parse tree produced by the {@code literalExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterLiteralExpression(CSharpParser.LiteralExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code literalExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitLiteralExpression(CSharpParser.LiteralExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code simpleNameExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterSimpleNameExpression(CSharpParser.SimpleNameExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code simpleNameExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitSimpleNameExpression(CSharpParser.SimpleNameExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code parenthesisExpressions} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterParenthesisExpressions(CSharpParser.ParenthesisExpressionsContext ctx); - /** - * Exit a parse tree produced by the {@code parenthesisExpressions} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitParenthesisExpressions(CSharpParser.ParenthesisExpressionsContext ctx); - /** - * Enter a parse tree produced by the {@code memberAccessExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterMemberAccessExpression(CSharpParser.MemberAccessExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code memberAccessExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitMemberAccessExpression(CSharpParser.MemberAccessExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code literalAccessExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterLiteralAccessExpression(CSharpParser.LiteralAccessExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code literalAccessExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitLiteralAccessExpression(CSharpParser.LiteralAccessExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code thisReferenceExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterThisReferenceExpression(CSharpParser.ThisReferenceExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code thisReferenceExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitThisReferenceExpression(CSharpParser.ThisReferenceExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code baseAccessExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterBaseAccessExpression(CSharpParser.BaseAccessExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code baseAccessExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitBaseAccessExpression(CSharpParser.BaseAccessExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code objectCreationExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterObjectCreationExpression(CSharpParser.ObjectCreationExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code objectCreationExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitObjectCreationExpression(CSharpParser.ObjectCreationExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code tupleExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterTupleExpression(CSharpParser.TupleExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code tupleExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitTupleExpression(CSharpParser.TupleExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code typeofExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterTypeofExpression(CSharpParser.TypeofExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code typeofExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitTypeofExpression(CSharpParser.TypeofExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code checkedExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterCheckedExpression(CSharpParser.CheckedExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code checkedExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitCheckedExpression(CSharpParser.CheckedExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code uncheckedExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterUncheckedExpression(CSharpParser.UncheckedExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code uncheckedExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitUncheckedExpression(CSharpParser.UncheckedExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code defaultValueExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterDefaultValueExpression(CSharpParser.DefaultValueExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code defaultValueExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitDefaultValueExpression(CSharpParser.DefaultValueExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code anonymousMethodExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterAnonymousMethodExpression(CSharpParser.AnonymousMethodExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code anonymousMethodExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitAnonymousMethodExpression(CSharpParser.AnonymousMethodExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code sizeofExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterSizeofExpression(CSharpParser.SizeofExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code sizeofExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitSizeofExpression(CSharpParser.SizeofExpressionContext ctx); - /** - * Enter a parse tree produced by the {@code nameofExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void enterNameofExpression(CSharpParser.NameofExpressionContext ctx); - /** - * Exit a parse tree produced by the {@code nameofExpression} - * labeled alternative in {@link CSharpParser#primary_expression_start}. - * @param ctx the parse tree - */ - void exitNameofExpression(CSharpParser.NameofExpressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#throwable_expression}. - * @param ctx the parse tree - */ - void enterThrowable_expression(CSharpParser.Throwable_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#throwable_expression}. - * @param ctx the parse tree - */ - void exitThrowable_expression(CSharpParser.Throwable_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#throw_expression}. - * @param ctx the parse tree - */ - void enterThrow_expression(CSharpParser.Throw_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#throw_expression}. - * @param ctx the parse tree - */ - void exitThrow_expression(CSharpParser.Throw_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#member_access}. - * @param ctx the parse tree - */ - void enterMember_access(CSharpParser.Member_accessContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#member_access}. - * @param ctx the parse tree - */ - void exitMember_access(CSharpParser.Member_accessContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#bracket_expression}. - * @param ctx the parse tree - */ - void enterBracket_expression(CSharpParser.Bracket_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#bracket_expression}. - * @param ctx the parse tree - */ - void exitBracket_expression(CSharpParser.Bracket_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#indexer_argument}. - * @param ctx the parse tree - */ - void enterIndexer_argument(CSharpParser.Indexer_argumentContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#indexer_argument}. - * @param ctx the parse tree - */ - void exitIndexer_argument(CSharpParser.Indexer_argumentContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#predefined_type}. - * @param ctx the parse tree - */ - void enterPredefined_type(CSharpParser.Predefined_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#predefined_type}. - * @param ctx the parse tree - */ - void exitPredefined_type(CSharpParser.Predefined_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#expression_list}. - * @param ctx the parse tree - */ - void enterExpression_list(CSharpParser.Expression_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#expression_list}. - * @param ctx the parse tree - */ - void exitExpression_list(CSharpParser.Expression_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#object_or_collection_initializer}. - * @param ctx the parse tree - */ - void enterObject_or_collection_initializer(CSharpParser.Object_or_collection_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#object_or_collection_initializer}. - * @param ctx the parse tree - */ - void exitObject_or_collection_initializer(CSharpParser.Object_or_collection_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#object_initializer}. - * @param ctx the parse tree - */ - void enterObject_initializer(CSharpParser.Object_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#object_initializer}. - * @param ctx the parse tree - */ - void exitObject_initializer(CSharpParser.Object_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#member_initializer_list}. - * @param ctx the parse tree - */ - void enterMember_initializer_list(CSharpParser.Member_initializer_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#member_initializer_list}. - * @param ctx the parse tree - */ - void exitMember_initializer_list(CSharpParser.Member_initializer_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#member_initializer}. - * @param ctx the parse tree - */ - void enterMember_initializer(CSharpParser.Member_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#member_initializer}. - * @param ctx the parse tree - */ - void exitMember_initializer(CSharpParser.Member_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#initializer_value}. - * @param ctx the parse tree - */ - void enterInitializer_value(CSharpParser.Initializer_valueContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#initializer_value}. - * @param ctx the parse tree - */ - void exitInitializer_value(CSharpParser.Initializer_valueContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#collection_initializer}. - * @param ctx the parse tree - */ - void enterCollection_initializer(CSharpParser.Collection_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#collection_initializer}. - * @param ctx the parse tree - */ - void exitCollection_initializer(CSharpParser.Collection_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#element_initializer}. - * @param ctx the parse tree - */ - void enterElement_initializer(CSharpParser.Element_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#element_initializer}. - * @param ctx the parse tree - */ - void exitElement_initializer(CSharpParser.Element_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#anonymous_object_initializer}. - * @param ctx the parse tree - */ - void enterAnonymous_object_initializer(CSharpParser.Anonymous_object_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#anonymous_object_initializer}. - * @param ctx the parse tree - */ - void exitAnonymous_object_initializer(CSharpParser.Anonymous_object_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#member_declarator_list}. - * @param ctx the parse tree - */ - void enterMember_declarator_list(CSharpParser.Member_declarator_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#member_declarator_list}. - * @param ctx the parse tree - */ - void exitMember_declarator_list(CSharpParser.Member_declarator_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#member_declarator}. - * @param ctx the parse tree - */ - void enterMember_declarator(CSharpParser.Member_declaratorContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#member_declarator}. - * @param ctx the parse tree - */ - void exitMember_declarator(CSharpParser.Member_declaratorContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#unbound_type_name}. - * @param ctx the parse tree - */ - void enterUnbound_type_name(CSharpParser.Unbound_type_nameContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#unbound_type_name}. - * @param ctx the parse tree - */ - void exitUnbound_type_name(CSharpParser.Unbound_type_nameContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#generic_dimension_specifier}. - * @param ctx the parse tree - */ - void enterGeneric_dimension_specifier(CSharpParser.Generic_dimension_specifierContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#generic_dimension_specifier}. - * @param ctx the parse tree - */ - void exitGeneric_dimension_specifier(CSharpParser.Generic_dimension_specifierContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#isType}. - * @param ctx the parse tree - */ - void enterIsType(CSharpParser.IsTypeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#isType}. - * @param ctx the parse tree - */ - void exitIsType(CSharpParser.IsTypeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#isTypePatternArms}. - * @param ctx the parse tree - */ - void enterIsTypePatternArms(CSharpParser.IsTypePatternArmsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#isTypePatternArms}. - * @param ctx the parse tree - */ - void exitIsTypePatternArms(CSharpParser.IsTypePatternArmsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#isTypePatternArm}. - * @param ctx the parse tree - */ - void enterIsTypePatternArm(CSharpParser.IsTypePatternArmContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#isTypePatternArm}. - * @param ctx the parse tree - */ - void exitIsTypePatternArm(CSharpParser.IsTypePatternArmContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#lambda_expression}. - * @param ctx the parse tree - */ - void enterLambda_expression(CSharpParser.Lambda_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#lambda_expression}. - * @param ctx the parse tree - */ - void exitLambda_expression(CSharpParser.Lambda_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#anonymous_function_signature}. - * @param ctx the parse tree - */ - void enterAnonymous_function_signature(CSharpParser.Anonymous_function_signatureContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#anonymous_function_signature}. - * @param ctx the parse tree - */ - void exitAnonymous_function_signature(CSharpParser.Anonymous_function_signatureContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#explicit_anonymous_function_parameter_list}. - * @param ctx the parse tree - */ - void enterExplicit_anonymous_function_parameter_list(CSharpParser.Explicit_anonymous_function_parameter_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#explicit_anonymous_function_parameter_list}. - * @param ctx the parse tree - */ - void exitExplicit_anonymous_function_parameter_list(CSharpParser.Explicit_anonymous_function_parameter_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#explicit_anonymous_function_parameter}. - * @param ctx the parse tree - */ - void enterExplicit_anonymous_function_parameter(CSharpParser.Explicit_anonymous_function_parameterContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#explicit_anonymous_function_parameter}. - * @param ctx the parse tree - */ - void exitExplicit_anonymous_function_parameter(CSharpParser.Explicit_anonymous_function_parameterContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#implicit_anonymous_function_parameter_list}. - * @param ctx the parse tree - */ - void enterImplicit_anonymous_function_parameter_list(CSharpParser.Implicit_anonymous_function_parameter_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#implicit_anonymous_function_parameter_list}. - * @param ctx the parse tree - */ - void exitImplicit_anonymous_function_parameter_list(CSharpParser.Implicit_anonymous_function_parameter_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#anonymous_function_body}. - * @param ctx the parse tree - */ - void enterAnonymous_function_body(CSharpParser.Anonymous_function_bodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#anonymous_function_body}. - * @param ctx the parse tree - */ - void exitAnonymous_function_body(CSharpParser.Anonymous_function_bodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#query_expression}. - * @param ctx the parse tree - */ - void enterQuery_expression(CSharpParser.Query_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#query_expression}. - * @param ctx the parse tree - */ - void exitQuery_expression(CSharpParser.Query_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#from_clause}. - * @param ctx the parse tree - */ - void enterFrom_clause(CSharpParser.From_clauseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#from_clause}. - * @param ctx the parse tree - */ - void exitFrom_clause(CSharpParser.From_clauseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#query_body}. - * @param ctx the parse tree - */ - void enterQuery_body(CSharpParser.Query_bodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#query_body}. - * @param ctx the parse tree - */ - void exitQuery_body(CSharpParser.Query_bodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#query_body_clause}. - * @param ctx the parse tree - */ - void enterQuery_body_clause(CSharpParser.Query_body_clauseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#query_body_clause}. - * @param ctx the parse tree - */ - void exitQuery_body_clause(CSharpParser.Query_body_clauseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#let_clause}. - * @param ctx the parse tree - */ - void enterLet_clause(CSharpParser.Let_clauseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#let_clause}. - * @param ctx the parse tree - */ - void exitLet_clause(CSharpParser.Let_clauseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#where_clause}. - * @param ctx the parse tree - */ - void enterWhere_clause(CSharpParser.Where_clauseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#where_clause}. - * @param ctx the parse tree - */ - void exitWhere_clause(CSharpParser.Where_clauseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#combined_join_clause}. - * @param ctx the parse tree - */ - void enterCombined_join_clause(CSharpParser.Combined_join_clauseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#combined_join_clause}. - * @param ctx the parse tree - */ - void exitCombined_join_clause(CSharpParser.Combined_join_clauseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#orderby_clause}. - * @param ctx the parse tree - */ - void enterOrderby_clause(CSharpParser.Orderby_clauseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#orderby_clause}. - * @param ctx the parse tree - */ - void exitOrderby_clause(CSharpParser.Orderby_clauseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#ordering}. - * @param ctx the parse tree - */ - void enterOrdering(CSharpParser.OrderingContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#ordering}. - * @param ctx the parse tree - */ - void exitOrdering(CSharpParser.OrderingContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#select_or_group_clause}. - * @param ctx the parse tree - */ - void enterSelect_or_group_clause(CSharpParser.Select_or_group_clauseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#select_or_group_clause}. - * @param ctx the parse tree - */ - void exitSelect_or_group_clause(CSharpParser.Select_or_group_clauseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#query_continuation}. - * @param ctx the parse tree - */ - void enterQuery_continuation(CSharpParser.Query_continuationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#query_continuation}. - * @param ctx the parse tree - */ - void exitQuery_continuation(CSharpParser.Query_continuationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#statement}. - * @param ctx the parse tree - */ - void enterStatement(CSharpParser.StatementContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#statement}. - * @param ctx the parse tree - */ - void exitStatement(CSharpParser.StatementContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#declarationStatement}. - * @param ctx the parse tree - */ - void enterDeclarationStatement(CSharpParser.DeclarationStatementContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#declarationStatement}. - * @param ctx the parse tree - */ - void exitDeclarationStatement(CSharpParser.DeclarationStatementContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#local_function_declaration}. - * @param ctx the parse tree - */ - void enterLocal_function_declaration(CSharpParser.Local_function_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#local_function_declaration}. - * @param ctx the parse tree - */ - void exitLocal_function_declaration(CSharpParser.Local_function_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#local_function_header}. - * @param ctx the parse tree - */ - void enterLocal_function_header(CSharpParser.Local_function_headerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#local_function_header}. - * @param ctx the parse tree - */ - void exitLocal_function_header(CSharpParser.Local_function_headerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#local_function_modifiers}. - * @param ctx the parse tree - */ - void enterLocal_function_modifiers(CSharpParser.Local_function_modifiersContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#local_function_modifiers}. - * @param ctx the parse tree - */ - void exitLocal_function_modifiers(CSharpParser.Local_function_modifiersContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#local_function_body}. - * @param ctx the parse tree - */ - void enterLocal_function_body(CSharpParser.Local_function_bodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#local_function_body}. - * @param ctx the parse tree - */ - void exitLocal_function_body(CSharpParser.Local_function_bodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#labeled_Statement}. - * @param ctx the parse tree - */ - void enterLabeled_Statement(CSharpParser.Labeled_StatementContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#labeled_Statement}. - * @param ctx the parse tree - */ - void exitLabeled_Statement(CSharpParser.Labeled_StatementContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#embedded_statement}. - * @param ctx the parse tree - */ - void enterEmbedded_statement(CSharpParser.Embedded_statementContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#embedded_statement}. - * @param ctx the parse tree - */ - void exitEmbedded_statement(CSharpParser.Embedded_statementContext ctx); - /** - * Enter a parse tree produced by the {@code theEmptyStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterTheEmptyStatement(CSharpParser.TheEmptyStatementContext ctx); - /** - * Exit a parse tree produced by the {@code theEmptyStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitTheEmptyStatement(CSharpParser.TheEmptyStatementContext ctx); - /** - * Enter a parse tree produced by the {@code expressionStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterExpressionStatement(CSharpParser.ExpressionStatementContext ctx); - /** - * Exit a parse tree produced by the {@code expressionStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitExpressionStatement(CSharpParser.ExpressionStatementContext ctx); - /** - * Enter a parse tree produced by the {@code ifStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterIfStatement(CSharpParser.IfStatementContext ctx); - /** - * Exit a parse tree produced by the {@code ifStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitIfStatement(CSharpParser.IfStatementContext ctx); - /** - * Enter a parse tree produced by the {@code switchStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterSwitchStatement(CSharpParser.SwitchStatementContext ctx); - /** - * Exit a parse tree produced by the {@code switchStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitSwitchStatement(CSharpParser.SwitchStatementContext ctx); - /** - * Enter a parse tree produced by the {@code whileStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterWhileStatement(CSharpParser.WhileStatementContext ctx); - /** - * Exit a parse tree produced by the {@code whileStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitWhileStatement(CSharpParser.WhileStatementContext ctx); - /** - * Enter a parse tree produced by the {@code doStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterDoStatement(CSharpParser.DoStatementContext ctx); - /** - * Exit a parse tree produced by the {@code doStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitDoStatement(CSharpParser.DoStatementContext ctx); - /** - * Enter a parse tree produced by the {@code forStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterForStatement(CSharpParser.ForStatementContext ctx); - /** - * Exit a parse tree produced by the {@code forStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitForStatement(CSharpParser.ForStatementContext ctx); - /** - * Enter a parse tree produced by the {@code foreachStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterForeachStatement(CSharpParser.ForeachStatementContext ctx); - /** - * Exit a parse tree produced by the {@code foreachStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitForeachStatement(CSharpParser.ForeachStatementContext ctx); - /** - * Enter a parse tree produced by the {@code breakStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterBreakStatement(CSharpParser.BreakStatementContext ctx); - /** - * Exit a parse tree produced by the {@code breakStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitBreakStatement(CSharpParser.BreakStatementContext ctx); - /** - * Enter a parse tree produced by the {@code continueStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterContinueStatement(CSharpParser.ContinueStatementContext ctx); - /** - * Exit a parse tree produced by the {@code continueStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitContinueStatement(CSharpParser.ContinueStatementContext ctx); - /** - * Enter a parse tree produced by the {@code gotoStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterGotoStatement(CSharpParser.GotoStatementContext ctx); - /** - * Exit a parse tree produced by the {@code gotoStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitGotoStatement(CSharpParser.GotoStatementContext ctx); - /** - * Enter a parse tree produced by the {@code returnStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterReturnStatement(CSharpParser.ReturnStatementContext ctx); - /** - * Exit a parse tree produced by the {@code returnStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitReturnStatement(CSharpParser.ReturnStatementContext ctx); - /** - * Enter a parse tree produced by the {@code throwStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterThrowStatement(CSharpParser.ThrowStatementContext ctx); - /** - * Exit a parse tree produced by the {@code throwStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitThrowStatement(CSharpParser.ThrowStatementContext ctx); - /** - * Enter a parse tree produced by the {@code tryStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterTryStatement(CSharpParser.TryStatementContext ctx); - /** - * Exit a parse tree produced by the {@code tryStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitTryStatement(CSharpParser.TryStatementContext ctx); - /** - * Enter a parse tree produced by the {@code checkedStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterCheckedStatement(CSharpParser.CheckedStatementContext ctx); - /** - * Exit a parse tree produced by the {@code checkedStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitCheckedStatement(CSharpParser.CheckedStatementContext ctx); - /** - * Enter a parse tree produced by the {@code uncheckedStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterUncheckedStatement(CSharpParser.UncheckedStatementContext ctx); - /** - * Exit a parse tree produced by the {@code uncheckedStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitUncheckedStatement(CSharpParser.UncheckedStatementContext ctx); - /** - * Enter a parse tree produced by the {@code lockStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterLockStatement(CSharpParser.LockStatementContext ctx); - /** - * Exit a parse tree produced by the {@code lockStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitLockStatement(CSharpParser.LockStatementContext ctx); - /** - * Enter a parse tree produced by the {@code usingStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterUsingStatement(CSharpParser.UsingStatementContext ctx); - /** - * Exit a parse tree produced by the {@code usingStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitUsingStatement(CSharpParser.UsingStatementContext ctx); - /** - * Enter a parse tree produced by the {@code yieldStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterYieldStatement(CSharpParser.YieldStatementContext ctx); - /** - * Exit a parse tree produced by the {@code yieldStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitYieldStatement(CSharpParser.YieldStatementContext ctx); - /** - * Enter a parse tree produced by the {@code unsafeStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterUnsafeStatement(CSharpParser.UnsafeStatementContext ctx); - /** - * Exit a parse tree produced by the {@code unsafeStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitUnsafeStatement(CSharpParser.UnsafeStatementContext ctx); - /** - * Enter a parse tree produced by the {@code fixedStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void enterFixedStatement(CSharpParser.FixedStatementContext ctx); - /** - * Exit a parse tree produced by the {@code fixedStatement} - * labeled alternative in {@link CSharpParser#simple_embedded_statement}. - * @param ctx the parse tree - */ - void exitFixedStatement(CSharpParser.FixedStatementContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#block}. - * @param ctx the parse tree - */ - void enterBlock(CSharpParser.BlockContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#block}. - * @param ctx the parse tree - */ - void exitBlock(CSharpParser.BlockContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#local_variable_declaration}. - * @param ctx the parse tree - */ - void enterLocal_variable_declaration(CSharpParser.Local_variable_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#local_variable_declaration}. - * @param ctx the parse tree - */ - void exitLocal_variable_declaration(CSharpParser.Local_variable_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#local_variable_type}. - * @param ctx the parse tree - */ - void enterLocal_variable_type(CSharpParser.Local_variable_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#local_variable_type}. - * @param ctx the parse tree - */ - void exitLocal_variable_type(CSharpParser.Local_variable_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#local_variable_declarator}. - * @param ctx the parse tree - */ - void enterLocal_variable_declarator(CSharpParser.Local_variable_declaratorContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#local_variable_declarator}. - * @param ctx the parse tree - */ - void exitLocal_variable_declarator(CSharpParser.Local_variable_declaratorContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#local_variable_initializer}. - * @param ctx the parse tree - */ - void enterLocal_variable_initializer(CSharpParser.Local_variable_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#local_variable_initializer}. - * @param ctx the parse tree - */ - void exitLocal_variable_initializer(CSharpParser.Local_variable_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#local_constant_declaration}. - * @param ctx the parse tree - */ - void enterLocal_constant_declaration(CSharpParser.Local_constant_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#local_constant_declaration}. - * @param ctx the parse tree - */ - void exitLocal_constant_declaration(CSharpParser.Local_constant_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#if_body}. - * @param ctx the parse tree - */ - void enterIf_body(CSharpParser.If_bodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#if_body}. - * @param ctx the parse tree - */ - void exitIf_body(CSharpParser.If_bodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#switch_section}. - * @param ctx the parse tree - */ - void enterSwitch_section(CSharpParser.Switch_sectionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#switch_section}. - * @param ctx the parse tree - */ - void exitSwitch_section(CSharpParser.Switch_sectionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#switch_label}. - * @param ctx the parse tree - */ - void enterSwitch_label(CSharpParser.Switch_labelContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#switch_label}. - * @param ctx the parse tree - */ - void exitSwitch_label(CSharpParser.Switch_labelContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#case_guard}. - * @param ctx the parse tree - */ - void enterCase_guard(CSharpParser.Case_guardContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#case_guard}. - * @param ctx the parse tree - */ - void exitCase_guard(CSharpParser.Case_guardContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#statement_list}. - * @param ctx the parse tree - */ - void enterStatement_list(CSharpParser.Statement_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#statement_list}. - * @param ctx the parse tree - */ - void exitStatement_list(CSharpParser.Statement_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#for_initializer}. - * @param ctx the parse tree - */ - void enterFor_initializer(CSharpParser.For_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#for_initializer}. - * @param ctx the parse tree - */ - void exitFor_initializer(CSharpParser.For_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#for_iterator}. - * @param ctx the parse tree - */ - void enterFor_iterator(CSharpParser.For_iteratorContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#for_iterator}. - * @param ctx the parse tree - */ - void exitFor_iterator(CSharpParser.For_iteratorContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#catch_clauses}. - * @param ctx the parse tree - */ - void enterCatch_clauses(CSharpParser.Catch_clausesContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#catch_clauses}. - * @param ctx the parse tree - */ - void exitCatch_clauses(CSharpParser.Catch_clausesContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#specific_catch_clause}. - * @param ctx the parse tree - */ - void enterSpecific_catch_clause(CSharpParser.Specific_catch_clauseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#specific_catch_clause}. - * @param ctx the parse tree - */ - void exitSpecific_catch_clause(CSharpParser.Specific_catch_clauseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#general_catch_clause}. - * @param ctx the parse tree - */ - void enterGeneral_catch_clause(CSharpParser.General_catch_clauseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#general_catch_clause}. - * @param ctx the parse tree - */ - void exitGeneral_catch_clause(CSharpParser.General_catch_clauseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#exception_filter}. - * @param ctx the parse tree - */ - void enterException_filter(CSharpParser.Exception_filterContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#exception_filter}. - * @param ctx the parse tree - */ - void exitException_filter(CSharpParser.Exception_filterContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#finally_clause}. - * @param ctx the parse tree - */ - void enterFinally_clause(CSharpParser.Finally_clauseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#finally_clause}. - * @param ctx the parse tree - */ - void exitFinally_clause(CSharpParser.Finally_clauseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#resource_acquisition}. - * @param ctx the parse tree - */ - void enterResource_acquisition(CSharpParser.Resource_acquisitionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#resource_acquisition}. - * @param ctx the parse tree - */ - void exitResource_acquisition(CSharpParser.Resource_acquisitionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#namespace_declaration}. - * @param ctx the parse tree - */ - void enterNamespace_declaration(CSharpParser.Namespace_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#namespace_declaration}. - * @param ctx the parse tree - */ - void exitNamespace_declaration(CSharpParser.Namespace_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#qualified_identifier}. - * @param ctx the parse tree - */ - void enterQualified_identifier(CSharpParser.Qualified_identifierContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#qualified_identifier}. - * @param ctx the parse tree - */ - void exitQualified_identifier(CSharpParser.Qualified_identifierContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#namespace_body}. - * @param ctx the parse tree - */ - void enterNamespace_body(CSharpParser.Namespace_bodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#namespace_body}. - * @param ctx the parse tree - */ - void exitNamespace_body(CSharpParser.Namespace_bodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#extern_alias_directives}. - * @param ctx the parse tree - */ - void enterExtern_alias_directives(CSharpParser.Extern_alias_directivesContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#extern_alias_directives}. - * @param ctx the parse tree - */ - void exitExtern_alias_directives(CSharpParser.Extern_alias_directivesContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#extern_alias_directive}. - * @param ctx the parse tree - */ - void enterExtern_alias_directive(CSharpParser.Extern_alias_directiveContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#extern_alias_directive}. - * @param ctx the parse tree - */ - void exitExtern_alias_directive(CSharpParser.Extern_alias_directiveContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#using_directives}. - * @param ctx the parse tree - */ - void enterUsing_directives(CSharpParser.Using_directivesContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#using_directives}. - * @param ctx the parse tree - */ - void exitUsing_directives(CSharpParser.Using_directivesContext ctx); - /** - * Enter a parse tree produced by the {@code usingAliasDirective} - * labeled alternative in {@link CSharpParser#using_directive}. - * @param ctx the parse tree - */ - void enterUsingAliasDirective(CSharpParser.UsingAliasDirectiveContext ctx); - /** - * Exit a parse tree produced by the {@code usingAliasDirective} - * labeled alternative in {@link CSharpParser#using_directive}. - * @param ctx the parse tree - */ - void exitUsingAliasDirective(CSharpParser.UsingAliasDirectiveContext ctx); - /** - * Enter a parse tree produced by the {@code usingNamespaceDirective} - * labeled alternative in {@link CSharpParser#using_directive}. - * @param ctx the parse tree - */ - void enterUsingNamespaceDirective(CSharpParser.UsingNamespaceDirectiveContext ctx); - /** - * Exit a parse tree produced by the {@code usingNamespaceDirective} - * labeled alternative in {@link CSharpParser#using_directive}. - * @param ctx the parse tree - */ - void exitUsingNamespaceDirective(CSharpParser.UsingNamespaceDirectiveContext ctx); - /** - * Enter a parse tree produced by the {@code usingStaticDirective} - * labeled alternative in {@link CSharpParser#using_directive}. - * @param ctx the parse tree - */ - void enterUsingStaticDirective(CSharpParser.UsingStaticDirectiveContext ctx); - /** - * Exit a parse tree produced by the {@code usingStaticDirective} - * labeled alternative in {@link CSharpParser#using_directive}. - * @param ctx the parse tree - */ - void exitUsingStaticDirective(CSharpParser.UsingStaticDirectiveContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#namespace_member_declarations}. - * @param ctx the parse tree - */ - void enterNamespace_member_declarations(CSharpParser.Namespace_member_declarationsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#namespace_member_declarations}. - * @param ctx the parse tree - */ - void exitNamespace_member_declarations(CSharpParser.Namespace_member_declarationsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#namespace_member_declaration}. - * @param ctx the parse tree - */ - void enterNamespace_member_declaration(CSharpParser.Namespace_member_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#namespace_member_declaration}. - * @param ctx the parse tree - */ - void exitNamespace_member_declaration(CSharpParser.Namespace_member_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#type_declaration}. - * @param ctx the parse tree - */ - void enterType_declaration(CSharpParser.Type_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#type_declaration}. - * @param ctx the parse tree - */ - void exitType_declaration(CSharpParser.Type_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#qualified_alias_member}. - * @param ctx the parse tree - */ - void enterQualified_alias_member(CSharpParser.Qualified_alias_memberContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#qualified_alias_member}. - * @param ctx the parse tree - */ - void exitQualified_alias_member(CSharpParser.Qualified_alias_memberContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#type_parameter_list}. - * @param ctx the parse tree - */ - void enterType_parameter_list(CSharpParser.Type_parameter_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#type_parameter_list}. - * @param ctx the parse tree - */ - void exitType_parameter_list(CSharpParser.Type_parameter_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#type_parameter}. - * @param ctx the parse tree - */ - void enterType_parameter(CSharpParser.Type_parameterContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#type_parameter}. - * @param ctx the parse tree - */ - void exitType_parameter(CSharpParser.Type_parameterContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#class_base}. - * @param ctx the parse tree - */ - void enterClass_base(CSharpParser.Class_baseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#class_base}. - * @param ctx the parse tree - */ - void exitClass_base(CSharpParser.Class_baseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#interface_type_list}. - * @param ctx the parse tree - */ - void enterInterface_type_list(CSharpParser.Interface_type_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#interface_type_list}. - * @param ctx the parse tree - */ - void exitInterface_type_list(CSharpParser.Interface_type_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#type_parameter_constraints_clauses}. - * @param ctx the parse tree - */ - void enterType_parameter_constraints_clauses(CSharpParser.Type_parameter_constraints_clausesContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#type_parameter_constraints_clauses}. - * @param ctx the parse tree - */ - void exitType_parameter_constraints_clauses(CSharpParser.Type_parameter_constraints_clausesContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#type_parameter_constraints_clause}. - * @param ctx the parse tree - */ - void enterType_parameter_constraints_clause(CSharpParser.Type_parameter_constraints_clauseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#type_parameter_constraints_clause}. - * @param ctx the parse tree - */ - void exitType_parameter_constraints_clause(CSharpParser.Type_parameter_constraints_clauseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#type_parameter_constraints}. - * @param ctx the parse tree - */ - void enterType_parameter_constraints(CSharpParser.Type_parameter_constraintsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#type_parameter_constraints}. - * @param ctx the parse tree - */ - void exitType_parameter_constraints(CSharpParser.Type_parameter_constraintsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#primary_constraint}. - * @param ctx the parse tree - */ - void enterPrimary_constraint(CSharpParser.Primary_constraintContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#primary_constraint}. - * @param ctx the parse tree - */ - void exitPrimary_constraint(CSharpParser.Primary_constraintContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#secondary_constraints}. - * @param ctx the parse tree - */ - void enterSecondary_constraints(CSharpParser.Secondary_constraintsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#secondary_constraints}. - * @param ctx the parse tree - */ - void exitSecondary_constraints(CSharpParser.Secondary_constraintsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#constructor_constraint}. - * @param ctx the parse tree - */ - void enterConstructor_constraint(CSharpParser.Constructor_constraintContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#constructor_constraint}. - * @param ctx the parse tree - */ - void exitConstructor_constraint(CSharpParser.Constructor_constraintContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#class_body}. - * @param ctx the parse tree - */ - void enterClass_body(CSharpParser.Class_bodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#class_body}. - * @param ctx the parse tree - */ - void exitClass_body(CSharpParser.Class_bodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#class_member_declarations}. - * @param ctx the parse tree - */ - void enterClass_member_declarations(CSharpParser.Class_member_declarationsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#class_member_declarations}. - * @param ctx the parse tree - */ - void exitClass_member_declarations(CSharpParser.Class_member_declarationsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#class_member_declaration}. - * @param ctx the parse tree - */ - void enterClass_member_declaration(CSharpParser.Class_member_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#class_member_declaration}. - * @param ctx the parse tree - */ - void exitClass_member_declaration(CSharpParser.Class_member_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#all_member_modifiers}. - * @param ctx the parse tree - */ - void enterAll_member_modifiers(CSharpParser.All_member_modifiersContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#all_member_modifiers}. - * @param ctx the parse tree - */ - void exitAll_member_modifiers(CSharpParser.All_member_modifiersContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#all_member_modifier}. - * @param ctx the parse tree - */ - void enterAll_member_modifier(CSharpParser.All_member_modifierContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#all_member_modifier}. - * @param ctx the parse tree - */ - void exitAll_member_modifier(CSharpParser.All_member_modifierContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#common_member_declaration}. - * @param ctx the parse tree - */ - void enterCommon_member_declaration(CSharpParser.Common_member_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#common_member_declaration}. - * @param ctx the parse tree - */ - void exitCommon_member_declaration(CSharpParser.Common_member_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#typed_member_declaration}. - * @param ctx the parse tree - */ - void enterTyped_member_declaration(CSharpParser.Typed_member_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#typed_member_declaration}. - * @param ctx the parse tree - */ - void exitTyped_member_declaration(CSharpParser.Typed_member_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#constant_declarators}. - * @param ctx the parse tree - */ - void enterConstant_declarators(CSharpParser.Constant_declaratorsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#constant_declarators}. - * @param ctx the parse tree - */ - void exitConstant_declarators(CSharpParser.Constant_declaratorsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#constant_declarator}. - * @param ctx the parse tree - */ - void enterConstant_declarator(CSharpParser.Constant_declaratorContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#constant_declarator}. - * @param ctx the parse tree - */ - void exitConstant_declarator(CSharpParser.Constant_declaratorContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#variable_declarators}. - * @param ctx the parse tree - */ - void enterVariable_declarators(CSharpParser.Variable_declaratorsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#variable_declarators}. - * @param ctx the parse tree - */ - void exitVariable_declarators(CSharpParser.Variable_declaratorsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#variable_declarator}. - * @param ctx the parse tree - */ - void enterVariable_declarator(CSharpParser.Variable_declaratorContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#variable_declarator}. - * @param ctx the parse tree - */ - void exitVariable_declarator(CSharpParser.Variable_declaratorContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#variable_initializer}. - * @param ctx the parse tree - */ - void enterVariable_initializer(CSharpParser.Variable_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#variable_initializer}. - * @param ctx the parse tree - */ - void exitVariable_initializer(CSharpParser.Variable_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#return_type}. - * @param ctx the parse tree - */ - void enterReturn_type(CSharpParser.Return_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#return_type}. - * @param ctx the parse tree - */ - void exitReturn_type(CSharpParser.Return_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#member_name}. - * @param ctx the parse tree - */ - void enterMember_name(CSharpParser.Member_nameContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#member_name}. - * @param ctx the parse tree - */ - void exitMember_name(CSharpParser.Member_nameContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#method_body}. - * @param ctx the parse tree - */ - void enterMethod_body(CSharpParser.Method_bodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#method_body}. - * @param ctx the parse tree - */ - void exitMethod_body(CSharpParser.Method_bodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#formal_parameter_list}. - * @param ctx the parse tree - */ - void enterFormal_parameter_list(CSharpParser.Formal_parameter_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#formal_parameter_list}. - * @param ctx the parse tree - */ - void exitFormal_parameter_list(CSharpParser.Formal_parameter_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#fixed_parameters}. - * @param ctx the parse tree - */ - void enterFixed_parameters(CSharpParser.Fixed_parametersContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#fixed_parameters}. - * @param ctx the parse tree - */ - void exitFixed_parameters(CSharpParser.Fixed_parametersContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#fixed_parameter}. - * @param ctx the parse tree - */ - void enterFixed_parameter(CSharpParser.Fixed_parameterContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#fixed_parameter}. - * @param ctx the parse tree - */ - void exitFixed_parameter(CSharpParser.Fixed_parameterContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#parameter_modifier}. - * @param ctx the parse tree - */ - void enterParameter_modifier(CSharpParser.Parameter_modifierContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#parameter_modifier}. - * @param ctx the parse tree - */ - void exitParameter_modifier(CSharpParser.Parameter_modifierContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#parameter_array}. - * @param ctx the parse tree - */ - void enterParameter_array(CSharpParser.Parameter_arrayContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#parameter_array}. - * @param ctx the parse tree - */ - void exitParameter_array(CSharpParser.Parameter_arrayContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#accessor_declarations}. - * @param ctx the parse tree - */ - void enterAccessor_declarations(CSharpParser.Accessor_declarationsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#accessor_declarations}. - * @param ctx the parse tree - */ - void exitAccessor_declarations(CSharpParser.Accessor_declarationsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#get_accessor_declaration}. - * @param ctx the parse tree - */ - void enterGet_accessor_declaration(CSharpParser.Get_accessor_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#get_accessor_declaration}. - * @param ctx the parse tree - */ - void exitGet_accessor_declaration(CSharpParser.Get_accessor_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#set_accessor_declaration}. - * @param ctx the parse tree - */ - void enterSet_accessor_declaration(CSharpParser.Set_accessor_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#set_accessor_declaration}. - * @param ctx the parse tree - */ - void exitSet_accessor_declaration(CSharpParser.Set_accessor_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#accessor_modifier}. - * @param ctx the parse tree - */ - void enterAccessor_modifier(CSharpParser.Accessor_modifierContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#accessor_modifier}. - * @param ctx the parse tree - */ - void exitAccessor_modifier(CSharpParser.Accessor_modifierContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#accessor_body}. - * @param ctx the parse tree - */ - void enterAccessor_body(CSharpParser.Accessor_bodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#accessor_body}. - * @param ctx the parse tree - */ - void exitAccessor_body(CSharpParser.Accessor_bodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#event_accessor_declarations}. - * @param ctx the parse tree - */ - void enterEvent_accessor_declarations(CSharpParser.Event_accessor_declarationsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#event_accessor_declarations}. - * @param ctx the parse tree - */ - void exitEvent_accessor_declarations(CSharpParser.Event_accessor_declarationsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#add_accessor_declaration}. - * @param ctx the parse tree - */ - void enterAdd_accessor_declaration(CSharpParser.Add_accessor_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#add_accessor_declaration}. - * @param ctx the parse tree - */ - void exitAdd_accessor_declaration(CSharpParser.Add_accessor_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#remove_accessor_declaration}. - * @param ctx the parse tree - */ - void enterRemove_accessor_declaration(CSharpParser.Remove_accessor_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#remove_accessor_declaration}. - * @param ctx the parse tree - */ - void exitRemove_accessor_declaration(CSharpParser.Remove_accessor_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#overloadable_operator}. - * @param ctx the parse tree - */ - void enterOverloadable_operator(CSharpParser.Overloadable_operatorContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#overloadable_operator}. - * @param ctx the parse tree - */ - void exitOverloadable_operator(CSharpParser.Overloadable_operatorContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#conversion_operator_declarator}. - * @param ctx the parse tree - */ - void enterConversion_operator_declarator(CSharpParser.Conversion_operator_declaratorContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#conversion_operator_declarator}. - * @param ctx the parse tree - */ - void exitConversion_operator_declarator(CSharpParser.Conversion_operator_declaratorContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#constructor_initializer}. - * @param ctx the parse tree - */ - void enterConstructor_initializer(CSharpParser.Constructor_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#constructor_initializer}. - * @param ctx the parse tree - */ - void exitConstructor_initializer(CSharpParser.Constructor_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#body}. - * @param ctx the parse tree - */ - void enterBody(CSharpParser.BodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#body}. - * @param ctx the parse tree - */ - void exitBody(CSharpParser.BodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#struct_interfaces}. - * @param ctx the parse tree - */ - void enterStruct_interfaces(CSharpParser.Struct_interfacesContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#struct_interfaces}. - * @param ctx the parse tree - */ - void exitStruct_interfaces(CSharpParser.Struct_interfacesContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#struct_body}. - * @param ctx the parse tree - */ - void enterStruct_body(CSharpParser.Struct_bodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#struct_body}. - * @param ctx the parse tree - */ - void exitStruct_body(CSharpParser.Struct_bodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#struct_member_declaration}. - * @param ctx the parse tree - */ - void enterStruct_member_declaration(CSharpParser.Struct_member_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#struct_member_declaration}. - * @param ctx the parse tree - */ - void exitStruct_member_declaration(CSharpParser.Struct_member_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#array_type}. - * @param ctx the parse tree - */ - void enterArray_type(CSharpParser.Array_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#array_type}. - * @param ctx the parse tree - */ - void exitArray_type(CSharpParser.Array_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#rank_specifier}. - * @param ctx the parse tree - */ - void enterRank_specifier(CSharpParser.Rank_specifierContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#rank_specifier}. - * @param ctx the parse tree - */ - void exitRank_specifier(CSharpParser.Rank_specifierContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#array_initializer}. - * @param ctx the parse tree - */ - void enterArray_initializer(CSharpParser.Array_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#array_initializer}. - * @param ctx the parse tree - */ - void exitArray_initializer(CSharpParser.Array_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#variant_type_parameter_list}. - * @param ctx the parse tree - */ - void enterVariant_type_parameter_list(CSharpParser.Variant_type_parameter_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#variant_type_parameter_list}. - * @param ctx the parse tree - */ - void exitVariant_type_parameter_list(CSharpParser.Variant_type_parameter_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#variant_type_parameter}. - * @param ctx the parse tree - */ - void enterVariant_type_parameter(CSharpParser.Variant_type_parameterContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#variant_type_parameter}. - * @param ctx the parse tree - */ - void exitVariant_type_parameter(CSharpParser.Variant_type_parameterContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#variance_annotation}. - * @param ctx the parse tree - */ - void enterVariance_annotation(CSharpParser.Variance_annotationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#variance_annotation}. - * @param ctx the parse tree - */ - void exitVariance_annotation(CSharpParser.Variance_annotationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#interface_base}. - * @param ctx the parse tree - */ - void enterInterface_base(CSharpParser.Interface_baseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#interface_base}. - * @param ctx the parse tree - */ - void exitInterface_base(CSharpParser.Interface_baseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#interface_body}. - * @param ctx the parse tree - */ - void enterInterface_body(CSharpParser.Interface_bodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#interface_body}. - * @param ctx the parse tree - */ - void exitInterface_body(CSharpParser.Interface_bodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#interface_member_declaration}. - * @param ctx the parse tree - */ - void enterInterface_member_declaration(CSharpParser.Interface_member_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#interface_member_declaration}. - * @param ctx the parse tree - */ - void exitInterface_member_declaration(CSharpParser.Interface_member_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#interface_accessors}. - * @param ctx the parse tree - */ - void enterInterface_accessors(CSharpParser.Interface_accessorsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#interface_accessors}. - * @param ctx the parse tree - */ - void exitInterface_accessors(CSharpParser.Interface_accessorsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#enum_base}. - * @param ctx the parse tree - */ - void enterEnum_base(CSharpParser.Enum_baseContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#enum_base}. - * @param ctx the parse tree - */ - void exitEnum_base(CSharpParser.Enum_baseContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#enum_body}. - * @param ctx the parse tree - */ - void enterEnum_body(CSharpParser.Enum_bodyContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#enum_body}. - * @param ctx the parse tree - */ - void exitEnum_body(CSharpParser.Enum_bodyContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#enum_member_declaration}. - * @param ctx the parse tree - */ - void enterEnum_member_declaration(CSharpParser.Enum_member_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#enum_member_declaration}. - * @param ctx the parse tree - */ - void exitEnum_member_declaration(CSharpParser.Enum_member_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#global_attribute_section}. - * @param ctx the parse tree - */ - void enterGlobal_attribute_section(CSharpParser.Global_attribute_sectionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#global_attribute_section}. - * @param ctx the parse tree - */ - void exitGlobal_attribute_section(CSharpParser.Global_attribute_sectionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#global_attribute_target}. - * @param ctx the parse tree - */ - void enterGlobal_attribute_target(CSharpParser.Global_attribute_targetContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#global_attribute_target}. - * @param ctx the parse tree - */ - void exitGlobal_attribute_target(CSharpParser.Global_attribute_targetContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#attributes}. - * @param ctx the parse tree - */ - void enterAttributes(CSharpParser.AttributesContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#attributes}. - * @param ctx the parse tree - */ - void exitAttributes(CSharpParser.AttributesContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#attribute_section}. - * @param ctx the parse tree - */ - void enterAttribute_section(CSharpParser.Attribute_sectionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#attribute_section}. - * @param ctx the parse tree - */ - void exitAttribute_section(CSharpParser.Attribute_sectionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#attribute_target}. - * @param ctx the parse tree - */ - void enterAttribute_target(CSharpParser.Attribute_targetContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#attribute_target}. - * @param ctx the parse tree - */ - void exitAttribute_target(CSharpParser.Attribute_targetContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#attribute_list}. - * @param ctx the parse tree - */ - void enterAttribute_list(CSharpParser.Attribute_listContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#attribute_list}. - * @param ctx the parse tree - */ - void exitAttribute_list(CSharpParser.Attribute_listContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#attribute}. - * @param ctx the parse tree - */ - void enterAttribute(CSharpParser.AttributeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#attribute}. - * @param ctx the parse tree - */ - void exitAttribute(CSharpParser.AttributeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#attribute_argument}. - * @param ctx the parse tree - */ - void enterAttribute_argument(CSharpParser.Attribute_argumentContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#attribute_argument}. - * @param ctx the parse tree - */ - void exitAttribute_argument(CSharpParser.Attribute_argumentContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#pointer_type}. - * @param ctx the parse tree - */ - void enterPointer_type(CSharpParser.Pointer_typeContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#pointer_type}. - * @param ctx the parse tree - */ - void exitPointer_type(CSharpParser.Pointer_typeContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#fixed_pointer_declarators}. - * @param ctx the parse tree - */ - void enterFixed_pointer_declarators(CSharpParser.Fixed_pointer_declaratorsContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#fixed_pointer_declarators}. - * @param ctx the parse tree - */ - void exitFixed_pointer_declarators(CSharpParser.Fixed_pointer_declaratorsContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#fixed_pointer_declarator}. - * @param ctx the parse tree - */ - void enterFixed_pointer_declarator(CSharpParser.Fixed_pointer_declaratorContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#fixed_pointer_declarator}. - * @param ctx the parse tree - */ - void exitFixed_pointer_declarator(CSharpParser.Fixed_pointer_declaratorContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#fixed_pointer_initializer}. - * @param ctx the parse tree - */ - void enterFixed_pointer_initializer(CSharpParser.Fixed_pointer_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#fixed_pointer_initializer}. - * @param ctx the parse tree - */ - void exitFixed_pointer_initializer(CSharpParser.Fixed_pointer_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#fixed_size_buffer_declarator}. - * @param ctx the parse tree - */ - void enterFixed_size_buffer_declarator(CSharpParser.Fixed_size_buffer_declaratorContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#fixed_size_buffer_declarator}. - * @param ctx the parse tree - */ - void exitFixed_size_buffer_declarator(CSharpParser.Fixed_size_buffer_declaratorContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#stackalloc_initializer}. - * @param ctx the parse tree - */ - void enterStackalloc_initializer(CSharpParser.Stackalloc_initializerContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#stackalloc_initializer}. - * @param ctx the parse tree - */ - void exitStackalloc_initializer(CSharpParser.Stackalloc_initializerContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#right_arrow}. - * @param ctx the parse tree - */ - void enterRight_arrow(CSharpParser.Right_arrowContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#right_arrow}. - * @param ctx the parse tree - */ - void exitRight_arrow(CSharpParser.Right_arrowContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#right_shift}. - * @param ctx the parse tree - */ - void enterRight_shift(CSharpParser.Right_shiftContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#right_shift}. - * @param ctx the parse tree - */ - void exitRight_shift(CSharpParser.Right_shiftContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#right_shift_assignment}. - * @param ctx the parse tree - */ - void enterRight_shift_assignment(CSharpParser.Right_shift_assignmentContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#right_shift_assignment}. - * @param ctx the parse tree - */ - void exitRight_shift_assignment(CSharpParser.Right_shift_assignmentContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#literal}. - * @param ctx the parse tree - */ - void enterLiteral(CSharpParser.LiteralContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#literal}. - * @param ctx the parse tree - */ - void exitLiteral(CSharpParser.LiteralContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#boolean_literal}. - * @param ctx the parse tree - */ - void enterBoolean_literal(CSharpParser.Boolean_literalContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#boolean_literal}. - * @param ctx the parse tree - */ - void exitBoolean_literal(CSharpParser.Boolean_literalContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#string_literal}. - * @param ctx the parse tree - */ - void enterString_literal(CSharpParser.String_literalContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#string_literal}. - * @param ctx the parse tree - */ - void exitString_literal(CSharpParser.String_literalContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#interpolated_regular_string}. - * @param ctx the parse tree - */ - void enterInterpolated_regular_string(CSharpParser.Interpolated_regular_stringContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#interpolated_regular_string}. - * @param ctx the parse tree - */ - void exitInterpolated_regular_string(CSharpParser.Interpolated_regular_stringContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#interpolated_verbatium_string}. - * @param ctx the parse tree - */ - void enterInterpolated_verbatium_string(CSharpParser.Interpolated_verbatium_stringContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#interpolated_verbatium_string}. - * @param ctx the parse tree - */ - void exitInterpolated_verbatium_string(CSharpParser.Interpolated_verbatium_stringContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#interpolated_regular_string_part}. - * @param ctx the parse tree - */ - void enterInterpolated_regular_string_part(CSharpParser.Interpolated_regular_string_partContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#interpolated_regular_string_part}. - * @param ctx the parse tree - */ - void exitInterpolated_regular_string_part(CSharpParser.Interpolated_regular_string_partContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#interpolated_verbatium_string_part}. - * @param ctx the parse tree - */ - void enterInterpolated_verbatium_string_part(CSharpParser.Interpolated_verbatium_string_partContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#interpolated_verbatium_string_part}. - * @param ctx the parse tree - */ - void exitInterpolated_verbatium_string_part(CSharpParser.Interpolated_verbatium_string_partContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#interpolated_string_expression}. - * @param ctx the parse tree - */ - void enterInterpolated_string_expression(CSharpParser.Interpolated_string_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#interpolated_string_expression}. - * @param ctx the parse tree - */ - void exitInterpolated_string_expression(CSharpParser.Interpolated_string_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#keyword}. - * @param ctx the parse tree - */ - void enterKeyword(CSharpParser.KeywordContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#keyword}. - * @param ctx the parse tree - */ - void exitKeyword(CSharpParser.KeywordContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#class_definition}. - * @param ctx the parse tree - */ - void enterClass_definition(CSharpParser.Class_definitionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#class_definition}. - * @param ctx the parse tree - */ - void exitClass_definition(CSharpParser.Class_definitionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#struct_definition}. - * @param ctx the parse tree - */ - void enterStruct_definition(CSharpParser.Struct_definitionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#struct_definition}. - * @param ctx the parse tree - */ - void exitStruct_definition(CSharpParser.Struct_definitionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#interface_definition}. - * @param ctx the parse tree - */ - void enterInterface_definition(CSharpParser.Interface_definitionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#interface_definition}. - * @param ctx the parse tree - */ - void exitInterface_definition(CSharpParser.Interface_definitionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#enum_definition}. - * @param ctx the parse tree - */ - void enterEnum_definition(CSharpParser.Enum_definitionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#enum_definition}. - * @param ctx the parse tree - */ - void exitEnum_definition(CSharpParser.Enum_definitionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#delegate_definition}. - * @param ctx the parse tree - */ - void enterDelegate_definition(CSharpParser.Delegate_definitionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#delegate_definition}. - * @param ctx the parse tree - */ - void exitDelegate_definition(CSharpParser.Delegate_definitionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#event_declaration}. - * @param ctx the parse tree - */ - void enterEvent_declaration(CSharpParser.Event_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#event_declaration}. - * @param ctx the parse tree - */ - void exitEvent_declaration(CSharpParser.Event_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#field_declaration}. - * @param ctx the parse tree - */ - void enterField_declaration(CSharpParser.Field_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#field_declaration}. - * @param ctx the parse tree - */ - void exitField_declaration(CSharpParser.Field_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#property_declaration}. - * @param ctx the parse tree - */ - void enterProperty_declaration(CSharpParser.Property_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#property_declaration}. - * @param ctx the parse tree - */ - void exitProperty_declaration(CSharpParser.Property_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#constant_declaration}. - * @param ctx the parse tree - */ - void enterConstant_declaration(CSharpParser.Constant_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#constant_declaration}. - * @param ctx the parse tree - */ - void exitConstant_declaration(CSharpParser.Constant_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#indexer_declaration}. - * @param ctx the parse tree - */ - void enterIndexer_declaration(CSharpParser.Indexer_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#indexer_declaration}. - * @param ctx the parse tree - */ - void exitIndexer_declaration(CSharpParser.Indexer_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#destructor_definition}. - * @param ctx the parse tree - */ - void enterDestructor_definition(CSharpParser.Destructor_definitionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#destructor_definition}. - * @param ctx the parse tree - */ - void exitDestructor_definition(CSharpParser.Destructor_definitionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#constructor_declaration}. - * @param ctx the parse tree - */ - void enterConstructor_declaration(CSharpParser.Constructor_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#constructor_declaration}. - * @param ctx the parse tree - */ - void exitConstructor_declaration(CSharpParser.Constructor_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#method_declaration}. - * @param ctx the parse tree - */ - void enterMethod_declaration(CSharpParser.Method_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#method_declaration}. - * @param ctx the parse tree - */ - void exitMethod_declaration(CSharpParser.Method_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#method_member_name}. - * @param ctx the parse tree - */ - void enterMethod_member_name(CSharpParser.Method_member_nameContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#method_member_name}. - * @param ctx the parse tree - */ - void exitMethod_member_name(CSharpParser.Method_member_nameContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#operator_declaration}. - * @param ctx the parse tree - */ - void enterOperator_declaration(CSharpParser.Operator_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#operator_declaration}. - * @param ctx the parse tree - */ - void exitOperator_declaration(CSharpParser.Operator_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#arg_declaration}. - * @param ctx the parse tree - */ - void enterArg_declaration(CSharpParser.Arg_declarationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#arg_declaration}. - * @param ctx the parse tree - */ - void exitArg_declaration(CSharpParser.Arg_declarationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#method_invocation}. - * @param ctx the parse tree - */ - void enterMethod_invocation(CSharpParser.Method_invocationContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#method_invocation}. - * @param ctx the parse tree - */ - void exitMethod_invocation(CSharpParser.Method_invocationContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#object_creation_expression}. - * @param ctx the parse tree - */ - void enterObject_creation_expression(CSharpParser.Object_creation_expressionContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#object_creation_expression}. - * @param ctx the parse tree - */ - void exitObject_creation_expression(CSharpParser.Object_creation_expressionContext ctx); - /** - * Enter a parse tree produced by {@link CSharpParser#identifier}. - * @param ctx the parse tree - */ - void enterIdentifier(CSharpParser.IdentifierContext ctx); - /** - * Exit a parse tree produced by {@link CSharpParser#identifier}. - * @param ctx the parse tree - */ - void exitIdentifier(CSharpParser.IdentifierContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#compilation_unit}. + * @param ctx the parse tree + */ + void enterCompilation_unit(CSharpParser.Compilation_unitContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#compilation_unit}. + * @param ctx the parse tree + */ + void exitCompilation_unit(CSharpParser.Compilation_unitContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#namespace_or_type_name}. + * @param ctx the parse tree + */ + void enterNamespace_or_type_name( + CSharpParser.Namespace_or_type_nameContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#namespace_or_type_name}. + * @param ctx the parse tree + */ + void exitNamespace_or_type_name( + CSharpParser.Namespace_or_type_nameContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#type_}. + * @param ctx the parse tree + */ + void enterType_(CSharpParser.Type_Context ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#type_}. + * @param ctx the parse tree + */ + void exitType_(CSharpParser.Type_Context ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#base_type}. + * @param ctx the parse tree + */ + void enterBase_type(CSharpParser.Base_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#base_type}. + * @param ctx the parse tree + */ + void exitBase_type(CSharpParser.Base_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#tuple_type}. + * @param ctx the parse tree + */ + void enterTuple_type(CSharpParser.Tuple_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#tuple_type}. + * @param ctx the parse tree + */ + void exitTuple_type(CSharpParser.Tuple_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#tuple_element}. + * @param ctx the parse tree + */ + void enterTuple_element(CSharpParser.Tuple_elementContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#tuple_element}. + * @param ctx the parse tree + */ + void exitTuple_element(CSharpParser.Tuple_elementContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#simple_type}. + * @param ctx the parse tree + */ + void enterSimple_type(CSharpParser.Simple_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#simple_type}. + * @param ctx the parse tree + */ + void exitSimple_type(CSharpParser.Simple_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#numeric_type}. + * @param ctx the parse tree + */ + void enterNumeric_type(CSharpParser.Numeric_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#numeric_type}. + * @param ctx the parse tree + */ + void exitNumeric_type(CSharpParser.Numeric_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#integral_type}. + * @param ctx the parse tree + */ + void enterIntegral_type(CSharpParser.Integral_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#integral_type}. + * @param ctx the parse tree + */ + void exitIntegral_type(CSharpParser.Integral_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#floating_point_type}. + * @param ctx the parse tree + */ + void enterFloating_point_type(CSharpParser.Floating_point_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#floating_point_type}. + * @param ctx the parse tree + */ + void exitFloating_point_type(CSharpParser.Floating_point_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#class_type}. + * @param ctx the parse tree + */ + void enterClass_type(CSharpParser.Class_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#class_type}. + * @param ctx the parse tree + */ + void exitClass_type(CSharpParser.Class_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#type_argument_list}. + * @param ctx the parse tree + */ + void enterType_argument_list(CSharpParser.Type_argument_listContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#type_argument_list}. + * @param ctx the parse tree + */ + void exitType_argument_list(CSharpParser.Type_argument_listContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#argument_list}. + * @param ctx the parse tree + */ + void enterArgument_list(CSharpParser.Argument_listContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#argument_list}. + * @param ctx the parse tree + */ + void exitArgument_list(CSharpParser.Argument_listContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#argument}. + * @param ctx the parse tree + */ + void enterArgument(CSharpParser.ArgumentContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#argument}. + * @param ctx the parse tree + */ + void exitArgument(CSharpParser.ArgumentContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#expression}. + * @param ctx the parse tree + */ + void enterExpression(CSharpParser.ExpressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#expression}. + * @param ctx the parse tree + */ + void exitExpression(CSharpParser.ExpressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#non_assignment_expression}. + * @param ctx the parse tree + */ + void enterNon_assignment_expression( + CSharpParser.Non_assignment_expressionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#non_assignment_expression}. + * @param ctx the parse tree + */ + void exitNon_assignment_expression( + CSharpParser.Non_assignment_expressionContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#assignment}. + * @param ctx the parse tree + */ + void enterAssignment(CSharpParser.AssignmentContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#assignment}. + * @param ctx the parse tree + */ + void exitAssignment(CSharpParser.AssignmentContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#assignment_operator}. + * @param ctx the parse tree + */ + void enterAssignment_operator(CSharpParser.Assignment_operatorContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#assignment_operator}. + * @param ctx the parse tree + */ + void exitAssignment_operator(CSharpParser.Assignment_operatorContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#conditional_expression}. + * @param ctx the parse tree + */ + void enterConditional_expression( + CSharpParser.Conditional_expressionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#conditional_expression}. + * @param ctx the parse tree + */ + void exitConditional_expression( + CSharpParser.Conditional_expressionContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#null_coalescing_expression}. + * @param ctx the parse tree + */ + void enterNull_coalescing_expression( + CSharpParser.Null_coalescing_expressionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#null_coalescing_expression}. + * @param ctx the parse tree + */ + void exitNull_coalescing_expression( + CSharpParser.Null_coalescing_expressionContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#conditional_or_expression}. + * @param ctx the parse tree + */ + void enterConditional_or_expression( + CSharpParser.Conditional_or_expressionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#conditional_or_expression}. + * @param ctx the parse tree + */ + void exitConditional_or_expression( + CSharpParser.Conditional_or_expressionContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#conditional_and_expression}. + * @param ctx the parse tree + */ + void enterConditional_and_expression( + CSharpParser.Conditional_and_expressionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#conditional_and_expression}. + * @param ctx the parse tree + */ + void exitConditional_and_expression( + CSharpParser.Conditional_and_expressionContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#inclusive_or_expression}. + * @param ctx the parse tree + */ + void enterInclusive_or_expression( + CSharpParser.Inclusive_or_expressionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#inclusive_or_expression}. + * @param ctx the parse tree + */ + void exitInclusive_or_expression( + CSharpParser.Inclusive_or_expressionContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#exclusive_or_expression}. + * @param ctx the parse tree + */ + void enterExclusive_or_expression( + CSharpParser.Exclusive_or_expressionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#exclusive_or_expression}. + * @param ctx the parse tree + */ + void exitExclusive_or_expression( + CSharpParser.Exclusive_or_expressionContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#and_expression}. + * @param ctx the parse tree + */ + void enterAnd_expression(CSharpParser.And_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#and_expression}. + * @param ctx the parse tree + */ + void exitAnd_expression(CSharpParser.And_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#equality_expression}. + * @param ctx the parse tree + */ + void enterEquality_expression(CSharpParser.Equality_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#equality_expression}. + * @param ctx the parse tree + */ + void exitEquality_expression(CSharpParser.Equality_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#relational_expression}. + * @param ctx the parse tree + */ + void enterRelational_expression( + CSharpParser.Relational_expressionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#relational_expression}. + * @param ctx the parse tree + */ + void exitRelational_expression(CSharpParser.Relational_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#shift_expression}. + * @param ctx the parse tree + */ + void enterShift_expression(CSharpParser.Shift_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#shift_expression}. + * @param ctx the parse tree + */ + void exitShift_expression(CSharpParser.Shift_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#additive_expression}. + * @param ctx the parse tree + */ + void enterAdditive_expression(CSharpParser.Additive_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#additive_expression}. + * @param ctx the parse tree + */ + void exitAdditive_expression(CSharpParser.Additive_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#multiplicative_expression}. + * @param ctx the parse tree + */ + void enterMultiplicative_expression( + CSharpParser.Multiplicative_expressionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#multiplicative_expression}. + * @param ctx the parse tree + */ + void exitMultiplicative_expression( + CSharpParser.Multiplicative_expressionContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#switch_expression}. + * @param ctx the parse tree + */ + void enterSwitch_expression(CSharpParser.Switch_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#switch_expression}. + * @param ctx the parse tree + */ + void exitSwitch_expression(CSharpParser.Switch_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#switch_expression_arms}. + * @param ctx the parse tree + */ + void enterSwitch_expression_arms( + CSharpParser.Switch_expression_armsContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#switch_expression_arms}. + * @param ctx the parse tree + */ + void exitSwitch_expression_arms( + CSharpParser.Switch_expression_armsContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#switch_expression_arm}. + * @param ctx the parse tree + */ + void enterSwitch_expression_arm( + CSharpParser.Switch_expression_armContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#switch_expression_arm}. + * @param ctx the parse tree + */ + void exitSwitch_expression_arm(CSharpParser.Switch_expression_armContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#range_expression}. + * @param ctx the parse tree + */ + void enterRange_expression(CSharpParser.Range_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#range_expression}. + * @param ctx the parse tree + */ + void exitRange_expression(CSharpParser.Range_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#unary_expression}. + * @param ctx the parse tree + */ + void enterUnary_expression(CSharpParser.Unary_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#unary_expression}. + * @param ctx the parse tree + */ + void exitUnary_expression(CSharpParser.Unary_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#primary_expression}. + * @param ctx the parse tree + */ + void enterPrimary_expression(CSharpParser.Primary_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#primary_expression}. + * @param ctx the parse tree + */ + void exitPrimary_expression(CSharpParser.Primary_expressionContext ctx); + /** + * Enter a parse tree produced by the {@code literalExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterLiteralExpression(CSharpParser.LiteralExpressionContext ctx); + /** + * Exit a parse tree produced by the {@code literalExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitLiteralExpression(CSharpParser.LiteralExpressionContext ctx); + /** + * Enter a parse tree produced by the {@code simpleNameExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterSimpleNameExpression(CSharpParser.SimpleNameExpressionContext ctx); + /** + * Exit a parse tree produced by the {@code simpleNameExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitSimpleNameExpression(CSharpParser.SimpleNameExpressionContext ctx); + /** + * Enter a parse tree produced by the {@code parenthesisExpressions} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterParenthesisExpressions( + CSharpParser.ParenthesisExpressionsContext ctx + ); + /** + * Exit a parse tree produced by the {@code parenthesisExpressions} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitParenthesisExpressions( + CSharpParser.ParenthesisExpressionsContext ctx + ); + /** + * Enter a parse tree produced by the {@code memberAccessExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterMemberAccessExpression( + CSharpParser.MemberAccessExpressionContext ctx + ); + /** + * Exit a parse tree produced by the {@code memberAccessExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitMemberAccessExpression( + CSharpParser.MemberAccessExpressionContext ctx + ); + /** + * Enter a parse tree produced by the {@code literalAccessExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterLiteralAccessExpression( + CSharpParser.LiteralAccessExpressionContext ctx + ); + /** + * Exit a parse tree produced by the {@code literalAccessExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitLiteralAccessExpression( + CSharpParser.LiteralAccessExpressionContext ctx + ); + /** + * Enter a parse tree produced by the {@code thisReferenceExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterThisReferenceExpression( + CSharpParser.ThisReferenceExpressionContext ctx + ); + /** + * Exit a parse tree produced by the {@code thisReferenceExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitThisReferenceExpression( + CSharpParser.ThisReferenceExpressionContext ctx + ); + /** + * Enter a parse tree produced by the {@code baseAccessExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterBaseAccessExpression(CSharpParser.BaseAccessExpressionContext ctx); + /** + * Exit a parse tree produced by the {@code baseAccessExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitBaseAccessExpression(CSharpParser.BaseAccessExpressionContext ctx); + /** + * Enter a parse tree produced by the {@code objectCreationExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterObjectCreationExpression( + CSharpParser.ObjectCreationExpressionContext ctx + ); + /** + * Exit a parse tree produced by the {@code objectCreationExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitObjectCreationExpression( + CSharpParser.ObjectCreationExpressionContext ctx + ); + /** + * Enter a parse tree produced by the {@code tupleExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterTupleExpression(CSharpParser.TupleExpressionContext ctx); + /** + * Exit a parse tree produced by the {@code tupleExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitTupleExpression(CSharpParser.TupleExpressionContext ctx); + /** + * Enter a parse tree produced by the {@code typeofExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterTypeofExpression(CSharpParser.TypeofExpressionContext ctx); + /** + * Exit a parse tree produced by the {@code typeofExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitTypeofExpression(CSharpParser.TypeofExpressionContext ctx); + /** + * Enter a parse tree produced by the {@code checkedExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterCheckedExpression(CSharpParser.CheckedExpressionContext ctx); + /** + * Exit a parse tree produced by the {@code checkedExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitCheckedExpression(CSharpParser.CheckedExpressionContext ctx); + /** + * Enter a parse tree produced by the {@code uncheckedExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterUncheckedExpression(CSharpParser.UncheckedExpressionContext ctx); + /** + * Exit a parse tree produced by the {@code uncheckedExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitUncheckedExpression(CSharpParser.UncheckedExpressionContext ctx); + /** + * Enter a parse tree produced by the {@code defaultValueExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterDefaultValueExpression( + CSharpParser.DefaultValueExpressionContext ctx + ); + /** + * Exit a parse tree produced by the {@code defaultValueExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitDefaultValueExpression( + CSharpParser.DefaultValueExpressionContext ctx + ); + /** + * Enter a parse tree produced by the {@code anonymousMethodExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterAnonymousMethodExpression( + CSharpParser.AnonymousMethodExpressionContext ctx + ); + /** + * Exit a parse tree produced by the {@code anonymousMethodExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitAnonymousMethodExpression( + CSharpParser.AnonymousMethodExpressionContext ctx + ); + /** + * Enter a parse tree produced by the {@code sizeofExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterSizeofExpression(CSharpParser.SizeofExpressionContext ctx); + /** + * Exit a parse tree produced by the {@code sizeofExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitSizeofExpression(CSharpParser.SizeofExpressionContext ctx); + /** + * Enter a parse tree produced by the {@code nameofExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void enterNameofExpression(CSharpParser.NameofExpressionContext ctx); + /** + * Exit a parse tree produced by the {@code nameofExpression} + * labeled alternative in {@link CSharpParser#primary_expression_start}. + * @param ctx the parse tree + */ + void exitNameofExpression(CSharpParser.NameofExpressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#throwable_expression}. + * @param ctx the parse tree + */ + void enterThrowable_expression(CSharpParser.Throwable_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#throwable_expression}. + * @param ctx the parse tree + */ + void exitThrowable_expression(CSharpParser.Throwable_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#throw_expression}. + * @param ctx the parse tree + */ + void enterThrow_expression(CSharpParser.Throw_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#throw_expression}. + * @param ctx the parse tree + */ + void exitThrow_expression(CSharpParser.Throw_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#member_access}. + * @param ctx the parse tree + */ + void enterMember_access(CSharpParser.Member_accessContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#member_access}. + * @param ctx the parse tree + */ + void exitMember_access(CSharpParser.Member_accessContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#bracket_expression}. + * @param ctx the parse tree + */ + void enterBracket_expression(CSharpParser.Bracket_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#bracket_expression}. + * @param ctx the parse tree + */ + void exitBracket_expression(CSharpParser.Bracket_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#indexer_argument}. + * @param ctx the parse tree + */ + void enterIndexer_argument(CSharpParser.Indexer_argumentContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#indexer_argument}. + * @param ctx the parse tree + */ + void exitIndexer_argument(CSharpParser.Indexer_argumentContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#predefined_type}. + * @param ctx the parse tree + */ + void enterPredefined_type(CSharpParser.Predefined_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#predefined_type}. + * @param ctx the parse tree + */ + void exitPredefined_type(CSharpParser.Predefined_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#expression_list}. + * @param ctx the parse tree + */ + void enterExpression_list(CSharpParser.Expression_listContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#expression_list}. + * @param ctx the parse tree + */ + void exitExpression_list(CSharpParser.Expression_listContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#object_or_collection_initializer}. + * @param ctx the parse tree + */ + void enterObject_or_collection_initializer( + CSharpParser.Object_or_collection_initializerContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#object_or_collection_initializer}. + * @param ctx the parse tree + */ + void exitObject_or_collection_initializer( + CSharpParser.Object_or_collection_initializerContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#object_initializer}. + * @param ctx the parse tree + */ + void enterObject_initializer(CSharpParser.Object_initializerContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#object_initializer}. + * @param ctx the parse tree + */ + void exitObject_initializer(CSharpParser.Object_initializerContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#member_initializer_list}. + * @param ctx the parse tree + */ + void enterMember_initializer_list( + CSharpParser.Member_initializer_listContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#member_initializer_list}. + * @param ctx the parse tree + */ + void exitMember_initializer_list( + CSharpParser.Member_initializer_listContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#member_initializer}. + * @param ctx the parse tree + */ + void enterMember_initializer(CSharpParser.Member_initializerContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#member_initializer}. + * @param ctx the parse tree + */ + void exitMember_initializer(CSharpParser.Member_initializerContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#initializer_value}. + * @param ctx the parse tree + */ + void enterInitializer_value(CSharpParser.Initializer_valueContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#initializer_value}. + * @param ctx the parse tree + */ + void exitInitializer_value(CSharpParser.Initializer_valueContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#collection_initializer}. + * @param ctx the parse tree + */ + void enterCollection_initializer( + CSharpParser.Collection_initializerContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#collection_initializer}. + * @param ctx the parse tree + */ + void exitCollection_initializer( + CSharpParser.Collection_initializerContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#element_initializer}. + * @param ctx the parse tree + */ + void enterElement_initializer(CSharpParser.Element_initializerContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#element_initializer}. + * @param ctx the parse tree + */ + void exitElement_initializer(CSharpParser.Element_initializerContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#anonymous_object_initializer}. + * @param ctx the parse tree + */ + void enterAnonymous_object_initializer( + CSharpParser.Anonymous_object_initializerContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#anonymous_object_initializer}. + * @param ctx the parse tree + */ + void exitAnonymous_object_initializer( + CSharpParser.Anonymous_object_initializerContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#member_declarator_list}. + * @param ctx the parse tree + */ + void enterMember_declarator_list( + CSharpParser.Member_declarator_listContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#member_declarator_list}. + * @param ctx the parse tree + */ + void exitMember_declarator_list( + CSharpParser.Member_declarator_listContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#member_declarator}. + * @param ctx the parse tree + */ + void enterMember_declarator(CSharpParser.Member_declaratorContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#member_declarator}. + * @param ctx the parse tree + */ + void exitMember_declarator(CSharpParser.Member_declaratorContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#unbound_type_name}. + * @param ctx the parse tree + */ + void enterUnbound_type_name(CSharpParser.Unbound_type_nameContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#unbound_type_name}. + * @param ctx the parse tree + */ + void exitUnbound_type_name(CSharpParser.Unbound_type_nameContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#generic_dimension_specifier}. + * @param ctx the parse tree + */ + void enterGeneric_dimension_specifier( + CSharpParser.Generic_dimension_specifierContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#generic_dimension_specifier}. + * @param ctx the parse tree + */ + void exitGeneric_dimension_specifier( + CSharpParser.Generic_dimension_specifierContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#isType}. + * @param ctx the parse tree + */ + void enterIsType(CSharpParser.IsTypeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#isType}. + * @param ctx the parse tree + */ + void exitIsType(CSharpParser.IsTypeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#isTypePatternArms}. + * @param ctx the parse tree + */ + void enterIsTypePatternArms(CSharpParser.IsTypePatternArmsContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#isTypePatternArms}. + * @param ctx the parse tree + */ + void exitIsTypePatternArms(CSharpParser.IsTypePatternArmsContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#isTypePatternArm}. + * @param ctx the parse tree + */ + void enterIsTypePatternArm(CSharpParser.IsTypePatternArmContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#isTypePatternArm}. + * @param ctx the parse tree + */ + void exitIsTypePatternArm(CSharpParser.IsTypePatternArmContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#lambda_expression}. + * @param ctx the parse tree + */ + void enterLambda_expression(CSharpParser.Lambda_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#lambda_expression}. + * @param ctx the parse tree + */ + void exitLambda_expression(CSharpParser.Lambda_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#anonymous_function_signature}. + * @param ctx the parse tree + */ + void enterAnonymous_function_signature( + CSharpParser.Anonymous_function_signatureContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#anonymous_function_signature}. + * @param ctx the parse tree + */ + void exitAnonymous_function_signature( + CSharpParser.Anonymous_function_signatureContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#explicit_anonymous_function_parameter_list}. + * @param ctx the parse tree + */ + void enterExplicit_anonymous_function_parameter_list( + CSharpParser.Explicit_anonymous_function_parameter_listContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#explicit_anonymous_function_parameter_list}. + * @param ctx the parse tree + */ + void exitExplicit_anonymous_function_parameter_list( + CSharpParser.Explicit_anonymous_function_parameter_listContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#explicit_anonymous_function_parameter}. + * @param ctx the parse tree + */ + void enterExplicit_anonymous_function_parameter( + CSharpParser.Explicit_anonymous_function_parameterContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#explicit_anonymous_function_parameter}. + * @param ctx the parse tree + */ + void exitExplicit_anonymous_function_parameter( + CSharpParser.Explicit_anonymous_function_parameterContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#implicit_anonymous_function_parameter_list}. + * @param ctx the parse tree + */ + void enterImplicit_anonymous_function_parameter_list( + CSharpParser.Implicit_anonymous_function_parameter_listContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#implicit_anonymous_function_parameter_list}. + * @param ctx the parse tree + */ + void exitImplicit_anonymous_function_parameter_list( + CSharpParser.Implicit_anonymous_function_parameter_listContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#anonymous_function_body}. + * @param ctx the parse tree + */ + void enterAnonymous_function_body( + CSharpParser.Anonymous_function_bodyContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#anonymous_function_body}. + * @param ctx the parse tree + */ + void exitAnonymous_function_body( + CSharpParser.Anonymous_function_bodyContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#query_expression}. + * @param ctx the parse tree + */ + void enterQuery_expression(CSharpParser.Query_expressionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#query_expression}. + * @param ctx the parse tree + */ + void exitQuery_expression(CSharpParser.Query_expressionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#from_clause}. + * @param ctx the parse tree + */ + void enterFrom_clause(CSharpParser.From_clauseContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#from_clause}. + * @param ctx the parse tree + */ + void exitFrom_clause(CSharpParser.From_clauseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#query_body}. + * @param ctx the parse tree + */ + void enterQuery_body(CSharpParser.Query_bodyContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#query_body}. + * @param ctx the parse tree + */ + void exitQuery_body(CSharpParser.Query_bodyContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#query_body_clause}. + * @param ctx the parse tree + */ + void enterQuery_body_clause(CSharpParser.Query_body_clauseContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#query_body_clause}. + * @param ctx the parse tree + */ + void exitQuery_body_clause(CSharpParser.Query_body_clauseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#let_clause}. + * @param ctx the parse tree + */ + void enterLet_clause(CSharpParser.Let_clauseContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#let_clause}. + * @param ctx the parse tree + */ + void exitLet_clause(CSharpParser.Let_clauseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#where_clause}. + * @param ctx the parse tree + */ + void enterWhere_clause(CSharpParser.Where_clauseContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#where_clause}. + * @param ctx the parse tree + */ + void exitWhere_clause(CSharpParser.Where_clauseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#combined_join_clause}. + * @param ctx the parse tree + */ + void enterCombined_join_clause(CSharpParser.Combined_join_clauseContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#combined_join_clause}. + * @param ctx the parse tree + */ + void exitCombined_join_clause(CSharpParser.Combined_join_clauseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#orderby_clause}. + * @param ctx the parse tree + */ + void enterOrderby_clause(CSharpParser.Orderby_clauseContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#orderby_clause}. + * @param ctx the parse tree + */ + void exitOrderby_clause(CSharpParser.Orderby_clauseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#ordering}. + * @param ctx the parse tree + */ + void enterOrdering(CSharpParser.OrderingContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#ordering}. + * @param ctx the parse tree + */ + void exitOrdering(CSharpParser.OrderingContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#select_or_group_clause}. + * @param ctx the parse tree + */ + void enterSelect_or_group_clause( + CSharpParser.Select_or_group_clauseContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#select_or_group_clause}. + * @param ctx the parse tree + */ + void exitSelect_or_group_clause( + CSharpParser.Select_or_group_clauseContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#query_continuation}. + * @param ctx the parse tree + */ + void enterQuery_continuation(CSharpParser.Query_continuationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#query_continuation}. + * @param ctx the parse tree + */ + void exitQuery_continuation(CSharpParser.Query_continuationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#statement}. + * @param ctx the parse tree + */ + void enterStatement(CSharpParser.StatementContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#statement}. + * @param ctx the parse tree + */ + void exitStatement(CSharpParser.StatementContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#declarationStatement}. + * @param ctx the parse tree + */ + void enterDeclarationStatement(CSharpParser.DeclarationStatementContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#declarationStatement}. + * @param ctx the parse tree + */ + void exitDeclarationStatement(CSharpParser.DeclarationStatementContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#local_function_declaration}. + * @param ctx the parse tree + */ + void enterLocal_function_declaration( + CSharpParser.Local_function_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#local_function_declaration}. + * @param ctx the parse tree + */ + void exitLocal_function_declaration( + CSharpParser.Local_function_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#local_function_header}. + * @param ctx the parse tree + */ + void enterLocal_function_header( + CSharpParser.Local_function_headerContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#local_function_header}. + * @param ctx the parse tree + */ + void exitLocal_function_header(CSharpParser.Local_function_headerContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#local_function_modifiers}. + * @param ctx the parse tree + */ + void enterLocal_function_modifiers( + CSharpParser.Local_function_modifiersContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#local_function_modifiers}. + * @param ctx the parse tree + */ + void exitLocal_function_modifiers( + CSharpParser.Local_function_modifiersContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#local_function_body}. + * @param ctx the parse tree + */ + void enterLocal_function_body(CSharpParser.Local_function_bodyContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#local_function_body}. + * @param ctx the parse tree + */ + void exitLocal_function_body(CSharpParser.Local_function_bodyContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#labeled_Statement}. + * @param ctx the parse tree + */ + void enterLabeled_Statement(CSharpParser.Labeled_StatementContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#labeled_Statement}. + * @param ctx the parse tree + */ + void exitLabeled_Statement(CSharpParser.Labeled_StatementContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#embedded_statement}. + * @param ctx the parse tree + */ + void enterEmbedded_statement(CSharpParser.Embedded_statementContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#embedded_statement}. + * @param ctx the parse tree + */ + void exitEmbedded_statement(CSharpParser.Embedded_statementContext ctx); + /** + * Enter a parse tree produced by the {@code theEmptyStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterTheEmptyStatement(CSharpParser.TheEmptyStatementContext ctx); + /** + * Exit a parse tree produced by the {@code theEmptyStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitTheEmptyStatement(CSharpParser.TheEmptyStatementContext ctx); + /** + * Enter a parse tree produced by the {@code expressionStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterExpressionStatement(CSharpParser.ExpressionStatementContext ctx); + /** + * Exit a parse tree produced by the {@code expressionStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitExpressionStatement(CSharpParser.ExpressionStatementContext ctx); + /** + * Enter a parse tree produced by the {@code ifStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterIfStatement(CSharpParser.IfStatementContext ctx); + /** + * Exit a parse tree produced by the {@code ifStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitIfStatement(CSharpParser.IfStatementContext ctx); + /** + * Enter a parse tree produced by the {@code switchStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterSwitchStatement(CSharpParser.SwitchStatementContext ctx); + /** + * Exit a parse tree produced by the {@code switchStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitSwitchStatement(CSharpParser.SwitchStatementContext ctx); + /** + * Enter a parse tree produced by the {@code whileStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterWhileStatement(CSharpParser.WhileStatementContext ctx); + /** + * Exit a parse tree produced by the {@code whileStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitWhileStatement(CSharpParser.WhileStatementContext ctx); + /** + * Enter a parse tree produced by the {@code doStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterDoStatement(CSharpParser.DoStatementContext ctx); + /** + * Exit a parse tree produced by the {@code doStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitDoStatement(CSharpParser.DoStatementContext ctx); + /** + * Enter a parse tree produced by the {@code forStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterForStatement(CSharpParser.ForStatementContext ctx); + /** + * Exit a parse tree produced by the {@code forStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitForStatement(CSharpParser.ForStatementContext ctx); + /** + * Enter a parse tree produced by the {@code foreachStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterForeachStatement(CSharpParser.ForeachStatementContext ctx); + /** + * Exit a parse tree produced by the {@code foreachStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitForeachStatement(CSharpParser.ForeachStatementContext ctx); + /** + * Enter a parse tree produced by the {@code breakStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterBreakStatement(CSharpParser.BreakStatementContext ctx); + /** + * Exit a parse tree produced by the {@code breakStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitBreakStatement(CSharpParser.BreakStatementContext ctx); + /** + * Enter a parse tree produced by the {@code continueStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterContinueStatement(CSharpParser.ContinueStatementContext ctx); + /** + * Exit a parse tree produced by the {@code continueStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitContinueStatement(CSharpParser.ContinueStatementContext ctx); + /** + * Enter a parse tree produced by the {@code gotoStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterGotoStatement(CSharpParser.GotoStatementContext ctx); + /** + * Exit a parse tree produced by the {@code gotoStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitGotoStatement(CSharpParser.GotoStatementContext ctx); + /** + * Enter a parse tree produced by the {@code returnStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterReturnStatement(CSharpParser.ReturnStatementContext ctx); + /** + * Exit a parse tree produced by the {@code returnStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitReturnStatement(CSharpParser.ReturnStatementContext ctx); + /** + * Enter a parse tree produced by the {@code throwStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterThrowStatement(CSharpParser.ThrowStatementContext ctx); + /** + * Exit a parse tree produced by the {@code throwStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitThrowStatement(CSharpParser.ThrowStatementContext ctx); + /** + * Enter a parse tree produced by the {@code tryStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterTryStatement(CSharpParser.TryStatementContext ctx); + /** + * Exit a parse tree produced by the {@code tryStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitTryStatement(CSharpParser.TryStatementContext ctx); + /** + * Enter a parse tree produced by the {@code checkedStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterCheckedStatement(CSharpParser.CheckedStatementContext ctx); + /** + * Exit a parse tree produced by the {@code checkedStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitCheckedStatement(CSharpParser.CheckedStatementContext ctx); + /** + * Enter a parse tree produced by the {@code uncheckedStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterUncheckedStatement(CSharpParser.UncheckedStatementContext ctx); + /** + * Exit a parse tree produced by the {@code uncheckedStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitUncheckedStatement(CSharpParser.UncheckedStatementContext ctx); + /** + * Enter a parse tree produced by the {@code lockStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterLockStatement(CSharpParser.LockStatementContext ctx); + /** + * Exit a parse tree produced by the {@code lockStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitLockStatement(CSharpParser.LockStatementContext ctx); + /** + * Enter a parse tree produced by the {@code usingStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterUsingStatement(CSharpParser.UsingStatementContext ctx); + /** + * Exit a parse tree produced by the {@code usingStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitUsingStatement(CSharpParser.UsingStatementContext ctx); + /** + * Enter a parse tree produced by the {@code yieldStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterYieldStatement(CSharpParser.YieldStatementContext ctx); + /** + * Exit a parse tree produced by the {@code yieldStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitYieldStatement(CSharpParser.YieldStatementContext ctx); + /** + * Enter a parse tree produced by the {@code unsafeStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterUnsafeStatement(CSharpParser.UnsafeStatementContext ctx); + /** + * Exit a parse tree produced by the {@code unsafeStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitUnsafeStatement(CSharpParser.UnsafeStatementContext ctx); + /** + * Enter a parse tree produced by the {@code fixedStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void enterFixedStatement(CSharpParser.FixedStatementContext ctx); + /** + * Exit a parse tree produced by the {@code fixedStatement} + * labeled alternative in {@link CSharpParser#simple_embedded_statement}. + * @param ctx the parse tree + */ + void exitFixedStatement(CSharpParser.FixedStatementContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#block}. + * @param ctx the parse tree + */ + void enterBlock(CSharpParser.BlockContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#block}. + * @param ctx the parse tree + */ + void exitBlock(CSharpParser.BlockContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#local_variable_declaration}. + * @param ctx the parse tree + */ + void enterLocal_variable_declaration( + CSharpParser.Local_variable_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#local_variable_declaration}. + * @param ctx the parse tree + */ + void exitLocal_variable_declaration( + CSharpParser.Local_variable_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#local_variable_type}. + * @param ctx the parse tree + */ + void enterLocal_variable_type(CSharpParser.Local_variable_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#local_variable_type}. + * @param ctx the parse tree + */ + void exitLocal_variable_type(CSharpParser.Local_variable_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#local_variable_declarator}. + * @param ctx the parse tree + */ + void enterLocal_variable_declarator( + CSharpParser.Local_variable_declaratorContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#local_variable_declarator}. + * @param ctx the parse tree + */ + void exitLocal_variable_declarator( + CSharpParser.Local_variable_declaratorContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#local_variable_initializer}. + * @param ctx the parse tree + */ + void enterLocal_variable_initializer( + CSharpParser.Local_variable_initializerContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#local_variable_initializer}. + * @param ctx the parse tree + */ + void exitLocal_variable_initializer( + CSharpParser.Local_variable_initializerContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#local_constant_declaration}. + * @param ctx the parse tree + */ + void enterLocal_constant_declaration( + CSharpParser.Local_constant_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#local_constant_declaration}. + * @param ctx the parse tree + */ + void exitLocal_constant_declaration( + CSharpParser.Local_constant_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#if_body}. + * @param ctx the parse tree + */ + void enterIf_body(CSharpParser.If_bodyContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#if_body}. + * @param ctx the parse tree + */ + void exitIf_body(CSharpParser.If_bodyContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#switch_section}. + * @param ctx the parse tree + */ + void enterSwitch_section(CSharpParser.Switch_sectionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#switch_section}. + * @param ctx the parse tree + */ + void exitSwitch_section(CSharpParser.Switch_sectionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#switch_label}. + * @param ctx the parse tree + */ + void enterSwitch_label(CSharpParser.Switch_labelContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#switch_label}. + * @param ctx the parse tree + */ + void exitSwitch_label(CSharpParser.Switch_labelContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#case_guard}. + * @param ctx the parse tree + */ + void enterCase_guard(CSharpParser.Case_guardContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#case_guard}. + * @param ctx the parse tree + */ + void exitCase_guard(CSharpParser.Case_guardContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#statement_list}. + * @param ctx the parse tree + */ + void enterStatement_list(CSharpParser.Statement_listContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#statement_list}. + * @param ctx the parse tree + */ + void exitStatement_list(CSharpParser.Statement_listContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#for_initializer}. + * @param ctx the parse tree + */ + void enterFor_initializer(CSharpParser.For_initializerContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#for_initializer}. + * @param ctx the parse tree + */ + void exitFor_initializer(CSharpParser.For_initializerContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#for_iterator}. + * @param ctx the parse tree + */ + void enterFor_iterator(CSharpParser.For_iteratorContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#for_iterator}. + * @param ctx the parse tree + */ + void exitFor_iterator(CSharpParser.For_iteratorContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#catch_clauses}. + * @param ctx the parse tree + */ + void enterCatch_clauses(CSharpParser.Catch_clausesContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#catch_clauses}. + * @param ctx the parse tree + */ + void exitCatch_clauses(CSharpParser.Catch_clausesContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#specific_catch_clause}. + * @param ctx the parse tree + */ + void enterSpecific_catch_clause( + CSharpParser.Specific_catch_clauseContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#specific_catch_clause}. + * @param ctx the parse tree + */ + void exitSpecific_catch_clause(CSharpParser.Specific_catch_clauseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#general_catch_clause}. + * @param ctx the parse tree + */ + void enterGeneral_catch_clause(CSharpParser.General_catch_clauseContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#general_catch_clause}. + * @param ctx the parse tree + */ + void exitGeneral_catch_clause(CSharpParser.General_catch_clauseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#exception_filter}. + * @param ctx the parse tree + */ + void enterException_filter(CSharpParser.Exception_filterContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#exception_filter}. + * @param ctx the parse tree + */ + void exitException_filter(CSharpParser.Exception_filterContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#finally_clause}. + * @param ctx the parse tree + */ + void enterFinally_clause(CSharpParser.Finally_clauseContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#finally_clause}. + * @param ctx the parse tree + */ + void exitFinally_clause(CSharpParser.Finally_clauseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#resource_acquisition}. + * @param ctx the parse tree + */ + void enterResource_acquisition(CSharpParser.Resource_acquisitionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#resource_acquisition}. + * @param ctx the parse tree + */ + void exitResource_acquisition(CSharpParser.Resource_acquisitionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#namespace_declaration}. + * @param ctx the parse tree + */ + void enterNamespace_declaration( + CSharpParser.Namespace_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#namespace_declaration}. + * @param ctx the parse tree + */ + void exitNamespace_declaration(CSharpParser.Namespace_declarationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#qualified_identifier}. + * @param ctx the parse tree + */ + void enterQualified_identifier(CSharpParser.Qualified_identifierContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#qualified_identifier}. + * @param ctx the parse tree + */ + void exitQualified_identifier(CSharpParser.Qualified_identifierContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#namespace_body}. + * @param ctx the parse tree + */ + void enterNamespace_body(CSharpParser.Namespace_bodyContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#namespace_body}. + * @param ctx the parse tree + */ + void exitNamespace_body(CSharpParser.Namespace_bodyContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#extern_alias_directives}. + * @param ctx the parse tree + */ + void enterExtern_alias_directives( + CSharpParser.Extern_alias_directivesContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#extern_alias_directives}. + * @param ctx the parse tree + */ + void exitExtern_alias_directives( + CSharpParser.Extern_alias_directivesContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#extern_alias_directive}. + * @param ctx the parse tree + */ + void enterExtern_alias_directive( + CSharpParser.Extern_alias_directiveContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#extern_alias_directive}. + * @param ctx the parse tree + */ + void exitExtern_alias_directive( + CSharpParser.Extern_alias_directiveContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#using_directives}. + * @param ctx the parse tree + */ + void enterUsing_directives(CSharpParser.Using_directivesContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#using_directives}. + * @param ctx the parse tree + */ + void exitUsing_directives(CSharpParser.Using_directivesContext ctx); + /** + * Enter a parse tree produced by the {@code usingAliasDirective} + * labeled alternative in {@link CSharpParser#using_directive}. + * @param ctx the parse tree + */ + void enterUsingAliasDirective(CSharpParser.UsingAliasDirectiveContext ctx); + /** + * Exit a parse tree produced by the {@code usingAliasDirective} + * labeled alternative in {@link CSharpParser#using_directive}. + * @param ctx the parse tree + */ + void exitUsingAliasDirective(CSharpParser.UsingAliasDirectiveContext ctx); + /** + * Enter a parse tree produced by the {@code usingNamespaceDirective} + * labeled alternative in {@link CSharpParser#using_directive}. + * @param ctx the parse tree + */ + void enterUsingNamespaceDirective( + CSharpParser.UsingNamespaceDirectiveContext ctx + ); + /** + * Exit a parse tree produced by the {@code usingNamespaceDirective} + * labeled alternative in {@link CSharpParser#using_directive}. + * @param ctx the parse tree + */ + void exitUsingNamespaceDirective( + CSharpParser.UsingNamespaceDirectiveContext ctx + ); + /** + * Enter a parse tree produced by the {@code usingStaticDirective} + * labeled alternative in {@link CSharpParser#using_directive}. + * @param ctx the parse tree + */ + void enterUsingStaticDirective(CSharpParser.UsingStaticDirectiveContext ctx); + /** + * Exit a parse tree produced by the {@code usingStaticDirective} + * labeled alternative in {@link CSharpParser#using_directive}. + * @param ctx the parse tree + */ + void exitUsingStaticDirective(CSharpParser.UsingStaticDirectiveContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#namespace_member_declarations}. + * @param ctx the parse tree + */ + void enterNamespace_member_declarations( + CSharpParser.Namespace_member_declarationsContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#namespace_member_declarations}. + * @param ctx the parse tree + */ + void exitNamespace_member_declarations( + CSharpParser.Namespace_member_declarationsContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#namespace_member_declaration}. + * @param ctx the parse tree + */ + void enterNamespace_member_declaration( + CSharpParser.Namespace_member_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#namespace_member_declaration}. + * @param ctx the parse tree + */ + void exitNamespace_member_declaration( + CSharpParser.Namespace_member_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#type_declaration}. + * @param ctx the parse tree + */ + void enterType_declaration(CSharpParser.Type_declarationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#type_declaration}. + * @param ctx the parse tree + */ + void exitType_declaration(CSharpParser.Type_declarationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#qualified_alias_member}. + * @param ctx the parse tree + */ + void enterQualified_alias_member( + CSharpParser.Qualified_alias_memberContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#qualified_alias_member}. + * @param ctx the parse tree + */ + void exitQualified_alias_member( + CSharpParser.Qualified_alias_memberContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#type_parameter_list}. + * @param ctx the parse tree + */ + void enterType_parameter_list(CSharpParser.Type_parameter_listContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#type_parameter_list}. + * @param ctx the parse tree + */ + void exitType_parameter_list(CSharpParser.Type_parameter_listContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#type_parameter}. + * @param ctx the parse tree + */ + void enterType_parameter(CSharpParser.Type_parameterContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#type_parameter}. + * @param ctx the parse tree + */ + void exitType_parameter(CSharpParser.Type_parameterContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#class_base}. + * @param ctx the parse tree + */ + void enterClass_base(CSharpParser.Class_baseContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#class_base}. + * @param ctx the parse tree + */ + void exitClass_base(CSharpParser.Class_baseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#interface_type_list}. + * @param ctx the parse tree + */ + void enterInterface_type_list(CSharpParser.Interface_type_listContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#interface_type_list}. + * @param ctx the parse tree + */ + void exitInterface_type_list(CSharpParser.Interface_type_listContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#type_parameter_constraints_clauses}. + * @param ctx the parse tree + */ + void enterType_parameter_constraints_clauses( + CSharpParser.Type_parameter_constraints_clausesContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#type_parameter_constraints_clauses}. + * @param ctx the parse tree + */ + void exitType_parameter_constraints_clauses( + CSharpParser.Type_parameter_constraints_clausesContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#type_parameter_constraints_clause}. + * @param ctx the parse tree + */ + void enterType_parameter_constraints_clause( + CSharpParser.Type_parameter_constraints_clauseContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#type_parameter_constraints_clause}. + * @param ctx the parse tree + */ + void exitType_parameter_constraints_clause( + CSharpParser.Type_parameter_constraints_clauseContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#type_parameter_constraints}. + * @param ctx the parse tree + */ + void enterType_parameter_constraints( + CSharpParser.Type_parameter_constraintsContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#type_parameter_constraints}. + * @param ctx the parse tree + */ + void exitType_parameter_constraints( + CSharpParser.Type_parameter_constraintsContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#primary_constraint}. + * @param ctx the parse tree + */ + void enterPrimary_constraint(CSharpParser.Primary_constraintContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#primary_constraint}. + * @param ctx the parse tree + */ + void exitPrimary_constraint(CSharpParser.Primary_constraintContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#secondary_constraints}. + * @param ctx the parse tree + */ + void enterSecondary_constraints( + CSharpParser.Secondary_constraintsContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#secondary_constraints}. + * @param ctx the parse tree + */ + void exitSecondary_constraints(CSharpParser.Secondary_constraintsContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#constructor_constraint}. + * @param ctx the parse tree + */ + void enterConstructor_constraint( + CSharpParser.Constructor_constraintContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#constructor_constraint}. + * @param ctx the parse tree + */ + void exitConstructor_constraint( + CSharpParser.Constructor_constraintContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#class_body}. + * @param ctx the parse tree + */ + void enterClass_body(CSharpParser.Class_bodyContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#class_body}. + * @param ctx the parse tree + */ + void exitClass_body(CSharpParser.Class_bodyContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#class_member_declarations}. + * @param ctx the parse tree + */ + void enterClass_member_declarations( + CSharpParser.Class_member_declarationsContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#class_member_declarations}. + * @param ctx the parse tree + */ + void exitClass_member_declarations( + CSharpParser.Class_member_declarationsContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#class_member_declaration}. + * @param ctx the parse tree + */ + void enterClass_member_declaration( + CSharpParser.Class_member_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#class_member_declaration}. + * @param ctx the parse tree + */ + void exitClass_member_declaration( + CSharpParser.Class_member_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#all_member_modifiers}. + * @param ctx the parse tree + */ + void enterAll_member_modifiers(CSharpParser.All_member_modifiersContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#all_member_modifiers}. + * @param ctx the parse tree + */ + void exitAll_member_modifiers(CSharpParser.All_member_modifiersContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#all_member_modifier}. + * @param ctx the parse tree + */ + void enterAll_member_modifier(CSharpParser.All_member_modifierContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#all_member_modifier}. + * @param ctx the parse tree + */ + void exitAll_member_modifier(CSharpParser.All_member_modifierContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#common_member_declaration}. + * @param ctx the parse tree + */ + void enterCommon_member_declaration( + CSharpParser.Common_member_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#common_member_declaration}. + * @param ctx the parse tree + */ + void exitCommon_member_declaration( + CSharpParser.Common_member_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#typed_member_declaration}. + * @param ctx the parse tree + */ + void enterTyped_member_declaration( + CSharpParser.Typed_member_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#typed_member_declaration}. + * @param ctx the parse tree + */ + void exitTyped_member_declaration( + CSharpParser.Typed_member_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#constant_declarators}. + * @param ctx the parse tree + */ + void enterConstant_declarators(CSharpParser.Constant_declaratorsContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#constant_declarators}. + * @param ctx the parse tree + */ + void exitConstant_declarators(CSharpParser.Constant_declaratorsContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#constant_declarator}. + * @param ctx the parse tree + */ + void enterConstant_declarator(CSharpParser.Constant_declaratorContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#constant_declarator}. + * @param ctx the parse tree + */ + void exitConstant_declarator(CSharpParser.Constant_declaratorContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#variable_declarators}. + * @param ctx the parse tree + */ + void enterVariable_declarators(CSharpParser.Variable_declaratorsContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#variable_declarators}. + * @param ctx the parse tree + */ + void exitVariable_declarators(CSharpParser.Variable_declaratorsContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#variable_declarator}. + * @param ctx the parse tree + */ + void enterVariable_declarator(CSharpParser.Variable_declaratorContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#variable_declarator}. + * @param ctx the parse tree + */ + void exitVariable_declarator(CSharpParser.Variable_declaratorContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#variable_initializer}. + * @param ctx the parse tree + */ + void enterVariable_initializer(CSharpParser.Variable_initializerContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#variable_initializer}. + * @param ctx the parse tree + */ + void exitVariable_initializer(CSharpParser.Variable_initializerContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#return_type}. + * @param ctx the parse tree + */ + void enterReturn_type(CSharpParser.Return_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#return_type}. + * @param ctx the parse tree + */ + void exitReturn_type(CSharpParser.Return_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#member_name}. + * @param ctx the parse tree + */ + void enterMember_name(CSharpParser.Member_nameContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#member_name}. + * @param ctx the parse tree + */ + void exitMember_name(CSharpParser.Member_nameContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#method_body}. + * @param ctx the parse tree + */ + void enterMethod_body(CSharpParser.Method_bodyContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#method_body}. + * @param ctx the parse tree + */ + void exitMethod_body(CSharpParser.Method_bodyContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#formal_parameter_list}. + * @param ctx the parse tree + */ + void enterFormal_parameter_list( + CSharpParser.Formal_parameter_listContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#formal_parameter_list}. + * @param ctx the parse tree + */ + void exitFormal_parameter_list(CSharpParser.Formal_parameter_listContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#fixed_parameters}. + * @param ctx the parse tree + */ + void enterFixed_parameters(CSharpParser.Fixed_parametersContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#fixed_parameters}. + * @param ctx the parse tree + */ + void exitFixed_parameters(CSharpParser.Fixed_parametersContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#fixed_parameter}. + * @param ctx the parse tree + */ + void enterFixed_parameter(CSharpParser.Fixed_parameterContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#fixed_parameter}. + * @param ctx the parse tree + */ + void exitFixed_parameter(CSharpParser.Fixed_parameterContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#parameter_modifier}. + * @param ctx the parse tree + */ + void enterParameter_modifier(CSharpParser.Parameter_modifierContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#parameter_modifier}. + * @param ctx the parse tree + */ + void exitParameter_modifier(CSharpParser.Parameter_modifierContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#parameter_array}. + * @param ctx the parse tree + */ + void enterParameter_array(CSharpParser.Parameter_arrayContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#parameter_array}. + * @param ctx the parse tree + */ + void exitParameter_array(CSharpParser.Parameter_arrayContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#accessor_declarations}. + * @param ctx the parse tree + */ + void enterAccessor_declarations( + CSharpParser.Accessor_declarationsContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#accessor_declarations}. + * @param ctx the parse tree + */ + void exitAccessor_declarations(CSharpParser.Accessor_declarationsContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#get_accessor_declaration}. + * @param ctx the parse tree + */ + void enterGet_accessor_declaration( + CSharpParser.Get_accessor_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#get_accessor_declaration}. + * @param ctx the parse tree + */ + void exitGet_accessor_declaration( + CSharpParser.Get_accessor_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#set_accessor_declaration}. + * @param ctx the parse tree + */ + void enterSet_accessor_declaration( + CSharpParser.Set_accessor_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#set_accessor_declaration}. + * @param ctx the parse tree + */ + void exitSet_accessor_declaration( + CSharpParser.Set_accessor_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#accessor_modifier}. + * @param ctx the parse tree + */ + void enterAccessor_modifier(CSharpParser.Accessor_modifierContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#accessor_modifier}. + * @param ctx the parse tree + */ + void exitAccessor_modifier(CSharpParser.Accessor_modifierContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#accessor_body}. + * @param ctx the parse tree + */ + void enterAccessor_body(CSharpParser.Accessor_bodyContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#accessor_body}. + * @param ctx the parse tree + */ + void exitAccessor_body(CSharpParser.Accessor_bodyContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#event_accessor_declarations}. + * @param ctx the parse tree + */ + void enterEvent_accessor_declarations( + CSharpParser.Event_accessor_declarationsContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#event_accessor_declarations}. + * @param ctx the parse tree + */ + void exitEvent_accessor_declarations( + CSharpParser.Event_accessor_declarationsContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#add_accessor_declaration}. + * @param ctx the parse tree + */ + void enterAdd_accessor_declaration( + CSharpParser.Add_accessor_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#add_accessor_declaration}. + * @param ctx the parse tree + */ + void exitAdd_accessor_declaration( + CSharpParser.Add_accessor_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#remove_accessor_declaration}. + * @param ctx the parse tree + */ + void enterRemove_accessor_declaration( + CSharpParser.Remove_accessor_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#remove_accessor_declaration}. + * @param ctx the parse tree + */ + void exitRemove_accessor_declaration( + CSharpParser.Remove_accessor_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#overloadable_operator}. + * @param ctx the parse tree + */ + void enterOverloadable_operator( + CSharpParser.Overloadable_operatorContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#overloadable_operator}. + * @param ctx the parse tree + */ + void exitOverloadable_operator(CSharpParser.Overloadable_operatorContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#conversion_operator_declarator}. + * @param ctx the parse tree + */ + void enterConversion_operator_declarator( + CSharpParser.Conversion_operator_declaratorContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#conversion_operator_declarator}. + * @param ctx the parse tree + */ + void exitConversion_operator_declarator( + CSharpParser.Conversion_operator_declaratorContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#constructor_initializer}. + * @param ctx the parse tree + */ + void enterConstructor_initializer( + CSharpParser.Constructor_initializerContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#constructor_initializer}. + * @param ctx the parse tree + */ + void exitConstructor_initializer( + CSharpParser.Constructor_initializerContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#body}. + * @param ctx the parse tree + */ + void enterBody(CSharpParser.BodyContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#body}. + * @param ctx the parse tree + */ + void exitBody(CSharpParser.BodyContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#struct_interfaces}. + * @param ctx the parse tree + */ + void enterStruct_interfaces(CSharpParser.Struct_interfacesContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#struct_interfaces}. + * @param ctx the parse tree + */ + void exitStruct_interfaces(CSharpParser.Struct_interfacesContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#struct_body}. + * @param ctx the parse tree + */ + void enterStruct_body(CSharpParser.Struct_bodyContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#struct_body}. + * @param ctx the parse tree + */ + void exitStruct_body(CSharpParser.Struct_bodyContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#struct_member_declaration}. + * @param ctx the parse tree + */ + void enterStruct_member_declaration( + CSharpParser.Struct_member_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#struct_member_declaration}. + * @param ctx the parse tree + */ + void exitStruct_member_declaration( + CSharpParser.Struct_member_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#array_type}. + * @param ctx the parse tree + */ + void enterArray_type(CSharpParser.Array_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#array_type}. + * @param ctx the parse tree + */ + void exitArray_type(CSharpParser.Array_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#rank_specifier}. + * @param ctx the parse tree + */ + void enterRank_specifier(CSharpParser.Rank_specifierContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#rank_specifier}. + * @param ctx the parse tree + */ + void exitRank_specifier(CSharpParser.Rank_specifierContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#array_initializer}. + * @param ctx the parse tree + */ + void enterArray_initializer(CSharpParser.Array_initializerContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#array_initializer}. + * @param ctx the parse tree + */ + void exitArray_initializer(CSharpParser.Array_initializerContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#variant_type_parameter_list}. + * @param ctx the parse tree + */ + void enterVariant_type_parameter_list( + CSharpParser.Variant_type_parameter_listContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#variant_type_parameter_list}. + * @param ctx the parse tree + */ + void exitVariant_type_parameter_list( + CSharpParser.Variant_type_parameter_listContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#variant_type_parameter}. + * @param ctx the parse tree + */ + void enterVariant_type_parameter( + CSharpParser.Variant_type_parameterContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#variant_type_parameter}. + * @param ctx the parse tree + */ + void exitVariant_type_parameter( + CSharpParser.Variant_type_parameterContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#variance_annotation}. + * @param ctx the parse tree + */ + void enterVariance_annotation(CSharpParser.Variance_annotationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#variance_annotation}. + * @param ctx the parse tree + */ + void exitVariance_annotation(CSharpParser.Variance_annotationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#interface_base}. + * @param ctx the parse tree + */ + void enterInterface_base(CSharpParser.Interface_baseContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#interface_base}. + * @param ctx the parse tree + */ + void exitInterface_base(CSharpParser.Interface_baseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#interface_body}. + * @param ctx the parse tree + */ + void enterInterface_body(CSharpParser.Interface_bodyContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#interface_body}. + * @param ctx the parse tree + */ + void exitInterface_body(CSharpParser.Interface_bodyContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#interface_member_declaration}. + * @param ctx the parse tree + */ + void enterInterface_member_declaration( + CSharpParser.Interface_member_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#interface_member_declaration}. + * @param ctx the parse tree + */ + void exitInterface_member_declaration( + CSharpParser.Interface_member_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#interface_accessors}. + * @param ctx the parse tree + */ + void enterInterface_accessors(CSharpParser.Interface_accessorsContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#interface_accessors}. + * @param ctx the parse tree + */ + void exitInterface_accessors(CSharpParser.Interface_accessorsContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#enum_base}. + * @param ctx the parse tree + */ + void enterEnum_base(CSharpParser.Enum_baseContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#enum_base}. + * @param ctx the parse tree + */ + void exitEnum_base(CSharpParser.Enum_baseContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#enum_body}. + * @param ctx the parse tree + */ + void enterEnum_body(CSharpParser.Enum_bodyContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#enum_body}. + * @param ctx the parse tree + */ + void exitEnum_body(CSharpParser.Enum_bodyContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#enum_member_declaration}. + * @param ctx the parse tree + */ + void enterEnum_member_declaration( + CSharpParser.Enum_member_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#enum_member_declaration}. + * @param ctx the parse tree + */ + void exitEnum_member_declaration( + CSharpParser.Enum_member_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#global_attribute_section}. + * @param ctx the parse tree + */ + void enterGlobal_attribute_section( + CSharpParser.Global_attribute_sectionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#global_attribute_section}. + * @param ctx the parse tree + */ + void exitGlobal_attribute_section( + CSharpParser.Global_attribute_sectionContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#global_attribute_target}. + * @param ctx the parse tree + */ + void enterGlobal_attribute_target( + CSharpParser.Global_attribute_targetContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#global_attribute_target}. + * @param ctx the parse tree + */ + void exitGlobal_attribute_target( + CSharpParser.Global_attribute_targetContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#attributes}. + * @param ctx the parse tree + */ + void enterAttributes(CSharpParser.AttributesContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#attributes}. + * @param ctx the parse tree + */ + void exitAttributes(CSharpParser.AttributesContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#attribute_section}. + * @param ctx the parse tree + */ + void enterAttribute_section(CSharpParser.Attribute_sectionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#attribute_section}. + * @param ctx the parse tree + */ + void exitAttribute_section(CSharpParser.Attribute_sectionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#attribute_target}. + * @param ctx the parse tree + */ + void enterAttribute_target(CSharpParser.Attribute_targetContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#attribute_target}. + * @param ctx the parse tree + */ + void exitAttribute_target(CSharpParser.Attribute_targetContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#attribute_list}. + * @param ctx the parse tree + */ + void enterAttribute_list(CSharpParser.Attribute_listContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#attribute_list}. + * @param ctx the parse tree + */ + void exitAttribute_list(CSharpParser.Attribute_listContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#attribute}. + * @param ctx the parse tree + */ + void enterAttribute(CSharpParser.AttributeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#attribute}. + * @param ctx the parse tree + */ + void exitAttribute(CSharpParser.AttributeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#attribute_argument}. + * @param ctx the parse tree + */ + void enterAttribute_argument(CSharpParser.Attribute_argumentContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#attribute_argument}. + * @param ctx the parse tree + */ + void exitAttribute_argument(CSharpParser.Attribute_argumentContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#pointer_type}. + * @param ctx the parse tree + */ + void enterPointer_type(CSharpParser.Pointer_typeContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#pointer_type}. + * @param ctx the parse tree + */ + void exitPointer_type(CSharpParser.Pointer_typeContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#fixed_pointer_declarators}. + * @param ctx the parse tree + */ + void enterFixed_pointer_declarators( + CSharpParser.Fixed_pointer_declaratorsContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#fixed_pointer_declarators}. + * @param ctx the parse tree + */ + void exitFixed_pointer_declarators( + CSharpParser.Fixed_pointer_declaratorsContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#fixed_pointer_declarator}. + * @param ctx the parse tree + */ + void enterFixed_pointer_declarator( + CSharpParser.Fixed_pointer_declaratorContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#fixed_pointer_declarator}. + * @param ctx the parse tree + */ + void exitFixed_pointer_declarator( + CSharpParser.Fixed_pointer_declaratorContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#fixed_pointer_initializer}. + * @param ctx the parse tree + */ + void enterFixed_pointer_initializer( + CSharpParser.Fixed_pointer_initializerContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#fixed_pointer_initializer}. + * @param ctx the parse tree + */ + void exitFixed_pointer_initializer( + CSharpParser.Fixed_pointer_initializerContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#fixed_size_buffer_declarator}. + * @param ctx the parse tree + */ + void enterFixed_size_buffer_declarator( + CSharpParser.Fixed_size_buffer_declaratorContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#fixed_size_buffer_declarator}. + * @param ctx the parse tree + */ + void exitFixed_size_buffer_declarator( + CSharpParser.Fixed_size_buffer_declaratorContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#stackalloc_initializer}. + * @param ctx the parse tree + */ + void enterStackalloc_initializer( + CSharpParser.Stackalloc_initializerContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#stackalloc_initializer}. + * @param ctx the parse tree + */ + void exitStackalloc_initializer( + CSharpParser.Stackalloc_initializerContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#right_arrow}. + * @param ctx the parse tree + */ + void enterRight_arrow(CSharpParser.Right_arrowContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#right_arrow}. + * @param ctx the parse tree + */ + void exitRight_arrow(CSharpParser.Right_arrowContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#right_shift}. + * @param ctx the parse tree + */ + void enterRight_shift(CSharpParser.Right_shiftContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#right_shift}. + * @param ctx the parse tree + */ + void exitRight_shift(CSharpParser.Right_shiftContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#right_shift_assignment}. + * @param ctx the parse tree + */ + void enterRight_shift_assignment( + CSharpParser.Right_shift_assignmentContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#right_shift_assignment}. + * @param ctx the parse tree + */ + void exitRight_shift_assignment( + CSharpParser.Right_shift_assignmentContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#literal}. + * @param ctx the parse tree + */ + void enterLiteral(CSharpParser.LiteralContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#literal}. + * @param ctx the parse tree + */ + void exitLiteral(CSharpParser.LiteralContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#boolean_literal}. + * @param ctx the parse tree + */ + void enterBoolean_literal(CSharpParser.Boolean_literalContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#boolean_literal}. + * @param ctx the parse tree + */ + void exitBoolean_literal(CSharpParser.Boolean_literalContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#string_literal}. + * @param ctx the parse tree + */ + void enterString_literal(CSharpParser.String_literalContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#string_literal}. + * @param ctx the parse tree + */ + void exitString_literal(CSharpParser.String_literalContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#interpolated_regular_string}. + * @param ctx the parse tree + */ + void enterInterpolated_regular_string( + CSharpParser.Interpolated_regular_stringContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#interpolated_regular_string}. + * @param ctx the parse tree + */ + void exitInterpolated_regular_string( + CSharpParser.Interpolated_regular_stringContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#interpolated_verbatium_string}. + * @param ctx the parse tree + */ + void enterInterpolated_verbatium_string( + CSharpParser.Interpolated_verbatium_stringContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#interpolated_verbatium_string}. + * @param ctx the parse tree + */ + void exitInterpolated_verbatium_string( + CSharpParser.Interpolated_verbatium_stringContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#interpolated_regular_string_part}. + * @param ctx the parse tree + */ + void enterInterpolated_regular_string_part( + CSharpParser.Interpolated_regular_string_partContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#interpolated_regular_string_part}. + * @param ctx the parse tree + */ + void exitInterpolated_regular_string_part( + CSharpParser.Interpolated_regular_string_partContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#interpolated_verbatium_string_part}. + * @param ctx the parse tree + */ + void enterInterpolated_verbatium_string_part( + CSharpParser.Interpolated_verbatium_string_partContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#interpolated_verbatium_string_part}. + * @param ctx the parse tree + */ + void exitInterpolated_verbatium_string_part( + CSharpParser.Interpolated_verbatium_string_partContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#interpolated_string_expression}. + * @param ctx the parse tree + */ + void enterInterpolated_string_expression( + CSharpParser.Interpolated_string_expressionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#interpolated_string_expression}. + * @param ctx the parse tree + */ + void exitInterpolated_string_expression( + CSharpParser.Interpolated_string_expressionContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#keyword}. + * @param ctx the parse tree + */ + void enterKeyword(CSharpParser.KeywordContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#keyword}. + * @param ctx the parse tree + */ + void exitKeyword(CSharpParser.KeywordContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#class_definition}. + * @param ctx the parse tree + */ + void enterClass_definition(CSharpParser.Class_definitionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#class_definition}. + * @param ctx the parse tree + */ + void exitClass_definition(CSharpParser.Class_definitionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#struct_definition}. + * @param ctx the parse tree + */ + void enterStruct_definition(CSharpParser.Struct_definitionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#struct_definition}. + * @param ctx the parse tree + */ + void exitStruct_definition(CSharpParser.Struct_definitionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#interface_definition}. + * @param ctx the parse tree + */ + void enterInterface_definition(CSharpParser.Interface_definitionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#interface_definition}. + * @param ctx the parse tree + */ + void exitInterface_definition(CSharpParser.Interface_definitionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#enum_definition}. + * @param ctx the parse tree + */ + void enterEnum_definition(CSharpParser.Enum_definitionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#enum_definition}. + * @param ctx the parse tree + */ + void exitEnum_definition(CSharpParser.Enum_definitionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#delegate_definition}. + * @param ctx the parse tree + */ + void enterDelegate_definition(CSharpParser.Delegate_definitionContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#delegate_definition}. + * @param ctx the parse tree + */ + void exitDelegate_definition(CSharpParser.Delegate_definitionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#event_declaration}. + * @param ctx the parse tree + */ + void enterEvent_declaration(CSharpParser.Event_declarationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#event_declaration}. + * @param ctx the parse tree + */ + void exitEvent_declaration(CSharpParser.Event_declarationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#field_declaration}. + * @param ctx the parse tree + */ + void enterField_declaration(CSharpParser.Field_declarationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#field_declaration}. + * @param ctx the parse tree + */ + void exitField_declaration(CSharpParser.Field_declarationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#property_declaration}. + * @param ctx the parse tree + */ + void enterProperty_declaration(CSharpParser.Property_declarationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#property_declaration}. + * @param ctx the parse tree + */ + void exitProperty_declaration(CSharpParser.Property_declarationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#constant_declaration}. + * @param ctx the parse tree + */ + void enterConstant_declaration(CSharpParser.Constant_declarationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#constant_declaration}. + * @param ctx the parse tree + */ + void exitConstant_declaration(CSharpParser.Constant_declarationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#indexer_declaration}. + * @param ctx the parse tree + */ + void enterIndexer_declaration(CSharpParser.Indexer_declarationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#indexer_declaration}. + * @param ctx the parse tree + */ + void exitIndexer_declaration(CSharpParser.Indexer_declarationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#destructor_definition}. + * @param ctx the parse tree + */ + void enterDestructor_definition( + CSharpParser.Destructor_definitionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#destructor_definition}. + * @param ctx the parse tree + */ + void exitDestructor_definition(CSharpParser.Destructor_definitionContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#constructor_declaration}. + * @param ctx the parse tree + */ + void enterConstructor_declaration( + CSharpParser.Constructor_declarationContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#constructor_declaration}. + * @param ctx the parse tree + */ + void exitConstructor_declaration( + CSharpParser.Constructor_declarationContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#method_declaration}. + * @param ctx the parse tree + */ + void enterMethod_declaration(CSharpParser.Method_declarationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#method_declaration}. + * @param ctx the parse tree + */ + void exitMethod_declaration(CSharpParser.Method_declarationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#method_member_name}. + * @param ctx the parse tree + */ + void enterMethod_member_name(CSharpParser.Method_member_nameContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#method_member_name}. + * @param ctx the parse tree + */ + void exitMethod_member_name(CSharpParser.Method_member_nameContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#operator_declaration}. + * @param ctx the parse tree + */ + void enterOperator_declaration(CSharpParser.Operator_declarationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#operator_declaration}. + * @param ctx the parse tree + */ + void exitOperator_declaration(CSharpParser.Operator_declarationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#arg_declaration}. + * @param ctx the parse tree + */ + void enterArg_declaration(CSharpParser.Arg_declarationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#arg_declaration}. + * @param ctx the parse tree + */ + void exitArg_declaration(CSharpParser.Arg_declarationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#method_invocation}. + * @param ctx the parse tree + */ + void enterMethod_invocation(CSharpParser.Method_invocationContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#method_invocation}. + * @param ctx the parse tree + */ + void exitMethod_invocation(CSharpParser.Method_invocationContext ctx); + /** + * Enter a parse tree produced by {@link CSharpParser#object_creation_expression}. + * @param ctx the parse tree + */ + void enterObject_creation_expression( + CSharpParser.Object_creation_expressionContext ctx + ); + /** + * Exit a parse tree produced by {@link CSharpParser#object_creation_expression}. + * @param ctx the parse tree + */ + void exitObject_creation_expression( + CSharpParser.Object_creation_expressionContext ctx + ); + /** + * Enter a parse tree produced by {@link CSharpParser#identifier}. + * @param ctx the parse tree + */ + void enterIdentifier(CSharpParser.IdentifierContext ctx); + /** + * Exit a parse tree produced by {@link CSharpParser#identifier}. + * @param ctx the parse tree + */ + void exitIdentifier(CSharpParser.IdentifierContext ctx); } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyApiCodegenTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyApiCodegenTest.java index 9ed9f1450b..fbf8428b87 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyApiCodegenTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyApiCodegenTest.java @@ -3,12 +3,14 @@ package software.amazon.polymorph.smithydafny; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; +import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; import java.nio.file.Path; import java.util.List; import java.util.function.BiConsumer; - +import org.junit.Test; import software.amazon.polymorph.util.TestModel; import software.amazon.polymorph.util.Tokenizer; import software.amazon.polymorph.util.Tokenizer.ParseToken; @@ -18,182 +20,277 @@ import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.StructureShape; -import static org.junit.Assert.assertEquals; -import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; -import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; - // TODO: use Dafny tokenizer instead of C# tokenizer public class DafnyApiCodegenTest { - private static DafnyApiCodegen setupCodegen(final BiConsumer updater) { - final Model model = TestModel.setupModel(updater); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - return new DafnyApiCodegen(model, serviceShape, Path.of(""), Path.of(""), new Path[0], false); - } - - @Test - public void testGenerateBlobTypeDefinition() { - final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - @length(min: 1, max: 1024) - blob SomeBlob - """.formatted(SERVICE_NAMESPACE))); - final String actualCode = codegen.generateBlobTypeDefinition( - ShapeId.fromParts(SERVICE_NAMESPACE, "SomeBlob")).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize(""" - type SomeBlob = x: seq | IsValid_SomeBlob(x) witness * - predicate method IsValid_SomeBlob(x: seq) { (1 <= |x| <= 1024) } - """); - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateBoolTypeDefinition() { - final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - boolean SomeBool - """.formatted(SERVICE_NAMESPACE))); - final String actualCode = codegen.generateBoolTypeDefinition( - ShapeId.fromParts(SERVICE_NAMESPACE, "SomeBool")).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize("type SomeBool = bool"); - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateStringTypeDefinition() { - final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - @length(min: 1, max: 1024) - string SomeString - """.formatted(SERVICE_NAMESPACE))); - final String actualCode = codegen.generateStringTypeDefinition( - ShapeId.fromParts(SERVICE_NAMESPACE, "SomeString")).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize(""" - type SomeString = x: string | IsValid_SomeString(x) witness * - predicate method IsValid_SomeString(x: string) { (1 <= |x| <= 1024) } - """); - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateEnumTypeDefinition() { - final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> - modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - @enum([ - {value: "V1", name: "N1"}, - {value: "V2", name: "N2"}, - {value: "V3", name: "N3"}, - ]) - string SomeEnum - """.formatted(SERVICE_NAMESPACE))); - final String actualCode = codegen.generateEnumTypeDefinition( - ShapeId.fromParts(SERVICE_NAMESPACE, "SomeEnum")).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize("datatype SomeEnum = | N1 | N2 | N3"); - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateNumericTypeDefinitionInt() { - final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - @range(min: 1, max: 10) - integer SomeInt - """.formatted(SERVICE_NAMESPACE))); - - final String actualCode = codegen.generateNumericTypeDefinition( - ShapeId.fromParts(SERVICE_NAMESPACE, "SomeInt")).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize(""" - type SomeInt = x: int32 | IsValid_SomeInt(x) witness * - predicate method IsValid_SomeInt(x: int32) { (1 <= x <= 10) } - """); - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateNumericTypeDefinitionLong() { - final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - @range(min: 1, max: 10) - long SomeLong - """.formatted(SERVICE_NAMESPACE))); - - final String actualCode = codegen.generateNumericTypeDefinition( - ShapeId.fromParts(SERVICE_NAMESPACE, "SomeLong")).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize(""" - type SomeLong = x: int64 | IsValid_SomeLong(x) witness * - predicate method IsValid_SomeLong(x: int64) { (1 <= x <= 10) } - """); - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateListTypeDefinition() { - final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - @length(min: 1, max: 10) - list SomeList { - member: Boolean - } - """.formatted(SERVICE_NAMESPACE))); - final String actualCode = codegen.generateListTypeDefinition( - ShapeId.fromParts(SERVICE_NAMESPACE, "SomeList")).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize(""" - type SomeList = x: seq | IsValid_SomeList(x) witness * - predicate method IsValid_SomeList(x: seq) { (1 <= |x| <= 10) } - """); - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateMapTypeDefinition() { - final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - @length(min: 1, max: 10) - map SomeMap { - key: String, - value: Boolean, - } - """.formatted(SERVICE_NAMESPACE))); - final String actualCode = codegen.generateMapTypeDefinition( - ShapeId.fromParts(SERVICE_NAMESPACE, "SomeMap")).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize(""" - type SomeMap = x: map | IsValid_SomeMap(x) witness * - predicate method IsValid_SomeMap(x: map) { (1 <= |x| <= 10) } - """); - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateStructureTypeDefinition() { - final StructureShape foobarStructureShape = TestModel.setupFoobarStructureShape(); - final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addShape(foobarStructureShape)); - - final String actualCode = codegen.generateStructureTypeDefinition(foobarStructureShape.getId()).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize(""" - datatype Foobar = | Foobar( - nameonly someInt: Option := Option.None, - nameonly someString: Option := Option.None, - nameonly someBool: bool - ) - """); - assertEquals(expectedTokens, actualTokens); - } + + private static DafnyApiCodegen setupCodegen( + final BiConsumer updater + ) { + final Model model = TestModel.setupModel(updater); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + return new DafnyApiCodegen( + model, + serviceShape, + Path.of(""), + Path.of(""), + new Path[0], + false + ); + } + + @Test + public void testGenerateBlobTypeDefinition() { + final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + @length(min: 1, max: 1024) + blob SomeBlob + """.formatted(SERVICE_NAMESPACE) + ) + ); + final String actualCode = codegen + .generateBlobTypeDefinition( + ShapeId.fromParts(SERVICE_NAMESPACE, "SomeBlob") + ) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + """ + type SomeBlob = x: seq | IsValid_SomeBlob(x) witness * + predicate method IsValid_SomeBlob(x: seq) { (1 <= |x| <= 1024) } + """ + ); + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateBoolTypeDefinition() { + final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + boolean SomeBool + """.formatted(SERVICE_NAMESPACE) + ) + ); + final String actualCode = codegen + .generateBoolTypeDefinition( + ShapeId.fromParts(SERVICE_NAMESPACE, "SomeBool") + ) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + "type SomeBool = bool" + ); + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateStringTypeDefinition() { + final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + @length(min: 1, max: 1024) + string SomeString + """.formatted(SERVICE_NAMESPACE) + ) + ); + final String actualCode = codegen + .generateStringTypeDefinition( + ShapeId.fromParts(SERVICE_NAMESPACE, "SomeString") + ) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + """ + type SomeString = x: string | IsValid_SomeString(x) witness * + predicate method IsValid_SomeString(x: string) { (1 <= |x| <= 1024) } + """ + ); + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateEnumTypeDefinition() { + final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + @enum([ + {value: "V1", name: "N1"}, + {value: "V2", name: "N2"}, + {value: "V3", name: "N3"}, + ]) + string SomeEnum + """.formatted(SERVICE_NAMESPACE) + ) + ); + final String actualCode = codegen + .generateEnumTypeDefinition( + ShapeId.fromParts(SERVICE_NAMESPACE, "SomeEnum") + ) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + "datatype SomeEnum = | N1 | N2 | N3" + ); + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateNumericTypeDefinitionInt() { + final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + @range(min: 1, max: 10) + integer SomeInt + """.formatted(SERVICE_NAMESPACE) + ) + ); + + final String actualCode = codegen + .generateNumericTypeDefinition( + ShapeId.fromParts(SERVICE_NAMESPACE, "SomeInt") + ) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + """ + type SomeInt = x: int32 | IsValid_SomeInt(x) witness * + predicate method IsValid_SomeInt(x: int32) { (1 <= x <= 10) } + """ + ); + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateNumericTypeDefinitionLong() { + final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + @range(min: 1, max: 10) + long SomeLong + """.formatted(SERVICE_NAMESPACE) + ) + ); + + final String actualCode = codegen + .generateNumericTypeDefinition( + ShapeId.fromParts(SERVICE_NAMESPACE, "SomeLong") + ) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + """ + type SomeLong = x: int64 | IsValid_SomeLong(x) witness * + predicate method IsValid_SomeLong(x: int64) { (1 <= x <= 10) } + """ + ); + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateListTypeDefinition() { + final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + @length(min: 1, max: 10) + list SomeList { + member: Boolean + } + """.formatted(SERVICE_NAMESPACE) + ) + ); + final String actualCode = codegen + .generateListTypeDefinition( + ShapeId.fromParts(SERVICE_NAMESPACE, "SomeList") + ) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + """ + type SomeList = x: seq | IsValid_SomeList(x) witness * + predicate method IsValid_SomeList(x: seq) { (1 <= |x| <= 10) } + """ + ); + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateMapTypeDefinition() { + final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + @length(min: 1, max: 10) + map SomeMap { + key: String, + value: Boolean, + } + """.formatted(SERVICE_NAMESPACE) + ) + ); + final String actualCode = codegen + .generateMapTypeDefinition( + ShapeId.fromParts(SERVICE_NAMESPACE, "SomeMap") + ) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + """ + type SomeMap = x: map | IsValid_SomeMap(x) witness * + predicate method IsValid_SomeMap(x: map) { (1 <= |x| <= 10) } + """ + ); + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateStructureTypeDefinition() { + final StructureShape foobarStructureShape = + TestModel.setupFoobarStructureShape(); + final DafnyApiCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addShape(foobarStructureShape) + ); + + final String actualCode = codegen + .generateStructureTypeDefinition(foobarStructureShape.getId()) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + """ + datatype Foobar = | Foobar( + nameonly someInt: Option := Option.None, + nameonly someString: Option := Option.None, + nameonly someBool: bool + ) + """ + ); + assertEquals(expectedTokens, actualTokens); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyVersionCompareToTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyVersionCompareToTest.java index c99e7fa03d..d6fc75b470 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyVersionCompareToTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyVersionCompareToTest.java @@ -2,51 +2,52 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithydafny; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; +import static org.junit.Assert.assertEquals; import java.util.Arrays; import java.util.Collection; - -import static org.junit.Assert.assertEquals; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; @RunWith(Parameterized.class) public class DafnyVersionCompareToTest { - @Parameterized.Parameters(name = "{0} compareTo {1} == {2}") - public static Collection data() { - return Arrays.asList(new Object[][] { - { "4.1", "4", 1 }, - { "4.0", "4", 0 }, - { "4", "4.0.0", 0 }, - { "4.1.3", "4", 1 }, - { "3.11", "4", -1 }, - { "4.1", "4", 1 }, - { "4.1.1", "4.1.2", -1 }, - { "4.1.1", "4.1.1", 0 }, - { "4.1.2", "4.1.1", 1 }, - { "4-alpha", "4", -1 }, - { "4-alpha", "4.0", -1 }, - { "4-alpha", "4-alpha", 0 }, - { "4-alpha", "4-beta", -1 }, - }); - } - - public DafnyVersionCompareToTest(String lhs, String rhs, int expected) { - this.lhs = lhs; - this.rhs = rhs; - this.expected = expected; - } - - private final String lhs; - private final String rhs; - private final int expected; - - @Test - public void testCompareTo() { - DafnyVersion left = DafnyVersion.parse(lhs); - DafnyVersion right = DafnyVersion.parse(rhs); - assertEquals(expected, left.compareTo(right)); - } + @Parameterized.Parameters(name = "{0} compareTo {1} == {2}") + public static Collection data() { + return Arrays.asList( + new Object[][] { + { "4.1", "4", 1 }, + { "4.0", "4", 0 }, + { "4", "4.0.0", 0 }, + { "4.1.3", "4", 1 }, + { "3.11", "4", -1 }, + { "4.1", "4", 1 }, + { "4.1.1", "4.1.2", -1 }, + { "4.1.1", "4.1.1", 0 }, + { "4.1.2", "4.1.1", 1 }, + { "4-alpha", "4", -1 }, + { "4-alpha", "4.0", -1 }, + { "4-alpha", "4-alpha", 0 }, + { "4-alpha", "4-beta", -1 }, + } + ); + } + + public DafnyVersionCompareToTest(String lhs, String rhs, int expected) { + this.lhs = lhs; + this.rhs = rhs; + this.expected = expected; + } + + private final String lhs; + private final String rhs; + private final int expected; + + @Test + public void testCompareTo() { + DafnyVersion left = DafnyVersion.parse(lhs); + DafnyVersion right = DafnyVersion.parse(rhs); + assertEquals(expected, left.compareTo(right)); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyVersionParsingTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyVersionParsingTest.java index 80be8805d9..1a2ab55a2a 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyVersionParsingTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydafny/DafnyVersionParsingTest.java @@ -2,53 +2,53 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithydafny; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Collection; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; -import java.util.Arrays; -import java.util.Collection; - -import static org.junit.Assert.assertEquals; - @RunWith(Parameterized.class) public class DafnyVersionParsingTest { - public DafnyVersionParsingTest(String versionString, DafnyVersion expected) { - this.versionString = versionString; - this.expected = expected; - } - - @Parameterized.Parameters(name = "{0} ==> {1}") - public static Collection data() { - return Arrays.asList(new Object[][] { - // Valid - { "4", new DafnyVersion(4, 0, 0) }, - { "4.1", new DafnyVersion(4, 1, 0) }, - { "4.1.4", new DafnyVersion(4, 1, 4) }, - { "4-almost", new DafnyVersion(4, 0, 0, "almost") }, - { "4.1-beta", new DafnyVersion(4, 1, 0, "beta") }, - { "4.1.4-any-day-now", new DafnyVersion(4, 1, 4, "any-day-now") }, - // Invalid - { "", null }, - { "$@%!", null }, - { "1.2.3.4", null }, - { "not.even.numbers", null } - }); - } - - private final String versionString; - private final DafnyVersion expected; - - @Test - public void testParsing() { - try { - DafnyVersion parsed = DafnyVersion.parse(versionString); - assertEquals(expected, parsed); - } catch (IllegalArgumentException e) { - assertEquals(null, expected); - } - + public DafnyVersionParsingTest(String versionString, DafnyVersion expected) { + this.versionString = versionString; + this.expected = expected; + } + + @Parameterized.Parameters(name = "{0} ==> {1}") + public static Collection data() { + return Arrays.asList( + new Object[][] { + // Valid + { "4", new DafnyVersion(4, 0, 0) }, + { "4.1", new DafnyVersion(4, 1, 0) }, + { "4.1.4", new DafnyVersion(4, 1, 4) }, + { "4-almost", new DafnyVersion(4, 0, 0, "almost") }, + { "4.1-beta", new DafnyVersion(4, 1, 0, "beta") }, + { "4.1.4-any-day-now", new DafnyVersion(4, 1, 4, "any-day-now") }, + // Invalid + { "", null }, + { "$@%!", null }, + { "1.2.3.4", null }, + { "not.even.numbers", null }, + } + ); + } + + private final String versionString; + private final DafnyVersion expected; + + @Test + public void testParsing() { + try { + DafnyVersion parsed = DafnyVersion.parse(versionString); + assertEquals(expected, parsed); + } catch (IllegalArgumentException e) { + assertEquals(null, expected); } + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/AwsSdkShimCodegenTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/AwsSdkShimCodegenTest.java index 1f83ef8d42..f72368f8c8 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/AwsSdkShimCodegenTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/AwsSdkShimCodegenTest.java @@ -3,6 +3,16 @@ package software.amazon.polymorph.smithydotnet; +import static org.junit.Assert.assertEquals; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; +import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; + +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.BiConsumer; import org.junit.Test; import software.amazon.polymorph.util.TestModel; import software.amazon.polymorph.util.Tokenizer; @@ -13,149 +23,200 @@ import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.ShapeId; -import java.nio.file.Path; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.BiConsumer; - -import static org.junit.Assert.assertEquals; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; -import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; - public class AwsSdkShimCodegenTest { - private static final String SERVICE_NAMESPACE = "com.amazonaws.foobar"; - private static final String SERVICE_NAME = "FoobarService"; - private static final ShapeId SERVICE_SHAPE_ID = ShapeId.fromParts(SERVICE_NAMESPACE, SERVICE_NAME); - - private static AwsSdkShimCodegen setupCodegen(final BiConsumer updater) { - final Model model = TestModel.setupModel((builder, assembler) -> { - builder.id(SERVICE_SHAPE_ID); - updater.accept(builder, assembler); - }); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - return new AwsSdkShimCodegen(model, serviceShape); - } - //TODO: apply AwsSdkShimCodegen refactor to tests - @Test - public void testGenerateEmptyService() { - final AwsSdkShimCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); - final Map codeByPath = codegen.generate(); - final Path shimPath = Path.of("FoobarServiceShim.cs"); - assert codeByPath.keySet().equals(Set.of(shimPath)); - - final String actual = codeByPath.get(shimPath).toString(); - - final String expected = """ - using System; - using System.IO; - using System.Collections.Generic; - - namespace Com.Amazonaws.Foobar { - public class FoobarServiceShim : software.amazon.cryptography.services.foobar.internaldafny.types.IFoobarServiceClient { - public Amazon.FoobarService.AmazonFoobarServiceClient _impl; - - public FoobarServiceShim(Amazon.FoobarService.AmazonFoobarServiceClient impl) { - this._impl = impl; - } - } - } - """; - - tokenizeAndAssertEqual(actual, expected); - } - - @Test - public void testGenerateServiceShim() { - final ShapeId inputOperation = ShapeId.fromParts(SERVICE_NAMESPACE, "DoInput"); - final ShapeId outputOperation = ShapeId.fromParts(SERVICE_NAMESPACE, "DoOutput"); - final AwsSdkShimCodegen codegen = setupCodegen((builder, modelAssembler) -> { - builder.addOperation(inputOperation); - builder.addOperation(outputOperation); - modelAssembler.addUnparsedModel("test.smithy", """ - namespace com.amazonaws.foobar - operation DoInput { - input: DoInputRequest, - errors: [Crash], - } - operation DoOutput { - output: DoOutputResponse, - errors: [Crash], - } - structure DoInputRequest {} - structure DoOutputResponse {} - @error("client") structure Crash { message: String } - """); - }); - final List actualTokens = Tokenizer.tokenize(codegen.generateServiceShim().toString()); - - final String expectedShimConstructor = codegen.generateServiceShimConstructor().toString(); - final String expectedInputOperationShim = codegen.generateOperationShim(inputOperation).toString(); - final String expectedOutputOperationShim = codegen.generateOperationShim(outputOperation).toString(); - final List expectedTokens = Tokenizer.tokenize(""" - namespace Com.Amazonaws.Foobar { - public class FoobarServiceShim : software.amazon.cryptography.services.foobar.internaldafny.types.IFoobarServiceClient { - public Amazon.FoobarService.AmazonFoobarServiceClient _impl; - %s - %s - %s - } - } - """.formatted( - expectedShimConstructor, - expectedInputOperationShim, - expectedOutputOperationShim)); - - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateOperationShim() { - final ShapeId operationShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Go"); - final ShapeId requestShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "GoRequest"); - final ShapeId responseShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "GoResponse"); - final AwsSdkShimCodegen codegen = setupCodegen((builder, modelAssembler) -> { - builder.addOperation(operationShapeId); - modelAssembler.addUnparsedModel("test.smithy", """ - namespace com.amazonaws.foobar - operation Go { - input: GoRequest, - output: GoResponse, - errors: [Crash], - } - structure GoRequest {} - structure GoResponse {} - @error("client") structure Crash { message: String } - """); - }); - - final List actualTokens = Tokenizer.tokenize( - codegen.generateOperationShim(operationShapeId).toString()); - - final String resultTypeParams = "%s, %s".formatted( - "software.amazon.cryptography.services.foobar.internaldafny.types._IGoResponse", "software.amazon.cryptography.services.foobar.internaldafny.types._IError"); - final String requestFromDafnyConverter = - AwsSdkDotNetNameResolver.qualifiedTypeConverter(requestShapeId, FROM_DAFNY); - final String responseToDafnyConverter = - AwsSdkDotNetNameResolver.qualifiedTypeConverter(responseShapeId, TO_DAFNY); - final List expectedTokens = Tokenizer.tokenize(""" - public Wrappers_Compile._IResult<%1$s> Go(software.amazon.cryptography.services.foobar.internaldafny.types._IGoRequest request) { - Amazon.FoobarService.Model.GoRequest sdkRequest = %2$s(request); - try { - Amazon.FoobarService.Model.GoResponse sdkResponse = - this._impl.GoAsync(sdkRequest).Result; - return Wrappers_Compile.Result<%1$s>.create_Success(%3$s(sdkResponse)); - } - catch (System.AggregateException aggregate) { - return Wrappers_Compile.Result<%1$s>.create_Failure(TypeConversion.ToDafny_CommonError(aggregate.InnerException)); - } - catch (System.Exception ex) { - return Wrappers_Compile.Result<%1$s>.create_Failure(TypeConversion.ToDafny_CommonError(ex)); - } - } - """.formatted(resultTypeParams, requestFromDafnyConverter, responseToDafnyConverter)); - - assertEquals(expectedTokens, actualTokens); - } + + private static final String SERVICE_NAMESPACE = "com.amazonaws.foobar"; + private static final String SERVICE_NAME = "FoobarService"; + private static final ShapeId SERVICE_SHAPE_ID = ShapeId.fromParts( + SERVICE_NAMESPACE, + SERVICE_NAME + ); + + private static AwsSdkShimCodegen setupCodegen( + final BiConsumer updater + ) { + final Model model = TestModel.setupModel((builder, assembler) -> { + builder.id(SERVICE_SHAPE_ID); + updater.accept(builder, assembler); + }); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + return new AwsSdkShimCodegen(model, serviceShape); + } + + //TODO: apply AwsSdkShimCodegen refactor to tests + @Test + public void testGenerateEmptyService() { + final AwsSdkShimCodegen codegen = setupCodegen( + (_builder, _modelAssembler) -> {} + ); + final Map codeByPath = codegen.generate(); + final Path shimPath = Path.of("FoobarServiceShim.cs"); + assert codeByPath.keySet().equals(Set.of(shimPath)); + + final String actual = codeByPath.get(shimPath).toString(); + + final String expected = + """ + using System; + using System.IO; + using System.Collections.Generic; + + namespace Com.Amazonaws.Foobar { + public class FoobarServiceShim : software.amazon.cryptography.services.foobar.internaldafny.types.IFoobarServiceClient { + public Amazon.FoobarService.AmazonFoobarServiceClient _impl; + + public FoobarServiceShim(Amazon.FoobarService.AmazonFoobarServiceClient impl) { + this._impl = impl; + } + } + } + """; + + tokenizeAndAssertEqual(actual, expected); + } + + @Test + public void testGenerateServiceShim() { + final ShapeId inputOperation = ShapeId.fromParts( + SERVICE_NAMESPACE, + "DoInput" + ); + final ShapeId outputOperation = ShapeId.fromParts( + SERVICE_NAMESPACE, + "DoOutput" + ); + final AwsSdkShimCodegen codegen = setupCodegen( + (builder, modelAssembler) -> { + builder.addOperation(inputOperation); + builder.addOperation(outputOperation); + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace com.amazonaws.foobar + operation DoInput { + input: DoInputRequest, + errors: [Crash], + } + operation DoOutput { + output: DoOutputResponse, + errors: [Crash], + } + structure DoInputRequest {} + structure DoOutputResponse {} + @error("client") structure Crash { message: String } + """ + ); + } + ); + final List actualTokens = Tokenizer.tokenize( + codegen.generateServiceShim().toString() + ); + + final String expectedShimConstructor = codegen + .generateServiceShimConstructor() + .toString(); + final String expectedInputOperationShim = codegen + .generateOperationShim(inputOperation) + .toString(); + final String expectedOutputOperationShim = codegen + .generateOperationShim(outputOperation) + .toString(); + final List expectedTokens = Tokenizer.tokenize( + """ + namespace Com.Amazonaws.Foobar { + public class FoobarServiceShim : software.amazon.cryptography.services.foobar.internaldafny.types.IFoobarServiceClient { + public Amazon.FoobarService.AmazonFoobarServiceClient _impl; + %s + %s + %s + } + } + """.formatted( + expectedShimConstructor, + expectedInputOperationShim, + expectedOutputOperationShim + ) + ); + + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateOperationShim() { + final ShapeId operationShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Go"); + final ShapeId requestShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "GoRequest" + ); + final ShapeId responseShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "GoResponse" + ); + final AwsSdkShimCodegen codegen = setupCodegen( + (builder, modelAssembler) -> { + builder.addOperation(operationShapeId); + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace com.amazonaws.foobar + operation Go { + input: GoRequest, + output: GoResponse, + errors: [Crash], + } + structure GoRequest {} + structure GoResponse {} + @error("client") structure Crash { message: String } + """ + ); + } + ); + + final List actualTokens = Tokenizer.tokenize( + codegen.generateOperationShim(operationShapeId).toString() + ); + + final String resultTypeParams = + "%s, %s".formatted( + "software.amazon.cryptography.services.foobar.internaldafny.types._IGoResponse", + "software.amazon.cryptography.services.foobar.internaldafny.types._IError" + ); + final String requestFromDafnyConverter = + AwsSdkDotNetNameResolver.qualifiedTypeConverter( + requestShapeId, + FROM_DAFNY + ); + final String responseToDafnyConverter = + AwsSdkDotNetNameResolver.qualifiedTypeConverter( + responseShapeId, + TO_DAFNY + ); + final List expectedTokens = Tokenizer.tokenize( + """ + public Wrappers_Compile._IResult<%1$s> Go(software.amazon.cryptography.services.foobar.internaldafny.types._IGoRequest request) { + Amazon.FoobarService.Model.GoRequest sdkRequest = %2$s(request); + try { + Amazon.FoobarService.Model.GoResponse sdkResponse = + this._impl.GoAsync(sdkRequest).Result; + return Wrappers_Compile.Result<%1$s>.create_Success(%3$s(sdkResponse)); + } + catch (System.AggregateException aggregate) { + return Wrappers_Compile.Result<%1$s>.create_Failure(TypeConversion.ToDafny_CommonError(aggregate.InnerException)); + } + catch (System.Exception ex) { + return Wrappers_Compile.Result<%1$s>.create_Failure(TypeConversion.ToDafny_CommonError(ex)); + } + } + """.formatted( + resultTypeParams, + requestFromDafnyConverter, + responseToDafnyConverter + ) + ); + + assertEquals(expectedTokens, actualTokens); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/AwsSdkTypeConversionCodegenTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/AwsSdkTypeConversionCodegenTest.java index 8bfdf1f929..b857581a39 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/AwsSdkTypeConversionCodegenTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/AwsSdkTypeConversionCodegenTest.java @@ -3,119 +3,126 @@ package software.amazon.polymorph.smithydotnet; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.function.BiConsumer; import software.amazon.polymorph.util.TestModel; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.loader.ModelAssembler; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.ShapeId; -import java.util.function.BiConsumer; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - public class AwsSdkTypeConversionCodegenTest { - // TODO: Apply "Errors" refactor to Tests - // https://github.com/smithy-lang/smithy-dafny/issues/25 - private static final String SERVICE_NAMESPACE = "com.amazonaws.foobar"; - private static final String SERVICE_NAME = "FoobarService"; - private static final ShapeId SERVICE_SHAPE_ID = ShapeId.fromParts(SERVICE_NAMESPACE, SERVICE_NAME); - private static AwsSdkTypeConversionCodegen setupCodegen(final BiConsumer updater) { - final Model model = TestModel.setupModel((builder, assembler) -> { - builder.id(SERVICE_SHAPE_ID); - updater.accept(builder, assembler); - }); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - return new AwsSdkTypeConversionCodegen(model, serviceShape); - } + // TODO: Apply "Errors" refactor to Tests + // https://github.com/smithy-lang/smithy-dafny/issues/25 + private static final String SERVICE_NAMESPACE = "com.amazonaws.foobar"; + private static final String SERVICE_NAME = "FoobarService"; + private static final ShapeId SERVICE_SHAPE_ID = ShapeId.fromParts( + SERVICE_NAMESPACE, + SERVICE_NAME + ); -// Removed 2023-01-27 for output-local-service-test -// /** -// * Test that an AWS SDK structure type converter doesn't try to call the member properties' {@code IsSet*} methods, -// * since those are marked internal and are thus inaccessible to our generated code. -// */ -// @Test -// public void testGenerateStructureConverterWithOptionalValue() { -// final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "OptionalInt"); -// final ShapeId memberId = shapeId.withMember("int"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// structure OptionalInt { int: Integer } -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConversionCodegen.TypeConverter converter = codegen.generateStructureConverter( -// codegen.getModel().expectShape(shapeId, StructureShape.class)); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = Tokenizer.tokenize(converter.fromDafny().toString()); -// final String structureFromDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final String memberFromDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(memberId, FROM_DAFNY); -// final List expectedTokensFromDafny = Tokenizer.tokenize(""" -// public static Amazon.FoobarService.Model.OptionalInt -// %s(Dafny.Com.Amazonaws.Foobar.Types._IOptionalInt value) { -// Dafny.Com.Amazonaws.Foobar.Types.OptionalInt concrete = (Dafny.Com.Amazonaws.Foobar.Types.OptionalInt)value; -// Amazon.FoobarService.Model.OptionalInt converted = new Amazon.FoobarService.Model.OptionalInt(); -// if (concrete._int.is_Some) converted.Int = (int) %s(concrete._int); -// return converted; -// } -// """.formatted(structureFromDafnyConverterName, memberFromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = Tokenizer.tokenize(converter.toDafny().toString()); -// final String structureToDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final String memberToDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(memberId, TO_DAFNY); -// final List expectedTokensToDafny = Tokenizer.tokenize(""" -// public static Dafny.Com.Amazonaws.Foobar.Types._IOptionalInt -// %s(Amazon.FoobarService.Model.OptionalInt value) { -// int? var_int = value.Int; -// return new Dafny.Com.Amazonaws.Foobar.Types.OptionalInt(%s(var_int)); -// } -// """.formatted(structureToDafnyConverterName, memberToDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } + private static AwsSdkTypeConversionCodegen setupCodegen( + final BiConsumer updater + ) { + final Model model = TestModel.setupModel((builder, assembler) -> { + builder.id(SERVICE_SHAPE_ID); + updater.accept(builder, assembler); + }); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + return new AwsSdkTypeConversionCodegen(model, serviceShape); + } + // Removed 2023-01-27 for output-local-service-test + // /** + // * Test that an AWS SDK structure type converter doesn't try to call the member properties' {@code IsSet*} methods, + // * since those are marked internal and are thus inaccessible to our generated code. + // */ + // @Test + // public void testGenerateStructureConverterWithOptionalValue() { + // final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "OptionalInt"); + // final ShapeId memberId = shapeId.withMember("int"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // structure OptionalInt { int: Integer } + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConversionCodegen.TypeConverter converter = codegen.generateStructureConverter( + // codegen.getModel().expectShape(shapeId, StructureShape.class)); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = Tokenizer.tokenize(converter.fromDafny().toString()); + // final String structureFromDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final String memberFromDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(memberId, FROM_DAFNY); + // final List expectedTokensFromDafny = Tokenizer.tokenize(""" + // public static Amazon.FoobarService.Model.OptionalInt + // %s(Dafny.Com.Amazonaws.Foobar.Types._IOptionalInt value) { + // Dafny.Com.Amazonaws.Foobar.Types.OptionalInt concrete = (Dafny.Com.Amazonaws.Foobar.Types.OptionalInt)value; + // Amazon.FoobarService.Model.OptionalInt converted = new Amazon.FoobarService.Model.OptionalInt(); + // if (concrete._int.is_Some) converted.Int = (int) %s(concrete._int); + // return converted; + // } + // """.formatted(structureFromDafnyConverterName, memberFromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = Tokenizer.tokenize(converter.toDafny().toString()); + // final String structureToDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final String memberToDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(memberId, TO_DAFNY); + // final List expectedTokensToDafny = Tokenizer.tokenize(""" + // public static Dafny.Com.Amazonaws.Foobar.Types._IOptionalInt + // %s(Amazon.FoobarService.Model.OptionalInt value) { + // int? var_int = value.Int; + // return new Dafny.Com.Amazonaws.Foobar.Types.OptionalInt(%s(var_int)); + // } + // """.formatted(structureToDafnyConverterName, memberToDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } -// @Test -// public void testGenerateStructureConverterErrorStructureWithMessage() { -// final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "OopsException"); -// final ShapeId stringShapeId = ShapeId.from("smithy.api#String"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// @error("client") -// structure OopsException { message: String } -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConversionCodegen.TypeConverter converter = codegen.generateStructureConverter( -// codegen.getModel().expectShape(shapeId, StructureShape.class)); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = Tokenizer.tokenize(converter.fromDafny().toString()); -// final String structureFromDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final String stringFromDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(stringShapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = Tokenizer.tokenize(""" -// public static Amazon.FoobarService.Model.OopsException -// %s(Dafny.Com.Amazonaws.Foobar.Types.Error_OopsException value) { -// return new Amazon.FoobarService.Model.OopsException( -// FromDafny_N3_com__N9_amazonaws__N6_foobar__S13_OopsException__M7_message(value._message) -// ); -// }""".formatted( -// structureFromDafnyConverterName, -// stringFromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = Tokenizer.tokenize(converter.toDafny().toString()); -// final String structureToDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final String stringToDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(stringShapeId, TO_DAFNY); -// final List expectedTokensToDafny = Tokenizer.tokenize(""" -// public static Dafny.Com.Amazonaws.Foobar.Types.Error_OopsException -// %s(Amazon.FoobarService.Model.OopsException value) { -// string var_message = value.Message; -// return new Dafny.Com.Amazonaws.Foobar.Types.Error_OopsException( -// ToDafny_N3_com__N9_amazonaws__N6_foobar__S13_OopsException__M7_message(var_message) -// ); -// }""".formatted( -// structureToDafnyConverterName, -// stringToDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } + // @Test + // public void testGenerateStructureConverterErrorStructureWithMessage() { + // final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "OopsException"); + // final ShapeId stringShapeId = ShapeId.from("smithy.api#String"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // @error("client") + // structure OopsException { message: String } + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConversionCodegen.TypeConverter converter = codegen.generateStructureConverter( + // codegen.getModel().expectShape(shapeId, StructureShape.class)); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = Tokenizer.tokenize(converter.fromDafny().toString()); + // final String structureFromDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final String stringFromDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(stringShapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = Tokenizer.tokenize(""" + // public static Amazon.FoobarService.Model.OopsException + // %s(Dafny.Com.Amazonaws.Foobar.Types.Error_OopsException value) { + // return new Amazon.FoobarService.Model.OopsException( + // FromDafny_N3_com__N9_amazonaws__N6_foobar__S13_OopsException__M7_message(value._message) + // ); + // }""".formatted( + // structureFromDafnyConverterName, + // stringFromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = Tokenizer.tokenize(converter.toDafny().toString()); + // final String structureToDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final String stringToDafnyConverterName = AwsSdkDotNetNameResolver.typeConverterForShape(stringShapeId, TO_DAFNY); + // final List expectedTokensToDafny = Tokenizer.tokenize(""" + // public static Dafny.Com.Amazonaws.Foobar.Types.Error_OopsException + // %s(Amazon.FoobarService.Model.OopsException value) { + // string var_message = value.Message; + // return new Dafny.Com.Amazonaws.Foobar.Types.Error_OopsException( + // ToDafny_N3_com__N9_amazonaws__N6_foobar__S13_OopsException__M7_message(var_message) + // ); + // }""".formatted( + // structureToDafnyConverterName, + // stringToDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/DotNetNameResolverTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/DotNetNameResolverTest.java index 75ea2d304c..7c66dfd006 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/DotNetNameResolverTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/DotNetNameResolverTest.java @@ -3,13 +3,18 @@ package software.amazon.polymorph.smithydotnet; +import static org.junit.Assert.assertEquals; +import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; +import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; + +import java.util.function.BiConsumer; import org.junit.Assert; import org.junit.Test; -import software.amazon.polymorph.utils.DafnyNameResolverHelpers; import software.amazon.polymorph.traits.DafnyUtf8BytesTrait; import software.amazon.polymorph.traits.PositionalTrait; import software.amazon.polymorph.traits.ReferenceTrait; import software.amazon.polymorph.util.TestModel; +import software.amazon.polymorph.utils.DafnyNameResolverHelpers; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.SourceLocation; import software.amazon.smithy.model.loader.ModelAssembler; @@ -24,214 +29,366 @@ import software.amazon.smithy.model.traits.EnumTrait; import software.amazon.smithy.model.traits.ErrorTrait; -import java.util.function.BiConsumer; +public class DotNetNameResolverTest { -import static org.junit.Assert.assertEquals; -import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; -import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; + private DotNetNameResolver setupNameResolver( + final BiConsumer updater + ) { + final Model model = TestModel.setupModel(updater); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + return new DotNetNameResolver(model, serviceShape); + } -public class DotNetNameResolverTest { - private DotNetNameResolver setupNameResolver(final BiConsumer updater) { - final Model model = TestModel.setupModel(updater); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - return new DotNetNameResolver(model, serviceShape); - } - - @Test - public void testEncodeShapeIdRoot() { - final ShapeId shapeId = ShapeId.fromParts("com.foo.bar_baz", "ShapeName"); - final String encodedShapeId = DotNetNameResolver.encodedIdentForShapeId(shapeId); - Assert.assertEquals(encodedShapeId, "N3_com__N3_foo__N7_bar_baz__S9_ShapeName"); - } - - @Test - public void testEncodeShapeIdWithMember() { - final ShapeId shapeId = ShapeId.fromParts("com.foo.bar_baz", "ShapeName", "MemberName"); - final String encodedShapeId = DotNetNameResolver.encodedIdentForShapeId(shapeId); - Assert.assertEquals(encodedShapeId, "N3_com__N3_foo__N7_bar_baz__S9_ShapeName__M10_MemberName"); - } - - @Test - public void testEncodeShapeIdWithSuspiciousIdents() { - final ShapeId shapeId = ShapeId.fromParts("N3_com__.__bar_baz.M10_MemberName", "N3_foo", "__SUS__S1__"); - final String encodedShapeId = DotNetNameResolver.encodedIdentForShapeId(shapeId); - Assert.assertEquals(encodedShapeId, "N8_N3_com____N9___bar_baz__N14_M10_MemberName__S6_N3_foo__M11___SUS__S1__"); - } - - @Test - public void testTypeConverterForShape() { - final StructureShape foobarStructureShape = TestModel.setupFoobarStructureShape(); - final DotNetNameResolver nameResolver = setupNameResolver( - (builder, modelAssembler) -> modelAssembler.addShape(foobarStructureShape)); - - final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(foobarStructureShape.getId(), - TypeConversionDirection.TO_DAFNY); - Assert.assertEquals("ToDafny_N4_test__N6_foobar__S6_Foobar", toDafnyConverterName); - - final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(foobarStructureShape.getId(), - TypeConversionDirection.FROM_DAFNY); - Assert.assertEquals("FromDafny_N4_test__N6_foobar__S6_Foobar", fromDafnyConverterName); - } - - @Test - public void testDafnyNamespaceForShapeId() { - final ShapeId shapeId = ShapeId.fromParts("test.fooBar.baz", "Whatever"); - final String dafnyNamespace = DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId); - Assert.assertEquals("test.foobar.baz.internaldafny.types", dafnyNamespace); - } - - @Test - public void testDafnyTypeForSimpleShapes() { - final DotNetNameResolver nameResolver = setupNameResolver((_builder, _modelAssembler) -> {}); - assertEquals("Dafny.ISequence", nameResolver.dafnyTypeForShape(ShapeId.from("smithy.api#Blob"))); - assertEquals("bool", nameResolver.dafnyTypeForShape(ShapeId.from("smithy.api#Boolean"))); - assertEquals("Dafny.ISequence", nameResolver.dafnyTypeForShape(ShapeId.from("smithy.api#String"))); - assertEquals("int", nameResolver.dafnyTypeForShape(ShapeId.from("smithy.api#Integer"))); - assertEquals("long", nameResolver.dafnyTypeForShape(ShapeId.from("smithy.api#Long"))); - } - - @Test - public void testDafnyTypeForEnum() { - final EnumTrait enumTrait = EnumTrait.builder() - .addEnum(EnumDefinition.builder().value("value").build()) - .build(); - final StringShape enumStringShape = StringShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "EnumString")) - .addTrait(enumTrait) - .build(); - final DotNetNameResolver nameResolver = setupNameResolver( - (builder, modelAssembler) -> modelAssembler.addShape(enumStringShape)); - assertEquals("test.foobar.internaldafny.types._IEnumString", nameResolver.dafnyTypeForShape(enumStringShape.getId())); - } - - @Test - public void testDafnyTypeForUtf8Bytes() { - final StringShape stringShape = StringShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Utf8BytesString")) - .addTrait(new DafnyUtf8BytesTrait()) - .build(); - final DotNetNameResolver nameResolver = setupNameResolver( - (builder, modelAssembler) -> modelAssembler.addShape(stringShape)); - assertEquals("Dafny.ISequence", nameResolver.dafnyTypeForShape(stringShape.getId())); - } - - @Test - public void testDafnyTypeForAggregateTypes() { - final ShapeId listShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "BoolList"); - final ListShape listShape = ListShape.builder() - .id(listShapeId) - .member(ShapeId.from("smithy.api#Boolean")) - .build(); - final MapShape mapShape = MapShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "StringToBoolListMap")) - .key(ShapeId.from("smithy.api#String")) - .value(listShapeId) - .build(); - final DotNetNameResolver nameResolver = setupNameResolver(((builder, modelAssembler) -> { - modelAssembler.addShape(listShape); - modelAssembler.addShape(mapShape); - })); - assertEquals("Dafny.ISequence", nameResolver.dafnyTypeForShape(listShape.getId())); - assertEquals("Dafny.IMap, Dafny.ISequence>", - nameResolver.dafnyTypeForShape(mapShape.getId())); - } - - @Test - public void testDafnyTypeForStructure() { - final StructureShape foobarStructureShape = TestModel.setupFoobarStructureShape(); - final DotNetNameResolver nameResolver = setupNameResolver( - (builder, modelAssembler) -> modelAssembler.addShape(foobarStructureShape)); - assertEquals("test.foobar.internaldafny.types._IFoobar", nameResolver.dafnyTypeForShape(foobarStructureShape.getId())); - } - - @Test - public void testDafnyTypeForResourceReferenceStructure() { - final ShapeId resourceShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "TestResource"); - final ResourceShape resourceShape = ResourceShape.builder() - .id(resourceShapeId) - .build(); - - final ReferenceTrait referenceTrait = ReferenceTrait.builder() - .referentType(ReferenceTrait.ReferentType.RESOURCE) - .referentId(resourceShapeId) - .build(); - final StructureShape referenceShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "ResourceReference")) - .addTrait(referenceTrait) - .build(); - - final DotNetNameResolver nameResolver = setupNameResolver( - (builder, modelAssembler) -> { - modelAssembler.addShape(referenceShape); - modelAssembler.addShape(resourceShape); - }); - assertEquals("test.foobar.internaldafny.types.ITestResource", nameResolver.dafnyTypeForShape(referenceShape.getId())); - } - - @Test - public void testDafnyTypeForPositionalStructure() { - final PositionalTrait positionalTrait = PositionalTrait.builder().build(); - final StructureShape positionalShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "PositionalShape")) - .addMember("aBoolean", ShapeId.from("smithy.api#Boolean")) - .addTrait(positionalTrait) - .build(); - final DotNetNameResolver nameResolver = setupNameResolver( - (builder, modelAssembler) -> modelAssembler.addShape(positionalShape)); - assertEquals("bool", nameResolver.dafnyTypeForShape(positionalShape.getId())); - } - - @Test - public void testDafnyTypeForErrorStructure() { - final ErrorTrait errorTrait = new ErrorTrait("client", new SourceLocation("test.smithy")); - final StructureShape errorShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "ErrorShape")) - .addMember("message", ShapeId.from("smithy.api#String")) - .addTrait(errorTrait) - .build(); - final DotNetNameResolver nameResolver = setupNameResolver( - (builder, modelAssembler) -> modelAssembler.addShape(errorShape)); - assertEquals("test.foobar.internaldafny.types.Error_ErrorShape", nameResolver.dafnyTypeForShape(errorShape.getId())); - } - - @Test - public void testDafnyTypeForMember() { - final StructureShape foobarStructureShape = TestModel.setupFoobarStructureShape(); - final DotNetNameResolver nameResolver = setupNameResolver( - (builder, modelAssembler) -> modelAssembler.addShape(foobarStructureShape)); - assertEquals("Wrappers_Compile._IOption", - nameResolver.dafnyTypeForShape(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar", "someInt"))); - assertEquals("Wrappers_Compile._IOption>", - nameResolver.dafnyTypeForShape(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar", "someString"))); - assertEquals("bool", - nameResolver.dafnyTypeForShape(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar", "someBool"))); - } - - @Test - public void testDafnyImplForServiceClient() { - final DotNetNameResolver nameResolver = setupNameResolver((_builder, _modelAssembler) -> {}); - final String actualName = nameResolver.dafnyImplForServiceClient(); - final String expectedName = "test.foobar.internaldafny.__default.FoobarServiceFactory"; - Assert.assertEquals(expectedName, actualName); - } - - @Test - public void testCapitalizeNamespaceSegment() { - assertEquals("FooBar", DotNetNameResolver.capitalizeNamespaceSegment("fooBar")); - assertEquals("EncryptionSDK", DotNetNameResolver.capitalizeNamespaceSegment("encryptionSdk")); - assertEquals("KMSKeyring", DotNetNameResolver.capitalizeNamespaceSegment("KmsKeyring")); - assertEquals("RSAOaepSha512Mgf1", DotNetNameResolver.capitalizeNamespaceSegment("rsaOaepSha512Mgf1")); - assertEquals("ALLCAPS", DotNetNameResolver.capitalizeNamespaceSegment("ALLCAPS")); - - // all together now - assertEquals("AWSKMSSDKAESRSA", DotNetNameResolver.capitalizeNamespaceSegment("awsKmsSdkAesRsa")); - } - - @Test - public void testCapitalizeNamespaceSegmentFailsOnInvalidSegment() { - Assert.assertThrows(IllegalArgumentException.class, - () -> DotNetNameResolver.capitalizeNamespaceSegment("sausage-case")); - Assert.assertThrows(IllegalArgumentException.class, - () -> DotNetNameResolver.capitalizeNamespaceSegment("snake_Case")); - } + @Test + public void testEncodeShapeIdRoot() { + final ShapeId shapeId = ShapeId.fromParts("com.foo.bar_baz", "ShapeName"); + final String encodedShapeId = DotNetNameResolver.encodedIdentForShapeId( + shapeId + ); + Assert.assertEquals( + encodedShapeId, + "N3_com__N3_foo__N7_bar_baz__S9_ShapeName" + ); + } + + @Test + public void testEncodeShapeIdWithMember() { + final ShapeId shapeId = ShapeId.fromParts( + "com.foo.bar_baz", + "ShapeName", + "MemberName" + ); + final String encodedShapeId = DotNetNameResolver.encodedIdentForShapeId( + shapeId + ); + Assert.assertEquals( + encodedShapeId, + "N3_com__N3_foo__N7_bar_baz__S9_ShapeName__M10_MemberName" + ); + } + + @Test + public void testEncodeShapeIdWithSuspiciousIdents() { + final ShapeId shapeId = ShapeId.fromParts( + "N3_com__.__bar_baz.M10_MemberName", + "N3_foo", + "__SUS__S1__" + ); + final String encodedShapeId = DotNetNameResolver.encodedIdentForShapeId( + shapeId + ); + Assert.assertEquals( + encodedShapeId, + "N8_N3_com____N9___bar_baz__N14_M10_MemberName__S6_N3_foo__M11___SUS__S1__" + ); + } + + @Test + public void testTypeConverterForShape() { + final StructureShape foobarStructureShape = + TestModel.setupFoobarStructureShape(); + final DotNetNameResolver nameResolver = setupNameResolver( + (builder, modelAssembler) -> + modelAssembler.addShape(foobarStructureShape) + ); + + final String toDafnyConverterName = + DotNetNameResolver.typeConverterForShape( + foobarStructureShape.getId(), + TypeConversionDirection.TO_DAFNY + ); + Assert.assertEquals( + "ToDafny_N4_test__N6_foobar__S6_Foobar", + toDafnyConverterName + ); + + final String fromDafnyConverterName = + DotNetNameResolver.typeConverterForShape( + foobarStructureShape.getId(), + TypeConversionDirection.FROM_DAFNY + ); + Assert.assertEquals( + "FromDafny_N4_test__N6_foobar__S6_Foobar", + fromDafnyConverterName + ); + } + + @Test + public void testDafnyNamespaceForShapeId() { + final ShapeId shapeId = ShapeId.fromParts("test.fooBar.baz", "Whatever"); + final String dafnyNamespace = + DafnyNameResolverHelpers.dafnyExternNamespaceForShapeId(shapeId); + Assert.assertEquals("test.foobar.baz.internaldafny.types", dafnyNamespace); + } + + @Test + public void testDafnyTypeForSimpleShapes() { + final DotNetNameResolver nameResolver = setupNameResolver( + (_builder, _modelAssembler) -> {} + ); + assertEquals( + "Dafny.ISequence", + nameResolver.dafnyTypeForShape(ShapeId.from("smithy.api#Blob")) + ); + assertEquals( + "bool", + nameResolver.dafnyTypeForShape(ShapeId.from("smithy.api#Boolean")) + ); + assertEquals( + "Dafny.ISequence", + nameResolver.dafnyTypeForShape(ShapeId.from("smithy.api#String")) + ); + assertEquals( + "int", + nameResolver.dafnyTypeForShape(ShapeId.from("smithy.api#Integer")) + ); + assertEquals( + "long", + nameResolver.dafnyTypeForShape(ShapeId.from("smithy.api#Long")) + ); + } + + @Test + public void testDafnyTypeForEnum() { + final EnumTrait enumTrait = EnumTrait + .builder() + .addEnum(EnumDefinition.builder().value("value").build()) + .build(); + final StringShape enumStringShape = StringShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "EnumString")) + .addTrait(enumTrait) + .build(); + final DotNetNameResolver nameResolver = setupNameResolver( + (builder, modelAssembler) -> + modelAssembler.addShape(enumStringShape) + ); + assertEquals( + "test.foobar.internaldafny.types._IEnumString", + nameResolver.dafnyTypeForShape(enumStringShape.getId()) + ); + } + + @Test + public void testDafnyTypeForUtf8Bytes() { + final StringShape stringShape = StringShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Utf8BytesString")) + .addTrait(new DafnyUtf8BytesTrait()) + .build(); + final DotNetNameResolver nameResolver = setupNameResolver( + (builder, modelAssembler) -> + modelAssembler.addShape(stringShape) + ); + assertEquals( + "Dafny.ISequence", + nameResolver.dafnyTypeForShape(stringShape.getId()) + ); + } + + @Test + public void testDafnyTypeForAggregateTypes() { + final ShapeId listShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "BoolList" + ); + final ListShape listShape = ListShape + .builder() + .id(listShapeId) + .member(ShapeId.from("smithy.api#Boolean")) + .build(); + final MapShape mapShape = MapShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "StringToBoolListMap")) + .key(ShapeId.from("smithy.api#String")) + .value(listShapeId) + .build(); + final DotNetNameResolver nameResolver = setupNameResolver( + ((builder, modelAssembler) -> { + modelAssembler.addShape(listShape); + modelAssembler.addShape(mapShape); + }) + ); + assertEquals( + "Dafny.ISequence", + nameResolver.dafnyTypeForShape(listShape.getId()) + ); + assertEquals( + "Dafny.IMap, Dafny.ISequence>", + nameResolver.dafnyTypeForShape(mapShape.getId()) + ); + } + + @Test + public void testDafnyTypeForStructure() { + final StructureShape foobarStructureShape = + TestModel.setupFoobarStructureShape(); + final DotNetNameResolver nameResolver = setupNameResolver( + (builder, modelAssembler) -> + modelAssembler.addShape(foobarStructureShape) + ); + assertEquals( + "test.foobar.internaldafny.types._IFoobar", + nameResolver.dafnyTypeForShape(foobarStructureShape.getId()) + ); + } + + @Test + public void testDafnyTypeForResourceReferenceStructure() { + final ShapeId resourceShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "TestResource" + ); + final ResourceShape resourceShape = ResourceShape + .builder() + .id(resourceShapeId) + .build(); + + final ReferenceTrait referenceTrait = ReferenceTrait + .builder() + .referentType(ReferenceTrait.ReferentType.RESOURCE) + .referentId(resourceShapeId) + .build(); + final StructureShape referenceShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "ResourceReference")) + .addTrait(referenceTrait) + .build(); + + final DotNetNameResolver nameResolver = setupNameResolver( + (builder, modelAssembler) -> { + modelAssembler.addShape(referenceShape); + modelAssembler.addShape(resourceShape); + } + ); + assertEquals( + "test.foobar.internaldafny.types.ITestResource", + nameResolver.dafnyTypeForShape(referenceShape.getId()) + ); + } + + @Test + public void testDafnyTypeForPositionalStructure() { + final PositionalTrait positionalTrait = PositionalTrait.builder().build(); + final StructureShape positionalShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "PositionalShape")) + .addMember("aBoolean", ShapeId.from("smithy.api#Boolean")) + .addTrait(positionalTrait) + .build(); + final DotNetNameResolver nameResolver = setupNameResolver( + (builder, modelAssembler) -> + modelAssembler.addShape(positionalShape) + ); + assertEquals( + "bool", + nameResolver.dafnyTypeForShape(positionalShape.getId()) + ); + } + + @Test + public void testDafnyTypeForErrorStructure() { + final ErrorTrait errorTrait = new ErrorTrait( + "client", + new SourceLocation("test.smithy") + ); + final StructureShape errorShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "ErrorShape")) + .addMember("message", ShapeId.from("smithy.api#String")) + .addTrait(errorTrait) + .build(); + final DotNetNameResolver nameResolver = setupNameResolver( + (builder, modelAssembler) -> + modelAssembler.addShape(errorShape) + ); + assertEquals( + "test.foobar.internaldafny.types.Error_ErrorShape", + nameResolver.dafnyTypeForShape(errorShape.getId()) + ); + } + + @Test + public void testDafnyTypeForMember() { + final StructureShape foobarStructureShape = + TestModel.setupFoobarStructureShape(); + final DotNetNameResolver nameResolver = setupNameResolver( + (builder, modelAssembler) -> + modelAssembler.addShape(foobarStructureShape) + ); + assertEquals( + "Wrappers_Compile._IOption", + nameResolver.dafnyTypeForShape( + ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar", "someInt") + ) + ); + assertEquals( + "Wrappers_Compile._IOption>", + nameResolver.dafnyTypeForShape( + ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar", "someString") + ) + ); + assertEquals( + "bool", + nameResolver.dafnyTypeForShape( + ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar", "someBool") + ) + ); + } + + @Test + public void testDafnyImplForServiceClient() { + final DotNetNameResolver nameResolver = setupNameResolver( + (_builder, _modelAssembler) -> {} + ); + final String actualName = nameResolver.dafnyImplForServiceClient(); + final String expectedName = + "test.foobar.internaldafny.__default.FoobarServiceFactory"; + Assert.assertEquals(expectedName, actualName); + } + + @Test + public void testCapitalizeNamespaceSegment() { + assertEquals( + "FooBar", + DotNetNameResolver.capitalizeNamespaceSegment("fooBar") + ); + assertEquals( + "EncryptionSDK", + DotNetNameResolver.capitalizeNamespaceSegment("encryptionSdk") + ); + assertEquals( + "KMSKeyring", + DotNetNameResolver.capitalizeNamespaceSegment("KmsKeyring") + ); + assertEquals( + "RSAOaepSha512Mgf1", + DotNetNameResolver.capitalizeNamespaceSegment("rsaOaepSha512Mgf1") + ); + assertEquals( + "ALLCAPS", + DotNetNameResolver.capitalizeNamespaceSegment("ALLCAPS") + ); + + // all together now + assertEquals( + "AWSKMSSDKAESRSA", + DotNetNameResolver.capitalizeNamespaceSegment("awsKmsSdkAesRsa") + ); + } + + @Test + public void testCapitalizeNamespaceSegmentFailsOnInvalidSegment() { + Assert.assertThrows( + IllegalArgumentException.class, + () -> DotNetNameResolver.capitalizeNamespaceSegment("sausage-case") + ); + Assert.assertThrows( + IllegalArgumentException.class, + () -> DotNetNameResolver.capitalizeNamespaceSegment("snake_Case") + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ServiceCodegenSmokeTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ServiceCodegenSmokeTest.java index 3cbb77dc62..87a65d80c5 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ServiceCodegenSmokeTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ServiceCodegenSmokeTest.java @@ -3,13 +3,7 @@ package software.amazon.polymorph.smithydotnet; -import org.junit.Test; -import software.amazon.polymorph.utils.ModelUtils; -import software.amazon.polymorph.utils.TokenTree; -import software.amazon.smithy.model.Model; -import software.amazon.smithy.model.loader.ModelAssembler; -import software.amazon.smithy.model.shapes.ShapeId; -import software.amazon.smithy.model.shapes.ServiceShape; +import static org.junit.Assert.*; import java.net.URL; import java.nio.file.Path; @@ -18,36 +12,56 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; - -import static org.junit.Assert.*; +import org.junit.Test; +import software.amazon.polymorph.utils.ModelUtils; +import software.amazon.polymorph.utils.TokenTree; +import software.amazon.smithy.model.Model; +import software.amazon.smithy.model.loader.ModelAssembler; +import software.amazon.smithy.model.shapes.ServiceShape; +import software.amazon.smithy.model.shapes.ShapeId; public class ServiceCodegenSmokeTest { - // TODO: Apply ServiceCodegen changes to tests - // https://github.com/smithy-lang/smithy-dafny/issues/27 - @Test - public void testCorrectFilesGenerated() { - final URL modelUrl = Objects.requireNonNull(this.getClass().getClassLoader().getResource("model.smithy")); - final ModelAssembler assembler = new ModelAssembler(); - ModelUtils.addCustomTraitsToModelAssembler(assembler); - final Model model = assembler.addImport(modelUrl).assemble().unwrap(); - final ShapeId serviceShapeId = ShapeId.fromParts("polymorph.demo", "StringLists"); - final ServiceShape serviceShape = model.expectShape(serviceShapeId, ServiceShape.class); - final ServiceCodegen serviceCodegen = new ServiceCodegen(model, serviceShape); - final Map codeByPath = serviceCodegen.generate(); + // TODO: Apply ServiceCodegen changes to tests + // https://github.com/smithy-lang/smithy-dafny/issues/27 + @Test + public void testCorrectFilesGenerated() { + final URL modelUrl = Objects.requireNonNull( + this.getClass().getClassLoader().getResource("model.smithy") + ); + final ModelAssembler assembler = new ModelAssembler(); + ModelUtils.addCustomTraitsToModelAssembler(assembler); + final Model model = assembler.addImport(modelUrl).assemble().unwrap(); + + final ShapeId serviceShapeId = ShapeId.fromParts( + "polymorph.demo", + "StringLists" + ); + final ServiceShape serviceShape = model.expectShape( + serviceShapeId, + ServiceShape.class + ); + final ServiceCodegen serviceCodegen = new ServiceCodegen( + model, + serviceShape + ); + final Map codeByPath = serviceCodegen.generate(); - final Set expectedPaths = Stream.of( - "OpaqueError", - "CollectionOfErrors", - "CreateArrayListInput", - "CreateArrayListOutput", - "IListOfStrings", - "ListOfStringsBase", - "GetElementInput", - "GetElementOutput", - "SetElementInput", - "IndexOutOfBoundsException" - ).map(name -> Path.of(name + ".cs")).collect(Collectors.toSet()); - assertEquals(expectedPaths, codeByPath.keySet()); - } + final Set expectedPaths = Stream + .of( + "OpaqueError", + "CollectionOfErrors", + "CreateArrayListInput", + "CreateArrayListOutput", + "IListOfStrings", + "ListOfStringsBase", + "GetElementInput", + "GetElementOutput", + "SetElementInput", + "IndexOutOfBoundsException" + ) + .map(name -> Path.of(name + ".cs")) + .collect(Collectors.toSet()); + assertEquals(expectedPaths, codeByPath.keySet()); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ServiceCodegenTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ServiceCodegenTest.java index c8aa65cf78..0932242153 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ServiceCodegenTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ServiceCodegenTest.java @@ -3,6 +3,17 @@ package software.amazon.polymorph.smithydotnet; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; +import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; + +import java.nio.file.Path; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.junit.Test; import software.amazon.polymorph.traits.PositionalTrait; import software.amazon.polymorph.traits.ReferenceTrait; @@ -22,552 +33,689 @@ import software.amazon.smithy.model.traits.EnumTrait; import software.amazon.smithy.model.traits.TraitDefinition; -import java.nio.file.Path; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; -import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; - public class ServiceCodegenTest { - // TODO: Apply ServiceCodegen changes to tests - // https://github.com/smithy-lang/smithy-dafny/issues/27 - @Test - public void testGenerateEmptyService() { - final Model model = TestModel.setupModel(); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - final Map codeByPath = codegen.generate(); - - final Set expectedPaths = new HashSet(); - expectedPaths.add(Path.of("CollectionOfErrors.cs")); - expectedPaths.add(Path.of("OpaqueError.cs")); - assertEquals(expectedPaths, codeByPath.keySet()); - } - - @Test - public void testGenerateServiceInterfaceMethod() { - final StructureShape inputShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingInput")) - .build(); - final StructureShape outputShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingOutput")) - .build(); - final OperationShape operationShape = OperationShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomething")) - .input(inputShape.getId()) - .output(outputShape.getId()) - .build(); - final Model model = TestModel.setupModel((builder, modelAssembler) -> { - modelAssembler.addShape(inputShape); - modelAssembler.addShape(outputShape); - builder.addOperation(operationShape.getId()); - modelAssembler.addShape(operationShape); - }); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - final String actualCode = codegen.generateInterfaceMethod(operationShape.getId()).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize(""" - Test.Foobar.DoSomethingOutput DoSomething(Test.Foobar.DoSomethingInput input); - """); - - assertEquals(expectedTokens, actualTokens); - } - -// Removed 2023-01-27 for output-local-service-test -// @Test -// public void testGenerateStructureClass() { -// final Model model = TestModel.setupModel((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// structure Foobar { -// someBool: Boolean, -// @required -// someInt: Integer, -// someString: String, -// } -// """.formatted(SERVICE_NAMESPACE))); -// -// final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); -// final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); -// final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar"); -// final StructureShape structureShape = model.expectShape(shapeId, StructureShape.class); -// final String actualCode = codegen.generateStructureClass(structureShape).toString(); -// final List actualTokens = Tokenizer.tokenize(actualCode); -// -// final List expectedTokens = Tokenizer.tokenize(""" -// namespace Test.Foobar { -// public class Foobar { -// private bool? _someBool; -// private int? _someInt; -// private string _someString; -// -// public bool SomeBool { -// get { return this._someBool.GetValueOrDefault(); } -// set { this._someBool = value; } -// } -// -// internal bool IsSetSomeBool() -// { -// return this._someBool.HasValue; -// } -// -// public int SomeInt { -// get { return this._someInt.GetValueOrDefault(); } -// set { this._someInt = value; } -// } -// -// internal bool IsSetSomeInt() -// { -// return this._someInt.HasValue; -// } -// -// public string SomeString { -// get { return this._someString; } -// set { this._someString = value; } -// } -// -// internal bool IsSetSomeString() -// { -// return this._someString != null; -// } -// -// public void Validate() { -// if (!IsSetSomeInt()) throw new System.ArgumentException( -// "Missing value for required property 'SomeInt'" -// ); -// } -// } -// } -// """); -// -// assertEquals(expectedTokens, actualTokens); -// } - - @Test - public void testGenerateResourceInterface() { - // Input, no output - final StructureShape inputShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingInput")) - .build(); - final OperationShape operationInputShape = OperationShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithInput")) - .input(inputShape.getId()) - .build(); - - // Output, no input - final StructureShape outputShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingOutput")) - .build(); - final OperationShape operationOutputShape = OperationShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput")) - .output(outputShape.getId()) - .build(); - - final ResourceShape resourceShape = ResourceShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Baz")) - .addOperation(operationInputShape) - .addOperation(operationOutputShape) - .build(); - - final Model model = TestModel.setupModel((builder, modelAssembler) -> { - modelAssembler.addShape(inputShape); - modelAssembler.addShape(outputShape); - modelAssembler.addShape(operationInputShape); - modelAssembler.addShape(operationOutputShape); - modelAssembler.addShape(resourceShape); - }); - - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - final String actualCode = codegen.generateResourceInterface(resourceShape.getId()).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - final List expectedTokens = Tokenizer.tokenize(""" - namespace Test.Foobar { - public interface IBaz { - void DoSomethingWithInput(Test.Foobar.DoSomethingInput input); - Test.Foobar.DoSomethingOutput DoSomethingWithOutput(); - } - } - """); - - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateResourceClass() { - // Input, no output - final StructureShape inputShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingInput")) - .build(); - final OperationShape operationInputShape = OperationShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithInput")) - .input(inputShape.getId()) - .build(); - - // Output, no input - final StructureShape outputShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingOutput")) - .build(); - final OperationShape operationOutputShape = OperationShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput")) - .output(outputShape.getId()) - .build(); - - final ResourceShape resourceShape = ResourceShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Baz")) - .addOperation(operationInputShape) - .addOperation(operationOutputShape) - .build(); - - final Model model = TestModel.setupModel((builder, modelAssembler) -> { - modelAssembler.addShape(inputShape); - modelAssembler.addShape(outputShape); - modelAssembler.addShape(operationInputShape); - modelAssembler.addShape(operationOutputShape); - modelAssembler.addShape(resourceShape); - }); - - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - final String actualCode = codegen.generateResourceClass(resourceShape.getId()).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - final List expectedTokens = Tokenizer.tokenize(""" - namespace Test.Foobar { - public abstract class BazBase : IBaz { - public void DoSomethingWithInput(Test.Foobar.DoSomethingInput input) { - input.Validate(); - _DoSomethingWithInput(input); - } - protected abstract void _DoSomethingWithInput(Test.Foobar.DoSomethingInput input); - - public Test.Foobar.DoSomethingOutput DoSomethingWithOutput() { - return _DoSomethingWithOutput(); - } - protected abstract Test.Foobar.DoSomethingOutput _DoSomethingWithOutput(); - } - } - """); - - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateResourceClassWithPositionalOutput() { - /* - * Test that shapes marked with @positional are unwrapped to their single member shape rather than the wrapper - * shape. - */ - final StructureShape targetShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "TargetShape")) - .build(); - final StructureShape wrapperShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "WrapperShape")) - .addMember("baz", targetShape.getId()) - .addTrait(PositionalTrait.builder().build()) - .build(); - final OperationShape operationOutputShape = OperationShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput")) - .output(wrapperShape.getId()) - .build(); - - final ResourceShape resourceShape = ResourceShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Baz")) - .addOperation(operationOutputShape) - .build(); - - final Model model = TestModel.setupModel((builder, modelAssembler) -> { - modelAssembler.addShape(targetShape); - modelAssembler.addShape(wrapperShape); - modelAssembler.addShape(operationOutputShape); - modelAssembler.addShape(resourceShape); - }); - - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - final String actualCode = codegen.generateResourceClass(resourceShape.getId()).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - final List expectedTokens = Tokenizer.tokenize(""" - namespace Test.Foobar { - public abstract class BazBase : IBaz { - public Test.Foobar.TargetShape DoSomethingWithOutput() { - return _DoSomethingWithOutput(); - } - protected abstract Test.Foobar.TargetShape _DoSomethingWithOutput(); - } - } - """); - - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testBadPositionalTrait() { - /* - * Test that a shape marked with @positional that has two members throws an exception - */ - final StructureShape targetShape1 = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "TargetShape1")) - .build(); - final StructureShape targetShape2 = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "TargetShape2")) - .build(); - final StructureShape wrapperShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "WrapperShape")) - .addMember("baz", targetShape1.getId()) - .addMember("bar", targetShape2.getId()) - .addTrait(PositionalTrait.builder().build()) - .build(); - final OperationShape operationOutputShape = OperationShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput")) - .output(wrapperShape.getId()) - .build(); - - final ResourceShape resourceShape = ResourceShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Baz")) - .addOperation(operationOutputShape) - .build(); - - final Model model = TestModel.setupModel((builder, modelAssembler) -> { - modelAssembler.addShape(targetShape1); - modelAssembler.addShape(targetShape2); - modelAssembler.addShape(wrapperShape); - modelAssembler.addShape(operationOutputShape); - modelAssembler.addShape(resourceShape); - }); - - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - try { - codegen.generateResourceClass(resourceShape.getId()).toString(); - } catch (IllegalStateException e) { - assertEquals(e.getMessage(), "Structures marked with '@positional' must have exactly one member"); - } - } - - @Test - public void testGenerateStructureWithReference() { - /* - * Tests that structures which contain members which are marked with @reference correctly use the referenced - * service/resource rather than the wrapper. - */ - final Model model = TestModel.setupModel((builder, modelAssembler) -> { - modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - use aws.polymorph#reference - resource Dummy {} - @reference(resource: Dummy) structure DummyReference {} - structure Container { dummy: DummyReference } - """.formatted(SERVICE_NAMESPACE)); - }); - - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - final ShapeId memberId = ShapeId.fromParts(SERVICE_NAMESPACE, "Container", "dummy"); - final MemberShape memberShape = model.expectShape(memberId, MemberShape.class); - final String actualCode = codegen.generateStructureClassField(memberShape).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize("private Test.Foobar.IDummy _dummy;"); - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateNamedEnumClass() { - final EnumTrait enumTrait = EnumTrait.builder() - .addEnum(EnumDefinition.builder() - .value("t2.nano") - .name("T2_NANO") - .documentation("t2.nano documentation") - .tags(List.of("ebsOnly")) - .build()) - .addEnum(EnumDefinition.builder() - .value("t2.micro") - .name("T2_MICRO") - .documentation("t2.micro documentation") - .tags(List.of("ebsOnly")) - .build()) - .addEnum(EnumDefinition.builder() - .value("m256.mega") - .name("M256_MEGA") - .deprecated(true) - .build()) - .build(); - final StringShape instanceTypeShape = StringShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "InstanceType")) - .addTrait(enumTrait) - .build(); - final Model model = TestModel.setupModel((builder, modelAssembler) -> modelAssembler.addShape(instanceTypeShape)); - - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - final String actualCode = codegen.generateEnumClass(instanceTypeShape.getId()).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - final List expectedTokens = Tokenizer.tokenize(""" - namespace Test.Foobar { - using Amazon.Runtime; - - public class InstanceType : ConstantClass { - /// - /// t2.nano documentation - /// - public static readonly InstanceType T2_NANO = new InstanceType("t2.nano"); - - /// - /// t2.micro documentation - /// - public static readonly InstanceType T2_MICRO = new InstanceType("t2.micro"); - - [System.Obsolete] - public static readonly InstanceType M256_MEGA = new InstanceType("m256.mega"); - - public static readonly InstanceType[] Values = {M256_MEGA, T2_MICRO, T2_NANO}; - - public InstanceType(string value) : base(value) {} - } - } - """); - - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateUnnamedEnumClass() { - final EnumTrait enumTrait = EnumTrait.builder() - .addEnum(EnumDefinition.builder().value("t2.nano").build()) - .addEnum(EnumDefinition.builder().value("t2.micro").build()) - .build(); - final StringShape instanceTypeShape = StringShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "InstanceType")) - .addTrait(enumTrait) - .build(); - final Model model = TestModel.setupModel((builder, modelAssembler) -> modelAssembler.addShape(instanceTypeShape)); - - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - final String actualCode = codegen.generateEnumClass(instanceTypeShape.getId()).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - final List expectedTokens = Tokenizer.tokenize(""" - namespace Test.Foobar { - public class InstanceType { - public static readonly string[] Values = {"t2.micro", "t2.nano"}; - - public InstanceType(string value) : base(value) {} - } - } - """); - - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testShouldNotGenerateStructureReference() { - final ReferenceTrait trait = ReferenceTrait.builder() - .referentId(SERVICE_SHAPE_ID) - .referentType(ReferenceTrait.ReferentType.RESOURCE) - .build(); - final StructureShape foobarStructureShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar")) - .addTrait(trait) - .build(); - - final Model model = TestModel.setupModel((builder, modelAssembler) -> modelAssembler.addShape(foobarStructureShape)); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - - assertFalse( - "Should not try to generate class for structure marked with @reference", - codegen.shouldGenerateStructure(foobarStructureShape) - ); - } - - @Test - public void testShouldNotGenerateStructurePositional() { - final PositionalTrait trait = PositionalTrait.builder().build(); - final StructureShape foobarStructureShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar")) - .addTrait(trait) - .build(); - - final Model model = TestModel.setupModel((builder, modelAssembler) -> modelAssembler.addShape(foobarStructureShape)); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - - assertFalse( - "Should not try to generate class for structure marked with @positional", - codegen.shouldGenerateStructure(foobarStructureShape) - ); - } - - @Test - public void testShouldNotGenerateStructureTrait() { - final TraitDefinition trait = TraitDefinition.builder().build(); - final StructureShape foobarStructureShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar")) - .addTrait(trait) - .build(); - - final Model model = TestModel.setupModel((builder, modelAssembler) -> modelAssembler.addShape(foobarStructureShape)); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - - assertFalse( - "Should not try to generate class for structure marked with @trait", - codegen.shouldGenerateStructure(foobarStructureShape) - ); - } - - @Test - public void testShouldGenerateStructureTrue() { - final TraitDefinition trait = TraitDefinition.builder().build(); - final StructureShape foobarStructureShape = StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar")) - .build(); - - final Model model = TestModel.setupModel((builder, modelAssembler) -> modelAssembler.addShape(foobarStructureShape)); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - - assertTrue( - "Should have generated class for structure", - codegen.shouldGenerateStructure(foobarStructureShape) - ); - } - @Test - public void testGenerateSpecificExceptionClass() { - final Model model = TestModel.setupModel(((builder, modelAssembler) -> - modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - @error("client") - structure UnfortunateException { - @required - message: String, - } - """.formatted(SERVICE_NAMESPACE)))); - final ShapeId exceptionShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "UnfortunateException"); - - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); - final String actualCode = codegen.generateSpecificExceptionClass( - model.expectShape(exceptionShapeId, StructureShape.class)).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - final List expectedTokens = Tokenizer.tokenize(""" - namespace Test.Foobar { - public class UnfortunateException : Exception { - public UnfortunateException(string message) : base(message) {} - public string getMessage() { return this.Message;} - } - } - """); - - assertEquals(expectedTokens, actualTokens); + // TODO: Apply ServiceCodegen changes to tests + // https://github.com/smithy-lang/smithy-dafny/issues/27 + @Test + public void testGenerateEmptyService() { + final Model model = TestModel.setupModel(); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + final Map codeByPath = codegen.generate(); + + final Set expectedPaths = new HashSet(); + expectedPaths.add(Path.of("CollectionOfErrors.cs")); + expectedPaths.add(Path.of("OpaqueError.cs")); + assertEquals(expectedPaths, codeByPath.keySet()); + } + + @Test + public void testGenerateServiceInterfaceMethod() { + final StructureShape inputShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingInput")) + .build(); + final StructureShape outputShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingOutput")) + .build(); + final OperationShape operationShape = OperationShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomething")) + .input(inputShape.getId()) + .output(outputShape.getId()) + .build(); + final Model model = TestModel.setupModel((builder, modelAssembler) -> { + modelAssembler.addShape(inputShape); + modelAssembler.addShape(outputShape); + builder.addOperation(operationShape.getId()); + modelAssembler.addShape(operationShape); + }); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + final String actualCode = codegen + .generateInterfaceMethod(operationShape.getId()) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + """ + Test.Foobar.DoSomethingOutput DoSomething(Test.Foobar.DoSomethingInput input); + """ + ); + + assertEquals(expectedTokens, actualTokens); + } + + // Removed 2023-01-27 for output-local-service-test + // @Test + // public void testGenerateStructureClass() { + // final Model model = TestModel.setupModel((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // structure Foobar { + // someBool: Boolean, + // @required + // someInt: Integer, + // someString: String, + // } + // """.formatted(SERVICE_NAMESPACE))); + // + // final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); + // final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + // final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar"); + // final StructureShape structureShape = model.expectShape(shapeId, StructureShape.class); + // final String actualCode = codegen.generateStructureClass(structureShape).toString(); + // final List actualTokens = Tokenizer.tokenize(actualCode); + // + // final List expectedTokens = Tokenizer.tokenize(""" + // namespace Test.Foobar { + // public class Foobar { + // private bool? _someBool; + // private int? _someInt; + // private string _someString; + // + // public bool SomeBool { + // get { return this._someBool.GetValueOrDefault(); } + // set { this._someBool = value; } + // } + // + // internal bool IsSetSomeBool() + // { + // return this._someBool.HasValue; + // } + // + // public int SomeInt { + // get { return this._someInt.GetValueOrDefault(); } + // set { this._someInt = value; } + // } + // + // internal bool IsSetSomeInt() + // { + // return this._someInt.HasValue; + // } + // + // public string SomeString { + // get { return this._someString; } + // set { this._someString = value; } + // } + // + // internal bool IsSetSomeString() + // { + // return this._someString != null; + // } + // + // public void Validate() { + // if (!IsSetSomeInt()) throw new System.ArgumentException( + // "Missing value for required property 'SomeInt'" + // ); + // } + // } + // } + // """); + // + // assertEquals(expectedTokens, actualTokens); + // } + + @Test + public void testGenerateResourceInterface() { + // Input, no output + final StructureShape inputShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingInput")) + .build(); + final OperationShape operationInputShape = OperationShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithInput")) + .input(inputShape.getId()) + .build(); + + // Output, no input + final StructureShape outputShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingOutput")) + .build(); + final OperationShape operationOutputShape = OperationShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput")) + .output(outputShape.getId()) + .build(); + + final ResourceShape resourceShape = ResourceShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Baz")) + .addOperation(operationInputShape) + .addOperation(operationOutputShape) + .build(); + + final Model model = TestModel.setupModel((builder, modelAssembler) -> { + modelAssembler.addShape(inputShape); + modelAssembler.addShape(outputShape); + modelAssembler.addShape(operationInputShape); + modelAssembler.addShape(operationOutputShape); + modelAssembler.addShape(resourceShape); + }); + + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + final String actualCode = codegen + .generateResourceInterface(resourceShape.getId()) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + final List expectedTokens = Tokenizer.tokenize( + """ + namespace Test.Foobar { + public interface IBaz { + void DoSomethingWithInput(Test.Foobar.DoSomethingInput input); + Test.Foobar.DoSomethingOutput DoSomethingWithOutput(); + } + } + """ + ); + + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateResourceClass() { + // Input, no output + final StructureShape inputShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingInput")) + .build(); + final OperationShape operationInputShape = OperationShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithInput")) + .input(inputShape.getId()) + .build(); + + // Output, no input + final StructureShape outputShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingOutput")) + .build(); + final OperationShape operationOutputShape = OperationShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput")) + .output(outputShape.getId()) + .build(); + + final ResourceShape resourceShape = ResourceShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Baz")) + .addOperation(operationInputShape) + .addOperation(operationOutputShape) + .build(); + + final Model model = TestModel.setupModel((builder, modelAssembler) -> { + modelAssembler.addShape(inputShape); + modelAssembler.addShape(outputShape); + modelAssembler.addShape(operationInputShape); + modelAssembler.addShape(operationOutputShape); + modelAssembler.addShape(resourceShape); + }); + + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + final String actualCode = codegen + .generateResourceClass(resourceShape.getId()) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + final List expectedTokens = Tokenizer.tokenize( + """ + namespace Test.Foobar { + public abstract class BazBase : IBaz { + public void DoSomethingWithInput(Test.Foobar.DoSomethingInput input) { + input.Validate(); + _DoSomethingWithInput(input); + } + protected abstract void _DoSomethingWithInput(Test.Foobar.DoSomethingInput input); + + public Test.Foobar.DoSomethingOutput DoSomethingWithOutput() { + return _DoSomethingWithOutput(); + } + protected abstract Test.Foobar.DoSomethingOutput _DoSomethingWithOutput(); + } + } + """ + ); + + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateResourceClassWithPositionalOutput() { + /* + * Test that shapes marked with @positional are unwrapped to their single member shape rather than the wrapper + * shape. + */ + final StructureShape targetShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "TargetShape")) + .build(); + final StructureShape wrapperShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "WrapperShape")) + .addMember("baz", targetShape.getId()) + .addTrait(PositionalTrait.builder().build()) + .build(); + final OperationShape operationOutputShape = OperationShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput")) + .output(wrapperShape.getId()) + .build(); + + final ResourceShape resourceShape = ResourceShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Baz")) + .addOperation(operationOutputShape) + .build(); + + final Model model = TestModel.setupModel((builder, modelAssembler) -> { + modelAssembler.addShape(targetShape); + modelAssembler.addShape(wrapperShape); + modelAssembler.addShape(operationOutputShape); + modelAssembler.addShape(resourceShape); + }); + + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + final String actualCode = codegen + .generateResourceClass(resourceShape.getId()) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + final List expectedTokens = Tokenizer.tokenize( + """ + namespace Test.Foobar { + public abstract class BazBase : IBaz { + public Test.Foobar.TargetShape DoSomethingWithOutput() { + return _DoSomethingWithOutput(); + } + protected abstract Test.Foobar.TargetShape _DoSomethingWithOutput(); + } + } + """ + ); + + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testBadPositionalTrait() { + /* + * Test that a shape marked with @positional that has two members throws an exception + */ + final StructureShape targetShape1 = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "TargetShape1")) + .build(); + final StructureShape targetShape2 = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "TargetShape2")) + .build(); + final StructureShape wrapperShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "WrapperShape")) + .addMember("baz", targetShape1.getId()) + .addMember("bar", targetShape2.getId()) + .addTrait(PositionalTrait.builder().build()) + .build(); + final OperationShape operationOutputShape = OperationShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput")) + .output(wrapperShape.getId()) + .build(); + + final ResourceShape resourceShape = ResourceShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Baz")) + .addOperation(operationOutputShape) + .build(); + + final Model model = TestModel.setupModel((builder, modelAssembler) -> { + modelAssembler.addShape(targetShape1); + modelAssembler.addShape(targetShape2); + modelAssembler.addShape(wrapperShape); + modelAssembler.addShape(operationOutputShape); + modelAssembler.addShape(resourceShape); + }); + + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + try { + codegen.generateResourceClass(resourceShape.getId()).toString(); + } catch (IllegalStateException e) { + assertEquals( + e.getMessage(), + "Structures marked with '@positional' must have exactly one member" + ); } + } + + @Test + public void testGenerateStructureWithReference() { + /* + * Tests that structures which contain members which are marked with @reference correctly use the referenced + * service/resource rather than the wrapper. + */ + final Model model = TestModel.setupModel((builder, modelAssembler) -> { + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + use aws.polymorph#reference + resource Dummy {} + @reference(resource: Dummy) structure DummyReference {} + structure Container { dummy: DummyReference } + """.formatted(SERVICE_NAMESPACE) + ); + }); + + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + final ShapeId memberId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "Container", + "dummy" + ); + final MemberShape memberShape = model.expectShape( + memberId, + MemberShape.class + ); + final String actualCode = codegen + .generateStructureClassField(memberShape) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + "private Test.Foobar.IDummy _dummy;" + ); + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateNamedEnumClass() { + final EnumTrait enumTrait = EnumTrait + .builder() + .addEnum( + EnumDefinition + .builder() + .value("t2.nano") + .name("T2_NANO") + .documentation("t2.nano documentation") + .tags(List.of("ebsOnly")) + .build() + ) + .addEnum( + EnumDefinition + .builder() + .value("t2.micro") + .name("T2_MICRO") + .documentation("t2.micro documentation") + .tags(List.of("ebsOnly")) + .build() + ) + .addEnum( + EnumDefinition + .builder() + .value("m256.mega") + .name("M256_MEGA") + .deprecated(true) + .build() + ) + .build(); + final StringShape instanceTypeShape = StringShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "InstanceType")) + .addTrait(enumTrait) + .build(); + final Model model = TestModel.setupModel((builder, modelAssembler) -> + modelAssembler.addShape(instanceTypeShape) + ); + + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + final String actualCode = codegen + .generateEnumClass(instanceTypeShape.getId()) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + final List expectedTokens = Tokenizer.tokenize( + """ + namespace Test.Foobar { + using Amazon.Runtime; + + public class InstanceType : ConstantClass { + /// + /// t2.nano documentation + /// + public static readonly InstanceType T2_NANO = new InstanceType("t2.nano"); + + /// + /// t2.micro documentation + /// + public static readonly InstanceType T2_MICRO = new InstanceType("t2.micro"); + + [System.Obsolete] + public static readonly InstanceType M256_MEGA = new InstanceType("m256.mega"); + + public static readonly InstanceType[] Values = {M256_MEGA, T2_MICRO, T2_NANO}; + + public InstanceType(string value) : base(value) {} + } + } + """ + ); + + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateUnnamedEnumClass() { + final EnumTrait enumTrait = EnumTrait + .builder() + .addEnum(EnumDefinition.builder().value("t2.nano").build()) + .addEnum(EnumDefinition.builder().value("t2.micro").build()) + .build(); + final StringShape instanceTypeShape = StringShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "InstanceType")) + .addTrait(enumTrait) + .build(); + final Model model = TestModel.setupModel((builder, modelAssembler) -> + modelAssembler.addShape(instanceTypeShape) + ); + + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + final String actualCode = codegen + .generateEnumClass(instanceTypeShape.getId()) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + final List expectedTokens = Tokenizer.tokenize( + """ + namespace Test.Foobar { + public class InstanceType { + public static readonly string[] Values = {"t2.micro", "t2.nano"}; + + public InstanceType(string value) : base(value) {} + } + } + """ + ); + + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testShouldNotGenerateStructureReference() { + final ReferenceTrait trait = ReferenceTrait + .builder() + .referentId(SERVICE_SHAPE_ID) + .referentType(ReferenceTrait.ReferentType.RESOURCE) + .build(); + final StructureShape foobarStructureShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar")) + .addTrait(trait) + .build(); + + final Model model = TestModel.setupModel((builder, modelAssembler) -> + modelAssembler.addShape(foobarStructureShape) + ); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + + assertFalse( + "Should not try to generate class for structure marked with @reference", + codegen.shouldGenerateStructure(foobarStructureShape) + ); + } + + @Test + public void testShouldNotGenerateStructurePositional() { + final PositionalTrait trait = PositionalTrait.builder().build(); + final StructureShape foobarStructureShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar")) + .addTrait(trait) + .build(); + + final Model model = TestModel.setupModel((builder, modelAssembler) -> + modelAssembler.addShape(foobarStructureShape) + ); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + + assertFalse( + "Should not try to generate class for structure marked with @positional", + codegen.shouldGenerateStructure(foobarStructureShape) + ); + } + + @Test + public void testShouldNotGenerateStructureTrait() { + final TraitDefinition trait = TraitDefinition.builder().build(); + final StructureShape foobarStructureShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar")) + .addTrait(trait) + .build(); + + final Model model = TestModel.setupModel((builder, modelAssembler) -> + modelAssembler.addShape(foobarStructureShape) + ); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + + assertFalse( + "Should not try to generate class for structure marked with @trait", + codegen.shouldGenerateStructure(foobarStructureShape) + ); + } + + @Test + public void testShouldGenerateStructureTrue() { + final TraitDefinition trait = TraitDefinition.builder().build(); + final StructureShape foobarStructureShape = StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar")) + .build(); + + final Model model = TestModel.setupModel((builder, modelAssembler) -> + modelAssembler.addShape(foobarStructureShape) + ); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + + assertTrue( + "Should have generated class for structure", + codegen.shouldGenerateStructure(foobarStructureShape) + ); + } + + @Test + public void testGenerateSpecificExceptionClass() { + final Model model = TestModel.setupModel( + ((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + @error("client") + structure UnfortunateException { + @required + message: String, + } + """.formatted(SERVICE_NAMESPACE) + )) + ); + final ShapeId exceptionShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "UnfortunateException" + ); + + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + final ServiceCodegen codegen = new ServiceCodegen(model, serviceShape); + final String actualCode = codegen + .generateSpecificExceptionClass( + model.expectShape(exceptionShapeId, StructureShape.class) + ) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + final List expectedTokens = Tokenizer.tokenize( + """ + namespace Test.Foobar { + public class UnfortunateException : Exception { + public UnfortunateException(string message) : base(message) {} + public string getMessage() { return this.Message;} + } + } + """ + ); + + assertEquals(expectedTokens, actualTokens); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ShimCodegenTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ShimCodegenTest.java index 9379e4cf9f..1f7064c79d 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ShimCodegenTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/ShimCodegenTest.java @@ -3,6 +3,13 @@ package software.amazon.polymorph.smithydotnet; +import static org.junit.Assert.*; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.*; +import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; +import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; + +import java.util.List; +import java.util.function.BiConsumer; import org.junit.Test; import software.amazon.polymorph.util.TestModel; import software.amazon.polymorph.util.Tokenizer; @@ -12,197 +19,288 @@ import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.ShapeId; -import java.util.List; -import java.util.function.BiConsumer; +public class ShimCodegenTest { -import static org.junit.Assert.*; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.*; -import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; -import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; + // TODO: Apply ShimCodegen refactor to tests + // https://github.com/smithy-lange/smithy-dafmy/issues/28 + private static ShimCodegen setupCodegen( + final BiConsumer updater + ) { + final Model model = TestModel.setupModel(updater); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + return new ShimCodegen(model, serviceShape); + } -public class ShimCodegenTest { - // TODO: Apply ShimCodegen refactor to tests - // https://github.com/smithy-lange/smithy-dafmy/issues/28 - private static ShimCodegen setupCodegen(final BiConsumer updater) { - final Model model = TestModel.setupModel(updater); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - return new ShimCodegen(model, serviceShape); - } - - @Test - public void testGenerateResourceShim() { - final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - resource Doer { operations: [DoIt] } - operation DoIt {} - """.formatted(SERVICE_NAMESPACE))); - final ServiceShape serviceShape = codegen.getModel().expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ShapeId resourceShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Doer"); - - final String commonErrorTypeConverter = codegen.getNameResolver() - .qualifiedTypeConverterForCommonError(serviceShape, FROM_DAFNY); - final List expectedTokens = Tokenizer.tokenize(""" - namespace Test.Foobar { - internal class Doer : DoerBase { - internal readonly test.foobar.internaldafny.types.IDoer _impl; - internal Doer(test.foobar.internaldafny.types.IDoer impl) { this._impl = impl; } - protected override void _DoIt() { - Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> result = - this._impl.DoIt(); - if (result.is_Failure) throw %s(result.dtor_error); - } - } - } - """.formatted(commonErrorTypeConverter)); - - final String actualCode = codegen.generateResourceShim(resourceShapeId).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateResourceConstructor() { - final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - resource Thing {} - """.formatted(SERVICE_NAMESPACE))); - final ShapeId resourceShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Thing"); - - final List expectedTokens = Tokenizer.tokenize( - "internal Thing(test.foobar.internaldafny.types.IThing impl) { this._impl = impl; }"); - - final String actualCode = codegen.generateResourceConstructor(resourceShapeId).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateOperationShims() { - final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - resource Doer { operations: [DoThis, DoThat] } - operation DoThis {} - operation DoThat {} - """.formatted(SERVICE_NAMESPACE))); - final ServiceShape serviceShape = codegen.getModel().expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ShapeId resourceShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Doer"); - - final String commonErrorTypeConverter = codegen.getNameResolver() - .qualifiedTypeConverterForCommonError(serviceShape, FROM_DAFNY); - final List expectedTokens = Tokenizer.tokenize(""" - protected override void _DoThis() { - Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> result = - this._impl.DoThis(); - if (result.is_Failure) throw %1$s(result.dtor_error); - } - protected override void _DoThat() { - Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> result = - this._impl.DoThat(); - if (result.is_Failure) throw %1$s(result.dtor_error); - } - """.formatted(commonErrorTypeConverter)); - - final String actualCode = codegen.generateOperationShims(resourceShapeId).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateOperationShimInputOnly() { - final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - operation DoIt { input: Input } - structure Input {} - """.formatted(SERVICE_NAMESPACE))); - final ServiceShape serviceShape = codegen.getModel().expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ShapeId operationShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "DoIt"); - final ShapeId inputShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Input"); - - final String commonErrorTypeConverter = codegen.getNameResolver() - .qualifiedTypeConverterForCommonError(serviceShape, FROM_DAFNY); - final List expectedTokens = Tokenizer.tokenize(""" - protected override void _DoIt(Test.Foobar.Input input) { - test.foobar.internaldafny.types._IInput internalInput = %s(input); - Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> - result = this._impl.DoIt(internalInput); - if (result.is_Failure) throw %s(result.dtor_error); - } - """.formatted( - DotNetNameResolver.qualifiedTypeConverter(inputShapeId, TO_DAFNY), - commonErrorTypeConverter)); - - final String actualCode = codegen.generateOperationShim(operationShapeId).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateOperationShimOutputOnly() { - final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - operation DoIt { output: Output } - structure Output {} - """.formatted(SERVICE_NAMESPACE))); - final ServiceShape serviceShape = codegen.getModel().expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ShapeId operationShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "DoIt"); - final ShapeId outputShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Output"); - - final String commonErrorTypeConverter = codegen.getNameResolver() - .qualifiedTypeConverterForCommonError(serviceShape, FROM_DAFNY); - final List expectedTokens = Tokenizer.tokenize(""" - protected override Test.Foobar.Output _DoIt() { - Wrappers_Compile._IResult - result = this._impl.DoIt(); - if (result.is_Failure) throw %s(result.dtor_error); - return %s(result.dtor_value); - } - """.formatted( - commonErrorTypeConverter, - DotNetNameResolver.qualifiedTypeConverter(outputShapeId, FROM_DAFNY))); - - final String actualCode = codegen.generateOperationShim(operationShapeId).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - assertEquals(expectedTokens, actualTokens); - } - - @Test - public void testGenerateOperationShimInputAndOutput() { - final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> { - modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - operation DoIt { input: Input, output: Output } - structure Input {} - structure Output {} - """.formatted(SERVICE_NAMESPACE)); - }); - final ServiceShape serviceShape = codegen.getModel().expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - final ShapeId operationShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "DoIt"); - final ShapeId inputShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Input"); - final ShapeId outputShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Output"); - - final String commonErrorTypeConverter = codegen.getNameResolver() - .qualifiedTypeConverterForCommonError(serviceShape, FROM_DAFNY); - final List expectedTokens = Tokenizer.tokenize(""" - protected override Test.Foobar.Output _DoIt(Test.Foobar.Input input) { - test.foobar.internaldafny.types._IInput internalInput = %s(input); - Wrappers_Compile._IResult - result = this._impl.DoIt(internalInput); - if (result.is_Failure) throw %s(result.dtor_error); - return %s(result.dtor_value); - } - """.formatted( - DotNetNameResolver.qualifiedTypeConverter(inputShapeId, TO_DAFNY), - commonErrorTypeConverter, - DotNetNameResolver.qualifiedTypeConverter(outputShapeId, FROM_DAFNY))); - - final String actualCode = codegen.generateOperationShim(operationShapeId).toString(); - final List actualTokens = Tokenizer.tokenize(actualCode); - - assertEquals(expectedTokens, actualTokens); - } + @Test + public void testGenerateResourceShim() { + final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + resource Doer { operations: [DoIt] } + operation DoIt {} + """.formatted(SERVICE_NAMESPACE) + ) + ); + final ServiceShape serviceShape = codegen + .getModel() + .expectShape(SERVICE_SHAPE_ID, ServiceShape.class); + final ShapeId resourceShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "Doer" + ); + + final String commonErrorTypeConverter = codegen + .getNameResolver() + .qualifiedTypeConverterForCommonError(serviceShape, FROM_DAFNY); + final List expectedTokens = Tokenizer.tokenize( + """ + namespace Test.Foobar { + internal class Doer : DoerBase { + internal readonly test.foobar.internaldafny.types.IDoer _impl; + internal Doer(test.foobar.internaldafny.types.IDoer impl) { this._impl = impl; } + protected override void _DoIt() { + Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> result = + this._impl.DoIt(); + if (result.is_Failure) throw %s(result.dtor_error); + } + } + } + """.formatted(commonErrorTypeConverter) + ); + + final String actualCode = codegen + .generateResourceShim(resourceShapeId) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateResourceConstructor() { + final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + resource Thing {} + """.formatted(SERVICE_NAMESPACE) + ) + ); + final ShapeId resourceShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "Thing" + ); + + final List expectedTokens = Tokenizer.tokenize( + "internal Thing(test.foobar.internaldafny.types.IThing impl) { this._impl = impl; }" + ); + + final String actualCode = codegen + .generateResourceConstructor(resourceShapeId) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateOperationShims() { + final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + resource Doer { operations: [DoThis, DoThat] } + operation DoThis {} + operation DoThat {} + """.formatted(SERVICE_NAMESPACE) + ) + ); + final ServiceShape serviceShape = codegen + .getModel() + .expectShape(SERVICE_SHAPE_ID, ServiceShape.class); + final ShapeId resourceShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "Doer" + ); + + final String commonErrorTypeConverter = codegen + .getNameResolver() + .qualifiedTypeConverterForCommonError(serviceShape, FROM_DAFNY); + final List expectedTokens = Tokenizer.tokenize( + """ + protected override void _DoThis() { + Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> result = + this._impl.DoThis(); + if (result.is_Failure) throw %1$s(result.dtor_error); + } + protected override void _DoThat() { + Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> result = + this._impl.DoThat(); + if (result.is_Failure) throw %1$s(result.dtor_error); + } + """.formatted(commonErrorTypeConverter) + ); + + final String actualCode = codegen + .generateOperationShims(resourceShapeId) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateOperationShimInputOnly() { + final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + operation DoIt { input: Input } + structure Input {} + """.formatted(SERVICE_NAMESPACE) + ) + ); + final ServiceShape serviceShape = codegen + .getModel() + .expectShape(SERVICE_SHAPE_ID, ServiceShape.class); + final ShapeId operationShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "DoIt" + ); + final ShapeId inputShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Input"); + + final String commonErrorTypeConverter = codegen + .getNameResolver() + .qualifiedTypeConverterForCommonError(serviceShape, FROM_DAFNY); + final List expectedTokens = Tokenizer.tokenize( + """ + protected override void _DoIt(Test.Foobar.Input input) { + test.foobar.internaldafny.types._IInput internalInput = %s(input); + Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> + result = this._impl.DoIt(internalInput); + if (result.is_Failure) throw %s(result.dtor_error); + } + """.formatted( + DotNetNameResolver.qualifiedTypeConverter(inputShapeId, TO_DAFNY), + commonErrorTypeConverter + ) + ); + + final String actualCode = codegen + .generateOperationShim(operationShapeId) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateOperationShimOutputOnly() { + final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + operation DoIt { output: Output } + structure Output {} + """.formatted(SERVICE_NAMESPACE) + ) + ); + final ServiceShape serviceShape = codegen + .getModel() + .expectShape(SERVICE_SHAPE_ID, ServiceShape.class); + final ShapeId operationShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "DoIt" + ); + final ShapeId outputShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "Output" + ); + + final String commonErrorTypeConverter = codegen + .getNameResolver() + .qualifiedTypeConverterForCommonError(serviceShape, FROM_DAFNY); + final List expectedTokens = Tokenizer.tokenize( + """ + protected override Test.Foobar.Output _DoIt() { + Wrappers_Compile._IResult + result = this._impl.DoIt(); + if (result.is_Failure) throw %s(result.dtor_error); + return %s(result.dtor_value); + } + """.formatted( + commonErrorTypeConverter, + DotNetNameResolver.qualifiedTypeConverter(outputShapeId, FROM_DAFNY) + ) + ); + + final String actualCode = codegen + .generateOperationShim(operationShapeId) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + assertEquals(expectedTokens, actualTokens); + } + + @Test + public void testGenerateOperationShimInputAndOutput() { + final ShimCodegen codegen = setupCodegen((builder, modelAssembler) -> { + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + operation DoIt { input: Input, output: Output } + structure Input {} + structure Output {} + """.formatted(SERVICE_NAMESPACE) + ); + }); + final ServiceShape serviceShape = codegen + .getModel() + .expectShape(SERVICE_SHAPE_ID, ServiceShape.class); + final ShapeId operationShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "DoIt" + ); + final ShapeId inputShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Input"); + final ShapeId outputShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "Output" + ); + + final String commonErrorTypeConverter = codegen + .getNameResolver() + .qualifiedTypeConverterForCommonError(serviceShape, FROM_DAFNY); + final List expectedTokens = Tokenizer.tokenize( + """ + protected override Test.Foobar.Output _DoIt(Test.Foobar.Input input) { + test.foobar.internaldafny.types._IInput internalInput = %s(input); + Wrappers_Compile._IResult + result = this._impl.DoIt(internalInput); + if (result.is_Failure) throw %s(result.dtor_error); + return %s(result.dtor_value); + } + """.formatted( + DotNetNameResolver.qualifiedTypeConverter(inputShapeId, TO_DAFNY), + commonErrorTypeConverter, + DotNetNameResolver.qualifiedTypeConverter(outputShapeId, FROM_DAFNY) + ) + ); + + final String actualCode = codegen + .generateOperationShim(operationShapeId) + .toString(); + final List actualTokens = Tokenizer.tokenize(actualCode); + + assertEquals(expectedTokens, actualTokens); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/TypeConversionCodegenTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/TypeConversionCodegenTest.java index 4fa6b689e8..4e24219816 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/TypeConversionCodegenTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/TypeConversionCodegenTest.java @@ -3,7 +3,15 @@ package software.amazon.polymorph.smithydotnet; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static software.amazon.polymorph.smithydotnet.TypeConversionCodegen.TYPE_CONVERSION_CLASS_PATH; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; +import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; +import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; +import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; +import static software.amazon.polymorph.util.Tokenizer.tokenize; +import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; import java.nio.file.Path; import java.util.HashSet; @@ -14,7 +22,7 @@ import java.util.function.BiConsumer; import java.util.stream.Collectors; import java.util.stream.Stream; - +import org.junit.Test; import software.amazon.polymorph.antlr.CSharpLexer; import software.amazon.polymorph.smithydotnet.TypeConversionCodegen.TypeConverter; import software.amazon.polymorph.traits.ClientConfigTrait; @@ -28,887 +36,947 @@ import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.StructureShape; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static software.amazon.polymorph.smithydotnet.TypeConversionCodegen.TYPE_CONVERSION_CLASS_PATH; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.FROM_DAFNY; -import static software.amazon.polymorph.smithydotnet.TypeConversionDirection.TO_DAFNY; -import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; -import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; -import static software.amazon.polymorph.util.Tokenizer.tokenize; -import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; - public class TypeConversionCodegenTest { - // TODO: Apply TypeConversionCodegen refactor to tests - // https://github.com/smithy-lang/smithy-dafny/issues/29 - private static TypeConversionCodegen setupCodegen(final BiConsumer updater) { - final Model model = TestModel.setupModel(updater); - final ServiceShape serviceShape = model.expectShape(SERVICE_SHAPE_ID, ServiceShape.class); - return new TypeConversionCodegen(model, serviceShape); - } - - private static String generate(final TypeConversionCodegen codegen) { - final Map generatedCode = codegen.generate(); - assertTrue(generatedCode.containsKey(TYPE_CONVERSION_CLASS_PATH)); - return Objects.requireNonNull(generatedCode.get(TYPE_CONVERSION_CLASS_PATH)).toString(); - } - -// Removed 2023-01-27 for output-local-service-test -// @Test -// public void testGenerateEmptyModel() { -// final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); -// final String actual = generate(codegen); -// final String expected = """ -// using System.Linq; -// using System; -// namespace Test.Foobar { -// internal static class TypeConversion { -// public static System.Exception FromDafny_CommonError(test.foobar.internaldafny.types._IError value) { -// switch (value) { -// case test.foobar.internaldafny.types.Error_Opaque dafnyVal: -// return new OpaqueError(dafnyVal._obj); -// default: -// // The switch MUST be complete for _IError, so `value` MUST NOT be an _IError. (How did you get here?) -// return new OpaqueError(); -// } -// } -// -// public static test.foobar.internaldafny.types._IError ToDafny_CommonError(System.Exception value) { -// switch (value) { -// // OpaqueError is redundant, but listed for completeness. -// case OpaqueError exception: -// return new test.foobar.internaldafny.types.Error_Opaque(exception); -// case System.Exception exception: -// return new test.foobar.internaldafny.types.Error_Opaque(exception); -// default: -// // The switch MUST be complete for System.Exception, so `value` MUST NOT be an System.Exception. (How did you get here?) -// return new test.foobar.internaldafny.types.Error_Opaque(value); -// } -// } -// } -// } -// """.formatted( -// DotNetNameResolver.typeConverterForShape(ShapeId.from("smithy.api#String"), FROM_DAFNY), -// DotNetNameResolver.typeConverterForShape(ShapeId.from("smithy.api#String"), TO_DAFNY), //ToDafny_String -// DotNetNameResolver.typeConverterForShape(ShapeId.from("smithy.api#String"), TO_DAFNY) //ToDafny_String -// ); -// tokenizeAndAssertEqual(expected, actual); -// } - - @Test - public void testGenerateSimpleModel() { - final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> { - builder.addOperation(ShapeId.fromParts(SERVICE_NAMESPACE, "DoBar")); - modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - operation DoBar { input: DoBarInput, output: DoBarOutput } - structure DoBarInput { bool: Boolean } - structure DoBarOutput { int: Integer } - """.formatted(SERVICE_NAMESPACE)); - }); - final String actual = generate(codegen); - final Set actualTokens = new HashSet<>(tokenize(actual)); - - final Stream expectedConverterMethods = Stream.of( - SERVICE_NAMESPACE + "#DoBarInput", - SERVICE_NAMESPACE + "#DoBarInput$bool", - SERVICE_NAMESPACE + "#DoBarOutput", - SERVICE_NAMESPACE + "#DoBarOutput$int", - "smithy.api#Boolean", - "smithy.api#Integer" - ) - .map(ShapeId::from) - .flatMap(shapeId -> Stream.of( - DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY), - DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY) - )) - .map(converterName -> new ParseToken(converterName, CSharpLexer.IDENTIFIER)); - assertTrue(expectedConverterMethods.allMatch(actualTokens::contains)); - } - - @Test - public void testFindShapeIdsToConvert() { - final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> { - builder.addOperation(ShapeId.fromParts(SERVICE_NAMESPACE, "DoBar")); - builder.addTrait(ClientConfigTrait.builder() - .clientConfigId(ShapeId.fromParts(SERVICE_NAMESPACE, "FoobarConfig")) - .build()); - modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - structure FoobarConfig {} - resource FooResource { operations: [DoBaz] } - operation DoBar { input: DoBarInput, errors: [UsedError] } - operation DoBaz { output: DoBazOutput } - structure DoBarInput { qux: Qux } - structure DoBazOutput { xyzzy: Xyzzy } - map Qux { key: String, value: Integer } - list Xyzzy { member: Blob } - @error("client") structure UsedError { @required message: String } - @error("client") structure UnusedError { @required message: String } - """.formatted(SERVICE_NAMESPACE)); - }); - final Set expectedShapeIds = Stream.of( - SERVICE_NAMESPACE + "#DoBarInput", - SERVICE_NAMESPACE + "#DoBarInput$qux", - SERVICE_NAMESPACE + "#DoBazOutput", - SERVICE_NAMESPACE + "#DoBazOutput$xyzzy", - SERVICE_NAMESPACE + "#Qux", - SERVICE_NAMESPACE + "#Qux$key", - SERVICE_NAMESPACE + "#Qux$value", - SERVICE_NAMESPACE + "#Xyzzy", - SERVICE_NAMESPACE + "#Xyzzy$member", - SERVICE_NAMESPACE + "#UsedError", - SERVICE_NAMESPACE + "#UsedError$message", - // Unused errors must also have type converters, since the common error shape converter depends on all - // specific errors in the model (even if unused in operations) - SERVICE_NAMESPACE + "#UnusedError", - SERVICE_NAMESPACE + "#UnusedError$message", - "smithy.api#String", - "smithy.api#Integer", - "smithy.api#Blob" - ).map(ShapeId::from).collect(Collectors.toSet()); - - final Set actualShapeIds = codegen.findShapeIdsToConvert(); - assertEquals(expectedShapeIds, actualShapeIds); - } - - @Test - public void testGenerateBlobConverter() { - final ShapeId shapeId = ShapeId.from("smithy.api#Blob"); - final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); - final TypeConverter converter = codegen.generateBlobConverter(BlobShape.builder().id(shapeId).build()); - assertEquals(shapeId, converter.shapeId()); - - final String actualFromDafny = converter.fromDafny().toString(); - final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); - final String expectedFromDafny = """ - public static System.IO.MemoryStream %s(Dafny.ISequence value) { - return new System.IO.MemoryStream(value.Elements); - } - """.formatted(fromDafnyConverterName); - tokenizeAndAssertEqual(expectedFromDafny, actualFromDafny); - - final String actualToDafny = converter.toDafny().toString(); - final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); - final String expectedToDafny = """ - public static Dafny.ISequence %s(System.IO.MemoryStream value) { - if (value.ToArray().Length == 0 && value.Length > 0) - { - throw new System.ArgumentException("Fatal Error: MemoryStream instance not backed by an array!"); - } - return Dafny.Sequence.FromArray(value.ToArray()); - } - """.formatted(toDafnyConverterName); - tokenizeAndAssertEqual(expectedToDafny, actualToDafny); - } - -// @Test -// public void testGenerateBooleanConverter() { -// final ShapeId shapeId = ShapeId.from("smithy.api#Boolean"); -// final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); -// final TypeConverter converter = codegen.generateBooleanConverter(BooleanShape.builder().id(shapeId).build()); -// assertEquals(shapeId, converter.shapeId()); -// -// final String actualFromDafny = converter.fromDafny().toString(); -// final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final String expectedFromDafny = -// "public static bool %s(bool value) { return value; }".formatted(fromDafnyConverterName); -// tokenizeAndAssertEqual(expectedFromDafny, actualFromDafny); -// -// final String actualToDafny = converter.toDafny().toString(); -// final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final String expectedToDafny = -// "public static bool %s(bool value) { return value; }".formatted(toDafnyConverterName); -// tokenizeAndAssertEqual(expectedToDafny, actualToDafny); -// } - -// @Test -// public void testGenerateStringConverterRegularString() { -// final ShapeId shapeId = ShapeId.from("smithy.api#String"); -// final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); -// final TypeConverter converter = codegen.generateStringConverter(StringShape.builder().id(shapeId).build()); -// assertEquals(shapeId, converter.shapeId()); -// -// final String actualFromDafny = converter.fromDafny().toString(); -// final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final String expectedFromDafny = """ -// public static string %s(Dafny.ISequence value) { -// return new string(value.Elements); -// }""".formatted(fromDafnyConverterName); -// tokenizeAndAssertEqual(expectedFromDafny, actualFromDafny); -// -// final String actualToDafny = converter.toDafny().toString(); -// final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final String expectedToDafny = """ -// public static Dafny.ISequence %s(string value) { -// return Dafny.Sequence.FromString(value); -// }""".formatted(toDafnyConverterName); -// tokenizeAndAssertEqual(expectedToDafny, actualToDafny); -// } - -// @Test -// public void testGenerateStringConverterEnumString() { -// final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "AnEnum"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// @enum([ -// { name: "VERSION_A", value: "bar" }, -// { name: "VERSION_B", value: "baz" }, -// ]) -// string AnEnum -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateStringConverter( -// codegen.getModel().expectShape(shapeId, StringShape.class)); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize(""" -// public static Test.Foobar.AnEnum %s(test.foobar.internaldafny.types._IAnEnum value) { -// if (value.is_VERSION__A) return Test.Foobar.AnEnum.VERSION_A; -// if (value.is_VERSION__B) return Test.Foobar.AnEnum.VERSION_B; -// throw new System.ArgumentException("Invalid Test.Foobar.AnEnum value"); -// }""".formatted(fromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize(""" -// public static test.foobar.internaldafny.types._IAnEnum %s(Test.Foobar.AnEnum value) { -// if (Test.Foobar.AnEnum.VERSION_A.Equals(value)) return test.foobar.internaldafny.types.AnEnum.create_VERSION__A(); -// if (Test.Foobar.AnEnum.VERSION_B.Equals(value)) return test.foobar.internaldafny.types.AnEnum.create_VERSION__B(); -// throw new System.ArgumentException("Invalid Test.Foobar.AnEnum value"); -// }""".formatted(toDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } -// -// /** -// * Test that we generate an enum converter correctly when the enum has only one constructor. -// * -// * This is different than the "normal" case because Dafny doesn't generate a compiled constructor when there's only -// * one. -// */ -// @Test -// public void testGenerateStringConverterEnumStringSingleConstructor() { -// final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "AnEnum"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// @enum([{ name: "VERSION_A", value: "bar" }]) -// string AnEnum -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateStringConverter( -// codegen.getModel().expectShape(shapeId, StringShape.class)); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize(""" -// public static Test.Foobar.AnEnum %s(test.foobar.internaldafny.types._IAnEnum value) { -// if (value.is_VERSION__A) return Test.Foobar.AnEnum.VERSION_A; -// throw new System.ArgumentException("Invalid Test.Foobar.AnEnum value"); -// }""".formatted(fromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize(""" -// public static test.foobar.internaldafny.types._IAnEnum %s(Test.Foobar.AnEnum value) { -// if (Test.Foobar.AnEnum.VERSION_A.Equals(value)) return test.foobar.internaldafny.types.AnEnum.create(); -// throw new System.ArgumentException("Invalid Test.Foobar.AnEnum value"); -// }""".formatted(toDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - -// @Test -// public void testGenerateStringConverterUtf8Bytes() { -// final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Utf8BytesString"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// use aws.polymorph#dafnyUtf8Bytes -// @dafnyUtf8Bytes -// string Utf8BytesString -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateStringConverter( -// codegen.getModel().expectShape(shapeId, StringShape.class)); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize(""" -// public static string %s(Dafny.ISequence value) { -// System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(false, true); -// return utf8.GetString(value.Elements); -// }""".formatted(fromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize(""" -// public static Dafny.ISequence %s(string value) { -// System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(false, true); -// return Dafny.Sequence.FromArray(utf8.GetBytes(value)); -// }""".formatted(toDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - -// @Test -// public void testGenerateIntegerConverter() { -// final ShapeId shapeId = ShapeId.from("smithy.api#Integer"); -// final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); -// final TypeConverter converter = codegen.generateIntegerConverter(IntegerShape.builder().id(shapeId).build()); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize( -// "public static int %s(int value) { return value; }".formatted(fromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize( -// "public static int %s(int value) { return value; }".formatted(toDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - -// @Test -// public void testGenerateLongConverter() { -// final ShapeId shapeId = ShapeId.from("smithy.api#Long"); -// final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); -// final TypeConverter converter = codegen.generateLongConverter(LongShape.builder().id(shapeId).build()); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize( -// "public static long %s(long value) { return value; }".formatted(fromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize( -// "public static long %s(long value) { return value; }".formatted(toDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - -// @Test -// public void testGenerateTimestampConverter() { -// final ShapeId shapeId = ShapeId.from("smithy.api#Timestamp"); -// final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); -// final TypeConverter converter = codegen.generateTimestampConverter( -// TimestampShape.builder().id(shapeId).build()); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize(""" -// public static System.DateTime %s(Dafny.ISequence value) { -// System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(""); -// string timestampString = new string(value.Elements); -// return System.DateTime.ParseExact(timestampString, "s", culture); -// } -// """.formatted(fromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize(""" -// public static Dafny.ISequence %s(System.DateTime value) { -// System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(""); -// string timestampString = value.ToString("s", culture); -// return Dafny.Sequence.FromString(timestampString); -// } -// """.formatted(toDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - -// @Test -// public void testGenerateListConverter() { -// final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "IntList"); -// final ShapeId memberShapeId = shapeId.withMember("member"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// list IntList { -// member: Integer -// } -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateListConverter( -// codegen.getModel().expectShape(shapeId, ListShape.class)); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String listFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final String intFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize(""" -// public static System.Collections.Generic.List %s(Dafny.ISequence value) { -// return new System.Collections.Generic.List(value.Elements.Select(%s)); -// }""".formatted(listFromDafnyConverterName, intFromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String listToDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final String intToDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize(""" -// public static Dafny.ISequence %s(System.Collections.Generic.List value) { -// return Dafny.Sequence.FromArray(value.Select(%s).ToArray()); -// }""".formatted(listToDafnyConverterName, intToDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - -// @Test -// public void testGenerateMapConverter() { -// final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "BoolMap"); -// final ShapeId keyMemberId = shapeId.withMember("key"); -// final ShapeId valueMemberId = shapeId.withMember("value"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// map BoolMap { -// key: String, -// value: Boolean, -// } -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateMapConverter( -// codegen.getModel().expectShape(shapeId, MapShape.class)); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String mapFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final String keyFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(keyMemberId, FROM_DAFNY); -// final String valueFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(valueMemberId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize(""" -// public static System.Collections.Generic.Dictionary %s( -// Dafny.IMap, bool> value) { -// return value.ItemEnumerable.ToDictionary(pair => %s(pair.Car), pair => %s(pair.Cdr)); -// }""".formatted(mapFromDafnyConverterName, keyFromDafnyConverterName, valueFromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String mapToDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final String keyToDafnyConverterName = DotNetNameResolver.typeConverterForShape(keyMemberId, TO_DAFNY); -// final String valueToDafnyConverterName = DotNetNameResolver.typeConverterForShape(valueMemberId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize(""" -// public static Dafny.IMap, bool> %s( -// System.Collections.Generic.Dictionary value) { -// return Dafny.Map, bool>.FromCollection( -// value.Select(pair => -// new Dafny.Pair, bool>(%s(pair.Key), %s(pair.Value)) -// ) -// ); -// }""".formatted(mapToDafnyConverterName, keyToDafnyConverterName, valueToDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - -// @Test -// public void testGenerateStructureConverterRegularStructure() { -// final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "IntAndBool"); -// final ShapeId intMemberId = shapeId.withMember("someInt"); -// final ShapeId boolMemberId = shapeId.withMember("someBool"); -// final ShapeId stringMemberId = shapeId.withMember("someString"); -// final ShapeId refMemberId = shapeId.withMember("someRef"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// use aws.polymorph#reference -// resource Thing {} -// @reference(resource: Thing) -// structure ThingReference {} -// -// structure IntAndBool { -// someInt: Integer, -// @required -// someBool: Boolean, -// someString: String, -// someRef: ThingReference, -// } -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateStructureConverter( -// codegen.getModel().expectShape(shapeId, StructureShape.class)); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String structureFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final String intFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(intMemberId, FROM_DAFNY); -// final String boolFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(boolMemberId, FROM_DAFNY); -// final String stringFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(stringMemberId, FROM_DAFNY); -// final String refFromDafnyConverterName = DotNetNameResolver -// .typeConverterForShape(refMemberId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize(""" -// public static Test.Foobar.IntAndBool %s(test.foobar.internaldafny.types._IIntAndBool value) { -// test.foobar.internaldafny.types.IntAndBool concrete = (test.foobar.internaldafny.types.IntAndBool)value; -// Test.Foobar.IntAndBool converted = new Test.Foobar.IntAndBool(); -// if (concrete._someInt.is_Some) converted.SomeInt = (int) %s(concrete._someInt); -// converted.SomeBool = (bool) %s(concrete._someBool); -// if (concrete._someString.is_Some) converted.SomeString = (string) %s(concrete._someString); -// if (concrete._someRef.is_Some) converted.SomeRef = (Test.Foobar.IThing) %s(concrete._someRef); -// return converted; -// }""".formatted( -// structureFromDafnyConverterName, -// intFromDafnyConverterName, -// boolFromDafnyConverterName, -// stringFromDafnyConverterName, -// refFromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String structureToDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final String intToDafnyConverterName = DotNetNameResolver.typeConverterForShape(intMemberId, TO_DAFNY); -// final String boolToDafnyConverterName = DotNetNameResolver.typeConverterForShape(boolMemberId, TO_DAFNY); -// final String stringToDafnyConverterName = DotNetNameResolver.typeConverterForShape(stringMemberId, TO_DAFNY); -// final String refToDafnyConverterName = DotNetNameResolver -// .typeConverterForShape(refMemberId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize(""" -// public static test.foobar.internaldafny.types._IIntAndBool %s(Test.Foobar.IntAndBool value) { -// int? var_someInt = value.IsSetSomeInt() ? value.SomeInt : (int?) null; -// string var_someString = value.IsSetSomeString() ? value.SomeString : (string) null; -// Test.Foobar.IThing var_someRef = value.IsSetSomeRef() ? value.SomeRef : (Test.Foobar.IThing) null; -// return new test.foobar.internaldafny.types.IntAndBool( -// %s(var_someInt), -// %s(value.SomeBool), -// %s(var_someString), -// %s(var_someRef) -// ); -// }""".formatted( -// structureToDafnyConverterName, -// intToDafnyConverterName, -// boolToDafnyConverterName, -// stringToDafnyConverterName, -// refToDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - - @Test - public void testGenerateStructureConverterReferenceStructure() { - final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "ThingReference"); - final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> - modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - use aws.polymorph#reference - resource Thing {} - @reference(resource: Thing) - structure ThingReference {} - """.formatted(SERVICE_NAMESPACE))); - final TypeConverter converter = codegen.generateStructureConverter( - codegen.getModel().expectShape(shapeId, StructureShape.class)); - assertEquals(shapeId, converter.shapeId()); - - final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); - final String structureFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); - final List expectedTokensFromDafny = tokenize(""" - public static Test.Foobar.IThing %s(test.foobar.internaldafny.types.IThing value) { - return new Thing(value); - }""".formatted(structureFromDafnyConverterName)); - assertEquals(expectedTokensFromDafny, actualTokensFromDafny); - - final List actualTokensToDafny = tokenize(converter.toDafny().toString()); - final String structureToDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); - final List expectedTokensToDafny = tokenize(""" - public static test.foobar.internaldafny.types.IThing %s(Test.Foobar.IThing value) { - if (value is Thing valueWithImpl) { - return valueWithImpl._impl; - } - throw new System.ArgumentException( - "Custom implementations of Test.Foobar.IThing are not supported"); - }""".formatted(structureToDafnyConverterName)); - assertEquals(expectedTokensToDafny, actualTokensToDafny); - } - - @Test - public void testGenerateStructureConverterExtendableStructure() { - final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "ThingReference"); - final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> - modelAssembler.addUnparsedModel("test.smithy", """ - namespace %s - use aws.polymorph#extendable - use aws.polymorph#reference - @extendable - resource Thing {} - @reference(resource: Thing) - structure ThingReference {} - """.formatted(SERVICE_NAMESPACE))); - final TypeConverter converter = codegen.generateStructureConverter( - codegen.getModel().expectShape(shapeId, StructureShape.class)); - assertEquals(shapeId, converter.shapeId()); - final String actualFromDafny = converter.fromDafny().toString(); - final String structureFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); - final String expectedFromDafny = """ - public static Test.Foobar.IThing %s(test.foobar.internaldafny.types.IThing value) { - if (value is NativeWrapper_Thing nativeWrapper) return nativeWrapper._impl; - return new Thing(value); - } - """.formatted(structureFromDafnyConverterName); - tokenizeAndAssertEqual(expectedFromDafny, actualFromDafny); - - final String actualToDafny = converter.toDafny().toString(); - final String structureToDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); - final String expectedToDafny = """ - public static test.foobar.internaldafny.types.IThing %s(Test.Foobar.IThing value) { - switch (value) - { - case Thing valueWithImpl: - return valueWithImpl._impl; - case ThingBase nativeImpl: - return new NativeWrapper_Thing(nativeImpl); - default: - throw new System.ArgumentException( - "Custom implementations of Thing must extend ThingBase."); - } - }""".formatted(structureToDafnyConverterName); - tokenizeAndAssertEqual(expectedToDafny, actualToDafny); - } - -// @Test -// public void testGenerateStructureConverterPositionalStructure() { -// final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "CreateThingOutput"); -// final ShapeId memberShapeId = shapeId.withMember("thing"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// use aws.polymorph#positional -// use aws.polymorph#reference -// resource Thing {} -// @reference(resource: Thing) -// structure ThingReference {} -// @positional -// structure CreateThingOutput { thing: ThingReference } -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateStructureConverter( -// codegen.getModel().expectShape(shapeId, StructureShape.class)); -// assertEquals(shapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String structureFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); -// final String memberFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize(""" -// public static Test.Foobar.IThing %s(test.foobar.internaldafny.types.IThing value) { -// return %s(value); -// }""".formatted(structureFromDafnyConverterName, memberFromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String structureToDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); -// final String memberToDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize(""" -// public static test.foobar.internaldafny.types.IThing %s(Test.Foobar.IThing value) { -// return %s(value); -// }""".formatted(structureToDafnyConverterName, memberToDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - -// @Test -// public void testGenerateMemberConverterRequired() { -// final ShapeId containerShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Container"); -// final ShapeId memberShapeId = containerShapeId.withMember("content"); -// final ShapeId targetShapeId = ShapeId.from("smithy.api#Integer"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// structure Container { -// @required -// content: Integer -// } -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateMemberConverter( -// codegen.getModel().expectShape(memberShapeId, MemberShape.class)); -// assertEquals(memberShapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String memberFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, FROM_DAFNY); -// final String targetFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize(""" -// public static int %s(int value) { -// return %s(value); -// }""".formatted(memberFromDafnyConverterName, targetFromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String memberToDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, TO_DAFNY); -// final String targetToDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize(""" -// public static int %s(int value) { -// return %s(value); -// }""".formatted(memberToDafnyConverterName, targetToDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - -// @Test -// public void testGenerateMemberConverterOptional() { -// final ShapeId containerShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Container"); -// final ShapeId memberShapeId = containerShapeId.withMember("content"); -// final ShapeId targetShapeId = ShapeId.from("smithy.api#Integer"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// structure Container { -// content: Integer -// } -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateMemberConverter( -// codegen.getModel().expectShape(memberShapeId, MemberShape.class)); -// assertEquals(memberShapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String memberFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, FROM_DAFNY); -// final String targetFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize(""" -// public static int? %s(Wrappers_Compile._IOption value) { -// return value.is_None ? (int?) null : %s(value.Extract()); -// }""".formatted(memberFromDafnyConverterName, targetFromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String memberToDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, TO_DAFNY); -// final String targetToDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize(""" -// public static Wrappers_Compile._IOption %s(int? value) { -// return value == null -// ? Wrappers_Compile.Option.create_None() -// : Wrappers_Compile.Option.create_Some(%s((int) value)); -// }""".formatted(memberToDafnyConverterName, targetToDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - -// @Test -// public void testGenerateMemberConverterOptionalReference() { -// final ShapeId containerShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Container"); -// final ShapeId memberShapeId = containerShapeId.withMember("ref"); -// final ShapeId targetShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "ThingReference"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// use aws.polymorph#reference -// resource Thing {} -// @reference(resource: Thing) -// structure ThingReference {} -// structure Container { -// ref: ThingReference -// } -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateMemberConverter( -// codegen.getModel().expectShape(memberShapeId, MemberShape.class)); -// assertEquals(memberShapeId, converter.shapeId()); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final String memberFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, FROM_DAFNY); -// final String targetFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, FROM_DAFNY); -// final List expectedTokensFromDafny = tokenize(""" -// public static Test.Foobar.IThing %s(Wrappers_Compile._IOption value) { -// return value.is_None ? (Test.Foobar.IThing) null : %s(value.Extract()); -// }""".formatted(memberFromDafnyConverterName, targetFromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final String memberToDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, TO_DAFNY); -// final String targetToDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, TO_DAFNY); -// final List expectedTokensToDafny = tokenize(""" -// public static Wrappers_Compile._IOption %s(Test.Foobar.IThing value) { -// return value == null -// ? Wrappers_Compile.Option.create_None() -// : Wrappers_Compile.Option.create_Some(%s((Test.Foobar.IThing) value)); -// }""".formatted(memberToDafnyConverterName, targetToDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } - -// @Test -// public void testGenerateSpecificExceptionConverter() { -// final ShapeId errorShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "UnfortunateError"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// @error("client") -// structure UnfortunateError { -// @required -// message: String -// } -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateSpecificExceptionConverter( -// codegen.getModel().expectShape(errorShapeId, StructureShape.class)); -// assertEquals(errorShapeId, converter.shapeId()); -// -// final String messageFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(errorShapeId.withMember("message"), FROM_DAFNY); -// final String messageToDafnyConverterName = DotNetNameResolver.typeConverterForShape(errorShapeId.withMember("message"), TO_DAFNY); -// final String errorFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(errorShapeId, FROM_DAFNY); -// final String errorToDafnyConverterName = DotNetNameResolver.typeConverterForShape(errorShapeId, TO_DAFNY); -// -// final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); -// final List expectedTokensFromDafny = tokenize(""" -// public static Test.Foobar.UnfortunateError %s(test.foobar.internaldafny.types.Error_UnfortunateError value) { -// return new Test.Foobar.UnfortunateError(%s(value.message)); -// }""".formatted(errorFromDafnyConverterName, messageFromDafnyConverterName)); -// assertEquals(expectedTokensFromDafny, actualTokensFromDafny); -// -// final List actualTokensToDafny = tokenize(converter.toDafny().toString()); -// final List expectedTokensToDafny = tokenize(""" -// public static test.foobar.internaldafny.types.Error_UnfortunateError %s(Test.Foobar.UnfortunateError value) { -// test.foobar.internaldafny.types.Error_UnfortunateError converted = new test.foobar.internaldafny.types.Error_UnfortunateError(); -// converted.message = %s(value.Message); -// return converted; -// }""".formatted(errorToDafnyConverterName, messageToDafnyConverterName)); -// assertEquals(expectedTokensToDafny, actualTokensToDafny); -// } -// -// @Test -// public void testGenerateCommonExceptionConverter() { -// final ShapeId exc1ShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Exception1"); -// final ShapeId exc2ShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Exception2"); -// final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> -// modelAssembler.addUnparsedModel("test.smithy", """ -// namespace %s -// @error("client") -// structure Exception1 { @required message: String } -// @error("server") -// structure Exception2 { @required message: String } -// """.formatted(SERVICE_NAMESPACE))); -// final TypeConverter converter = codegen.generateCommonExceptionConverter(); -// assertTrue("Common exception converter must use a shape ID not in the model", -// codegen.getModel().getShape(converter.shapeId()).isEmpty()); -// -// final String actualFromDafny = converter.fromDafny().toString(); -// final String expectedFromDafny = """ -// public static System.Exception FromDafny_CommonError(test.foobar.internaldafny.types._IError value) { -// switch (value) { -// case test.foobar.internaldafny.types.Error_Exception1 dafnyVal: -// return %s(dafnyVal); -// case test.foobar.internaldafny.types.Error_Exception2 dafnyVal: -// return %s(dafnyVal); -// case test.foobar.internaldafny.types.Error_Opaque dafnyVal: -// return new OpaqueError(dafnyVal._obj); -// default: -// // The switch MUST be complete for _IError, so `value` MUST NOT be an _IError. (How did you get here?) -// return new OpaqueError(); -// } -// }""".formatted( -// DotNetNameResolver.typeConverterForShape(exc1ShapeId, FROM_DAFNY), -// DotNetNameResolver.typeConverterForShape(exc2ShapeId, FROM_DAFNY) -// ); -// tokenizeAndAssertEqual(expectedFromDafny, actualFromDafny); -// -// -// final String actualToDafny = converter.toDafny().toString(); -// final String expectedToDafny = """ -// public static test.foobar.internaldafny.types._IError ToDafny_CommonError(System.Exception value) { -// switch (value) { -// case Test.Foobar.Exception1 exception: -// return %s(exception); -// case Test.Foobar.Exception2 exception: -// return %s(exception); -// // OpaqueError is redundant, but listed for completeness. -// case OpaqueError exception: -// return new test.foobar.internaldafny.types.Error_Opaque(exception); -// case System.Exception exception: -// return new test.foobar.internaldafny.types.Error_Opaque(exception); -// default: -// // The switch MUST be complete for System.Exception, so `value` MUST NOT be an System.Exception. (How did you get here?) -// return new test.foobar.internaldafny.types.Error_Opaque(value); -// } -// }""".formatted(DotNetNameResolver.typeConverterForShape(exc1ShapeId, TO_DAFNY), -// DotNetNameResolver.typeConverterForShape(exc2ShapeId, TO_DAFNY) -// ); -// -// tokenizeAndAssertEqual(expectedToDafny, actualToDafny); -// } + + // TODO: Apply TypeConversionCodegen refactor to tests + // https://github.com/smithy-lang/smithy-dafny/issues/29 + private static TypeConversionCodegen setupCodegen( + final BiConsumer updater + ) { + final Model model = TestModel.setupModel(updater); + final ServiceShape serviceShape = model.expectShape( + SERVICE_SHAPE_ID, + ServiceShape.class + ); + return new TypeConversionCodegen(model, serviceShape); + } + + private static String generate(final TypeConversionCodegen codegen) { + final Map generatedCode = codegen.generate(); + assertTrue(generatedCode.containsKey(TYPE_CONVERSION_CLASS_PATH)); + return Objects + .requireNonNull(generatedCode.get(TYPE_CONVERSION_CLASS_PATH)) + .toString(); + } + + // Removed 2023-01-27 for output-local-service-test + // @Test + // public void testGenerateEmptyModel() { + // final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); + // final String actual = generate(codegen); + // final String expected = """ + // using System.Linq; + // using System; + // namespace Test.Foobar { + // internal static class TypeConversion { + // public static System.Exception FromDafny_CommonError(test.foobar.internaldafny.types._IError value) { + // switch (value) { + // case test.foobar.internaldafny.types.Error_Opaque dafnyVal: + // return new OpaqueError(dafnyVal._obj); + // default: + // // The switch MUST be complete for _IError, so `value` MUST NOT be an _IError. (How did you get here?) + // return new OpaqueError(); + // } + // } + // + // public static test.foobar.internaldafny.types._IError ToDafny_CommonError(System.Exception value) { + // switch (value) { + // // OpaqueError is redundant, but listed for completeness. + // case OpaqueError exception: + // return new test.foobar.internaldafny.types.Error_Opaque(exception); + // case System.Exception exception: + // return new test.foobar.internaldafny.types.Error_Opaque(exception); + // default: + // // The switch MUST be complete for System.Exception, so `value` MUST NOT be an System.Exception. (How did you get here?) + // return new test.foobar.internaldafny.types.Error_Opaque(value); + // } + // } + // } + // } + // """.formatted( + // DotNetNameResolver.typeConverterForShape(ShapeId.from("smithy.api#String"), FROM_DAFNY), + // DotNetNameResolver.typeConverterForShape(ShapeId.from("smithy.api#String"), TO_DAFNY), //ToDafny_String + // DotNetNameResolver.typeConverterForShape(ShapeId.from("smithy.api#String"), TO_DAFNY) //ToDafny_String + // ); + // tokenizeAndAssertEqual(expected, actual); + // } + + @Test + public void testGenerateSimpleModel() { + final TypeConversionCodegen codegen = setupCodegen( + (builder, modelAssembler) -> { + builder.addOperation(ShapeId.fromParts(SERVICE_NAMESPACE, "DoBar")); + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + operation DoBar { input: DoBarInput, output: DoBarOutput } + structure DoBarInput { bool: Boolean } + structure DoBarOutput { int: Integer } + """.formatted(SERVICE_NAMESPACE) + ); + } + ); + final String actual = generate(codegen); + final Set actualTokens = new HashSet<>(tokenize(actual)); + + final Stream expectedConverterMethods = Stream + .of( + SERVICE_NAMESPACE + "#DoBarInput", + SERVICE_NAMESPACE + "#DoBarInput$bool", + SERVICE_NAMESPACE + "#DoBarOutput", + SERVICE_NAMESPACE + "#DoBarOutput$int", + "smithy.api#Boolean", + "smithy.api#Integer" + ) + .map(ShapeId::from) + .flatMap(shapeId -> + Stream.of( + DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY), + DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY) + ) + ) + .map(converterName -> + new ParseToken(converterName, CSharpLexer.IDENTIFIER) + ); + assertTrue(expectedConverterMethods.allMatch(actualTokens::contains)); + } + + @Test + public void testFindShapeIdsToConvert() { + final TypeConversionCodegen codegen = setupCodegen( + (builder, modelAssembler) -> { + builder.addOperation(ShapeId.fromParts(SERVICE_NAMESPACE, "DoBar")); + builder.addTrait( + ClientConfigTrait + .builder() + .clientConfigId( + ShapeId.fromParts(SERVICE_NAMESPACE, "FoobarConfig") + ) + .build() + ); + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + structure FoobarConfig {} + resource FooResource { operations: [DoBaz] } + operation DoBar { input: DoBarInput, errors: [UsedError] } + operation DoBaz { output: DoBazOutput } + structure DoBarInput { qux: Qux } + structure DoBazOutput { xyzzy: Xyzzy } + map Qux { key: String, value: Integer } + list Xyzzy { member: Blob } + @error("client") structure UsedError { @required message: String } + @error("client") structure UnusedError { @required message: String } + """.formatted(SERVICE_NAMESPACE) + ); + } + ); + final Set expectedShapeIds = Stream + .of( + SERVICE_NAMESPACE + "#DoBarInput", + SERVICE_NAMESPACE + "#DoBarInput$qux", + SERVICE_NAMESPACE + "#DoBazOutput", + SERVICE_NAMESPACE + "#DoBazOutput$xyzzy", + SERVICE_NAMESPACE + "#Qux", + SERVICE_NAMESPACE + "#Qux$key", + SERVICE_NAMESPACE + "#Qux$value", + SERVICE_NAMESPACE + "#Xyzzy", + SERVICE_NAMESPACE + "#Xyzzy$member", + SERVICE_NAMESPACE + "#UsedError", + SERVICE_NAMESPACE + "#UsedError$message", + // Unused errors must also have type converters, since the common error shape converter depends on all + // specific errors in the model (even if unused in operations) + SERVICE_NAMESPACE + "#UnusedError", + SERVICE_NAMESPACE + "#UnusedError$message", + "smithy.api#String", + "smithy.api#Integer", + "smithy.api#Blob" + ) + .map(ShapeId::from) + .collect(Collectors.toSet()); + + final Set actualShapeIds = codegen.findShapeIdsToConvert(); + assertEquals(expectedShapeIds, actualShapeIds); + } + + @Test + public void testGenerateBlobConverter() { + final ShapeId shapeId = ShapeId.from("smithy.api#Blob"); + final TypeConversionCodegen codegen = setupCodegen( + (_builder, _modelAssembler) -> {} + ); + final TypeConverter converter = codegen.generateBlobConverter( + BlobShape.builder().id(shapeId).build() + ); + assertEquals(shapeId, converter.shapeId()); + + final String actualFromDafny = converter.fromDafny().toString(); + final String fromDafnyConverterName = + DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + final String expectedFromDafny = + """ + public static System.IO.MemoryStream %s(Dafny.ISequence value) { + return new System.IO.MemoryStream(value.Elements); + } + """.formatted(fromDafnyConverterName); + tokenizeAndAssertEqual(expectedFromDafny, actualFromDafny); + + final String actualToDafny = converter.toDafny().toString(); + final String toDafnyConverterName = + DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + final String expectedToDafny = + """ + public static Dafny.ISequence %s(System.IO.MemoryStream value) { + if (value.ToArray().Length == 0 && value.Length > 0) + { + throw new System.ArgumentException("Fatal Error: MemoryStream instance not backed by an array!"); + } + return Dafny.Sequence.FromArray(value.ToArray()); + } + """.formatted(toDafnyConverterName); + tokenizeAndAssertEqual(expectedToDafny, actualToDafny); + } + + // @Test + // public void testGenerateBooleanConverter() { + // final ShapeId shapeId = ShapeId.from("smithy.api#Boolean"); + // final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); + // final TypeConverter converter = codegen.generateBooleanConverter(BooleanShape.builder().id(shapeId).build()); + // assertEquals(shapeId, converter.shapeId()); + // + // final String actualFromDafny = converter.fromDafny().toString(); + // final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final String expectedFromDafny = + // "public static bool %s(bool value) { return value; }".formatted(fromDafnyConverterName); + // tokenizeAndAssertEqual(expectedFromDafny, actualFromDafny); + // + // final String actualToDafny = converter.toDafny().toString(); + // final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final String expectedToDafny = + // "public static bool %s(bool value) { return value; }".formatted(toDafnyConverterName); + // tokenizeAndAssertEqual(expectedToDafny, actualToDafny); + // } + + // @Test + // public void testGenerateStringConverterRegularString() { + // final ShapeId shapeId = ShapeId.from("smithy.api#String"); + // final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); + // final TypeConverter converter = codegen.generateStringConverter(StringShape.builder().id(shapeId).build()); + // assertEquals(shapeId, converter.shapeId()); + // + // final String actualFromDafny = converter.fromDafny().toString(); + // final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final String expectedFromDafny = """ + // public static string %s(Dafny.ISequence value) { + // return new string(value.Elements); + // }""".formatted(fromDafnyConverterName); + // tokenizeAndAssertEqual(expectedFromDafny, actualFromDafny); + // + // final String actualToDafny = converter.toDafny().toString(); + // final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final String expectedToDafny = """ + // public static Dafny.ISequence %s(string value) { + // return Dafny.Sequence.FromString(value); + // }""".formatted(toDafnyConverterName); + // tokenizeAndAssertEqual(expectedToDafny, actualToDafny); + // } + + // @Test + // public void testGenerateStringConverterEnumString() { + // final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "AnEnum"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // @enum([ + // { name: "VERSION_A", value: "bar" }, + // { name: "VERSION_B", value: "baz" }, + // ]) + // string AnEnum + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateStringConverter( + // codegen.getModel().expectShape(shapeId, StringShape.class)); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize(""" + // public static Test.Foobar.AnEnum %s(test.foobar.internaldafny.types._IAnEnum value) { + // if (value.is_VERSION__A) return Test.Foobar.AnEnum.VERSION_A; + // if (value.is_VERSION__B) return Test.Foobar.AnEnum.VERSION_B; + // throw new System.ArgumentException("Invalid Test.Foobar.AnEnum value"); + // }""".formatted(fromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize(""" + // public static test.foobar.internaldafny.types._IAnEnum %s(Test.Foobar.AnEnum value) { + // if (Test.Foobar.AnEnum.VERSION_A.Equals(value)) return test.foobar.internaldafny.types.AnEnum.create_VERSION__A(); + // if (Test.Foobar.AnEnum.VERSION_B.Equals(value)) return test.foobar.internaldafny.types.AnEnum.create_VERSION__B(); + // throw new System.ArgumentException("Invalid Test.Foobar.AnEnum value"); + // }""".formatted(toDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + // + // /** + // * Test that we generate an enum converter correctly when the enum has only one constructor. + // * + // * This is different than the "normal" case because Dafny doesn't generate a compiled constructor when there's only + // * one. + // */ + // @Test + // public void testGenerateStringConverterEnumStringSingleConstructor() { + // final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "AnEnum"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // @enum([{ name: "VERSION_A", value: "bar" }]) + // string AnEnum + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateStringConverter( + // codegen.getModel().expectShape(shapeId, StringShape.class)); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize(""" + // public static Test.Foobar.AnEnum %s(test.foobar.internaldafny.types._IAnEnum value) { + // if (value.is_VERSION__A) return Test.Foobar.AnEnum.VERSION_A; + // throw new System.ArgumentException("Invalid Test.Foobar.AnEnum value"); + // }""".formatted(fromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize(""" + // public static test.foobar.internaldafny.types._IAnEnum %s(Test.Foobar.AnEnum value) { + // if (Test.Foobar.AnEnum.VERSION_A.Equals(value)) return test.foobar.internaldafny.types.AnEnum.create(); + // throw new System.ArgumentException("Invalid Test.Foobar.AnEnum value"); + // }""".formatted(toDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + // @Test + // public void testGenerateStringConverterUtf8Bytes() { + // final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Utf8BytesString"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // use aws.polymorph#dafnyUtf8Bytes + // @dafnyUtf8Bytes + // string Utf8BytesString + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateStringConverter( + // codegen.getModel().expectShape(shapeId, StringShape.class)); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize(""" + // public static string %s(Dafny.ISequence value) { + // System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(false, true); + // return utf8.GetString(value.Elements); + // }""".formatted(fromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize(""" + // public static Dafny.ISequence %s(string value) { + // System.Text.UTF8Encoding utf8 = new System.Text.UTF8Encoding(false, true); + // return Dafny.Sequence.FromArray(utf8.GetBytes(value)); + // }""".formatted(toDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + // @Test + // public void testGenerateIntegerConverter() { + // final ShapeId shapeId = ShapeId.from("smithy.api#Integer"); + // final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); + // final TypeConverter converter = codegen.generateIntegerConverter(IntegerShape.builder().id(shapeId).build()); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize( + // "public static int %s(int value) { return value; }".formatted(fromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize( + // "public static int %s(int value) { return value; }".formatted(toDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + // @Test + // public void testGenerateLongConverter() { + // final ShapeId shapeId = ShapeId.from("smithy.api#Long"); + // final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); + // final TypeConverter converter = codegen.generateLongConverter(LongShape.builder().id(shapeId).build()); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize( + // "public static long %s(long value) { return value; }".formatted(fromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize( + // "public static long %s(long value) { return value; }".formatted(toDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + // @Test + // public void testGenerateTimestampConverter() { + // final ShapeId shapeId = ShapeId.from("smithy.api#Timestamp"); + // final TypeConversionCodegen codegen = setupCodegen((_builder, _modelAssembler) -> {}); + // final TypeConverter converter = codegen.generateTimestampConverter( + // TimestampShape.builder().id(shapeId).build()); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String fromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize(""" + // public static System.DateTime %s(Dafny.ISequence value) { + // System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(""); + // string timestampString = new string(value.Elements); + // return System.DateTime.ParseExact(timestampString, "s", culture); + // } + // """.formatted(fromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String toDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize(""" + // public static Dafny.ISequence %s(System.DateTime value) { + // System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo(""); + // string timestampString = value.ToString("s", culture); + // return Dafny.Sequence.FromString(timestampString); + // } + // """.formatted(toDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + // @Test + // public void testGenerateListConverter() { + // final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "IntList"); + // final ShapeId memberShapeId = shapeId.withMember("member"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // list IntList { + // member: Integer + // } + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateListConverter( + // codegen.getModel().expectShape(shapeId, ListShape.class)); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String listFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final String intFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize(""" + // public static System.Collections.Generic.List %s(Dafny.ISequence value) { + // return new System.Collections.Generic.List(value.Elements.Select(%s)); + // }""".formatted(listFromDafnyConverterName, intFromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String listToDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final String intToDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize(""" + // public static Dafny.ISequence %s(System.Collections.Generic.List value) { + // return Dafny.Sequence.FromArray(value.Select(%s).ToArray()); + // }""".formatted(listToDafnyConverterName, intToDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + // @Test + // public void testGenerateMapConverter() { + // final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "BoolMap"); + // final ShapeId keyMemberId = shapeId.withMember("key"); + // final ShapeId valueMemberId = shapeId.withMember("value"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // map BoolMap { + // key: String, + // value: Boolean, + // } + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateMapConverter( + // codegen.getModel().expectShape(shapeId, MapShape.class)); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String mapFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final String keyFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(keyMemberId, FROM_DAFNY); + // final String valueFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(valueMemberId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize(""" + // public static System.Collections.Generic.Dictionary %s( + // Dafny.IMap, bool> value) { + // return value.ItemEnumerable.ToDictionary(pair => %s(pair.Car), pair => %s(pair.Cdr)); + // }""".formatted(mapFromDafnyConverterName, keyFromDafnyConverterName, valueFromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String mapToDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final String keyToDafnyConverterName = DotNetNameResolver.typeConverterForShape(keyMemberId, TO_DAFNY); + // final String valueToDafnyConverterName = DotNetNameResolver.typeConverterForShape(valueMemberId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize(""" + // public static Dafny.IMap, bool> %s( + // System.Collections.Generic.Dictionary value) { + // return Dafny.Map, bool>.FromCollection( + // value.Select(pair => + // new Dafny.Pair, bool>(%s(pair.Key), %s(pair.Value)) + // ) + // ); + // }""".formatted(mapToDafnyConverterName, keyToDafnyConverterName, valueToDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + // @Test + // public void testGenerateStructureConverterRegularStructure() { + // final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "IntAndBool"); + // final ShapeId intMemberId = shapeId.withMember("someInt"); + // final ShapeId boolMemberId = shapeId.withMember("someBool"); + // final ShapeId stringMemberId = shapeId.withMember("someString"); + // final ShapeId refMemberId = shapeId.withMember("someRef"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // use aws.polymorph#reference + // resource Thing {} + // @reference(resource: Thing) + // structure ThingReference {} + // + // structure IntAndBool { + // someInt: Integer, + // @required + // someBool: Boolean, + // someString: String, + // someRef: ThingReference, + // } + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateStructureConverter( + // codegen.getModel().expectShape(shapeId, StructureShape.class)); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String structureFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final String intFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(intMemberId, FROM_DAFNY); + // final String boolFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(boolMemberId, FROM_DAFNY); + // final String stringFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(stringMemberId, FROM_DAFNY); + // final String refFromDafnyConverterName = DotNetNameResolver + // .typeConverterForShape(refMemberId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize(""" + // public static Test.Foobar.IntAndBool %s(test.foobar.internaldafny.types._IIntAndBool value) { + // test.foobar.internaldafny.types.IntAndBool concrete = (test.foobar.internaldafny.types.IntAndBool)value; + // Test.Foobar.IntAndBool converted = new Test.Foobar.IntAndBool(); + // if (concrete._someInt.is_Some) converted.SomeInt = (int) %s(concrete._someInt); + // converted.SomeBool = (bool) %s(concrete._someBool); + // if (concrete._someString.is_Some) converted.SomeString = (string) %s(concrete._someString); + // if (concrete._someRef.is_Some) converted.SomeRef = (Test.Foobar.IThing) %s(concrete._someRef); + // return converted; + // }""".formatted( + // structureFromDafnyConverterName, + // intFromDafnyConverterName, + // boolFromDafnyConverterName, + // stringFromDafnyConverterName, + // refFromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String structureToDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final String intToDafnyConverterName = DotNetNameResolver.typeConverterForShape(intMemberId, TO_DAFNY); + // final String boolToDafnyConverterName = DotNetNameResolver.typeConverterForShape(boolMemberId, TO_DAFNY); + // final String stringToDafnyConverterName = DotNetNameResolver.typeConverterForShape(stringMemberId, TO_DAFNY); + // final String refToDafnyConverterName = DotNetNameResolver + // .typeConverterForShape(refMemberId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize(""" + // public static test.foobar.internaldafny.types._IIntAndBool %s(Test.Foobar.IntAndBool value) { + // int? var_someInt = value.IsSetSomeInt() ? value.SomeInt : (int?) null; + // string var_someString = value.IsSetSomeString() ? value.SomeString : (string) null; + // Test.Foobar.IThing var_someRef = value.IsSetSomeRef() ? value.SomeRef : (Test.Foobar.IThing) null; + // return new test.foobar.internaldafny.types.IntAndBool( + // %s(var_someInt), + // %s(value.SomeBool), + // %s(var_someString), + // %s(var_someRef) + // ); + // }""".formatted( + // structureToDafnyConverterName, + // intToDafnyConverterName, + // boolToDafnyConverterName, + // stringToDafnyConverterName, + // refToDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + @Test + public void testGenerateStructureConverterReferenceStructure() { + final ShapeId shapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "ThingReference" + ); + final TypeConversionCodegen codegen = setupCodegen( + (builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + use aws.polymorph#reference + resource Thing {} + @reference(resource: Thing) + structure ThingReference {} + """.formatted(SERVICE_NAMESPACE) + ) + ); + final TypeConverter converter = codegen.generateStructureConverter( + codegen.getModel().expectShape(shapeId, StructureShape.class) + ); + assertEquals(shapeId, converter.shapeId()); + + final List actualTokensFromDafny = tokenize( + converter.fromDafny().toString() + ); + final String structureFromDafnyConverterName = + DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + final List expectedTokensFromDafny = tokenize( + """ + public static Test.Foobar.IThing %s(test.foobar.internaldafny.types.IThing value) { + return new Thing(value); + }""".formatted(structureFromDafnyConverterName) + ); + assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + + final List actualTokensToDafny = tokenize( + converter.toDafny().toString() + ); + final String structureToDafnyConverterName = + DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + final List expectedTokensToDafny = tokenize( + """ + public static test.foobar.internaldafny.types.IThing %s(Test.Foobar.IThing value) { + if (value is Thing valueWithImpl) { + return valueWithImpl._impl; + } + throw new System.ArgumentException( + "Custom implementations of Test.Foobar.IThing are not supported"); + }""".formatted(structureToDafnyConverterName) + ); + assertEquals(expectedTokensToDafny, actualTokensToDafny); + } + + @Test + public void testGenerateStructureConverterExtendableStructure() { + final ShapeId shapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "ThingReference" + ); + final TypeConversionCodegen codegen = setupCodegen( + (builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + """ + namespace %s + use aws.polymorph#extendable + use aws.polymorph#reference + @extendable + resource Thing {} + @reference(resource: Thing) + structure ThingReference {} + """.formatted(SERVICE_NAMESPACE) + ) + ); + final TypeConverter converter = codegen.generateStructureConverter( + codegen.getModel().expectShape(shapeId, StructureShape.class) + ); + assertEquals(shapeId, converter.shapeId()); + final String actualFromDafny = converter.fromDafny().toString(); + final String structureFromDafnyConverterName = + DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + final String expectedFromDafny = + """ + public static Test.Foobar.IThing %s(test.foobar.internaldafny.types.IThing value) { + if (value is NativeWrapper_Thing nativeWrapper) return nativeWrapper._impl; + return new Thing(value); + } + """.formatted(structureFromDafnyConverterName); + tokenizeAndAssertEqual(expectedFromDafny, actualFromDafny); + + final String actualToDafny = converter.toDafny().toString(); + final String structureToDafnyConverterName = + DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + final String expectedToDafny = + """ + public static test.foobar.internaldafny.types.IThing %s(Test.Foobar.IThing value) { + switch (value) + { + case Thing valueWithImpl: + return valueWithImpl._impl; + case ThingBase nativeImpl: + return new NativeWrapper_Thing(nativeImpl); + default: + throw new System.ArgumentException( + "Custom implementations of Thing must extend ThingBase."); + } + }""".formatted(structureToDafnyConverterName); + tokenizeAndAssertEqual(expectedToDafny, actualToDafny); + } + // @Test + // public void testGenerateStructureConverterPositionalStructure() { + // final ShapeId shapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "CreateThingOutput"); + // final ShapeId memberShapeId = shapeId.withMember("thing"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // use aws.polymorph#positional + // use aws.polymorph#reference + // resource Thing {} + // @reference(resource: Thing) + // structure ThingReference {} + // @positional + // structure CreateThingOutput { thing: ThingReference } + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateStructureConverter( + // codegen.getModel().expectShape(shapeId, StructureShape.class)); + // assertEquals(shapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String structureFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, FROM_DAFNY); + // final String memberFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize(""" + // public static Test.Foobar.IThing %s(test.foobar.internaldafny.types.IThing value) { + // return %s(value); + // }""".formatted(structureFromDafnyConverterName, memberFromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String structureToDafnyConverterName = DotNetNameResolver.typeConverterForShape(shapeId, TO_DAFNY); + // final String memberToDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize(""" + // public static test.foobar.internaldafny.types.IThing %s(Test.Foobar.IThing value) { + // return %s(value); + // }""".formatted(structureToDafnyConverterName, memberToDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + // @Test + // public void testGenerateMemberConverterRequired() { + // final ShapeId containerShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Container"); + // final ShapeId memberShapeId = containerShapeId.withMember("content"); + // final ShapeId targetShapeId = ShapeId.from("smithy.api#Integer"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // structure Container { + // @required + // content: Integer + // } + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateMemberConverter( + // codegen.getModel().expectShape(memberShapeId, MemberShape.class)); + // assertEquals(memberShapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String memberFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, FROM_DAFNY); + // final String targetFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize(""" + // public static int %s(int value) { + // return %s(value); + // }""".formatted(memberFromDafnyConverterName, targetFromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String memberToDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, TO_DAFNY); + // final String targetToDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize(""" + // public static int %s(int value) { + // return %s(value); + // }""".formatted(memberToDafnyConverterName, targetToDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + // @Test + // public void testGenerateMemberConverterOptional() { + // final ShapeId containerShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Container"); + // final ShapeId memberShapeId = containerShapeId.withMember("content"); + // final ShapeId targetShapeId = ShapeId.from("smithy.api#Integer"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // structure Container { + // content: Integer + // } + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateMemberConverter( + // codegen.getModel().expectShape(memberShapeId, MemberShape.class)); + // assertEquals(memberShapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String memberFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, FROM_DAFNY); + // final String targetFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize(""" + // public static int? %s(Wrappers_Compile._IOption value) { + // return value.is_None ? (int?) null : %s(value.Extract()); + // }""".formatted(memberFromDafnyConverterName, targetFromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String memberToDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, TO_DAFNY); + // final String targetToDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize(""" + // public static Wrappers_Compile._IOption %s(int? value) { + // return value == null + // ? Wrappers_Compile.Option.create_None() + // : Wrappers_Compile.Option.create_Some(%s((int) value)); + // }""".formatted(memberToDafnyConverterName, targetToDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + // @Test + // public void testGenerateMemberConverterOptionalReference() { + // final ShapeId containerShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Container"); + // final ShapeId memberShapeId = containerShapeId.withMember("ref"); + // final ShapeId targetShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "ThingReference"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // use aws.polymorph#reference + // resource Thing {} + // @reference(resource: Thing) + // structure ThingReference {} + // structure Container { + // ref: ThingReference + // } + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateMemberConverter( + // codegen.getModel().expectShape(memberShapeId, MemberShape.class)); + // assertEquals(memberShapeId, converter.shapeId()); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final String memberFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, FROM_DAFNY); + // final String targetFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, FROM_DAFNY); + // final List expectedTokensFromDafny = tokenize(""" + // public static Test.Foobar.IThing %s(Wrappers_Compile._IOption value) { + // return value.is_None ? (Test.Foobar.IThing) null : %s(value.Extract()); + // }""".formatted(memberFromDafnyConverterName, targetFromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final String memberToDafnyConverterName = DotNetNameResolver.typeConverterForShape(memberShapeId, TO_DAFNY); + // final String targetToDafnyConverterName = DotNetNameResolver.typeConverterForShape(targetShapeId, TO_DAFNY); + // final List expectedTokensToDafny = tokenize(""" + // public static Wrappers_Compile._IOption %s(Test.Foobar.IThing value) { + // return value == null + // ? Wrappers_Compile.Option.create_None() + // : Wrappers_Compile.Option.create_Some(%s((Test.Foobar.IThing) value)); + // }""".formatted(memberToDafnyConverterName, targetToDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + + // @Test + // public void testGenerateSpecificExceptionConverter() { + // final ShapeId errorShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "UnfortunateError"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // @error("client") + // structure UnfortunateError { + // @required + // message: String + // } + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateSpecificExceptionConverter( + // codegen.getModel().expectShape(errorShapeId, StructureShape.class)); + // assertEquals(errorShapeId, converter.shapeId()); + // + // final String messageFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(errorShapeId.withMember("message"), FROM_DAFNY); + // final String messageToDafnyConverterName = DotNetNameResolver.typeConverterForShape(errorShapeId.withMember("message"), TO_DAFNY); + // final String errorFromDafnyConverterName = DotNetNameResolver.typeConverterForShape(errorShapeId, FROM_DAFNY); + // final String errorToDafnyConverterName = DotNetNameResolver.typeConverterForShape(errorShapeId, TO_DAFNY); + // + // final List actualTokensFromDafny = tokenize(converter.fromDafny().toString()); + // final List expectedTokensFromDafny = tokenize(""" + // public static Test.Foobar.UnfortunateError %s(test.foobar.internaldafny.types.Error_UnfortunateError value) { + // return new Test.Foobar.UnfortunateError(%s(value.message)); + // }""".formatted(errorFromDafnyConverterName, messageFromDafnyConverterName)); + // assertEquals(expectedTokensFromDafny, actualTokensFromDafny); + // + // final List actualTokensToDafny = tokenize(converter.toDafny().toString()); + // final List expectedTokensToDafny = tokenize(""" + // public static test.foobar.internaldafny.types.Error_UnfortunateError %s(Test.Foobar.UnfortunateError value) { + // test.foobar.internaldafny.types.Error_UnfortunateError converted = new test.foobar.internaldafny.types.Error_UnfortunateError(); + // converted.message = %s(value.Message); + // return converted; + // }""".formatted(errorToDafnyConverterName, messageToDafnyConverterName)); + // assertEquals(expectedTokensToDafny, actualTokensToDafny); + // } + // + // @Test + // public void testGenerateCommonExceptionConverter() { + // final ShapeId exc1ShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Exception1"); + // final ShapeId exc2ShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "Exception2"); + // final TypeConversionCodegen codegen = setupCodegen((builder, modelAssembler) -> + // modelAssembler.addUnparsedModel("test.smithy", """ + // namespace %s + // @error("client") + // structure Exception1 { @required message: String } + // @error("server") + // structure Exception2 { @required message: String } + // """.formatted(SERVICE_NAMESPACE))); + // final TypeConverter converter = codegen.generateCommonExceptionConverter(); + // assertTrue("Common exception converter must use a shape ID not in the model", + // codegen.getModel().getShape(converter.shapeId()).isEmpty()); + // + // final String actualFromDafny = converter.fromDafny().toString(); + // final String expectedFromDafny = """ + // public static System.Exception FromDafny_CommonError(test.foobar.internaldafny.types._IError value) { + // switch (value) { + // case test.foobar.internaldafny.types.Error_Exception1 dafnyVal: + // return %s(dafnyVal); + // case test.foobar.internaldafny.types.Error_Exception2 dafnyVal: + // return %s(dafnyVal); + // case test.foobar.internaldafny.types.Error_Opaque dafnyVal: + // return new OpaqueError(dafnyVal._obj); + // default: + // // The switch MUST be complete for _IError, so `value` MUST NOT be an _IError. (How did you get here?) + // return new OpaqueError(); + // } + // }""".formatted( + // DotNetNameResolver.typeConverterForShape(exc1ShapeId, FROM_DAFNY), + // DotNetNameResolver.typeConverterForShape(exc2ShapeId, FROM_DAFNY) + // ); + // tokenizeAndAssertEqual(expectedFromDafny, actualFromDafny); + // + // + // final String actualToDafny = converter.toDafny().toString(); + // final String expectedToDafny = """ + // public static test.foobar.internaldafny.types._IError ToDafny_CommonError(System.Exception value) { + // switch (value) { + // case Test.Foobar.Exception1 exception: + // return %s(exception); + // case Test.Foobar.Exception2 exception: + // return %s(exception); + // // OpaqueError is redundant, but listed for completeness. + // case OpaqueError exception: + // return new test.foobar.internaldafny.types.Error_Opaque(exception); + // case System.Exception exception: + // return new test.foobar.internaldafny.types.Error_Opaque(exception); + // default: + // // The switch MUST be complete for System.Exception, so `value` MUST NOT be an System.Exception. (How did you get here?) + // return new test.foobar.internaldafny.types.Error_Opaque(value); + // } + // }""".formatted(DotNetNameResolver.typeConverterForShape(exc1ShapeId, TO_DAFNY), + // DotNetNameResolver.typeConverterForShape(exc2ShapeId, TO_DAFNY) + // ); + // + // tokenizeAndAssertEqual(expectedToDafny, actualToDafny); + // } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegenTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegenTest.java index 5363a20ecc..8219114977 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegenTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegenTest.java @@ -3,21 +3,19 @@ package software.amazon.polymorph.smithydotnet.nativeWrapper; -import org.junit.Before; -import org.junit.Test; +import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; +import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; +import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; import java.util.Optional; - +import org.junit.Before; +import org.junit.Test; import software.amazon.polymorph.smithydotnet.DotNetNameResolver; import software.amazon.polymorph.util.TestModel; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.ShapeId; -import static software.amazon.polymorph.util.TestModel.SERVICE_NAMESPACE; -import static software.amazon.polymorph.util.TestModel.SERVICE_SHAPE_ID; -import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; - // Debugging Guidance: // These tests are arranged from Simplest to Most Complete. // Generally, the simplest unit test have shorter durations. @@ -26,167 +24,196 @@ // Addressing that unit test will often resolve the more complex failures. public class NativeWrapperCodegenTest { - protected Model model; - protected DotNetNameResolver nameResolver; - protected NativeWrapperCodegen underTest; - - @Before - public void setup() { - String rawModel = """ - namespace test.foobar - resource Baz { operations: [DoSomethingWithInput, DoSomethingWithOutput] } - operation DoSomethingWithInput { input: DoSomethingInput } - structure DoSomethingInput {} - operation DoSomethingWithOutput { output: DoSomethingOutput } - structure DoSomethingOutput {} - """; - - this.model = TestModel.setupModel( - (builder, modelAssembler) -> modelAssembler - .addUnparsedModel("test.smithy", rawModel)); - - this.nameResolver = getNameResolver(model, SERVICE_SHAPE_ID); - - this.underTest = new NativeWrapperCodegen( - this.model, - SERVICE_SHAPE_ID, - ShapeId.fromParts(SERVICE_NAMESPACE, "Baz"), - this.nameResolver); - } - - @Test - public void testGenerateValidateNativeOutput() { - ShapeId outputShapeId = ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingOutput"); - String nativeOutputType = "Test.Foobar.DoSomethingOutput"; - final String actual = this.underTest - .generateValidateNativeOutputMethod( - Optional.of(outputShapeId), - Optional.of(nativeOutputType), - "DoSomethingWithOutput") - .toString(); - final String expected = NativeWrapperCodegenTestConstants.VALIDATE_NATIVE_OUTPUT - .formatted(nativeOutputType, "DoSomethingWithOutput"); - tokenizeAndAssertEqual(actual, expected); - } - - - @Test - public void testGenerateOperationWrapperWithOutput() { - String rawModel = """ - namespace test.foobar - use aws.polymorph#positional - resource Baz { operations: [DoSomethingWithOutput] } - operation DoSomethingWithOutput { output: DoSomethingOutput } - structure DoSomethingOutput {} - """; - NativeWrapperCodegen localUnderTest = setupLocalModel(rawModel); - final String actual = localUnderTest.generateOperationWrapper( - ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput") - ).toString(); - final String expected = NativeWrapperCodegenTestConstants.DO_OUTPUT_NOT_POSITIONAL; - tokenizeAndAssertEqual(actual, expected); - } - - @Test - public void testGenerateOperationWrapperWithOutputPositional() { - String rawModel = """ - namespace test.foobar - use aws.polymorph#positional - use aws.polymorph#reference - resource Thing {} - @reference(resource: Thing) - structure ThingReference {} - resource Baz { operations: [DoSomethingWithOutput] } - operation DoSomethingWithOutput { output: DoSomethingOutput } - @positional - structure DoSomethingOutput { thing: ThingReference } - """; - NativeWrapperCodegen localUnderTest = setupLocalModel(rawModel); - final String actual = localUnderTest.generateOperationWrapper( - ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput") - ).toString(); - final String expected = NativeWrapperCodegenTestConstants.DO_OUTPUT_POSITIONAL; - tokenizeAndAssertEqual(actual, expected); - } - - @Test - public void testGenerateOperationWrapperWithInput() { - String rawModel = """ - namespace test.foobar - resource Baz { operations: [DoSomethingWithInput] } - operation DoSomethingWithInput { input: DoSomethingInput } - structure DoSomethingInput {} - """; - NativeWrapperCodegen localUnderTest = setupLocalModel(rawModel); - final String actual = localUnderTest.generateOperationWrapper( - ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithInput") - ).toString(); - final String expected = NativeWrapperCodegenTestConstants.DO_INPUT; - tokenizeAndAssertEqual(actual, expected); - } - - @Test - public void testGenerateConstructor() { - final String className = "NativeWrapper_Baz"; - final String actual = this.underTest.generateConstructor(className) - .toString(); - final String expected = NativeWrapperCodegenTestConstants.CONSTRUCTOR; - tokenizeAndAssertEqual(actual, expected); - } - - @Test - public void testGenerateClassSimple() { - String rawModel = """ - namespace test.foobar - resource Baz {} - """; - NativeWrapperCodegen localUnderTest = setupLocalModel(rawModel); - final String actual = localUnderTest.generateClass().toString(); - final String expected = NativeWrapperCodegenTestConstants.SIMPLE_CLASS; - tokenizeAndAssertEqual(actual, expected); - } - - @Test - public void testGenerateClassVoid() { - String rawModel = """ - namespace test.foobar - resource Baz {operations: [Do]} - operation Do {} - """; - NativeWrapperCodegen localUnderTest = setupLocalModel(rawModel); - final String actual = localUnderTest.generateClass().toString(); - final String expected = NativeWrapperCodegenTestConstants.VOID_CLASS; - tokenizeAndAssertEqual(actual, expected); - } - - @Test - public void testGenerateClassComplete() { - final String actual = this.underTest.generateClass().toString(); - final String expected = NativeWrapperCodegenTestConstants.COMPLETE_CLASS; - tokenizeAndAssertEqual(actual, expected); - } - - @Test - public void testGenerate() { - final String actual = this.underTest.generate().toString(); - final String expected = NativeWrapperCodegenTestConstants.COMPLETE; - tokenizeAndAssertEqual(actual, expected); - } - - NativeWrapperCodegen setupLocalModel(String rawModel) { - Model localModel = TestModel.setupModel( - (builder, modelAssembler) -> modelAssembler - .addUnparsedModel("test.smithy", rawModel)); - return new NativeWrapperCodegen( - localModel, - SERVICE_SHAPE_ID, - ShapeId.fromParts(SERVICE_NAMESPACE, "Baz"), - getNameResolver(localModel, SERVICE_SHAPE_ID)); - } - - @SuppressWarnings("SameParameterValue") - protected static DotNetNameResolver getNameResolver(Model model, ShapeId shapeId) { - return new DotNetNameResolver(model, - model.expectShape(shapeId, ServiceShape.class)); - } + protected Model model; + protected DotNetNameResolver nameResolver; + protected NativeWrapperCodegen underTest; + + @Before + public void setup() { + String rawModel = + """ + namespace test.foobar + resource Baz { operations: [DoSomethingWithInput, DoSomethingWithOutput] } + operation DoSomethingWithInput { input: DoSomethingInput } + structure DoSomethingInput {} + operation DoSomethingWithOutput { output: DoSomethingOutput } + structure DoSomethingOutput {} + """; + + this.model = + TestModel.setupModel((builder, modelAssembler) -> + modelAssembler.addUnparsedModel("test.smithy", rawModel) + ); + + this.nameResolver = getNameResolver(model, SERVICE_SHAPE_ID); + + this.underTest = + new NativeWrapperCodegen( + this.model, + SERVICE_SHAPE_ID, + ShapeId.fromParts(SERVICE_NAMESPACE, "Baz"), + this.nameResolver + ); + } + + @Test + public void testGenerateValidateNativeOutput() { + ShapeId outputShapeId = ShapeId.fromParts( + SERVICE_NAMESPACE, + "DoSomethingOutput" + ); + String nativeOutputType = "Test.Foobar.DoSomethingOutput"; + final String actual = + this.underTest.generateValidateNativeOutputMethod( + Optional.of(outputShapeId), + Optional.of(nativeOutputType), + "DoSomethingWithOutput" + ) + .toString(); + final String expected = + NativeWrapperCodegenTestConstants.VALIDATE_NATIVE_OUTPUT.formatted( + nativeOutputType, + "DoSomethingWithOutput" + ); + tokenizeAndAssertEqual(actual, expected); + } + + @Test + public void testGenerateOperationWrapperWithOutput() { + String rawModel = + """ + namespace test.foobar + use aws.polymorph#positional + resource Baz { operations: [DoSomethingWithOutput] } + operation DoSomethingWithOutput { output: DoSomethingOutput } + structure DoSomethingOutput {} + """; + NativeWrapperCodegen localUnderTest = setupLocalModel(rawModel); + final String actual = localUnderTest + .generateOperationWrapper( + ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput") + ) + .toString(); + final String expected = + NativeWrapperCodegenTestConstants.DO_OUTPUT_NOT_POSITIONAL; + tokenizeAndAssertEqual(actual, expected); + } + + @Test + public void testGenerateOperationWrapperWithOutputPositional() { + String rawModel = + """ + namespace test.foobar + use aws.polymorph#positional + use aws.polymorph#reference + resource Thing {} + @reference(resource: Thing) + structure ThingReference {} + resource Baz { operations: [DoSomethingWithOutput] } + operation DoSomethingWithOutput { output: DoSomethingOutput } + @positional + structure DoSomethingOutput { thing: ThingReference } + """; + NativeWrapperCodegen localUnderTest = setupLocalModel(rawModel); + final String actual = localUnderTest + .generateOperationWrapper( + ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithOutput") + ) + .toString(); + final String expected = + NativeWrapperCodegenTestConstants.DO_OUTPUT_POSITIONAL; + tokenizeAndAssertEqual(actual, expected); + } + + @Test + public void testGenerateOperationWrapperWithInput() { + String rawModel = + """ + namespace test.foobar + resource Baz { operations: [DoSomethingWithInput] } + operation DoSomethingWithInput { input: DoSomethingInput } + structure DoSomethingInput {} + """; + NativeWrapperCodegen localUnderTest = setupLocalModel(rawModel); + final String actual = localUnderTest + .generateOperationWrapper( + ShapeId.fromParts(SERVICE_NAMESPACE, "DoSomethingWithInput") + ) + .toString(); + final String expected = NativeWrapperCodegenTestConstants.DO_INPUT; + tokenizeAndAssertEqual(actual, expected); + } + + @Test + public void testGenerateConstructor() { + final String className = "NativeWrapper_Baz"; + final String actual = + this.underTest.generateConstructor(className).toString(); + final String expected = NativeWrapperCodegenTestConstants.CONSTRUCTOR; + tokenizeAndAssertEqual(actual, expected); + } + + @Test + public void testGenerateClassSimple() { + String rawModel = + """ + namespace test.foobar + resource Baz {} + """; + NativeWrapperCodegen localUnderTest = setupLocalModel(rawModel); + final String actual = localUnderTest.generateClass().toString(); + final String expected = NativeWrapperCodegenTestConstants.SIMPLE_CLASS; + tokenizeAndAssertEqual(actual, expected); + } + + @Test + public void testGenerateClassVoid() { + String rawModel = + """ + namespace test.foobar + resource Baz {operations: [Do]} + operation Do {} + """; + NativeWrapperCodegen localUnderTest = setupLocalModel(rawModel); + final String actual = localUnderTest.generateClass().toString(); + final String expected = NativeWrapperCodegenTestConstants.VOID_CLASS; + tokenizeAndAssertEqual(actual, expected); + } + + @Test + public void testGenerateClassComplete() { + final String actual = this.underTest.generateClass().toString(); + final String expected = NativeWrapperCodegenTestConstants.COMPLETE_CLASS; + tokenizeAndAssertEqual(actual, expected); + } + + @Test + public void testGenerate() { + final String actual = this.underTest.generate().toString(); + final String expected = NativeWrapperCodegenTestConstants.COMPLETE; + tokenizeAndAssertEqual(actual, expected); + } + + NativeWrapperCodegen setupLocalModel(String rawModel) { + Model localModel = TestModel.setupModel((builder, modelAssembler) -> + modelAssembler.addUnparsedModel("test.smithy", rawModel) + ); + return new NativeWrapperCodegen( + localModel, + SERVICE_SHAPE_ID, + ShapeId.fromParts(SERVICE_NAMESPACE, "Baz"), + getNameResolver(localModel, SERVICE_SHAPE_ID) + ); + } + + @SuppressWarnings("SameParameterValue") + protected static DotNetNameResolver getNameResolver( + Model model, + ShapeId shapeId + ) { + return new DotNetNameResolver( + model, + model.expectShape(shapeId, ServiceShape.class) + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegenTestConstants.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegenTestConstants.java index 8e4c1ddd9b..bd7f7db49a 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegenTestConstants.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithydotnet/nativeWrapper/NativeWrapperCodegenTestConstants.java @@ -5,194 +5,199 @@ class NativeWrapperCodegenTestConstants { - static String VALIDATE_NATIVE_OUTPUT = - """ - void validateOutput(%s nativeOutput) - { - try { nativeOutput.Validate(); } catch (ArgumentException e) - { - var message = $"Output of {_impl}._%s is invalid. {e.Message}"; - throw new FoobarServiceException(message); - } - } - """; // Format: nativeOutputType, methodName - - static String CATCH_GENERAL = - """ - catch (Exception e) - { - return Wrappers_Compile - .Result<%s, test.foobar.internaldafny.types._IError> - .create_Failure(TypeConversion.ToDafny_CommonError(e)); - } - """; // Format: method name - - static String DO_OUTPUT = - """ - public Wrappers_Compile._IResult< - %s, - test.foobar.internaldafny.types._IError - > DoSomethingWithOutput() - { - %s - try - { - %s nativeOutput = _impl.DoSomethingWithOutput(); - _ = nativeOutput ?? throw new FoobarServiceException( - $"{_impl}._DoSomethingWithOutput returned null, should be {typeof(%s)}" - ); - %s - return Wrappers_Compile.Result< - %s, - test.foobar.internaldafny.types._IError - >.create_Success( - TypeConversion.%s( - nativeOutput) - ); - } - %s - } - - public Wrappers_Compile._IResult<%s, test.foobar.internaldafny.types._IError> - DoSomethingWithOutput_k() - { - throw new FoobarServiceException("Not supported at this time."); - } - """; - - static String getOutput( - String abstractOutput, - String validateOutputMethod, - String nativeOutput, - String invokeValidateOutput, - String toDafnyOutputConverter, - String catchGeneral) { - return DO_OUTPUT.formatted( - abstractOutput, - validateOutputMethod, - nativeOutput, - nativeOutput, - invokeValidateOutput, - abstractOutput, - toDafnyOutputConverter, - catchGeneral.formatted(abstractOutput), - abstractOutput - ); + static String VALIDATE_NATIVE_OUTPUT = + """ + void validateOutput(%s nativeOutput) + { + try { nativeOutput.Validate(); } catch (ArgumentException e) + { + var message = $"Output of {_impl}._%s is invalid. {e.Message}"; + throw new FoobarServiceException(message); + } + } + """; // Format: nativeOutputType, methodName + + static String CATCH_GENERAL = + """ + catch (Exception e) + { + return Wrappers_Compile + .Result<%s, test.foobar.internaldafny.types._IError> + .create_Failure(TypeConversion.ToDafny_CommonError(e)); + } + """; // Format: method name + + static String DO_OUTPUT = + """ + public Wrappers_Compile._IResult< + %s, + test.foobar.internaldafny.types._IError + > DoSomethingWithOutput() + { + %s + try + { + %s nativeOutput = _impl.DoSomethingWithOutput(); + _ = nativeOutput ?? throw new FoobarServiceException( + $"{_impl}._DoSomethingWithOutput returned null, should be {typeof(%s)}" + ); + %s + return Wrappers_Compile.Result< + %s, + test.foobar.internaldafny.types._IError + >.create_Success( + TypeConversion.%s( + nativeOutput) + ); + } + %s } - static String DO_OUTPUT_POSITIONAL = getOutput( - "test.foobar.internaldafny.types.IThing", // abstract output or interface - "", // validateOutput method - "Test.Foobar.IThing", // type of native output - "", // validate native output - "ToDafny_N4_test__N6_foobar__S17_DoSomethingOutput", // to dafny output converter - CATCH_GENERAL + public Wrappers_Compile._IResult<%s, test.foobar.internaldafny.types._IError> + DoSomethingWithOutput_k() + { + throw new FoobarServiceException("Not supported at this time."); + } + """; + + static String getOutput( + String abstractOutput, + String validateOutputMethod, + String nativeOutput, + String invokeValidateOutput, + String toDafnyOutputConverter, + String catchGeneral + ) { + return DO_OUTPUT.formatted( + abstractOutput, + validateOutputMethod, + nativeOutput, + nativeOutput, + invokeValidateOutput, + abstractOutput, + toDafnyOutputConverter, + catchGeneral.formatted(abstractOutput), + abstractOutput ); + } + + static String DO_OUTPUT_POSITIONAL = getOutput( + "test.foobar.internaldafny.types.IThing", // abstract output or interface + "", // validateOutput method + "Test.Foobar.IThing", // type of native output + "", // validate native output + "ToDafny_N4_test__N6_foobar__S17_DoSomethingOutput", // to dafny output converter + CATCH_GENERAL + ); + + static String DO_OUTPUT_NOT_POSITIONAL = getOutput( + "test.foobar.internaldafny.types._IDoSomethingOutput", + VALIDATE_NATIVE_OUTPUT.formatted( + "Test.Foobar.DoSomethingOutput", + "DoSomethingWithOutput" + ), + "Test.Foobar.DoSomethingOutput", + "validateOutput(nativeOutput);", + "ToDafny_N4_test__N6_foobar__S17_DoSomethingOutput", // to dafny output converter + CATCH_GENERAL + ); + + static String DO_INPUT = + """ + public Wrappers_Compile._IResult< + _System._ITuple0, + test.foobar.internaldafny.types._IError + > DoSomethingWithInput(test.foobar.internaldafny.types._IDoSomethingInput input) + { + Test.Foobar.DoSomethingInput nativeInput = + TypeConversion.FromDafny_N4_test__N6_foobar__S16_DoSomethingInput( + input); + try + { + _impl.DoSomethingWithInput(nativeInput); + return Wrappers_Compile.Result< + _System._ITuple0, + test.foobar.internaldafny.types._IError + >.create_Success(Tuple0.create()); + } + %s + } + public Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> DoSomethingWithInput_k(test.foobar.internaldafny.types._IDoSomethingInput input) + { + throw new FoobarServiceException("Not supported at this time."); + } + """.formatted(CATCH_GENERAL.formatted("_System._ITuple0")); + + static String DO = + """ + public Wrappers_Compile._IResult< + _System._ITuple0, + test.foobar.internaldafny.types._IError + > Do() + { + try + { + _impl.Do(); + return Wrappers_Compile.Result< + _System._ITuple0, + test.foobar.internaldafny.types._IError + >.create_Success(Tuple0.create()); + } + %s + } - static String DO_OUTPUT_NOT_POSITIONAL = getOutput( - "test.foobar.internaldafny.types._IDoSomethingOutput", - VALIDATE_NATIVE_OUTPUT.formatted("Test.Foobar.DoSomethingOutput", "DoSomethingWithOutput"), - "Test.Foobar.DoSomethingOutput", - "validateOutput(nativeOutput);", - "ToDafny_N4_test__N6_foobar__S17_DoSomethingOutput", // to dafny output converter - CATCH_GENERAL - ); + public Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> Do_k() + { + throw new FoobarServiceException("Not supported at this time."); + } + """.formatted(CATCH_GENERAL.formatted("_System._ITuple0")); - static String DO_INPUT = - """ - public Wrappers_Compile._IResult< - _System._ITuple0, - test.foobar.internaldafny.types._IError - > DoSomethingWithInput(test.foobar.internaldafny.types._IDoSomethingInput input) - { - Test.Foobar.DoSomethingInput nativeInput = - TypeConversion.FromDafny_N4_test__N6_foobar__S16_DoSomethingInput( - input); - try - { - _impl.DoSomethingWithInput(nativeInput); - return Wrappers_Compile.Result< - _System._ITuple0, - test.foobar.internaldafny.types._IError - >.create_Success(Tuple0.create()); - } - %s - } - public Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> DoSomethingWithInput_k(test.foobar.internaldafny.types._IDoSomethingInput input) - { - throw new FoobarServiceException("Not supported at this time."); - } - """.formatted(CATCH_GENERAL.formatted("_System._ITuple0")); - - static String DO = - """ - public Wrappers_Compile._IResult< - _System._ITuple0, - test.foobar.internaldafny.types._IError - > Do() - { - try - { - _impl.Do(); - return Wrappers_Compile.Result< - _System._ITuple0, - test.foobar.internaldafny.types._IError - >.create_Success(Tuple0.create()); - } - %s - } - - public Wrappers_Compile._IResult<_System._ITuple0, test.foobar.internaldafny.types._IError> Do_k() - { - throw new FoobarServiceException("Not supported at this time."); - } - """.formatted(CATCH_GENERAL.formatted("_System._ITuple0")); - - static String CONSTRUCTOR = - """ - public NativeWrapper_Baz(BazBase nativeImpl) - { - _impl = nativeImpl; - } - """; - - static String getNameSpacedNativeWrapper(String constructor, String operations) { - return - """ - namespace Test.Foobar - { - internal class NativeWrapper_Baz : test.foobar.internaldafny.types.IBaz - { - internal readonly BazBase _impl; - - %s - - %s - } - } - """.formatted(constructor, operations); + static String CONSTRUCTOR = + """ + public NativeWrapper_Baz(BazBase nativeImpl) + { + _impl = nativeImpl; } + """; + + static String getNameSpacedNativeWrapper( + String constructor, + String operations + ) { + return """ + namespace Test.Foobar + { + internal class NativeWrapper_Baz : test.foobar.internaldafny.types.IBaz + { + internal readonly BazBase _impl; + + %s + + %s + } + } + """.formatted(constructor, operations); + } + + static String SIMPLE_CLASS = getNameSpacedNativeWrapper(CONSTRUCTOR, ""); - static String SIMPLE_CLASS = getNameSpacedNativeWrapper(CONSTRUCTOR, ""); + static String VOID_CLASS = getNameSpacedNativeWrapper(CONSTRUCTOR, DO); - static String VOID_CLASS = getNameSpacedNativeWrapper(CONSTRUCTOR, DO); + static String COMPLETE_CLASS = getNameSpacedNativeWrapper( + CONSTRUCTOR, + "%s\n%s".formatted(DO_INPUT, DO_OUTPUT_NOT_POSITIONAL) + ); - static String COMPLETE_CLASS = - getNameSpacedNativeWrapper( - CONSTRUCTOR, - "%s\n%s".formatted(DO_INPUT, DO_OUTPUT_NOT_POSITIONAL)); + static String PRELUDE = + """ + // ReSharper disable RedundantUsingDirective + // ReSharper disable RedundantNameQualifier + // ReSharper disable SuggestVarOrType_SimpleTypes - static String PRELUDE = - """ - // ReSharper disable RedundantUsingDirective - // ReSharper disable RedundantNameQualifier - // ReSharper disable SuggestVarOrType_SimpleTypes - - using System; - using _System; - using Wrappers_Compile; - """; + using System; + using _System; + using Wrappers_Compile; + """; - static String COMPLETE = - "%s\n%s".formatted(PRELUDE, COMPLETE_CLASS); + static String COMPLETE = "%s\n%s".formatted(PRELUDE, COMPLETE_CLASS); } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ForEachDafnyTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ForEachDafnyTest.java index 37021333fa..20ace96be3 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ForEachDafnyTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ForEachDafnyTest.java @@ -2,21 +2,22 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava; +import java.util.Arrays; +import java.util.Collection; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import software.amazon.polymorph.smithydafny.DafnyVersion; -import java.util.Arrays; -import java.util.Collection; - @RunWith(Parameterized.class) public abstract class ForEachDafnyTest { - @Parameterized.Parameters(name = "dafnyVersion = {0}") - public static Collection dafnies() { - return Arrays.asList(new Object[][] { - { new DafnyVersion(4, 1, 0) }, - { new DafnyVersion(4, 3, 0) }, - }); - } + @Parameterized.Parameters(name = "dafnyVersion = {0}") + public static Collection dafnies() { + return Arrays.asList( + new Object[][] { + { new DafnyVersion(4, 1, 0) }, + { new DafnyVersion(4, 3, 0) }, + } + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ModelConstants.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ModelConstants.java index 79e94acb06..a3d50bf264 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ModelConstants.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/ModelConstants.java @@ -3,112 +3,117 @@ package software.amazon.polymorph.smithyjava; public class ModelConstants { - public static String MOCK_KMS = """ - namespace com.amazonaws.kms - service KeyManagementService { operations: [DoSomething, DoVoid] } - operation DoSomething { - input: DoSomethingRequest, - output: DoSomethingResponse, - errors: [DependencyTimeoutException] - } - operation DoVoid { - input: DoVoidRequest, - errors: [DependencyTimeoutException] - } - @error("server") - structure DependencyTimeoutException { message: String } - structure DoSomethingRequest {} - structure DoSomethingResponse {} - structure DoVoidRequest {} - """; - public static String KMS_A_STRING_OPERATION = """ - namespace com.amazonaws.kms - service KeyManagementService { operations: [DoSomething] } - operation DoSomething { - input: DoSomethingRequest, - output: DoSomethingResponse, - errors: [DependencyTimeoutException] - } - @error("server") - structure DependencyTimeoutException { message: String } - structure DoSomethingRequest { - @required - message: String - } - structure DoSomethingResponse { message: String } - """; + public static String MOCK_KMS = + """ + namespace com.amazonaws.kms + service KeyManagementService { operations: [DoSomething, DoVoid] } + operation DoSomething { + input: DoSomethingRequest, + output: DoSomethingResponse, + errors: [DependencyTimeoutException] + } + operation DoVoid { + input: DoVoidRequest, + errors: [DependencyTimeoutException] + } + @error("server") + structure DependencyTimeoutException { message: String } + structure DoSomethingRequest {} + structure DoSomethingResponse {} + structure DoVoidRequest {} + """; - public static String KMS_KITCHEN = """ - namespace com.amazonaws.kms - use com.amazonaws.other#OtherNamespace - service KeyManagementService {} - blob CiphertextType - string TagKeyType - @enum([ - { name: "SIGN_VERIFY", value: "SIGN_VERIFY" }, - { name: "ENCRYPT_DECRYPT", value: "ENCRYPT_DECRYPT" }, - ]) - string KeyUsageType - list KeyUsageTypes { member: KeyUsageType } - list OtherNamespaces { member: OtherNamespace } - string OptionalString - set Names { member: String } - map EncryptionContextType { key: String, value: String } - structure Kitchen { - @required ciphertext: CiphertextType, - @required name: TagKeyType, - @required keyUsage: KeyUsageType, - @required otherNamespace: OtherNamespace, - message: OptionalString, - @required listEnum: KeyUsageTypes - } - structure Simple {} - structure AOptional { message: OptionalString } - structure RequiredListEnum { @required listEnum: KeyUsageTypes } - double NotSupported - """; + public static String KMS_A_STRING_OPERATION = + """ + namespace com.amazonaws.kms + service KeyManagementService { operations: [DoSomething] } + operation DoSomething { + input: DoSomethingRequest, + output: DoSomethingResponse, + errors: [DependencyTimeoutException] + } + @error("server") + structure DependencyTimeoutException { message: String } + structure DoSomethingRequest { + @required + message: String + } + structure DoSomethingResponse { message: String } + """; - public static String OTHER_NAMESPACE = """ - namespace com.amazonaws.other - structure OtherNamespace {} - service OtherService {} - """; + public static String KMS_KITCHEN = + """ + namespace com.amazonaws.kms + use com.amazonaws.other#OtherNamespace + service KeyManagementService {} + blob CiphertextType + string TagKeyType + @enum([ + { name: "SIGN_VERIFY", value: "SIGN_VERIFY" }, + { name: "ENCRYPT_DECRYPT", value: "ENCRYPT_DECRYPT" }, + ]) + string KeyUsageType + list KeyUsageTypes { member: KeyUsageType } + list OtherNamespaces { member: OtherNamespace } + string OptionalString + set Names { member: String } + map EncryptionContextType { key: String, value: String } + structure Kitchen { + @required ciphertext: CiphertextType, + @required name: TagKeyType, + @required keyUsage: KeyUsageType, + @required otherNamespace: OtherNamespace, + message: OptionalString, + @required listEnum: KeyUsageTypes + } + structure Simple {} + structure AOptional { message: OptionalString } + structure RequiredListEnum { @required listEnum: KeyUsageTypes } + double NotSupported + """; - public static String CRYPTOGRAPHY_A_STRING_OPERATION = """ - namespace aws.cryptography.test - @aws.polymorph#localService( - sdkId: "Test", - config: TestConfig, - ) - service Test { - operations: [DoSomething], - errors: [TestError] - } - structure TestConfig {} - operation DoSomething { - input: DoSomethingRequest, - output: DoSomethingResponse, - errors: [TestError] - } - @error("client") - structure TestError { - @required - message: String - } - structure DoSomethingRequest { - @required - message: String - } - structure DoSomethingResponse { message: String } - @range(min: 0, max: 10) integer ZeroToTenInteger - structure TestRangeMinMaxInteger { - zeroToTen: ZeroToTenInteger - } - @length(min:256, max:256) blob Aes256Key - structure TestLengthMinMaxBlob { - key: Aes256Key - } - """; + public static String OTHER_NAMESPACE = + """ + namespace com.amazonaws.other + structure OtherNamespace {} + service OtherService {} + """; + public static String CRYPTOGRAPHY_A_STRING_OPERATION = + """ + namespace aws.cryptography.test + @aws.polymorph#localService( + sdkId: "Test", + config: TestConfig, + ) + service Test { + operations: [DoSomething], + errors: [TestError] + } + structure TestConfig {} + operation DoSomething { + input: DoSomethingRequest, + output: DoSomethingResponse, + errors: [TestError] + } + @error("client") + structure TestError { + @required + message: String + } + structure DoSomethingRequest { + @required + message: String + } + structure DoSomethingResponse { message: String } + @range(min: 0, max: 10) integer ZeroToTenInteger + structure TestRangeMinMaxInteger { + zeroToTen: ZeroToTenInteger + } + @length(min:256, max:256) blob Aes256Key + structure TestLengthMinMaxBlob { + key: Aes256Key + } + """; } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/ToDafnyConstants.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/ToDafnyConstants.java index f59fb25239..6c739ef09c 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/ToDafnyConstants.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/ToDafnyConstants.java @@ -3,47 +3,57 @@ package software.amazon.polymorph.smithyjava.generator; public class ToDafnyConstants { - public static String MEMBER_DECLARATION_REQUIRED = - "dafny.DafnySequence name"; - public static String MEMBER_DECLARATION_OPTIONAL = - "Wrappers_Compile.Option> message"; - public static String MEMBER_ASSIGNMENT_REQUIRED = - "name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getName())"; - public static String STRING_CONVERSION = "software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence"; - public static String KEY_USAGE_TYPE_CONVERSION = "software.amazon.cryptography.services.kms.internaldafny.ToDafny.KeyUsageType"; - public static String OTHER_NAMESPACE_CONVERSION = "Dafny.Com.Amazonaws.Other.ToDafny.OtherNamespace"; - public static String MEMBER_ASSIGNMENT_OPTIONAL = """ - message = java.util.Objects.nonNull(nativeValue.getMessage()) ? - Wrappers_Compile.Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) - : Wrappers_Compile.Option.create_None()"""; - public static String RETURN_A_OPTIONAL = "return new software.amazon.cryptography.services.kms.internaldafny.types.AOptional(message)"; - public static String SIMPLE_STRUCTURE = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.Simple Simple( - com.amazonaws.services.kms.model.Simple nativeValue) { - return new software.amazon.cryptography.services.kms.internaldafny.types.Simple(); - } - """; - public static String A_OPTIONAL_STRUCTURE = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.AOptional AOptional( - com.amazonaws.services.kms.model.AOptional nativeValue) { - %s; - %s; - %s; - } - """.formatted(MEMBER_DECLARATION_OPTIONAL, MEMBER_ASSIGNMENT_OPTIONAL, RETURN_A_OPTIONAL); - - - public static String GENERATE_CONVERT_ERROR = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.Error Error( - com.amazonaws.services.kms.model.DependencyTimeoutException nativeValue - ) { - Wrappers_Compile.Option> message; - message = java.util.Objects.nonNull(nativeValue.getMessage()) ? - Wrappers_Compile.Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) - : Wrappers_Compile.Option.create_None(); - return new software.amazon.cryptography.services.kms.internaldafny.types.Error_DependencyTimeoutException(message); - } - """; + public static String MEMBER_DECLARATION_REQUIRED = + "dafny.DafnySequence name"; + public static String MEMBER_DECLARATION_OPTIONAL = + "Wrappers_Compile.Option> message"; + public static String MEMBER_ASSIGNMENT_REQUIRED = + "name = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getName())"; + public static String STRING_CONVERSION = + "software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence"; + public static String KEY_USAGE_TYPE_CONVERSION = + "software.amazon.cryptography.services.kms.internaldafny.ToDafny.KeyUsageType"; + public static String OTHER_NAMESPACE_CONVERSION = + "Dafny.Com.Amazonaws.Other.ToDafny.OtherNamespace"; + public static String MEMBER_ASSIGNMENT_OPTIONAL = + """ + message = java.util.Objects.nonNull(nativeValue.getMessage()) ? + Wrappers_Compile.Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) + : Wrappers_Compile.Option.create_None()"""; + public static String RETURN_A_OPTIONAL = + "return new software.amazon.cryptography.services.kms.internaldafny.types.AOptional(message)"; + public static String SIMPLE_STRUCTURE = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.Simple Simple( + com.amazonaws.services.kms.model.Simple nativeValue) { + return new software.amazon.cryptography.services.kms.internaldafny.types.Simple(); + } + """; + public static String A_OPTIONAL_STRUCTURE = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.AOptional AOptional( + com.amazonaws.services.kms.model.AOptional nativeValue) { + %s; + %s; + %s; + } + """.formatted( + MEMBER_DECLARATION_OPTIONAL, + MEMBER_ASSIGNMENT_OPTIONAL, + RETURN_A_OPTIONAL + ); + public static String GENERATE_CONVERT_ERROR = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.Error Error( + com.amazonaws.services.kms.model.DependencyTimeoutException nativeValue + ) { + Wrappers_Compile.Option> message; + message = java.util.Objects.nonNull(nativeValue.getMessage()) ? + Wrappers_Compile.Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) + : Wrappers_Compile.Option.create_None(); + return new software.amazon.cryptography.services.kms.internaldafny.types.Error_DependencyTimeoutException(message); + } + """; } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/ToDafnyTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/ToDafnyTest.java index 9391f9f3f1..c47430ca62 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/ToDafnyTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/ToDafnyTest.java @@ -5,9 +5,7 @@ import com.squareup.javapoet.ClassName; import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; - import java.util.Set; - import software.amazon.polymorph.smithyjava.MethodReference; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.MemberShape; @@ -15,28 +13,38 @@ @SuppressWarnings("OptionalGetWithoutIsPresent") public class ToDafnyTest { - protected ToDafnyTestImpl underTest; - protected Model model; - static class ToDafnyTestImpl extends ToDafny { + protected ToDafnyTestImpl underTest; + protected Model model; - public ToDafnyTestImpl(CodegenSubject subject) { - super(subject, ClassName.get(subject.dafnyNameResolver.packageName(), TO_DAFNY)); - } + static class ToDafnyTestImpl extends ToDafny { - /** For AWS SDK structure members, the getter is `get + capitalized member name`. */ - @Override //At least for now, we are just going to use AWS SDK V1 style getter's here - protected CodeBlock getMember(CodeBlock variableName, MemberShape memberShape) { - return CodeBlock.of("$L.get$L()", variableName, StringUtils.capitalize(memberShape.getMemberName())); - } + public ToDafnyTestImpl(CodegenSubject subject) { + super( + subject, + ClassName.get(subject.dafnyNameResolver.packageName(), TO_DAFNY) + ); + } - @Override - public Set javaFiles() { - return null; - } + /** For AWS SDK structure members, the getter is `get + capitalized member name`. */ + @Override //At least for now, we are just going to use AWS SDK V1 style getter's here + protected CodeBlock getMember( + CodeBlock variableName, + MemberShape memberShape + ) { + return CodeBlock.of( + "$L.get$L()", + variableName, + StringUtils.capitalize(memberShape.getMemberName()) + ); } - /*@Before + @Override + public Set javaFiles() { + return null; + } + } + /*@Before public void setup() { model = TestSetupUtils.setupTwoLocalModel(ModelConstants.KMS_KITCHEN, ModelConstants.OTHER_NAMESPACE); underTest = new ToDafnyTestImpl(TestSetupUtils.setupAwsSdkV1(model, "kms")); diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/TestSetupUtils.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/TestSetupUtils.java index 457db60563..c025278e6f 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/TestSetupUtils.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/TestSetupUtils.java @@ -2,44 +2,78 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk; -import java.util.function.BiConsumer; +import static software.amazon.polymorph.utils.AwsSdkNameResolverHelpers.namespaceForService; +import static software.amazon.polymorph.utils.ModelUtils.serviceFromNamespace; +import java.util.function.BiConsumer; import software.amazon.polymorph.smithydafny.DafnyVersion; +import software.amazon.polymorph.smithyjava.generator.CodegenSubject; import software.amazon.polymorph.smithyjava.generator.awssdk.v1.JavaAwsSdkV1; import software.amazon.polymorph.smithyjava.generator.awssdk.v2.JavaAwsSdkV2; -import software.amazon.polymorph.smithyjava.generator.CodegenSubject; import software.amazon.polymorph.smithyjava.generator.library.JavaLibrary; import software.amazon.polymorph.util.TestModel; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.loader.ModelAssembler; import software.amazon.smithy.model.shapes.ServiceShape; -import static software.amazon.polymorph.utils.AwsSdkNameResolverHelpers.namespaceForService; -import static software.amazon.polymorph.utils.ModelUtils.serviceFromNamespace; - public class TestSetupUtils { - public static Model setupLocalModel(String rawModel) { - BiConsumer updater; - updater = ((builder, modelAssembler) -> modelAssembler.addUnparsedModel("test.smithy", rawModel)); - return TestModel.setupModel(updater); - } - public static Model setupTwoLocalModel(String rawModelOne, String rawModelTwo) { - BiConsumer updater; - updater = ((builder, modelAssembler) -> modelAssembler.addUnparsedModel("testOne.smithy", rawModelOne).addUnparsedModel("testTwo.smithy", rawModelTwo)); - return TestModel.setupModel(updater); - } - public static JavaAwsSdkV1 setupAwsSdkV1(Model localModel, String awsName) { - ServiceShape serviceShape = serviceFromNamespace( - localModel, namespaceForService(awsName)); - return JavaAwsSdkV1.createJavaAwsSdkV1(serviceShape, localModel); - } - public static JavaAwsSdkV2 setupAwsSdkV2(Model localModel, String awsName, DafnyVersion dafnyVersion) { - ServiceShape serviceShape = serviceFromNamespace( - localModel, namespaceForService(awsName)); - return JavaAwsSdkV2.createJavaAwsSdkV2(serviceShape, localModel, dafnyVersion); - } - public static JavaLibrary setupLibrary(Model localModel, String namespace, DafnyVersion dafnyVersion) { - ServiceShape serviceShape = serviceFromNamespace(localModel, namespace); - return new JavaLibrary(localModel, serviceShape, CodegenSubject.AwsSdkVersion.V1, dafnyVersion); - } + + public static Model setupLocalModel(String rawModel) { + BiConsumer updater; + updater = + ((builder, modelAssembler) -> + modelAssembler.addUnparsedModel("test.smithy", rawModel)); + return TestModel.setupModel(updater); + } + + public static Model setupTwoLocalModel( + String rawModelOne, + String rawModelTwo + ) { + BiConsumer updater; + updater = + ((builder, modelAssembler) -> + modelAssembler + .addUnparsedModel("testOne.smithy", rawModelOne) + .addUnparsedModel("testTwo.smithy", rawModelTwo)); + return TestModel.setupModel(updater); + } + + public static JavaAwsSdkV1 setupAwsSdkV1(Model localModel, String awsName) { + ServiceShape serviceShape = serviceFromNamespace( + localModel, + namespaceForService(awsName) + ); + return JavaAwsSdkV1.createJavaAwsSdkV1(serviceShape, localModel); + } + + public static JavaAwsSdkV2 setupAwsSdkV2( + Model localModel, + String awsName, + DafnyVersion dafnyVersion + ) { + ServiceShape serviceShape = serviceFromNamespace( + localModel, + namespaceForService(awsName) + ); + return JavaAwsSdkV2.createJavaAwsSdkV2( + serviceShape, + localModel, + dafnyVersion + ); + } + + public static JavaLibrary setupLibrary( + Model localModel, + String namespace, + DafnyVersion dafnyVersion + ) { + ServiceShape serviceShape = serviceFromNamespace(localModel, namespace); + return new JavaLibrary( + localModel, + serviceShape, + CodegenSubject.AwsSdkVersion.V1, + dafnyVersion + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/Constants.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/Constants.java index 5e2946ae11..d823f4577e 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/Constants.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/Constants.java @@ -3,78 +3,81 @@ package software.amazon.polymorph.smithyjava.generator.awssdk.v1; public class Constants { - static String DoSomethingOperation = """ - @Override - public Result DoSomething(DoSomethingRequest input) { - com.amazonaws.services.kms.model.DoSomethingRequest converted = ToNative.DoSomethingRequest(input); - try { - DoSomethingResult result = _impl.doSomething(converted); - DoSomethingResponse dafnyResponse = ToDafny.DoSomethingResponse(result); - return Result.create_Success(dafnyResponse); - } catch (DependencyTimeoutException ex) { - return Result.create_Failure(ToDafny.Error(ex)); - } catch (AWSKMSException ex) { - return Result.create_Failure(ToDafny.Error(ex)); - } - } - """; - static String DoVoidOperation = """ - @Override - public Result DoVoid(DoVoidRequest input) { - com.amazonaws.services.kms.model.DoVoidRequest converted = ToNative.DoVoidRequest(input); - try { - _impl.doVoid(converted); - return Result.create_Success(Tuple0.create()); - } catch (DependencyTimeoutException ex) { - return Result.create_Failure(ToDafny.Error(ex)); - } catch (AWSKMSException ex) { - return Result.create_Failure(ToDafny.Error(ex)); - } - } - """; + static String DoSomethingOperation = + """ + @Override + public Result DoSomething(DoSomethingRequest input) { + com.amazonaws.services.kms.model.DoSomethingRequest converted = ToNative.DoSomethingRequest(input); + try { + DoSomethingResult result = _impl.doSomething(converted); + DoSomethingResponse dafnyResponse = ToDafny.DoSomethingResponse(result); + return Result.create_Success(dafnyResponse); + } catch (DependencyTimeoutException ex) { + return Result.create_Failure(ToDafny.Error(ex)); + } catch (AWSKMSException ex) { + return Result.create_Failure(ToDafny.Error(ex)); + } + } + """; - static String MockKmsShim = """ - package software.amazon.cryptography.services.kms.internaldafny; - - import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest; - import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse; - import software.amazon.cryptography.services.kms.internaldafny.types.DoVoidRequest; - import software.amazon.cryptography.services.kms.internaldafny.types.Error; - import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; - - import Wrappers_Compile.Result; - - import com.amazonaws.services.kms.AWSKMS; - import com.amazonaws.services.kms.model.AWSKMSException; - import com.amazonaws.services.kms.model.DependencyTimeoutException; - import com.amazonaws.services.kms.model.DoSomethingResult; - import dafny.Tuple0; - - import java.lang.Override; - import java.lang.String; - - public class Shim implements IKeyManagementServiceClient { - private final AWSKMS _impl; - - private final String region; - - public Shim(final AWSKMS impl, final String region) { - this._impl = impl; - this.region = region; - } - - public AWSKMS impl() { - return this._impl; - } - - public String region() { - return this.region; - } - - %s - %s - } - """.formatted(DoSomethingOperation, DoVoidOperation); + static String DoVoidOperation = + """ + @Override + public Result DoVoid(DoVoidRequest input) { + com.amazonaws.services.kms.model.DoVoidRequest converted = ToNative.DoVoidRequest(input); + try { + _impl.doVoid(converted); + return Result.create_Success(Tuple0.create()); + } catch (DependencyTimeoutException ex) { + return Result.create_Failure(ToDafny.Error(ex)); + } catch (AWSKMSException ex) { + return Result.create_Failure(ToDafny.Error(ex)); + } + } + """; + static String MockKmsShim = + """ + package software.amazon.cryptography.services.kms.internaldafny; + + import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest; + import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse; + import software.amazon.cryptography.services.kms.internaldafny.types.DoVoidRequest; + import software.amazon.cryptography.services.kms.internaldafny.types.Error; + import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; + + import Wrappers_Compile.Result; + + import com.amazonaws.services.kms.AWSKMS; + import com.amazonaws.services.kms.model.AWSKMSException; + import com.amazonaws.services.kms.model.DependencyTimeoutException; + import com.amazonaws.services.kms.model.DoSomethingResult; + import dafny.Tuple0; + + import java.lang.Override; + import java.lang.String; + + public class Shim implements IKeyManagementServiceClient { + private final AWSKMS _impl; + + private final String region; + + public Shim(final AWSKMS impl, final String region) { + this._impl = impl; + this.region = region; + } + + public AWSKMS impl() { + return this._impl; + } + + public String region() { + return this.region; + } + + %s + %s + } + """.formatted(DoSomethingOperation, DoVoidOperation); } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ShimTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ShimTest.java index 533550511b..883fbc32bf 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ShimTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ShimTest.java @@ -2,18 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v1; -import software.amazon.polymorph.utils.TokenTree; -import software.amazon.smithy.model.Model; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import software.amazon.polymorph.utils.TokenTree; +import software.amazon.smithy.model.Model; + public class ShimTest { - protected ShimV1 underTest; - protected Model model; - protected JavaAwsSdkV1 subject; - /*@Before + protected ShimV1 underTest; + protected Model model; + protected JavaAwsSdkV1 subject; + /*@Before public void setup() { model = TestSetupUtils.setupLocalModel(ModelConstants.MOCK_KMS); subject = TestSetupUtils.setupAwsSdkV1(model, "kms"); diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1Constants.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1Constants.java index ce8a7390e7..fbb59cfcf8 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1Constants.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1Constants.java @@ -6,153 +6,163 @@ import static software.amazon.polymorph.smithyjava.generator.ToDafnyConstants.MEMBER_DECLARATION_OPTIONAL; public class ToDafnyAwsV1Constants { - protected static String DO_SOMETHING_RESPONSE = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse DoSomethingResponse( - com.amazonaws.services.kms.model.DoSomethingResult nativeValue) { - %s; - %s; - return new software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse(message); - } - """.formatted(MEMBER_DECLARATION_OPTIONAL, MEMBER_ASSIGNMENT_OPTIONAL); - protected static String KEY_USAGE_TYPE = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType KeyUsageType( - com.amazonaws.services.kms.model.KeyUsageType nativeValue - ) { - switch (nativeValue) { - case SIGN_VERIFY: { - return software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType.create_SIGN__VERIFY(); - } - case ENCRYPT_DECRYPT: { - return software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType.create_ENCRYPT__DECRYPT(); - } - default: { - throw new java.lang.RuntimeException("Cannot convert " + nativeValue + " to software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType."); - } - } - } - """; + protected static String DO_SOMETHING_RESPONSE = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse DoSomethingResponse( + com.amazonaws.services.kms.model.DoSomethingResult nativeValue) { + %s; + %s; + return new software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse(message); + } + """.formatted(MEMBER_DECLARATION_OPTIONAL, MEMBER_ASSIGNMENT_OPTIONAL); - protected static String KEY_USAGE_TYPE_STRING = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType KeyUsageType( - java.lang.String nativeValue - ) { - return KeyUsageType(com.amazonaws.services.kms.model.KeyUsageType.fromValue(nativeValue)); - }"""; + protected static String KEY_USAGE_TYPE = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType KeyUsageType( + com.amazonaws.services.kms.model.KeyUsageType nativeValue + ) { + switch (nativeValue) { + case SIGN_VERIFY: { + return software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType.create_SIGN__VERIFY(); + } + case ENCRYPT_DECRYPT: { + return software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType.create_ENCRYPT__DECRYPT(); + } + default: { + throw new java.lang.RuntimeException("Cannot convert " + nativeValue + " to software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType."); + } + } + } + """; - protected static String GENERATE_CONVERT_LIST = """ - public static dafny.DafnySequence KeyUsageTypes ( - java.util.List nativeValue - ) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.services.kms.internaldafny.ToDafny::KeyUsageType, - software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType._typeDescriptor() - ); - } - """; - protected static String GENERATE_CONVERT_LIST_STRUCTURES = """ - public static dafny.DafnySequence OtherNamespaces ( - java.util.List nativeValue - ) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - Dafny.Com.Amazonaws.Other.ToDafny::OtherNamespace, - Dafny.Com.Amazonaws.Other.Types.OtherNamespace._typeDescriptor() - ); - } - """; - protected static String GENERATE_CONVERT_MAP_STRING = """ - public static dafny.DafnyMap< - ? extends dafny.DafnySequence, - ? extends dafny.DafnySequence> - EncryptionContextType( - java.util.Map nativeValue - ) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToMap( - nativeValue, - software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence, - software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence - ); - } - """; - protected static String GENERATE_CONVERT_SET_STRING = """ - public static dafny.DafnySet< - ? extends dafny.DafnySequence> - Names( - java.util.Set nativeValue - ) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSet( - nativeValue, - software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence - ); - } - """; + protected static String KEY_USAGE_TYPE_STRING = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType KeyUsageType( + java.lang.String nativeValue + ) { + return KeyUsageType(com.amazonaws.services.kms.model.KeyUsageType.fromValue(nativeValue)); + }"""; - protected static String GENERATE_CONVERT_OPAQUE_ERROR = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.Error Error( - com.amazonaws.services.kms.model.AWSKMSException nativeValue - ) { - Wrappers_Compile.Option> message; - message = java.util.Objects.nonNull(nativeValue.getMessage()) ? - Wrappers_Compile.Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) - : Wrappers_Compile.Option.create_None(); - return new software.amazon.cryptography.services.kms.internaldafny.types.Error_Opaque(message); - } - """; + protected static String GENERATE_CONVERT_LIST = + """ + public static dafny.DafnySequence KeyUsageTypes ( + java.util.List nativeValue + ) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.services.kms.internaldafny.ToDafny::KeyUsageType, + software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType._typeDescriptor() + ); + } + """; + protected static String GENERATE_CONVERT_LIST_STRUCTURES = + """ + public static dafny.DafnySequence OtherNamespaces ( + java.util.List nativeValue + ) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + Dafny.Com.Amazonaws.Other.ToDafny::OtherNamespace, + Dafny.Com.Amazonaws.Other.Types.OtherNamespace._typeDescriptor() + ); + } + """; + protected static String GENERATE_CONVERT_MAP_STRING = + """ + public static dafny.DafnyMap< + ? extends dafny.DafnySequence, + ? extends dafny.DafnySequence> + EncryptionContextType( + java.util.Map nativeValue + ) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToMap( + nativeValue, + software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence, + software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence + ); + } + """; + protected static String GENERATE_CONVERT_SET_STRING = + """ + public static dafny.DafnySet< + ? extends dafny.DafnySequence> + Names( + java.util.Set nativeValue + ) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSet( + nativeValue, + software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence + ); + } + """; - protected static final String KMS_A_STRING_OPERATION_JAVA_FILE = """ - package software.amazon.cryptography.services.kms.internaldafny; - - import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest; - import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse; - import software.amazon.cryptography.services.kms.internaldafny.types.Error; - import software.amazon.cryptography.services.kms.internaldafny.types.Error_DependencyTimeoutException; - import software.amazon.cryptography.services.kms.internaldafny.types.Error_Opaque; - import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; - import Wrappers_Compile.Option; - import com.amazonaws.services.kms.AWSKMS; - import com.amazonaws.services.kms.model.AWSKMSException; - import com.amazonaws.services.kms.model.DependencyTimeoutException; - import com.amazonaws.services.kms.model.DoSomethingResult; - import dafny.DafnySequence; - import java.lang.Character; - import java.util.Objects; - - public class ToDafny { - public static DoSomethingResponse DoSomethingResponse(DoSomethingResult nativeValue) { - Option> message; - message = Objects.nonNull(nativeValue.getMessage()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) - : Option.create_None(); - return new DoSomethingResponse(message); - } - - public static DoSomethingRequest DoSomethingRequest( - com.amazonaws.services.kms.model.DoSomethingRequest nativeValue) { - DafnySequence message; - message = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage()); - return new DoSomethingRequest(message); - } - - public static Error Error(DependencyTimeoutException nativeValue) { - Option> message; - message = Objects.nonNull(nativeValue.getMessage()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) - : Option.create_None(); - return new Error_DependencyTimeoutException(message); - } - - public static Error Error(AWSKMSException nativeValue) { - Option> message; - message = Objects.nonNull(nativeValue.getMessage()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) - : Option.create_None(); - return new Error_Opaque(message); - } - - public static IKeyManagementServiceClient KeyManagementService(AWSKMS nativeValue) { - return new Shim(nativeValue, null); - } - }"""; + protected static String GENERATE_CONVERT_OPAQUE_ERROR = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.Error Error( + com.amazonaws.services.kms.model.AWSKMSException nativeValue + ) { + Wrappers_Compile.Option> message; + message = java.util.Objects.nonNull(nativeValue.getMessage()) ? + Wrappers_Compile.Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) + : Wrappers_Compile.Option.create_None(); + return new software.amazon.cryptography.services.kms.internaldafny.types.Error_Opaque(message); + } + """; + + protected static final String KMS_A_STRING_OPERATION_JAVA_FILE = + """ + package software.amazon.cryptography.services.kms.internaldafny; + + import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest; + import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse; + import software.amazon.cryptography.services.kms.internaldafny.types.Error; + import software.amazon.cryptography.services.kms.internaldafny.types.Error_DependencyTimeoutException; + import software.amazon.cryptography.services.kms.internaldafny.types.Error_Opaque; + import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; + import Wrappers_Compile.Option; + import com.amazonaws.services.kms.AWSKMS; + import com.amazonaws.services.kms.model.AWSKMSException; + import com.amazonaws.services.kms.model.DependencyTimeoutException; + import com.amazonaws.services.kms.model.DoSomethingResult; + import dafny.DafnySequence; + import java.lang.Character; + import java.util.Objects; + + public class ToDafny { + public static DoSomethingResponse DoSomethingResponse(DoSomethingResult nativeValue) { + Option> message; + message = Objects.nonNull(nativeValue.getMessage()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) + : Option.create_None(); + return new DoSomethingResponse(message); + } + + public static DoSomethingRequest DoSomethingRequest( + com.amazonaws.services.kms.model.DoSomethingRequest nativeValue) { + DafnySequence message; + message = software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage()); + return new DoSomethingRequest(message); + } + + public static Error Error(DependencyTimeoutException nativeValue) { + Option> message; + message = Objects.nonNull(nativeValue.getMessage()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) + : Option.create_None(); + return new Error_DependencyTimeoutException(message); + } + + public static Error Error(AWSKMSException nativeValue) { + Option> message; + message = Objects.nonNull(nativeValue.getMessage()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) + : Option.create_None(); + return new Error_Opaque(message); + } + + public static IKeyManagementServiceClient KeyManagementService(AWSKMS nativeValue) { + return new Shim(nativeValue, null); + } + }"""; } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1Test.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1Test.java index a74ef86851..fbeda7c850 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1Test.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToDafnyAwsV1Test.java @@ -2,18 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v1; -import software.amazon.polymorph.utils.TokenTree; -import software.amazon.smithy.model.Model; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThrows; +import software.amazon.polymorph.utils.TokenTree; +import software.amazon.smithy.model.Model; + public class ToDafnyAwsV1Test { - protected ToDafnyAwsV1 underTest; - protected Model model; - /* @Before + protected ToDafnyAwsV1 underTest; + protected Model model; + /* @Before public void setup() { model = TestSetupUtils.setupTwoLocalModel(ModelConstants.KMS_KITCHEN, ModelConstants.OTHER_NAMESPACE); underTest = new ToDafnyAwsV1(TestSetupUtils.setupAwsSdkV1(model, "kms")); diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeConstants.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeConstants.java index 1253489603..f757b2236b 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeConstants.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeConstants.java @@ -3,120 +3,135 @@ package software.amazon.polymorph.smithyjava.generator.awssdk.v1; public class ToNativeConstants { - static String STRING_CONVERSION = "software.amazon.smithy.dafny.conversion.ToNative.Simple.String"; - static String KEY_USAGE_TYPE_CONVERSION = "software.amazon.cryptography.services.kms.internaldafny.ToNative.KeyUsageType"; - static String OTHER_NAMESPACE_CONVERSION = "Dafny.Com.Amazonaws.Other.ToNative.OtherNamespace"; - static String INIT_TEMP_ARRAY = "com.amazonaws.services.kms.model.KeyUsageType[] listEnum_temp = new com.amazonaws.services.kms.model.KeyUsageType[dafnyValue.dtor_listEnum().length()]"; - static String SET_WITH_CONVERSION_CALL = "converted.withCiphertext(software.amazon.smithy.dafny.conversion.ToNative.Simple.ByteBuffer(dafnyValue.dtor_ciphertext()))"; - static String SET_WITH_CONVERSION_CALL_AND_TO_ARRAY = "converted.withListEnum(software.amazon.cryptography.services.kms.internaldafny.ToNative.KeyUsageTypes(dafnyValue.dtor_listEnum()).toArray(listEnum_temp))"; - static String KEY_USAGE_TYPE = """ - public static com.amazonaws.services.kms.model.KeyUsageType KeyUsageType( - software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType dafnyValue - ) { - if (dafnyValue.is_SIGN__VERIFY()) { - return com.amazonaws.services.kms.model.KeyUsageType.SIGN_VERIFY; - } - if (dafnyValue.is_ENCRYPT__DECRYPT()) { - return com.amazonaws.services.kms.model.KeyUsageType.ENCRYPT_DECRYPT; - } - return com.amazonaws.services.kms.model.KeyUsageType.fromValue(dafnyValue.toString()); - }"""; - static String GENERATE_CONVERT_LIST = """ - public static java.util.List KeyUsageTypes( - dafny.DafnySequence dafnyValue - ) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.services.kms.internaldafny.ToNative::KeyUsageType); - } - """; - static String GENERATE_CONVERT_SET = """ - public static java.util.Set Names( - dafny.DafnySet> dafnyValue - ) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToSet( - dafnyValue, - software.amazon.smithy.dafny.conversion.ToNative.Simple::String); - } - """; - static String GENERATE_CONVERT_MAP = """ - public static java.util.Map EncryptionContextType( - dafny.DafnyMap< - ? extends dafny.DafnySequence, - ? extends dafny.DafnySequence - > dafnyValue - ) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToMap( - dafnyValue, - software.amazon.smithy.dafny.conversion.ToNative.Simple::String, - software.amazon.smithy.dafny.conversion.ToNative.Simple::String); - }"""; - static String SIMPLE_STRUCTURE = """ - public static com.amazonaws.services.kms.model.Simple Simple( - software.amazon.cryptography.services.kms.internaldafny.types.Simple dafnyValue - ) { - return new com.amazonaws.services.kms.model.Simple(); - } - """; - static String A_OPTIONAL_STRUCTURE = """ - public static com.amazonaws.services.kms.model.AOptional AOptional( - software.amazon.cryptography.services.kms.internaldafny.types.AOptional dafnyValue - ) { - com.amazonaws.services.kms.model.AOptional converted = new com.amazonaws.services.kms.model.AOptional(); - if (dafnyValue.dtor_message().is_Some()) { - converted.withMessage(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message().dtor_value())); - } - return converted; - } - """; - static String REQUIRED_LIST_ENUM_STRUCTURE = """ - public static com.amazonaws.services.kms.model.RequiredListEnum RequiredListEnum( - software.amazon.cryptography.services.kms.internaldafny.types.RequiredListEnum dafnyValue - ) { - com.amazonaws.services.kms.model.RequiredListEnum converted = new com.amazonaws.services.kms.model.RequiredListEnum(); - %s; - %s; - return converted; - } - """.formatted(INIT_TEMP_ARRAY, SET_WITH_CONVERSION_CALL_AND_TO_ARRAY); - static String KMS_A_STRING_OPERATION_JAVA_FILE = """ - package software.amazon.cryptography.services.kms.internaldafny; - - import software.amazon.cryptography.services.kms.internaldafny.types.Error_DependencyTimeoutException; - import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; - import com.amazonaws.services.kms.AWSKMS; - import com.amazonaws.services.kms.model.DependencyTimeoutException; - import com.amazonaws.services.kms.model.DoSomethingRequest; - import com.amazonaws.services.kms.model.DoSomethingResponse; - import com.amazonaws.services.kms.model.DoSomethingResult; - - public class ToNative { - public static DoSomethingResponse DoSomethingResponse(DoSomethingResult nativeValue) { - DoSomethingResponse.Builder nativeBuilder = DoSomethingResponse.builder(); - if (dafnyValue.dtor_message().is_Some()) { - converted.withMessage(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message().dtor_value())); - } - return nativeBuilder.build(); - } - - public static DoSomethingRequest DoSomethingRequest( - software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest dafnyValue) { - DoSomethingRequest converted = new DoSomethingRequest(); - converted.withMessage(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message())); - return converted; - } - - public static DependencyTimeoutException Error(Error_DependencyTimeoutException dafnyValue) { - DependencyTimeoutException converted = new DependencyTimeoutException(); - if (dafnyValue.dtor_message().is_Some()) { - converted.withMessage(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message().dtor_value())); - } - return converted; - } - - public static AWSKMS KeyManagementService(IKeyManagementServiceClient dafnyValue) { - return ((Shim) dafnyValue).impl(); - } - } - """; + + static String STRING_CONVERSION = + "software.amazon.smithy.dafny.conversion.ToNative.Simple.String"; + static String KEY_USAGE_TYPE_CONVERSION = + "software.amazon.cryptography.services.kms.internaldafny.ToNative.KeyUsageType"; + static String OTHER_NAMESPACE_CONVERSION = + "Dafny.Com.Amazonaws.Other.ToNative.OtherNamespace"; + static String INIT_TEMP_ARRAY = + "com.amazonaws.services.kms.model.KeyUsageType[] listEnum_temp = new com.amazonaws.services.kms.model.KeyUsageType[dafnyValue.dtor_listEnum().length()]"; + static String SET_WITH_CONVERSION_CALL = + "converted.withCiphertext(software.amazon.smithy.dafny.conversion.ToNative.Simple.ByteBuffer(dafnyValue.dtor_ciphertext()))"; + static String SET_WITH_CONVERSION_CALL_AND_TO_ARRAY = + "converted.withListEnum(software.amazon.cryptography.services.kms.internaldafny.ToNative.KeyUsageTypes(dafnyValue.dtor_listEnum()).toArray(listEnum_temp))"; + static String KEY_USAGE_TYPE = + """ + public static com.amazonaws.services.kms.model.KeyUsageType KeyUsageType( + software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType dafnyValue + ) { + if (dafnyValue.is_SIGN__VERIFY()) { + return com.amazonaws.services.kms.model.KeyUsageType.SIGN_VERIFY; + } + if (dafnyValue.is_ENCRYPT__DECRYPT()) { + return com.amazonaws.services.kms.model.KeyUsageType.ENCRYPT_DECRYPT; + } + return com.amazonaws.services.kms.model.KeyUsageType.fromValue(dafnyValue.toString()); + }"""; + static String GENERATE_CONVERT_LIST = + """ + public static java.util.List KeyUsageTypes( + dafny.DafnySequence dafnyValue + ) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.services.kms.internaldafny.ToNative::KeyUsageType); + } + """; + static String GENERATE_CONVERT_SET = + """ + public static java.util.Set Names( + dafny.DafnySet> dafnyValue + ) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToSet( + dafnyValue, + software.amazon.smithy.dafny.conversion.ToNative.Simple::String); + } + """; + static String GENERATE_CONVERT_MAP = + """ + public static java.util.Map EncryptionContextType( + dafny.DafnyMap< + ? extends dafny.DafnySequence, + ? extends dafny.DafnySequence + > dafnyValue + ) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToMap( + dafnyValue, + software.amazon.smithy.dafny.conversion.ToNative.Simple::String, + software.amazon.smithy.dafny.conversion.ToNative.Simple::String); + }"""; + static String SIMPLE_STRUCTURE = + """ + public static com.amazonaws.services.kms.model.Simple Simple( + software.amazon.cryptography.services.kms.internaldafny.types.Simple dafnyValue + ) { + return new com.amazonaws.services.kms.model.Simple(); + } + """; + static String A_OPTIONAL_STRUCTURE = + """ + public static com.amazonaws.services.kms.model.AOptional AOptional( + software.amazon.cryptography.services.kms.internaldafny.types.AOptional dafnyValue + ) { + com.amazonaws.services.kms.model.AOptional converted = new com.amazonaws.services.kms.model.AOptional(); + if (dafnyValue.dtor_message().is_Some()) { + converted.withMessage(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message().dtor_value())); + } + return converted; + } + """; + static String REQUIRED_LIST_ENUM_STRUCTURE = + """ + public static com.amazonaws.services.kms.model.RequiredListEnum RequiredListEnum( + software.amazon.cryptography.services.kms.internaldafny.types.RequiredListEnum dafnyValue + ) { + com.amazonaws.services.kms.model.RequiredListEnum converted = new com.amazonaws.services.kms.model.RequiredListEnum(); + %s; + %s; + return converted; + } + """.formatted(INIT_TEMP_ARRAY, SET_WITH_CONVERSION_CALL_AND_TO_ARRAY); + static String KMS_A_STRING_OPERATION_JAVA_FILE = + """ + package software.amazon.cryptography.services.kms.internaldafny; + + import software.amazon.cryptography.services.kms.internaldafny.types.Error_DependencyTimeoutException; + import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; + import com.amazonaws.services.kms.AWSKMS; + import com.amazonaws.services.kms.model.DependencyTimeoutException; + import com.amazonaws.services.kms.model.DoSomethingRequest; + import com.amazonaws.services.kms.model.DoSomethingResponse; + import com.amazonaws.services.kms.model.DoSomethingResult; + + public class ToNative { + public static DoSomethingResponse DoSomethingResponse(DoSomethingResult nativeValue) { + DoSomethingResponse.Builder nativeBuilder = DoSomethingResponse.builder(); + if (dafnyValue.dtor_message().is_Some()) { + converted.withMessage(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message().dtor_value())); + } + return nativeBuilder.build(); + } + + public static DoSomethingRequest DoSomethingRequest( + software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest dafnyValue) { + DoSomethingRequest converted = new DoSomethingRequest(); + converted.withMessage(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message())); + return converted; + } + + public static DependencyTimeoutException Error(Error_DependencyTimeoutException dafnyValue) { + DependencyTimeoutException converted = new DependencyTimeoutException(); + if (dafnyValue.dtor_message().is_Some()) { + converted.withMessage(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message().dtor_value())); + } + return converted; + } + + public static AWSKMS KeyManagementService(IKeyManagementServiceClient dafnyValue) { + return ((Shim) dafnyValue).impl(); + } + } + """; } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeTest.java index 2d2052b313..bf16d68b2d 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v1/ToNativeTest.java @@ -2,12 +2,14 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v1; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; + import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; - import java.util.Set; - import software.amazon.polymorph.smithyjava.MethodReference; import software.amazon.polymorph.smithyjava.nameresolver.Dafny; import software.amazon.polymorph.utils.TokenTree; @@ -18,70 +20,73 @@ import software.amazon.smithy.model.shapes.SetShape; import software.amazon.smithy.model.shapes.Shape; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThrows; - @SuppressWarnings("OptionalGetWithoutIsPresent") public class ToNativeTest { - // Why two underTests? - // As we refactor ToNativeAwsV1 and abstract ToNative, - // we are going to bump into permission issues in unit tests - // for protected methods. - // ToNativeTestImpl exposes the abstract classes protected methods - // to this test class, - // b/c ToNativeTestImpl is defined INSIDE the test class. - // But we still need to test the yet to be refactored logic. - // TODO: Clean up this test class by creating test class for ToNativeAwsV1 - // and moving AwsV1 specific tests there. - protected ToNativeAwsV1 underTest; - protected ToNativeTestImpl underTestAbstract; - protected Model model; - - class ToNativeTestImpl extends ToNativeAwsV1 { - - public ToNativeTestImpl(JavaAwsSdkV1 awsSdk) { - super(awsSdk); - } - - @Override - public Set javaFiles() { - return null; - } - - @Override - // This allows the test class to call the otherwise protected method. - protected MethodSpec modeledList(ListShape shape) { - return super.modeledList(shape); - } - - @Override - // This allows the test class to call the otherwise protected method. - protected MethodSpec modeledSet(SetShape shape) { - return super.modeledSet(shape); - } - - @Override - // This allows the test class to call the otherwise protected method. - protected MethodSpec modeledMap(MapShape shape) { return super.modeledMap(shape);} - - @Override - // This allows the test class to call the otherwise protected method. - protected MethodReference conversionMethodReference(Shape shape) { - if (shape.isMemberShape()) { - return conversionMethodReference(model.expectShape(shape.asMemberShape().get().getTarget())); - } - return super.conversionMethodReference(shape); - } - - @Override - // This allows the test class to call the otherwise protected method. - protected CodeBlock setWithConversionCall(MemberShape member, CodeBlock getMember) { - return super.setWithConversionCall(member, getMember); - } - } - - /*@Before + + // Why two underTests? + // As we refactor ToNativeAwsV1 and abstract ToNative, + // we are going to bump into permission issues in unit tests + // for protected methods. + // ToNativeTestImpl exposes the abstract classes protected methods + // to this test class, + // b/c ToNativeTestImpl is defined INSIDE the test class. + // But we still need to test the yet to be refactored logic. + // TODO: Clean up this test class by creating test class for ToNativeAwsV1 + // and moving AwsV1 specific tests there. + protected ToNativeAwsV1 underTest; + protected ToNativeTestImpl underTestAbstract; + protected Model model; + + class ToNativeTestImpl extends ToNativeAwsV1 { + + public ToNativeTestImpl(JavaAwsSdkV1 awsSdk) { + super(awsSdk); + } + + @Override + public Set javaFiles() { + return null; + } + + @Override + // This allows the test class to call the otherwise protected method. + protected MethodSpec modeledList(ListShape shape) { + return super.modeledList(shape); + } + + @Override + // This allows the test class to call the otherwise protected method. + protected MethodSpec modeledSet(SetShape shape) { + return super.modeledSet(shape); + } + + @Override + // This allows the test class to call the otherwise protected method. + protected MethodSpec modeledMap(MapShape shape) { + return super.modeledMap(shape); + } + + @Override + // This allows the test class to call the otherwise protected method. + protected MethodReference conversionMethodReference(Shape shape) { + if (shape.isMemberShape()) { + return conversionMethodReference( + model.expectShape(shape.asMemberShape().get().getTarget()) + ); + } + return super.conversionMethodReference(shape); + } + + @Override + // This allows the test class to call the otherwise protected method. + protected CodeBlock setWithConversionCall( + MemberShape member, + CodeBlock getMember + ) { + return super.setWithConversionCall(member, getMember); + } + } + /*@Before public void setup() { model = TestSetupUtils.setupTwoLocalModel(ModelConstants.KMS_KITCHEN, ModelConstants.OTHER_NAMESPACE); underTest = new ToNativeAwsV1(TestSetupUtils.setupAwsSdkV1(model, "kms")); diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/Constants.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/Constants.java index b960c5e4f0..f9aaf43151 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/Constants.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/Constants.java @@ -6,166 +6,179 @@ import software.amazon.polymorph.smithyjava.nameresolver.Dafny; public class Constants { - static String DoSomethingOperation = """ - @Override - public Result DoSomething(DoSomethingRequest input) { - software.amazon.awssdk.services.kms.model.DoSomethingRequest converted = ToNative.DoSomethingRequest(input); - try { - software.amazon.awssdk.services.kms.model.DoSomethingResponse result = _impl.doSomething(converted); - DoSomethingResponse dafnyResponse = ToDafny.DoSomethingResponse(result); - return Result.create_Success(dafnyResponse); - } catch (DependencyTimeoutException ex) { - return Result.create_Failure(ToDafny.Error(ex)); - } catch (KmsException ex) { - return Result.create_Failure(ToDafny.Error(ex)); - } catch (Exception ex) { - return Result.create_Failure(Error.create_Opaque(ex.toString())); - } - } - """; - - static String DoSomethingOperationWithTypeDescriptors = """ - @Override - public Result DoSomething(DoSomethingRequest input) { - software.amazon.awssdk.services.kms.model.DoSomethingRequest converted = ToNative.DoSomethingRequest(input); - try { - software.amazon.awssdk.services.kms.model.DoSomethingResponse result = _impl.doSomething(converted); - DoSomethingResponse dafnyResponse = ToDafny.DoSomethingResponse(result); - return Result.create_Success(DoSomethingResponse._typeDescriptor(), Error._typeDescriptor(), dafnyResponse); - } catch (DependencyTimeoutException ex) { - return Result.create_Failure(DoSomethingResponse._typeDescriptor(), Error._typeDescriptor(), ToDafny.Error(ex)); - } catch (KmsException ex) { - return Result.create_Failure(DoSomethingResponse._typeDescriptor(), Error._typeDescriptor(), ToDafny.Error(ex)); - } catch (Exception ex) { - return Result.create_Failure(DoSomethingResponse._typeDescriptor(), Error._typeDescriptor(), Error.create_Opaque(ex.toString())); - } - } - """; - - static String DoSomethingOperation(DafnyVersion dafnyVersion) { - return Dafny.datatypeConstructorsNeedTypeDescriptors(dafnyVersion) ? - DoSomethingOperationWithTypeDescriptors : DoSomethingOperation; - } - static String DoVoidOperation = """ - @Override - public Result DoVoid(DoVoidRequest input) { - software.amazon.awssdk.services.kms.model.DoVoidRequest converted = ToNative.DoVoidRequest(input); - try { - _impl.doVoid(converted); - return Result.create_Success(Tuple0.create()); - } catch (DependencyTimeoutException ex) { - return Result.create_Failure(ToDafny.Error(ex)); - } catch (KmsException ex) { - return Result.create_Failure(ToDafny.Error(ex)); - } catch (Exception ex) { - return Result.create_Failure(Error.create_Opaque(ex.toString())); - } - } - """; - - static String DoVoidOperationWithTypeDescriptors = """ - @Override - public Result DoVoid(DoVoidRequest input) { - software.amazon.awssdk.services.kms.model.DoVoidRequest converted = ToNative.DoVoidRequest(input); - try { - _impl.doVoid(converted); - return Result.create_Success(dafny.Tuple0._typeDescriptor(), Error._typeDescriptor(), Tuple0.create()); - } catch (DependencyTimeoutException ex) { - return Result.create_Failure(dafny.Tuple0._typeDescriptor(), Error._typeDescriptor(), ToDafny.Error(ex)); - } catch (KmsException ex) { - return Result.create_Failure(dafny.Tuple0._typeDescriptor(), Error._typeDescriptor(), ToDafny.Error(ex)); - } catch (Exception ex) { - return Result.create_Failure(dafny.Tuple0._typeDescriptor(), Error._typeDescriptor(), Error.create_Opaque(ex.toString())); - } - } - """; - - static String DoVoidOperation(DafnyVersion dafnyVersion) { - return Dafny.datatypeConstructorsNeedTypeDescriptors(dafnyVersion) ? - DoVoidOperationWithTypeDescriptors : DoVoidOperation; + static String DoSomethingOperation = + """ + @Override + public Result DoSomething(DoSomethingRequest input) { + software.amazon.awssdk.services.kms.model.DoSomethingRequest converted = ToNative.DoSomethingRequest(input); + try { + software.amazon.awssdk.services.kms.model.DoSomethingResponse result = _impl.doSomething(converted); + DoSomethingResponse dafnyResponse = ToDafny.DoSomethingResponse(result); + return Result.create_Success(dafnyResponse); + } catch (DependencyTimeoutException ex) { + return Result.create_Failure(ToDafny.Error(ex)); + } catch (KmsException ex) { + return Result.create_Failure(ToDafny.Error(ex)); + } catch (Exception ex) { + return Result.create_Failure(Error.create_Opaque(ex.toString())); + } + } + """; + + static String DoSomethingOperationWithTypeDescriptors = + """ + @Override + public Result DoSomething(DoSomethingRequest input) { + software.amazon.awssdk.services.kms.model.DoSomethingRequest converted = ToNative.DoSomethingRequest(input); + try { + software.amazon.awssdk.services.kms.model.DoSomethingResponse result = _impl.doSomething(converted); + DoSomethingResponse dafnyResponse = ToDafny.DoSomethingResponse(result); + return Result.create_Success(DoSomethingResponse._typeDescriptor(), Error._typeDescriptor(), dafnyResponse); + } catch (DependencyTimeoutException ex) { + return Result.create_Failure(DoSomethingResponse._typeDescriptor(), Error._typeDescriptor(), ToDafny.Error(ex)); + } catch (KmsException ex) { + return Result.create_Failure(DoSomethingResponse._typeDescriptor(), Error._typeDescriptor(), ToDafny.Error(ex)); + } catch (Exception ex) { + return Result.create_Failure(DoSomethingResponse._typeDescriptor(), Error._typeDescriptor(), Error.create_Opaque(ex.toString())); + } + } + """; + + static String DoSomethingOperation(DafnyVersion dafnyVersion) { + return Dafny.datatypeConstructorsNeedTypeDescriptors(dafnyVersion) + ? DoSomethingOperationWithTypeDescriptors + : DoSomethingOperation; + } + + static String DoVoidOperation = + """ + @Override + public Result DoVoid(DoVoidRequest input) { + software.amazon.awssdk.services.kms.model.DoVoidRequest converted = ToNative.DoVoidRequest(input); + try { + _impl.doVoid(converted); + return Result.create_Success(Tuple0.create()); + } catch (DependencyTimeoutException ex) { + return Result.create_Failure(ToDafny.Error(ex)); + } catch (KmsException ex) { + return Result.create_Failure(ToDafny.Error(ex)); + } catch (Exception ex) { + return Result.create_Failure(Error.create_Opaque(ex.toString())); + } + } + """; + + static String DoVoidOperationWithTypeDescriptors = + """ + @Override + public Result DoVoid(DoVoidRequest input) { + software.amazon.awssdk.services.kms.model.DoVoidRequest converted = ToNative.DoVoidRequest(input); + try { + _impl.doVoid(converted); + return Result.create_Success(dafny.Tuple0._typeDescriptor(), Error._typeDescriptor(), Tuple0.create()); + } catch (DependencyTimeoutException ex) { + return Result.create_Failure(dafny.Tuple0._typeDescriptor(), Error._typeDescriptor(), ToDafny.Error(ex)); + } catch (KmsException ex) { + return Result.create_Failure(dafny.Tuple0._typeDescriptor(), Error._typeDescriptor(), ToDafny.Error(ex)); + } catch (Exception ex) { + return Result.create_Failure(dafny.Tuple0._typeDescriptor(), Error._typeDescriptor(), Error.create_Opaque(ex.toString())); + } + } + """; + + static String DoVoidOperation(DafnyVersion dafnyVersion) { + return Dafny.datatypeConstructorsNeedTypeDescriptors(dafnyVersion) + ? DoVoidOperationWithTypeDescriptors + : DoVoidOperation; + } + + static String MockKmsShim = + """ + package software.amazon.cryptography.services.kms.internaldafny; + + import Wrappers_Compile.Result; + import dafny.Tuple0; + import java.lang.Override; + import java.lang.String; + import software.amazon.awssdk.services.kms.KmsClient; + import software.amazon.awssdk.services.kms.model.DependencyTimeoutException; + import software.amazon.awssdk.services.kms.model.KmsException; + import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest; + import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse; + import software.amazon.cryptography.services.kms.internaldafny.types.DoVoidRequest; + import software.amazon.cryptography.services.kms.internaldafny.types.Error; + import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; + + public class Shim implements IKeyManagementServiceClient { + private final KmsClient _impl; + + private final String region; + + public Shim(final KmsClient impl, final String region) { + this._impl = impl; + this.region = region; + } + + public KmsClient impl() { + return this._impl; + } + + public String region() { + return this.region; + } + + %s + %s } + """.formatted(DoSomethingOperation, DoVoidOperation); + + static String MockKmsShimWithTypeDescriptors = + """ + package software.amazon.cryptography.services.kms.internaldafny; + + import Wrappers_Compile.Result; + import dafny.Tuple0; + import java.lang.Override; + import java.lang.String; + import software.amazon.awssdk.services.kms.KmsClient; + import software.amazon.awssdk.services.kms.model.DependencyTimeoutException; + import software.amazon.awssdk.services.kms.model.KmsException; + import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest; + import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse; + import software.amazon.cryptography.services.kms.internaldafny.types.DoVoidRequest; + import software.amazon.cryptography.services.kms.internaldafny.types.Error; + import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; + + public class Shim implements IKeyManagementServiceClient { + private final KmsClient _impl; - static String MockKmsShim = """ - package software.amazon.cryptography.services.kms.internaldafny; - - import Wrappers_Compile.Result; - import dafny.Tuple0; - import java.lang.Override; - import java.lang.String; - import software.amazon.awssdk.services.kms.KmsClient; - import software.amazon.awssdk.services.kms.model.DependencyTimeoutException; - import software.amazon.awssdk.services.kms.model.KmsException; - import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest; - import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse; - import software.amazon.cryptography.services.kms.internaldafny.types.DoVoidRequest; - import software.amazon.cryptography.services.kms.internaldafny.types.Error; - import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; - - public class Shim implements IKeyManagementServiceClient { - private final KmsClient _impl; - - private final String region; - - public Shim(final KmsClient impl, final String region) { - this._impl = impl; - this.region = region; - } - - public KmsClient impl() { - return this._impl; - } - - public String region() { - return this.region; - } - - %s - %s - } - """.formatted(DoSomethingOperation, DoVoidOperation); - - static String MockKmsShimWithTypeDescriptors = """ - package software.amazon.cryptography.services.kms.internaldafny; - - import Wrappers_Compile.Result; - import dafny.Tuple0; - import java.lang.Override; - import java.lang.String; - import software.amazon.awssdk.services.kms.KmsClient; - import software.amazon.awssdk.services.kms.model.DependencyTimeoutException; - import software.amazon.awssdk.services.kms.model.KmsException; - import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest; - import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse; - import software.amazon.cryptography.services.kms.internaldafny.types.DoVoidRequest; - import software.amazon.cryptography.services.kms.internaldafny.types.Error; - import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; - - public class Shim implements IKeyManagementServiceClient { - private final KmsClient _impl; - - private final String region; - - public Shim(final KmsClient impl, final String region) { - this._impl = impl; - this.region = region; - } - - public KmsClient impl() { - return this._impl; - } - - public String region() { - return this.region; - } - - %s - %s - } - """.formatted(DoSomethingOperationWithTypeDescriptors, DoVoidOperationWithTypeDescriptors); - - static String MockKmsShim(DafnyVersion dafnyVersion) { - return Dafny.datatypeConstructorsNeedTypeDescriptors(dafnyVersion) ? - MockKmsShimWithTypeDescriptors : MockKmsShim; + private final String region; + + public Shim(final KmsClient impl, final String region) { + this._impl = impl; + this.region = region; + } + + public KmsClient impl() { + return this._impl; + } + + public String region() { + return this.region; + } + + %s + %s } + """.formatted( + DoSomethingOperationWithTypeDescriptors, + DoVoidOperationWithTypeDescriptors + ); + + static String MockKmsShim(DafnyVersion dafnyVersion) { + return Dafny.datatypeConstructorsNeedTypeDescriptors(dafnyVersion) + ? MockKmsShimWithTypeDescriptors + : MockKmsShim; + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ShimTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ShimTest.java index e5185f10af..1f9c2fe230 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ShimTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ShimTest.java @@ -2,18 +2,20 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v2; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static software.amazon.polymorph.smithyjava.generator.awssdk.v2.Constants.DoSomethingOperation; +import static software.amazon.polymorph.smithyjava.generator.awssdk.v2.Constants.DoVoidOperation; +import static software.amazon.polymorph.smithyjava.generator.awssdk.v2.Constants.MockKmsShim; + import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.TypeSpec; - -import org.junit.Before; -import org.junit.Test; - import java.nio.file.Path; import java.util.Map; - import javax.lang.model.element.Modifier; - +import org.junit.Before; +import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import software.amazon.polymorph.smithydafny.DafnyVersion; @@ -25,104 +27,91 @@ import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.ShapeId; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static software.amazon.polymorph.smithyjava.generator.awssdk.v2.Constants.DoSomethingOperation; -import static software.amazon.polymorph.smithyjava.generator.awssdk.v2.Constants.DoVoidOperation; -import static software.amazon.polymorph.smithyjava.generator.awssdk.v2.Constants.MockKmsShim; - public class ShimTest extends ForEachDafnyTest { - protected ShimV2 underTest; - protected Model model; - protected JavaAwsSdkV2 subject; - protected final DafnyVersion dafnyVersion; - public ShimTest(DafnyVersion dafnyVersion) { - this.dafnyVersion = dafnyVersion; - model = TestSetupUtils.setupLocalModel(ModelConstants.MOCK_KMS); - subject = TestSetupUtils.setupAwsSdkV2(model, "kms", dafnyVersion); - underTest = new ShimV2(subject); - } + protected ShimV2 underTest; + protected Model model; + protected JavaAwsSdkV2 subject; + protected final DafnyVersion dafnyVersion; + + public ShimTest(DafnyVersion dafnyVersion) { + this.dafnyVersion = dafnyVersion; + model = TestSetupUtils.setupLocalModel(ModelConstants.MOCK_KMS); + subject = TestSetupUtils.setupAwsSdkV2(model, "kms", dafnyVersion); + underTest = new ShimV2(subject); + } - @Test - public void operation() { - final MethodSpec actual = underTest.operation( - ShapeId.fromParts("com.amazonaws.kms", "DoSomething") - ).orElseThrow(AssertionError::new); - // By wrapping the actual method spec with a - // TypeSpec and JavaFile, - // Javapoet does not fully qualify every type name. - // Which is nice. - TypeSpec shim = TypeSpec.classBuilder("Shim") - .addModifiers(Modifier.PUBLIC, Modifier.FINAL) - .addMethod(actual) - .build(); + @Test + public void operation() { + final MethodSpec actual = underTest + .operation(ShapeId.fromParts("com.amazonaws.kms", "DoSomething")) + .orElseThrow(AssertionError::new); + // By wrapping the actual method spec with a + // TypeSpec and JavaFile, + // Javapoet does not fully qualify every type name. + // Which is nice. + TypeSpec shim = TypeSpec + .classBuilder("Shim") + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + .addMethod(actual) + .build(); - JavaFile javaFile = JavaFile - .builder( - subject.packageName, - shim) - .build(); - final String actualString = javaFile.toString(); - assertTrue( - (""" - Expected actual to contain excepted. - Actual: - %s + JavaFile javaFile = JavaFile.builder(subject.packageName, shim).build(); + final String actualString = javaFile.toString(); + assertTrue( + (""" + Expected actual to contain excepted. + Actual: + %s - Expected: - %s""").formatted( - actualString, DoSomethingOperation(dafnyVersion) - ), - actualString.contains(DoSomethingOperation(dafnyVersion)) - ); - } + Expected: + %s""").formatted(actualString, DoSomethingOperation(dafnyVersion)), + actualString.contains(DoSomethingOperation(dafnyVersion)) + ); + } - @Test - public void operationVoid() { - final MethodSpec actual = underTest.operation( - ShapeId.fromParts("com.amazonaws.kms", "DoVoid") - ).orElseThrow(AssertionError::new); - // By wrapping the actual method spec with a - // TypeSpec and JavaFile, - // Javapoet does not fully qualify every type name. - // Which is nice. - TypeSpec shim = TypeSpec.classBuilder("Shim") - .addModifiers(Modifier.PUBLIC, Modifier.FINAL) - .addMethod(actual) - .build(); + @Test + public void operationVoid() { + final MethodSpec actual = underTest + .operation(ShapeId.fromParts("com.amazonaws.kms", "DoVoid")) + .orElseThrow(AssertionError::new); + // By wrapping the actual method spec with a + // TypeSpec and JavaFile, + // Javapoet does not fully qualify every type name. + // Which is nice. + TypeSpec shim = TypeSpec + .classBuilder("Shim") + .addModifiers(Modifier.PUBLIC, Modifier.FINAL) + .addMethod(actual) + .build(); - JavaFile javaFile = JavaFile - .builder( - subject.packageName, - shim) - .build(); - final String actualString = javaFile.toString(); - assertTrue( - (""" - Expected actual to contain excepted. - Actual: - %s + JavaFile javaFile = JavaFile.builder(subject.packageName, shim).build(); + final String actualString = javaFile.toString(); + assertTrue( + (""" + Expected actual to contain excepted. + Actual: + %s - Expected: - %s""").formatted( - actualString, DoVoidOperation(dafnyVersion) - ), - actualString.contains(DoVoidOperation(dafnyVersion)) - ); - } + Expected: + %s""").formatted(actualString, DoVoidOperation(dafnyVersion)), + actualString.contains(DoVoidOperation(dafnyVersion)) + ); + } - @Test - public void generate() { - final Map actual = underTest.generate(); - // TODO: refactor so that Shim is written as - // com.amazonaws.encryptionsdk.kms.Shim.java - final Path expectedPath = Path.of("software/amazon/cryptography/services/kms/internaldafny/Shim.java"); - Path[] temp = new Path[1]; - final Path actualPath = actual.keySet().toArray(temp)[0]; - assertEquals(expectedPath, actualPath); - final String actualSource = actual.get(actualPath).toString(); - final String mockKmsShim = MockKmsShim(dafnyVersion); - Tokenizer.tokenizeAndAssertEqual(mockKmsShim, actualSource); - } + @Test + public void generate() { + final Map actual = underTest.generate(); + // TODO: refactor so that Shim is written as + // com.amazonaws.encryptionsdk.kms.Shim.java + final Path expectedPath = Path.of( + "software/amazon/cryptography/services/kms/internaldafny/Shim.java" + ); + Path[] temp = new Path[1]; + final Path actualPath = actual.keySet().toArray(temp)[0]; + assertEquals(expectedPath, actualPath); + final String actualSource = actual.get(actualPath).toString(); + final String mockKmsShim = MockKmsShim(dafnyVersion); + Tokenizer.tokenizeAndAssertEqual(mockKmsShim, actualSource); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2Constants.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2Constants.java index 8fcc67b2d7..c56706b1d1 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2Constants.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2Constants.java @@ -6,157 +6,169 @@ import static software.amazon.polymorph.smithyjava.generator.ToDafnyConstants.MEMBER_DECLARATION_OPTIONAL; public class ToDafnyAwsV2Constants { - protected static String DO_SOMETHING_RESPONSE = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse DoSomethingResponse( - software.amazon.awssdk.services.kms.model.DoSomethingResponse nativeValue) { - %s; - %s; - return new software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse(message); - } - """.formatted(MEMBER_DECLARATION_OPTIONAL, MEMBER_ASSIGNMENT_OPTIONAL); - protected static String KEY_USAGE_TYPE = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType KeyUsageType( - software.amazon.awssdk.services.kms.model.KeyUsageType nativeValue - ) { - switch (nativeValue) { - case SIGN_VERIFY: { - return software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType.create_SIGN__VERIFY(); - } - case ENCRYPT_DECRYPT: { - return software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType.create_ENCRYPT__DECRYPT(); - } - default: { - throw new java.lang.RuntimeException("Cannot convert " + nativeValue + " to software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType."); - } - } - } - """; + protected static String DO_SOMETHING_RESPONSE = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse DoSomethingResponse( + software.amazon.awssdk.services.kms.model.DoSomethingResponse nativeValue) { + %s; + %s; + return new software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse(message); + } + """.formatted(MEMBER_DECLARATION_OPTIONAL, MEMBER_ASSIGNMENT_OPTIONAL); - protected static String KEY_USAGE_TYPE_STRING = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType KeyUsageType( - java.lang.String nativeValue - ) { - return KeyUsageType(software.amazon.awssdk.services.kms.model.KeyUsageType.fromValue(nativeValue)); - }"""; + protected static String KEY_USAGE_TYPE = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType KeyUsageType( + software.amazon.awssdk.services.kms.model.KeyUsageType nativeValue + ) { + switch (nativeValue) { + case SIGN_VERIFY: { + return software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType.create_SIGN__VERIFY(); + } + case ENCRYPT_DECRYPT: { + return software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType.create_ENCRYPT__DECRYPT(); + } + default: { + throw new java.lang.RuntimeException("Cannot convert " + nativeValue + " to software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType."); + } + } + } + """; - protected static String GENERATE_CONVERT_LIST = """ - public static dafny.DafnySequence KeyUsageTypes ( - java.util.List nativeValue - ) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.services.kms.internaldafny.ToDafny::KeyUsageType, - software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType._typeDescriptor() - ); - } - """; - protected static String GENERATE_CONVERT_LIST_STRUCTURES = """ - public static dafny.DafnySequence OtherNamespaces ( - java.util.List nativeValue - ) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( - nativeValue, - software.amazon.cryptography.services.other.internaldafny.ToDafny::OtherNamespace, - software.amazon.cryptography.services.other.internaldafny.types.OtherNamespace._typeDescriptor() - ); - } - """; - protected static String GENERATE_CONVERT_MAP_STRING = """ - public static dafny.DafnyMap< - ? extends dafny.DafnySequence, - ? extends dafny.DafnySequence> - EncryptionContextType( - java.util.Map nativeValue - ) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToMap( - nativeValue, - software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence, - software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence - ); - } - """; - protected static String GENERATE_CONVERT_SET_STRING = """ - public static dafny.DafnySet< - ? extends dafny.DafnySequence> - Names( - java.util.Set nativeValue - ) { - return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSet( - nativeValue, - software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence - ); - } - """; + protected static String KEY_USAGE_TYPE_STRING = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType KeyUsageType( + java.lang.String nativeValue + ) { + return KeyUsageType(software.amazon.awssdk.services.kms.model.KeyUsageType.fromValue(nativeValue)); + }"""; - public static String SIMPLE_STRUCTURE = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.Simple Simple( - software.amazon.awssdk.services.kms.model.Simple nativeValue) { - return new software.amazon.cryptography.services.kms.internaldafny.types.Simple(); - } - """; + protected static String GENERATE_CONVERT_LIST = + """ + public static dafny.DafnySequence KeyUsageTypes ( + java.util.List nativeValue + ) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.services.kms.internaldafny.ToDafny::KeyUsageType, + software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType._typeDescriptor() + ); + } + """; + protected static String GENERATE_CONVERT_LIST_STRUCTURES = + """ + public static dafny.DafnySequence OtherNamespaces ( + java.util.List nativeValue + ) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSequence( + nativeValue, + software.amazon.cryptography.services.other.internaldafny.ToDafny::OtherNamespace, + software.amazon.cryptography.services.other.internaldafny.types.OtherNamespace._typeDescriptor() + ); + } + """; + protected static String GENERATE_CONVERT_MAP_STRING = + """ + public static dafny.DafnyMap< + ? extends dafny.DafnySequence, + ? extends dafny.DafnySequence> + EncryptionContextType( + java.util.Map nativeValue + ) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToMap( + nativeValue, + software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence, + software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence + ); + } + """; + protected static String GENERATE_CONVERT_SET_STRING = + """ + public static dafny.DafnySet< + ? extends dafny.DafnySequence> + Names( + java.util.Set nativeValue + ) { + return software.amazon.smithy.dafny.conversion.ToDafny.Aggregate.GenericToSet( + nativeValue, + software.amazon.smithy.dafny.conversion.ToDafny.Simple::CharacterSequence + ); + } + """; - protected static String GENERATE_CONVERT_OPAQUE_ERROR = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.Error Error( - software.amazon.awssdk.services.kms.model.KmsException nativeValue - ) { - Wrappers_Compile.Option> message; - message = java.util.Objects.nonNull(nativeValue.getMessage()) ? - Wrappers_Compile.Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) - : Wrappers_Compile.Option.create_None(); - return new software.amazon.cryptography.services.kms.internaldafny.types.Error_Opaque(message); - } - """; + public static String SIMPLE_STRUCTURE = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.Simple Simple( + software.amazon.awssdk.services.kms.model.Simple nativeValue) { + return new software.amazon.cryptography.services.kms.internaldafny.types.Simple(); + } + """; - protected static String GENERATE_CONVERT_OPAQUE_ERROR_WITH_TYPE_DESCRIPTORS = """ - public static software.amazon.cryptography.services.kms.internaldafny.types.Error Error( - software.amazon.awssdk.services.kms.model.KmsException nativeValue - ) { - Wrappers_Compile.Option> message; - message = java.util.Objects.nonNull(nativeValue.getMessage()) ? - Wrappers_Compile.Option.create_Some(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) - : Wrappers_Compile.Option.create_None(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR)); - return new software.amazon.cryptography.services.kms.internaldafny.types.Error_Opaque(message); - } - """; + protected static String GENERATE_CONVERT_OPAQUE_ERROR = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.Error Error( + software.amazon.awssdk.services.kms.model.KmsException nativeValue + ) { + Wrappers_Compile.Option> message; + message = java.util.Objects.nonNull(nativeValue.getMessage()) ? + Wrappers_Compile.Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) + : Wrappers_Compile.Option.create_None(); + return new software.amazon.cryptography.services.kms.internaldafny.types.Error_Opaque(message); + } + """; - protected static final String KMS_A_STRING_OPERATION_JAVA_FILE = """ - package software.amazon.cryptography.services.kms.internaldafny; - - import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse; - import software.amazon.cryptography.services.kms.internaldafny.types.Error; - import software.amazon.cryptography.services.kms.internaldafny.types.Error_DependencyTimeoutException; - import software.amazon.cryptography.services.kms.internaldafny.types.Error_Opaque; - import Wrappers_Compile.Option; - import dafny.DafnySequence; - import java.lang.Character; - import java.util.Objects; - import software.amazon.awssdk.services.kms.model.KmsException; - import software.amazon.awssdk.services.kms.model.DependencyTimeoutException; - - public class ToDafny { - public static DoSomethingResponse DoSomethingResponse(DoSomethingResponse nativeValue) { - Option> message; - message = Objects.nonNull(nativeValue.getMessage()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) - : Option.create_None(); - return new DoSomethingResponse(message); - } - - public static Error Error(DependencyTimeoutException nativeValue) { - Option> message; - message = Objects.nonNull(nativeValue.getMessage()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) - : Option.create_None(); - return new Error_DependencyTimeoutException(message); - } - - public static Error Error(KmsException nativeValue) { - Option> message; - message = Objects.nonNull(nativeValue.getMessage()) ? - Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) - : Option.create_None(); - return new Error_Opaque(message); - } - }"""; + protected static String GENERATE_CONVERT_OPAQUE_ERROR_WITH_TYPE_DESCRIPTORS = + """ + public static software.amazon.cryptography.services.kms.internaldafny.types.Error Error( + software.amazon.awssdk.services.kms.model.KmsException nativeValue + ) { + Wrappers_Compile.Option> message; + message = java.util.Objects.nonNull(nativeValue.getMessage()) ? + Wrappers_Compile.Option.create_Some(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR), software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) + : Wrappers_Compile.Option.create_None(dafny.DafnySequence._typeDescriptor(dafny.TypeDescriptor.CHAR)); + return new software.amazon.cryptography.services.kms.internaldafny.types.Error_Opaque(message); + } + """; + + protected static final String KMS_A_STRING_OPERATION_JAVA_FILE = + """ + package software.amazon.cryptography.services.kms.internaldafny; + + import software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse; + import software.amazon.cryptography.services.kms.internaldafny.types.Error; + import software.amazon.cryptography.services.kms.internaldafny.types.Error_DependencyTimeoutException; + import software.amazon.cryptography.services.kms.internaldafny.types.Error_Opaque; + import Wrappers_Compile.Option; + import dafny.DafnySequence; + import java.lang.Character; + import java.util.Objects; + import software.amazon.awssdk.services.kms.model.KmsException; + import software.amazon.awssdk.services.kms.model.DependencyTimeoutException; + + public class ToDafny { + public static DoSomethingResponse DoSomethingResponse(DoSomethingResponse nativeValue) { + Option> message; + message = Objects.nonNull(nativeValue.getMessage()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) + : Option.create_None(); + return new DoSomethingResponse(message); + } + + public static Error Error(DependencyTimeoutException nativeValue) { + Option> message; + message = Objects.nonNull(nativeValue.getMessage()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) + : Option.create_None(); + return new Error_DependencyTimeoutException(message); + } + + public static Error Error(KmsException nativeValue) { + Option> message; + message = Objects.nonNull(nativeValue.getMessage()) ? + Option.create_Some(software.amazon.smithy.dafny.conversion.ToDafny.Simple.CharacterSequence(nativeValue.getMessage())) + : Option.create_None(); + return new Error_Opaque(message); + } + }"""; } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2Test.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2Test.java index 47b5dda3df..44fe32e60a 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2Test.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToDafnyAwsV2Test.java @@ -2,14 +2,16 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v2; -import com.squareup.javapoet.MethodSpec; - -import org.junit.Before; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; +import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; +import com.squareup.javapoet.MethodSpec; import java.nio.file.Path; import java.util.Map; - +import org.junit.Before; +import org.junit.Test; import software.amazon.polymorph.smithydafny.DafnyVersion; import software.amazon.polymorph.smithyjava.ForEachDafnyTest; import software.amazon.polymorph.smithyjava.ModelConstants; @@ -19,83 +21,132 @@ import software.amazon.smithy.model.Model; import software.amazon.smithy.model.shapes.ShapeId; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThrows; -import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; - public class ToDafnyAwsV2Test extends ForEachDafnyTest { - protected final ToDafnyAwsV2 underTest; - protected final Model model; - protected final DafnyVersion dafnyVersion; - public ToDafnyAwsV2Test(DafnyVersion dafnyVersion) { - this.dafnyVersion = dafnyVersion; - model = TestSetupUtils.setupTwoLocalModel(ModelConstants.KMS_KITCHEN, ModelConstants.OTHER_NAMESPACE); - underTest = new ToDafnyAwsV2(TestSetupUtils.setupAwsSdkV2(model, "kms", dafnyVersion)); - } + protected final ToDafnyAwsV2 underTest; + protected final Model model; + protected final DafnyVersion dafnyVersion; + + public ToDafnyAwsV2Test(DafnyVersion dafnyVersion) { + this.dafnyVersion = dafnyVersion; + model = + TestSetupUtils.setupTwoLocalModel( + ModelConstants.KMS_KITCHEN, + ModelConstants.OTHER_NAMESPACE + ); + underTest = + new ToDafnyAwsV2( + TestSetupUtils.setupAwsSdkV2(model, "kms", dafnyVersion) + ); + } - @Test - public void generateConvertEnumEnum() { - ShapeId enumId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageType"); - MethodSpec actual = underTest.generateConvertEnumEnum(enumId); - tokenizeAndAssertEqual(ToDafnyAwsV2Constants.KEY_USAGE_TYPE, actual.toString()); - } + @Test + public void generateConvertEnumEnum() { + ShapeId enumId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageType"); + MethodSpec actual = underTest.generateConvertEnumEnum(enumId); + tokenizeAndAssertEqual( + ToDafnyAwsV2Constants.KEY_USAGE_TYPE, + actual.toString() + ); + } - @Test - public void generateConvertEnumString() { - ShapeId enumId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageType"); - MethodSpec actual = underTest.generateConvertEnumString(enumId); - tokenizeAndAssertEqual(ToDafnyAwsV2Constants.KEY_USAGE_TYPE_STRING, actual.toString()); - } + @Test + public void generateConvertEnumString() { + ShapeId enumId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageType"); + MethodSpec actual = underTest.generateConvertEnumString(enumId); + tokenizeAndAssertEqual( + ToDafnyAwsV2Constants.KEY_USAGE_TYPE_STRING, + actual.toString() + ); + } - @Test - public void generateConvert() { - // case Simple - ShapeId CiphertextTypeId = ShapeId.fromParts("com.amazonaws.kms", "CiphertextType"); - assertNull(underTest.generateConvert(CiphertextTypeId)); - // case LIST of Enums (which will take a list of Strings for AWS SDK for Java V2) - ShapeId listEnumId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageTypes"); - String actualListEnum = underTest.generateConvert(listEnumId).toString(); - tokenizeAndAssertEqual(ToDafnyAwsV2Constants.GENERATE_CONVERT_LIST, actualListEnum); - // case LIST of Structures from other AWS SDK namespace - ShapeId listStructureId = ShapeId.fromParts("com.amazonaws.kms", "OtherNamespaces"); - String actualListOther = underTest.generateConvert(listStructureId).toString(); - tokenizeAndAssertEqual(ToDafnyAwsV2Constants.GENERATE_CONVERT_LIST_STRUCTURES, actualListOther); - // case MAP - ShapeId mapId = ShapeId.fromParts("com.amazonaws.kms", "EncryptionContextType"); - tokenizeAndAssertEqual(ToDafnyAwsV2Constants.GENERATE_CONVERT_MAP_STRING, underTest.generateConvert(mapId).toString()); - // case SET - ShapeId setId = ShapeId.fromParts("com.amazonaws.kms", "Names"); - tokenizeAndAssertEqual(ToDafnyAwsV2Constants.GENERATE_CONVERT_SET_STRING, underTest.generateConvert(setId).toString()); - // case Structure - ShapeId simpleId = ShapeId.fromParts("com.amazonaws.kms", "Simple"); - tokenizeAndAssertEqual(ToDafnyAwsV2Constants.SIMPLE_STRUCTURE, underTest.generateConvert(simpleId).toString()); - // default - ShapeId doubleId = ShapeId.fromParts("com.amazonaws.kms", "NotSupported"); - //assertThrows(UnsupportedOperationException.class, () -> underTest.generateConvert(doubleId)); - } + @Test + public void generateConvert() { + // case Simple + ShapeId CiphertextTypeId = ShapeId.fromParts( + "com.amazonaws.kms", + "CiphertextType" + ); + assertNull(underTest.generateConvert(CiphertextTypeId)); + // case LIST of Enums (which will take a list of Strings for AWS SDK for Java V2) + ShapeId listEnumId = ShapeId.fromParts( + "com.amazonaws.kms", + "KeyUsageTypes" + ); + String actualListEnum = underTest.generateConvert(listEnumId).toString(); + tokenizeAndAssertEqual( + ToDafnyAwsV2Constants.GENERATE_CONVERT_LIST, + actualListEnum + ); + // case LIST of Structures from other AWS SDK namespace + ShapeId listStructureId = ShapeId.fromParts( + "com.amazonaws.kms", + "OtherNamespaces" + ); + String actualListOther = underTest + .generateConvert(listStructureId) + .toString(); + tokenizeAndAssertEqual( + ToDafnyAwsV2Constants.GENERATE_CONVERT_LIST_STRUCTURES, + actualListOther + ); + // case MAP + ShapeId mapId = ShapeId.fromParts( + "com.amazonaws.kms", + "EncryptionContextType" + ); + tokenizeAndAssertEqual( + ToDafnyAwsV2Constants.GENERATE_CONVERT_MAP_STRING, + underTest.generateConvert(mapId).toString() + ); + // case SET + ShapeId setId = ShapeId.fromParts("com.amazonaws.kms", "Names"); + tokenizeAndAssertEqual( + ToDafnyAwsV2Constants.GENERATE_CONVERT_SET_STRING, + underTest.generateConvert(setId).toString() + ); + // case Structure + ShapeId simpleId = ShapeId.fromParts("com.amazonaws.kms", "Simple"); + tokenizeAndAssertEqual( + ToDafnyAwsV2Constants.SIMPLE_STRUCTURE, + underTest.generateConvert(simpleId).toString() + ); + // default + ShapeId doubleId = ShapeId.fromParts("com.amazonaws.kms", "NotSupported"); + //assertThrows(UnsupportedOperationException.class, () -> underTest.generateConvert(doubleId)); + } - @Test - public void generateConvertOpaqueError() { - final String expected = Dafny.datatypeConstructorsNeedTypeDescriptors(dafnyVersion) ? - ToDafnyAwsV2Constants.GENERATE_CONVERT_OPAQUE_ERROR_WITH_TYPE_DESCRIPTORS - : ToDafnyAwsV2Constants.GENERATE_CONVERT_OPAQUE_ERROR; - tokenizeAndAssertEqual(expected, underTest.generateConvertOpaqueError().toString()); - } + @Test + public void generateConvertOpaqueError() { + final String expected = Dafny.datatypeConstructorsNeedTypeDescriptors( + dafnyVersion + ) + ? ToDafnyAwsV2Constants.GENERATE_CONVERT_OPAQUE_ERROR_WITH_TYPE_DESCRIPTORS + : ToDafnyAwsV2Constants.GENERATE_CONVERT_OPAQUE_ERROR; + tokenizeAndAssertEqual( + expected, + underTest.generateConvertOpaqueError().toString() + ); + } - @Test - public void generate() { - Model localModel = TestSetupUtils.setupLocalModel(ModelConstants.KMS_A_STRING_OPERATION); - ToDafnyAwsV2 localUnderTest = new ToDafnyAwsV2(TestSetupUtils.setupAwsSdkV2(localModel, "kms", dafnyVersion)); - final Map actual = localUnderTest.generate(); - final Path expectedPath = Path.of("software/amazon/cryptography/services/kms/internaldafny/ToDafny.java"); - Path[] temp = new Path[1]; - final Path actualPath = actual.keySet().toArray(temp)[0]; - assertEquals(expectedPath, actualPath); - final String actualSource = actual.get(actualPath).toString(); - // TODO: This test is failing, but we have largely given up on Polymorph unit tests. - // If we decide to resume writing unit tests, we should fix this test. - // tokenizeAndAssertEqual(ToDafnyAwsV2Constants.KMS_A_STRING_OPERATION_JAVA_FILE, actualSource); - } + @Test + public void generate() { + Model localModel = TestSetupUtils.setupLocalModel( + ModelConstants.KMS_A_STRING_OPERATION + ); + ToDafnyAwsV2 localUnderTest = new ToDafnyAwsV2( + TestSetupUtils.setupAwsSdkV2(localModel, "kms", dafnyVersion) + ); + final Map actual = localUnderTest.generate(); + final Path expectedPath = Path.of( + "software/amazon/cryptography/services/kms/internaldafny/ToDafny.java" + ); + Path[] temp = new Path[1]; + final Path actualPath = actual.keySet().toArray(temp)[0]; + assertEquals(expectedPath, actualPath); + final String actualSource = actual.get(actualPath).toString(); + // TODO: This test is failing, but we have largely given up on Polymorph unit tests. + // If we decide to resume writing unit tests, we should fix this test. + // tokenizeAndAssertEqual(ToDafnyAwsV2Constants.KMS_A_STRING_OPERATION_JAVA_FILE, actualSource); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeConstants.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeConstants.java index c1b2dda56f..d61094902c 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeConstants.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeConstants.java @@ -3,120 +3,135 @@ package software.amazon.polymorph.smithyjava.generator.awssdk.v2; public class ToNativeConstants { - static String STRING_CONVERSION = "software.amazon.smithy.dafny.conversion.ToNative.Simple.String"; - static String KEY_USAGE_TYPE_CONVERSION = "software.amazon.cryptography.services.kms.internaldafny.ToNative.KeyUsageType"; - static String OTHER_NAMESPACE_CONVERSION = "software.amazon.cryptography.services.other.internaldafny.ToNative.OtherNamespace"; - static String INIT_TEMP_ARRAY = "software.amazon.awssdk.services.kms.model.KeyUsageType[] listEnum_temp = new software.amazon.awssdk.services.kms.model.KeyUsageType[dafnyValue.dtor_listEnum().length()]"; - static String SET_WITH_CONVERSION_CALL = "builder.ciphertext(software.amazon.awssdk.core.SdkBytes.fromByteArray((byte[]) (dafnyValue.dtor_ciphertext().toRawArray())))"; - static String SET_WITH_CONVERSION_CALL_AND_TO_ARRAY = "builder.listEnum(software.amazon.cryptography.services.kms.internaldafny.ToNative.KeyUsageTypes(dafnyValue.dtor_listEnum()).toArray(listEnum_temp))"; - static String KEY_USAGE_TYPE = """ - public static software.amazon.awssdk.services.kms.model.KeyUsageType KeyUsageType( - software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType dafnyValue - ) { - if (dafnyValue.is_SIGN__VERIFY()) { - return software.amazon.awssdk.services.kms.model.KeyUsageType.SIGN_VERIFY; - } - if (dafnyValue.is_ENCRYPT__DECRYPT()) { - return software.amazon.awssdk.services.kms.model.KeyUsageType.ENCRYPT_DECRYPT; - } - return software.amazon.awssdk.services.kms.model.KeyUsageType.fromValue(dafnyValue.toString()); - }"""; - static String GENERATE_CONVERT_LIST = """ - public static java.util.List KeyUsageTypes( - dafny.DafnySequence dafnyValue - ) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( - dafnyValue, - software.amazon.cryptography.services.kms.internaldafny.ToNative::KeyUsageType); - } - """; - static String GENERATE_CONVERT_SET = """ - public static java.util.Set Names( - dafny.DafnySet> dafnyValue - ) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToSet( - dafnyValue, - software.amazon.smithy.dafny.conversion.ToNative.Simple::String); - } - """; - static String GENERATE_CONVERT_MAP = """ - public static java.util.Map EncryptionContextType( - dafny.DafnyMap< - ? extends dafny.DafnySequence, - ? extends dafny.DafnySequence - > dafnyValue - ) { - return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToMap( - dafnyValue, - software.amazon.smithy.dafny.conversion.ToNative.Simple::String, - software.amazon.smithy.dafny.conversion.ToNative.Simple::String); - }"""; - static String SIMPLE_STRUCTURE = """ - public static software.amazon.awssdk.services.kms.model.Simple Simple( - software.amazon.cryptography.services.kms.internaldafny.types.Simple dafnyValue - ) { - return software.amazon.awssdk.services.kms.model.Simple.builder().build(); - } - """; - static String A_OPTIONAL_STRUCTURE = """ - public static software.amazon.awssdk.services.kms.model.AOptional AOptional( - software.amazon.cryptography.services.kms.internaldafny.types.AOptional dafnyValue - ) { - software.amazon.awssdk.services.kms.model.AOptional.Builder builder = software.amazon.awssdk.services.kms.model.AOptional.builder(); - if (dafnyValue.dtor_message().is_Some()) { - builder.message(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message().dtor_value())); - } - return builder.build(); - } - """; - static String REQUIRED_LIST_ENUM_STRUCTURE = """ - public static software.amazon.awssdk.services.kms.model.RequiredListEnum RequiredListEnum( - software.amazon.cryptography.services.kms.internaldafny.types.RequiredListEnum dafnyValue - ) { - software.amazon.awssdk.services.kms.model.RequiredListEnum.Builder builder = software.amazon.awssdk.services.kms.model.RequiredListEnum.builder(); - %s; - %s; - return builder.build(); - } - """.formatted(INIT_TEMP_ARRAY, SET_WITH_CONVERSION_CALL_AND_TO_ARRAY); - static String KMS_A_STRING_OPERATION_JAVA_FILE = """ - package software.amazon.cryptography.services.kms.internaldafny; - - import software.amazon.awssdk.services.kms.KmsClient; - import software.amazon.awssdk.services.kms.model.DependencyTimeoutException; - import software.amazon.awssdk.services.kms.model.DoSomethingRequest; - import software.amazon.awssdk.services.kms.model.DoSomethingResponse; - import software.amazon.cryptography.services.kms.internaldafny.types.Error_DependencyTimeoutException; - import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; - - public class ToNative { - public static DoSomethingRequest DoSomethingRequest( - software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest dafnyValue) { - DoSomethingRequest.Builder builder = DoSomethingRequest.builder(); - builder.message(%s(dafnyValue.dtor_message())); - return builder.build(); - } - - public static DoSomethingResponse DoSomethingResponse( - software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse dafnyValue) { - DoSomethingResponse.Builder builder = DoSomethingResponse.builder(); - if (dafnyValue.dtor_message().is_Some()) { - builder.message(%s(dafnyValue.dtor_message().dtor_value())); - } - return builder.build(); - } - - public static DependencyTimeoutException Error(Error_DependencyTimeoutException dafnyValue) { - DependencyTimeoutException.Builder builder = DependencyTimeoutException.builder(); - if (dafnyValue.dtor_message().is_Some()) { - builder.message(%s(dafnyValue.dtor_message().dtor_value())); - } - return builder.build(); - } - - public static KmsClient KeyManagementService(IKeyManagementServiceClient dafnyValue) { - return ((Shim) dafnyValue).impl(); - } - } - """.formatted(STRING_CONVERSION, STRING_CONVERSION, STRING_CONVERSION); + + static String STRING_CONVERSION = + "software.amazon.smithy.dafny.conversion.ToNative.Simple.String"; + static String KEY_USAGE_TYPE_CONVERSION = + "software.amazon.cryptography.services.kms.internaldafny.ToNative.KeyUsageType"; + static String OTHER_NAMESPACE_CONVERSION = + "software.amazon.cryptography.services.other.internaldafny.ToNative.OtherNamespace"; + static String INIT_TEMP_ARRAY = + "software.amazon.awssdk.services.kms.model.KeyUsageType[] listEnum_temp = new software.amazon.awssdk.services.kms.model.KeyUsageType[dafnyValue.dtor_listEnum().length()]"; + static String SET_WITH_CONVERSION_CALL = + "builder.ciphertext(software.amazon.awssdk.core.SdkBytes.fromByteArray((byte[]) (dafnyValue.dtor_ciphertext().toRawArray())))"; + static String SET_WITH_CONVERSION_CALL_AND_TO_ARRAY = + "builder.listEnum(software.amazon.cryptography.services.kms.internaldafny.ToNative.KeyUsageTypes(dafnyValue.dtor_listEnum()).toArray(listEnum_temp))"; + static String KEY_USAGE_TYPE = + """ + public static software.amazon.awssdk.services.kms.model.KeyUsageType KeyUsageType( + software.amazon.cryptography.services.kms.internaldafny.types.KeyUsageType dafnyValue + ) { + if (dafnyValue.is_SIGN__VERIFY()) { + return software.amazon.awssdk.services.kms.model.KeyUsageType.SIGN_VERIFY; + } + if (dafnyValue.is_ENCRYPT__DECRYPT()) { + return software.amazon.awssdk.services.kms.model.KeyUsageType.ENCRYPT_DECRYPT; + } + return software.amazon.awssdk.services.kms.model.KeyUsageType.fromValue(dafnyValue.toString()); + }"""; + static String GENERATE_CONVERT_LIST = + """ + public static java.util.List KeyUsageTypes( + dafny.DafnySequence dafnyValue + ) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToList( + dafnyValue, + software.amazon.cryptography.services.kms.internaldafny.ToNative::KeyUsageType); + } + """; + static String GENERATE_CONVERT_SET = + """ + public static java.util.Set Names( + dafny.DafnySet> dafnyValue + ) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToSet( + dafnyValue, + software.amazon.smithy.dafny.conversion.ToNative.Simple::String); + } + """; + static String GENERATE_CONVERT_MAP = + """ + public static java.util.Map EncryptionContextType( + dafny.DafnyMap< + ? extends dafny.DafnySequence, + ? extends dafny.DafnySequence + > dafnyValue + ) { + return software.amazon.smithy.dafny.conversion.ToNative.Aggregate.GenericToMap( + dafnyValue, + software.amazon.smithy.dafny.conversion.ToNative.Simple::String, + software.amazon.smithy.dafny.conversion.ToNative.Simple::String); + }"""; + static String SIMPLE_STRUCTURE = + """ + public static software.amazon.awssdk.services.kms.model.Simple Simple( + software.amazon.cryptography.services.kms.internaldafny.types.Simple dafnyValue + ) { + return software.amazon.awssdk.services.kms.model.Simple.builder().build(); + } + """; + static String A_OPTIONAL_STRUCTURE = + """ + public static software.amazon.awssdk.services.kms.model.AOptional AOptional( + software.amazon.cryptography.services.kms.internaldafny.types.AOptional dafnyValue + ) { + software.amazon.awssdk.services.kms.model.AOptional.Builder builder = software.amazon.awssdk.services.kms.model.AOptional.builder(); + if (dafnyValue.dtor_message().is_Some()) { + builder.message(software.amazon.smithy.dafny.conversion.ToNative.Simple.String(dafnyValue.dtor_message().dtor_value())); + } + return builder.build(); + } + """; + static String REQUIRED_LIST_ENUM_STRUCTURE = + """ + public static software.amazon.awssdk.services.kms.model.RequiredListEnum RequiredListEnum( + software.amazon.cryptography.services.kms.internaldafny.types.RequiredListEnum dafnyValue + ) { + software.amazon.awssdk.services.kms.model.RequiredListEnum.Builder builder = software.amazon.awssdk.services.kms.model.RequiredListEnum.builder(); + %s; + %s; + return builder.build(); + } + """.formatted(INIT_TEMP_ARRAY, SET_WITH_CONVERSION_CALL_AND_TO_ARRAY); + static String KMS_A_STRING_OPERATION_JAVA_FILE = + """ + package software.amazon.cryptography.services.kms.internaldafny; + + import software.amazon.awssdk.services.kms.KmsClient; + import software.amazon.awssdk.services.kms.model.DependencyTimeoutException; + import software.amazon.awssdk.services.kms.model.DoSomethingRequest; + import software.amazon.awssdk.services.kms.model.DoSomethingResponse; + import software.amazon.cryptography.services.kms.internaldafny.types.Error_DependencyTimeoutException; + import software.amazon.cryptography.services.kms.internaldafny.types.IKeyManagementServiceClient; + + public class ToNative { + public static DoSomethingRequest DoSomethingRequest( + software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingRequest dafnyValue) { + DoSomethingRequest.Builder builder = DoSomethingRequest.builder(); + builder.message(%s(dafnyValue.dtor_message())); + return builder.build(); + } + + public static DoSomethingResponse DoSomethingResponse( + software.amazon.cryptography.services.kms.internaldafny.types.DoSomethingResponse dafnyValue) { + DoSomethingResponse.Builder builder = DoSomethingResponse.builder(); + if (dafnyValue.dtor_message().is_Some()) { + builder.message(%s(dafnyValue.dtor_message().dtor_value())); + } + return builder.build(); + } + + public static DependencyTimeoutException Error(Error_DependencyTimeoutException dafnyValue) { + DependencyTimeoutException.Builder builder = DependencyTimeoutException.builder(); + if (dafnyValue.dtor_message().is_Some()) { + builder.message(%s(dafnyValue.dtor_message().dtor_value())); + } + return builder.build(); + } + + public static KmsClient KeyManagementService(IKeyManagementServiceClient dafnyValue) { + return ((Shim) dafnyValue).impl(); + } + } + """.formatted(STRING_CONVERSION, STRING_CONVERSION, STRING_CONVERSION); } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeTest.java index a60c073a38..eb1786957d 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/awssdk/v2/ToNativeTest.java @@ -2,19 +2,22 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.awssdk.v2; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThrows; +import static software.amazon.polymorph.smithyjava.generator.awssdk.v2.ToNativeConstants.KEY_USAGE_TYPE; +import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; + import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; - -import org.junit.Before; -import org.junit.Test; - import java.nio.file.Path; import java.util.Arrays; import java.util.Collection; import java.util.Map; import java.util.Set; - +import org.junit.Before; +import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import software.amazon.polymorph.smithydafny.DafnyVersion; @@ -33,218 +36,327 @@ import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.StructureShape; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThrows; - -import static software.amazon.polymorph.smithyjava.generator.awssdk.v2.ToNativeConstants.KEY_USAGE_TYPE; -import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; - @SuppressWarnings("OptionalGetWithoutIsPresent") public class ToNativeTest extends ForEachDafnyTest { - // Why two underTests? - // As we refactor ToNativeAwsV2 and abstract ToNative, - // we are going to bump into permission issues in unit tests - // for protected methods. - // ToNativeTestImpl exposes the abstract classes protected methods - // to this test class, - // b/c ToNativeTestImpl is defined INSIDE the test class. - // But we still need to test the yet to be refactored logic. - // TODO: Clean up this test class by creating test class for ToNativeAwsV2 - // and moving AwsV2 specific tests there. - protected ToNativeAwsV2 underTest; - protected ToNativeTestImpl underTestAbstract; - protected Model model; - protected final DafnyVersion dafnyVersion; - - class ToNativeTestImpl extends ToNativeAwsV2 { - - public ToNativeTestImpl(JavaAwsSdkV2 awsSdk) { - super(awsSdk); - } - - @Override - public Set javaFiles() { - return null; - } - - @Override - // This allows the test class to call the otherwise protected method. - protected MethodSpec modeledList(ListShape shape) { - return super.modeledList(shape); - } - - @Override - // This allows the test class to call the otherwise protected method. - protected MethodSpec modeledSet(SetShape shape) { - return super.modeledSet(shape); - } - - @Override - // This allows the test class to call the otherwise protected method. - protected MethodSpec modeledMap(MapShape shape) { return super.modeledMap(shape);} - - @Override - // This allows the test class to call the otherwise protected method. - protected MethodReference conversionMethodReference(Shape shape) { - if (shape.isMemberShape()) { - return conversionMethodReference(model.expectShape(shape.asMemberShape().get().getTarget())); - } - return super.conversionMethodReference(shape); - } - - @Override - // This allows the test class to call the otherwise protected method. - protected CodeBlock setWithConversionCall(MemberShape member, CodeBlock getMember) { - return super.setWithConversionCall(member, getMember); - } - } - public ToNativeTest(DafnyVersion dafnyVersion) { - this.dafnyVersion = dafnyVersion; - model = TestSetupUtils.setupTwoLocalModel(ModelConstants.KMS_KITCHEN, ModelConstants.OTHER_NAMESPACE); - underTest = new ToNativeAwsV2(TestSetupUtils.setupAwsSdkV2(model, "kms", dafnyVersion)); - underTestAbstract = new ToNativeTestImpl(TestSetupUtils.setupAwsSdkV2(model, "kms", dafnyVersion)); - } + // Why two underTests? + // As we refactor ToNativeAwsV2 and abstract ToNative, + // we are going to bump into permission issues in unit tests + // for protected methods. + // ToNativeTestImpl exposes the abstract classes protected methods + // to this test class, + // b/c ToNativeTestImpl is defined INSIDE the test class. + // But we still need to test the yet to be refactored logic. + // TODO: Clean up this test class by creating test class for ToNativeAwsV2 + // and moving AwsV2 specific tests there. + protected ToNativeAwsV2 underTest; + protected ToNativeTestImpl underTestAbstract; + protected Model model; + protected final DafnyVersion dafnyVersion; - @Test - public void setMemberField() { - ShapeId structureId = ShapeId.fromParts("com.amazonaws.kms", "Kitchen"); - StructureShape structureShape = model.expectShape(structureId, StructureShape.class); - MemberShape stringMember = structureShape.getMember("name").get(); - CodeBlock actual = underTest.setMemberField(stringMember); - String expected = "name"; - tokenizeAndAssertEqual(expected, actual.toString()); - } + class ToNativeTestImpl extends ToNativeAwsV2 { - @Test - public void conversionMethodReference() { - ShapeId structureId = ShapeId.fromParts("com.amazonaws.kms", "Kitchen"); - StructureShape structureShape = model.expectShape(structureId, StructureShape.class); - // If the target is simple, use SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE - MemberShape stringMember = structureShape.getMember("name").get(); - MethodReference simpleActual = underTestAbstract.conversionMethodReference(stringMember); - String simpleExpected = ToNativeConstants.STRING_CONVERSION; - tokenizeAndAssertEqual(simpleExpected, simpleActual.asNormalReference().toString()); - // if in namespace reference created converter - MemberShape enumMember = structureShape.getMember("keyUsage").get(); - MethodReference enumActual = underTestAbstract.conversionMethodReference(enumMember); - String enumExpected = ToNativeConstants.KEY_USAGE_TYPE_CONVERSION; - tokenizeAndAssertEqual(enumExpected, enumActual.asNormalReference().toString()); - // Otherwise, this target must be in another namespace - MemberShape otherNamespaceMember = structureShape.getMember("otherNamespace").get(); - MethodReference otherNamespaceActual = underTestAbstract.conversionMethodReference(otherNamespaceMember); - String otherNamespaceExpected = ToNativeConstants.OTHER_NAMESPACE_CONVERSION; - String otherNamespaceActualString = otherNamespaceActual.asNormalReference().toString(); - tokenizeAndAssertEqual(otherNamespaceExpected, otherNamespaceActualString); + public ToNativeTestImpl(JavaAwsSdkV2 awsSdk) { + super(awsSdk); } - @Test - public void setWithConversionCall() { - ShapeId structureId = ShapeId.fromParts("com.amazonaws.kms", "Kitchen"); - StructureShape structureShape = model.expectShape(structureId, StructureShape.class); - MemberShape ciphertextMember = structureShape.getMember("ciphertext").get(); - CodeBlock actual = underTestAbstract.setWithConversionCall(ciphertextMember, Dafny.getMemberFieldValue(ciphertextMember)); - tokenizeAndAssertEqual(ToNativeConstants.SET_WITH_CONVERSION_CALL, actual.toString()); + @Override + public Set javaFiles() { + return null; } - @Test - public void generateConvertEnum() { - ShapeId inputShapeId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageType"); - MethodSpec actual = underTest.generateConvertEnum(inputShapeId); - String expected = KEY_USAGE_TYPE; - tokenizeAndAssertEqual(expected, actual.toString()); + @Override + // This allows the test class to call the otherwise protected method. + protected MethodSpec modeledList(ListShape shape) { + return super.modeledList(shape); } - @Test - public void generateConvertString() { - ShapeId plainStringShapeId = ShapeId.fromParts("com.amazonaws.kms", "TagKeyType"); - MethodSpec plainStringActual = underTest.generateConvertString(plainStringShapeId); - assertNull(plainStringActual); - ShapeId inputShapeId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageType"); - MethodSpec actual = underTest.generateConvertString(inputShapeId); - String expected = KEY_USAGE_TYPE; - tokenizeAndAssertEqual(expected, actual.toString()); + @Override + // This allows the test class to call the otherwise protected method. + protected MethodSpec modeledSet(SetShape shape) { + return super.modeledSet(shape); } - @Test - public void generateConvertList() { - ShapeId listId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageTypes"); - ListShape listShape = model.expectShape(listId, ListShape.class); - MethodSpec listActual = underTestAbstract.modeledList(listShape); - tokenizeAndAssertEqual(ToNativeConstants.GENERATE_CONVERT_LIST, listActual.toString()); + @Override + // This allows the test class to call the otherwise protected method. + protected MethodSpec modeledMap(MapShape shape) { + return super.modeledMap(shape); } - @Test - public void generateConvertSet() { - ShapeId setId = ShapeId.fromParts("com.amazonaws.kms", "Names"); - SetShape setShape = model.expectShape(setId, SetShape.class); - MethodSpec setActual = underTestAbstract.modeledSet(setShape); - tokenizeAndAssertEqual(ToNativeConstants.GENERATE_CONVERT_SET, setActual.toString()); + @Override + // This allows the test class to call the otherwise protected method. + protected MethodReference conversionMethodReference(Shape shape) { + if (shape.isMemberShape()) { + return conversionMethodReference( + model.expectShape(shape.asMemberShape().get().getTarget()) + ); + } + return super.conversionMethodReference(shape); } - @Test - public void generateConvertMap() { - ShapeId mapId = ShapeId.fromParts("com.amazonaws.kms", "EncryptionContextType"); - MapShape mapShape = model.expectShape(mapId, MapShape.class); - MethodSpec mapActual = underTestAbstract.modeledMap(mapShape); - tokenizeAndAssertEqual(ToNativeConstants.GENERATE_CONVERT_MAP, mapActual.toString()); + @Override + // This allows the test class to call the otherwise protected method. + protected CodeBlock setWithConversionCall( + MemberShape member, + CodeBlock getMember + ) { + return super.setWithConversionCall(member, getMember); } + } - @Test - public void generateConvertStructure() { - // structureShape.members().size() == 0 - ShapeId simpleId = ShapeId.fromParts("com.amazonaws.kms", "Simple"); - StructureShape simpleShape = model.expectShape(simpleId, StructureShape.class); - MethodSpec simpleActual = underTest.modeledStructure(simpleShape); - tokenizeAndAssertEqual(ToNativeConstants.SIMPLE_STRUCTURE, simpleActual.toString()); - // if optional, check if present - ShapeId aOptionalId = ShapeId.fromParts("com.amazonaws.kms", "AOptional"); - MethodSpec aOptionalActual = underTest.generateConvert(aOptionalId); - tokenizeAndAssertEqual(ToNativeConstants.A_OPTIONAL_STRUCTURE, aOptionalActual.toString()); - // if converting a LIST or SET of enums - ShapeId requiredListEnumId = ShapeId.fromParts("com.amazonaws.kms", "RequiredListEnum"); - MethodSpec requiredListEnumActual = underTest.generateConvert(requiredListEnumId); - // TODO: This test is failing, but we have largely given up on Polymorph unit tests. - // If we decide to resume writing unit tests, we should fix this test. - // tokenizeAndAssertEqual(ToNativeConstants.REQUIRED_LIST_ENUM_STRUCTURE, requiredListEnumActual.toString()); - } + public ToNativeTest(DafnyVersion dafnyVersion) { + this.dafnyVersion = dafnyVersion; + model = + TestSetupUtils.setupTwoLocalModel( + ModelConstants.KMS_KITCHEN, + ModelConstants.OTHER_NAMESPACE + ); + underTest = + new ToNativeAwsV2( + TestSetupUtils.setupAwsSdkV2(model, "kms", dafnyVersion) + ); + underTestAbstract = + new ToNativeTestImpl( + TestSetupUtils.setupAwsSdkV2(model, "kms", dafnyVersion) + ); + } - @Test - public void generateConvert() { - // case Simple - ShapeId CiphertextTypeId = ShapeId.fromParts("com.amazonaws.kms", "CiphertextType"); - assertNull(underTest.generateConvert(CiphertextTypeId)); - // case ENUM - ShapeId enumId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageType"); - tokenizeAndAssertEqual(KEY_USAGE_TYPE, underTest.generateConvert(enumId).toString()); - // case LIST - ShapeId listId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageTypes"); - tokenizeAndAssertEqual(ToNativeConstants.GENERATE_CONVERT_LIST, underTest.generateConvert(listId).toString()); - // case SET - ShapeId setId = ShapeId.fromParts("com.amazonaws.kms", "Names"); - tokenizeAndAssertEqual(ToNativeConstants.GENERATE_CONVERT_SET, underTest.generateConvert(setId).toString()); - // case MAP - ShapeId mapId = ShapeId.fromParts("com.amazonaws.kms", "EncryptionContextType"); - tokenizeAndAssertEqual(ToNativeConstants.GENERATE_CONVERT_MAP, underTest.generateConvert(mapId).toString()); - // case STRUCTURE - ShapeId simpleId = ShapeId.fromParts("com.amazonaws.kms", "Simple"); - tokenizeAndAssertEqual(ToNativeConstants.SIMPLE_STRUCTURE, underTest.generateConvert(simpleId).toString()); - // default - ShapeId doubleId = ShapeId.fromParts("com.amazonaws.kms", "NotSupported"); - //assertThrows(UnsupportedOperationException.class, () -> underTest.generateConvert(doubleId)); - } + @Test + public void setMemberField() { + ShapeId structureId = ShapeId.fromParts("com.amazonaws.kms", "Kitchen"); + StructureShape structureShape = model.expectShape( + structureId, + StructureShape.class + ); + MemberShape stringMember = structureShape.getMember("name").get(); + CodeBlock actual = underTest.setMemberField(stringMember); + String expected = "name"; + tokenizeAndAssertEqual(expected, actual.toString()); + } - @Test - public void generate() { - Model model = TestSetupUtils.setupLocalModel(ModelConstants.KMS_A_STRING_OPERATION); - ToNativeAwsV2 underTest = new ToNativeAwsV2(TestSetupUtils.setupAwsSdkV2(model, "kms", dafnyVersion)); - final Map actual = underTest.generate(); - final Path expectedPath = Path.of("software/amazon/cryptography/services/kms/internaldafny/ToNative.java"); - Path[] temp = new Path[1]; - final Path actualPath = actual.keySet().toArray(temp)[0]; - assertEquals(expectedPath, actualPath); - final String actualSource = actual.get(actualPath).toString(); - tokenizeAndAssertEqual(ToNativeConstants.KMS_A_STRING_OPERATION_JAVA_FILE, actualSource); - } + @Test + public void conversionMethodReference() { + ShapeId structureId = ShapeId.fromParts("com.amazonaws.kms", "Kitchen"); + StructureShape structureShape = model.expectShape( + structureId, + StructureShape.class + ); + // If the target is simple, use SIMPLE_CONVERSION_METHOD_FROM_SHAPE_TYPE + MemberShape stringMember = structureShape.getMember("name").get(); + MethodReference simpleActual = underTestAbstract.conversionMethodReference( + stringMember + ); + String simpleExpected = ToNativeConstants.STRING_CONVERSION; + tokenizeAndAssertEqual( + simpleExpected, + simpleActual.asNormalReference().toString() + ); + // if in namespace reference created converter + MemberShape enumMember = structureShape.getMember("keyUsage").get(); + MethodReference enumActual = underTestAbstract.conversionMethodReference( + enumMember + ); + String enumExpected = ToNativeConstants.KEY_USAGE_TYPE_CONVERSION; + tokenizeAndAssertEqual( + enumExpected, + enumActual.asNormalReference().toString() + ); + // Otherwise, this target must be in another namespace + MemberShape otherNamespaceMember = structureShape + .getMember("otherNamespace") + .get(); + MethodReference otherNamespaceActual = + underTestAbstract.conversionMethodReference(otherNamespaceMember); + String otherNamespaceExpected = + ToNativeConstants.OTHER_NAMESPACE_CONVERSION; + String otherNamespaceActualString = otherNamespaceActual + .asNormalReference() + .toString(); + tokenizeAndAssertEqual(otherNamespaceExpected, otherNamespaceActualString); + } + + @Test + public void setWithConversionCall() { + ShapeId structureId = ShapeId.fromParts("com.amazonaws.kms", "Kitchen"); + StructureShape structureShape = model.expectShape( + structureId, + StructureShape.class + ); + MemberShape ciphertextMember = structureShape.getMember("ciphertext").get(); + CodeBlock actual = underTestAbstract.setWithConversionCall( + ciphertextMember, + Dafny.getMemberFieldValue(ciphertextMember) + ); + tokenizeAndAssertEqual( + ToNativeConstants.SET_WITH_CONVERSION_CALL, + actual.toString() + ); + } + + @Test + public void generateConvertEnum() { + ShapeId inputShapeId = ShapeId.fromParts( + "com.amazonaws.kms", + "KeyUsageType" + ); + MethodSpec actual = underTest.generateConvertEnum(inputShapeId); + String expected = KEY_USAGE_TYPE; + tokenizeAndAssertEqual(expected, actual.toString()); + } + + @Test + public void generateConvertString() { + ShapeId plainStringShapeId = ShapeId.fromParts( + "com.amazonaws.kms", + "TagKeyType" + ); + MethodSpec plainStringActual = underTest.generateConvertString( + plainStringShapeId + ); + assertNull(plainStringActual); + ShapeId inputShapeId = ShapeId.fromParts( + "com.amazonaws.kms", + "KeyUsageType" + ); + MethodSpec actual = underTest.generateConvertString(inputShapeId); + String expected = KEY_USAGE_TYPE; + tokenizeAndAssertEqual(expected, actual.toString()); + } + + @Test + public void generateConvertList() { + ShapeId listId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageTypes"); + ListShape listShape = model.expectShape(listId, ListShape.class); + MethodSpec listActual = underTestAbstract.modeledList(listShape); + tokenizeAndAssertEqual( + ToNativeConstants.GENERATE_CONVERT_LIST, + listActual.toString() + ); + } + + @Test + public void generateConvertSet() { + ShapeId setId = ShapeId.fromParts("com.amazonaws.kms", "Names"); + SetShape setShape = model.expectShape(setId, SetShape.class); + MethodSpec setActual = underTestAbstract.modeledSet(setShape); + tokenizeAndAssertEqual( + ToNativeConstants.GENERATE_CONVERT_SET, + setActual.toString() + ); + } + + @Test + public void generateConvertMap() { + ShapeId mapId = ShapeId.fromParts( + "com.amazonaws.kms", + "EncryptionContextType" + ); + MapShape mapShape = model.expectShape(mapId, MapShape.class); + MethodSpec mapActual = underTestAbstract.modeledMap(mapShape); + tokenizeAndAssertEqual( + ToNativeConstants.GENERATE_CONVERT_MAP, + mapActual.toString() + ); + } + + @Test + public void generateConvertStructure() { + // structureShape.members().size() == 0 + ShapeId simpleId = ShapeId.fromParts("com.amazonaws.kms", "Simple"); + StructureShape simpleShape = model.expectShape( + simpleId, + StructureShape.class + ); + MethodSpec simpleActual = underTest.modeledStructure(simpleShape); + tokenizeAndAssertEqual( + ToNativeConstants.SIMPLE_STRUCTURE, + simpleActual.toString() + ); + // if optional, check if present + ShapeId aOptionalId = ShapeId.fromParts("com.amazonaws.kms", "AOptional"); + MethodSpec aOptionalActual = underTest.generateConvert(aOptionalId); + tokenizeAndAssertEqual( + ToNativeConstants.A_OPTIONAL_STRUCTURE, + aOptionalActual.toString() + ); + // if converting a LIST or SET of enums + ShapeId requiredListEnumId = ShapeId.fromParts( + "com.amazonaws.kms", + "RequiredListEnum" + ); + MethodSpec requiredListEnumActual = underTest.generateConvert( + requiredListEnumId + ); + // TODO: This test is failing, but we have largely given up on Polymorph unit tests. + // If we decide to resume writing unit tests, we should fix this test. + // tokenizeAndAssertEqual(ToNativeConstants.REQUIRED_LIST_ENUM_STRUCTURE, requiredListEnumActual.toString()); + } + + @Test + public void generateConvert() { + // case Simple + ShapeId CiphertextTypeId = ShapeId.fromParts( + "com.amazonaws.kms", + "CiphertextType" + ); + assertNull(underTest.generateConvert(CiphertextTypeId)); + // case ENUM + ShapeId enumId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageType"); + tokenizeAndAssertEqual( + KEY_USAGE_TYPE, + underTest.generateConvert(enumId).toString() + ); + // case LIST + ShapeId listId = ShapeId.fromParts("com.amazonaws.kms", "KeyUsageTypes"); + tokenizeAndAssertEqual( + ToNativeConstants.GENERATE_CONVERT_LIST, + underTest.generateConvert(listId).toString() + ); + // case SET + ShapeId setId = ShapeId.fromParts("com.amazonaws.kms", "Names"); + tokenizeAndAssertEqual( + ToNativeConstants.GENERATE_CONVERT_SET, + underTest.generateConvert(setId).toString() + ); + // case MAP + ShapeId mapId = ShapeId.fromParts( + "com.amazonaws.kms", + "EncryptionContextType" + ); + tokenizeAndAssertEqual( + ToNativeConstants.GENERATE_CONVERT_MAP, + underTest.generateConvert(mapId).toString() + ); + // case STRUCTURE + ShapeId simpleId = ShapeId.fromParts("com.amazonaws.kms", "Simple"); + tokenizeAndAssertEqual( + ToNativeConstants.SIMPLE_STRUCTURE, + underTest.generateConvert(simpleId).toString() + ); + // default + ShapeId doubleId = ShapeId.fromParts("com.amazonaws.kms", "NotSupported"); + //assertThrows(UnsupportedOperationException.class, () -> underTest.generateConvert(doubleId)); + } + + @Test + public void generate() { + Model model = TestSetupUtils.setupLocalModel( + ModelConstants.KMS_A_STRING_OPERATION + ); + ToNativeAwsV2 underTest = new ToNativeAwsV2( + TestSetupUtils.setupAwsSdkV2(model, "kms", dafnyVersion) + ); + final Map actual = underTest.generate(); + final Path expectedPath = Path.of( + "software/amazon/cryptography/services/kms/internaldafny/ToNative.java" + ); + Path[] temp = new Path[1]; + final Path actualPath = actual.keySet().toArray(temp)[0]; + assertEquals(expectedPath, actualPath); + final String actualSource = actual.get(actualPath).toString(); + tokenizeAndAssertEqual( + ToNativeConstants.KMS_A_STRING_OPERATION_JAVA_FILE, + actualSource + ); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/library/Constants.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/library/Constants.java index 166e8ee392..89e8e67033 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/library/Constants.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/library/Constants.java @@ -4,33 +4,45 @@ class Constants { - static String RANGE_TRAIT_INTEGER_BUILD_METHOD_START = "public TestRangeMinMaxInteger build()"; - static String RANGE_TRAIT_INTEGER_BUILD_METHOD_RETURN = "return new TestRangeMinMaxInteger(this);"; - static String RANGE_TRAIT_INTEGER_BUILD_EXPECTED = """ - %s { - if (this._zeroToTenSet && this.zeroToTen() < 0) { - throw new IllegalArgumentException("`zeroToTen` must be greater than or equal to 0"); - } - if (this._zeroToTenSet && this.zeroToTen() > 10) { - throw new IllegalArgumentException("`zeroToTen` must be less than or equal to 10."); - } - %s - }""".formatted(RANGE_TRAIT_INTEGER_BUILD_METHOD_START, RANGE_TRAIT_INTEGER_BUILD_METHOD_RETURN); + static String RANGE_TRAIT_INTEGER_BUILD_METHOD_START = + "public TestRangeMinMaxInteger build()"; + static String RANGE_TRAIT_INTEGER_BUILD_METHOD_RETURN = + "return new TestRangeMinMaxInteger(this);"; + static String RANGE_TRAIT_INTEGER_BUILD_EXPECTED = + """ + %s { + if (this._zeroToTenSet && this.zeroToTen() < 0) { + throw new IllegalArgumentException("`zeroToTen` must be greater than or equal to 0"); + } + if (this._zeroToTenSet && this.zeroToTen() > 10) { + throw new IllegalArgumentException("`zeroToTen` must be less than or equal to 10."); + } + %s + }""".formatted( + RANGE_TRAIT_INTEGER_BUILD_METHOD_START, + RANGE_TRAIT_INTEGER_BUILD_METHOD_RETURN + ); - // Method's end is down 1 line (1 \n), in class (2 spaces), inside BuilderImpl (2 spaces), and the bracket (1 } ) - static int BUILD_METHOD_END_OFFSET = 6; + // Method's end is down 1 line (1 \n), in class (2 spaces), inside BuilderImpl (2 spaces), and the bracket (1 } ) + static int BUILD_METHOD_END_OFFSET = 6; - static String LENGTH_TRAIT_BLOB_BUILD_METHOD_START = "public TestLengthMinMaxBlob build()"; - static String LENGTH_TRAIT_BLOB_BUILD_METHOD_RETURN = "return new TestLengthMinMaxBlob(this);"; - static String LENGTH_TRAIT_BLOB_BUILD_METHOD_EXPECTED = """ - %s { - if (Objects.nonNull(this.key()) && this.key().remaining() < 256) { - throw new IllegalArgumentException("The size of `key` must be greater than or equal to 256"); - } - if (Objects.nonNull(this.key()) && this.key().remaining() > 256) { - throw new IllegalArgumentException("The size of `key` must be less than or equal to 256"); - } - %s - } - """.formatted(LENGTH_TRAIT_BLOB_BUILD_METHOD_START, LENGTH_TRAIT_BLOB_BUILD_METHOD_RETURN); + static String LENGTH_TRAIT_BLOB_BUILD_METHOD_START = + "public TestLengthMinMaxBlob build()"; + static String LENGTH_TRAIT_BLOB_BUILD_METHOD_RETURN = + "return new TestLengthMinMaxBlob(this);"; + static String LENGTH_TRAIT_BLOB_BUILD_METHOD_EXPECTED = + """ + %s { + if (Objects.nonNull(this.key()) && this.key().remaining() < 256) { + throw new IllegalArgumentException("The size of `key` must be greater than or equal to 256"); + } + if (Objects.nonNull(this.key()) && this.key().remaining() > 256) { + throw new IllegalArgumentException("The size of `key` must be less than or equal to 256"); + } + %s + } + """.formatted( + LENGTH_TRAIT_BLOB_BUILD_METHOD_START, + LENGTH_TRAIT_BLOB_BUILD_METHOD_RETURN + ); } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/library/ModelCodegenTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/library/ModelCodegenTest.java index 52c9a5342b..a968e2ee4e 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/library/ModelCodegenTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/generator/library/ModelCodegenTest.java @@ -2,11 +2,11 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.generator.library; -import com.squareup.javapoet.JavaFile; +import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; +import com.squareup.javapoet.JavaFile; import org.junit.Before; import org.junit.Test; - import software.amazon.polymorph.smithydafny.DafnyVersion; import software.amazon.polymorph.smithyjava.ForEachDafnyTest; import software.amazon.polymorph.smithyjava.ModelConstants; @@ -15,45 +15,75 @@ import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.StructureShape; -import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; - public class ModelCodegenTest extends ForEachDafnyTest { - protected ModelCodegen underTest; - protected Model model; - - public ModelCodegenTest(DafnyVersion dafnyVersion) { - model = TestSetupUtils.setupLocalModel(ModelConstants.CRYPTOGRAPHY_A_STRING_OPERATION); - underTest = new ModelCodegen(TestSetupUtils.setupLibrary(model, "aws.cryptography.test", dafnyVersion)); - } - - @Test - public void StructureWithRangeTraitTest() { - ShapeId structureId = ShapeId.fromParts("aws.cryptography.test", "TestRangeMinMaxInteger"); - StructureShape structureShape = model.expectShape(structureId, StructureShape.class); - JavaFile actual = underTest.modeledStructure(structureShape); - String actualString = actual.toString(); - int startBuildMethod = actualString.indexOf(Constants.RANGE_TRAIT_INTEGER_BUILD_METHOD_START); - int endBuildMethod = actualString.indexOf(Constants.RANGE_TRAIT_INTEGER_BUILD_METHOD_RETURN) - + Constants.RANGE_TRAIT_INTEGER_BUILD_METHOD_RETURN.length() - + Constants.BUILD_METHOD_END_OFFSET; - tokenizeAndAssertEqual(Constants.RANGE_TRAIT_INTEGER_BUILD_EXPECTED, - actualString.substring(startBuildMethod, endBuildMethod)); - } - - @Test - public void StructureWithLengthTraitTest() { - ShapeId structureId = ShapeId.fromParts("aws.cryptography.test", "TestLengthMinMaxBlob"); - StructureShape structureShape = model.expectShape(structureId, StructureShape.class); - JavaFile actual = underTest.modeledStructure(structureShape); - String actualString = actual.toString(); - int startBuildMethod = actualString.indexOf(Constants.LENGTH_TRAIT_BLOB_BUILD_METHOD_START); - int endBuildMethod = actualString.indexOf(Constants.LENGTH_TRAIT_BLOB_BUILD_METHOD_RETURN) - + Constants.LENGTH_TRAIT_BLOB_BUILD_METHOD_RETURN.length() - + Constants.BUILD_METHOD_END_OFFSET; - tokenizeAndAssertEqual(Constants.LENGTH_TRAIT_BLOB_BUILD_METHOD_EXPECTED, - actualString.substring(startBuildMethod, endBuildMethod)); - } - - // TODO: Test structure with Enum member + + protected ModelCodegen underTest; + protected Model model; + + public ModelCodegenTest(DafnyVersion dafnyVersion) { + model = + TestSetupUtils.setupLocalModel( + ModelConstants.CRYPTOGRAPHY_A_STRING_OPERATION + ); + underTest = + new ModelCodegen( + TestSetupUtils.setupLibrary( + model, + "aws.cryptography.test", + dafnyVersion + ) + ); + } + + @Test + public void StructureWithRangeTraitTest() { + ShapeId structureId = ShapeId.fromParts( + "aws.cryptography.test", + "TestRangeMinMaxInteger" + ); + StructureShape structureShape = model.expectShape( + structureId, + StructureShape.class + ); + JavaFile actual = underTest.modeledStructure(structureShape); + String actualString = actual.toString(); + int startBuildMethod = actualString.indexOf( + Constants.RANGE_TRAIT_INTEGER_BUILD_METHOD_START + ); + int endBuildMethod = + actualString.indexOf(Constants.RANGE_TRAIT_INTEGER_BUILD_METHOD_RETURN) + + Constants.RANGE_TRAIT_INTEGER_BUILD_METHOD_RETURN.length() + + Constants.BUILD_METHOD_END_OFFSET; + tokenizeAndAssertEqual( + Constants.RANGE_TRAIT_INTEGER_BUILD_EXPECTED, + actualString.substring(startBuildMethod, endBuildMethod) + ); + } + + @Test + public void StructureWithLengthTraitTest() { + ShapeId structureId = ShapeId.fromParts( + "aws.cryptography.test", + "TestLengthMinMaxBlob" + ); + StructureShape structureShape = model.expectShape( + structureId, + StructureShape.class + ); + JavaFile actual = underTest.modeledStructure(structureShape); + String actualString = actual.toString(); + int startBuildMethod = actualString.indexOf( + Constants.LENGTH_TRAIT_BLOB_BUILD_METHOD_START + ); + int endBuildMethod = + actualString.indexOf(Constants.LENGTH_TRAIT_BLOB_BUILD_METHOD_RETURN) + + Constants.LENGTH_TRAIT_BLOB_BUILD_METHOD_RETURN.length() + + Constants.BUILD_METHOD_END_OFFSET; + tokenizeAndAssertEqual( + Constants.LENGTH_TRAIT_BLOB_BUILD_METHOD_EXPECTED, + actualString.substring(startBuildMethod, endBuildMethod) + ); + } + // TODO: Test structure with Enum member } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeTest.java index 3e58099327..4c2ca71ca4 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/nameresolver/AwsSdkNativeTest.java @@ -2,12 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.nameresolver; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThrows; +import static org.junit.Assert.assertTrue; + import com.squareup.javapoet.ClassName; import com.squareup.javapoet.TypeName; - import org.junit.Before; import org.junit.Test; - import software.amazon.polymorph.smithyjava.ModelConstants; import software.amazon.polymorph.util.TestModel; import software.amazon.polymorph.utils.AwsSdkNameResolverHelpers; @@ -16,86 +19,102 @@ import software.amazon.smithy.model.shapes.ServiceShape; import software.amazon.smithy.model.shapes.ShapeId; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; - public class AwsSdkNativeTest { - AwsSdkNativeV1 underTest; - @Before - public void setup() { - underTest = setupLocalModel(ModelConstants.MOCK_KMS, "kms"); - } + AwsSdkNativeV1 underTest; + + @Before + public void setup() { + underTest = setupLocalModel(ModelConstants.MOCK_KMS, "kms"); + } - @Test - public void testIsInServiceNameSpaceSimple() { - assertTrue(underTest.isInServiceNameSpace( - ShapeId.fromParts("com.amazonaws.kms", "DoSomething") - )); - } + @Test + public void testIsInServiceNameSpaceSimple() { + assertTrue( + underTest.isInServiceNameSpace( + ShapeId.fromParts("com.amazonaws.kms", "DoSomething") + ) + ); + } - @Test - public void testIsInServiceNameSpaceOneDeep() { - assertTrue(underTest.isInServiceNameSpace( - ShapeId.fromParts("com.amazonaws.kms.model", "DoSomething") - )); - } + @Test + public void testIsInServiceNameSpaceOneDeep() { + assertTrue( + underTest.isInServiceNameSpace( + ShapeId.fromParts("com.amazonaws.kms.model", "DoSomething") + ) + ); + } - @Test - public void testIsInServiceNameSpaceNegative() { - assertFalse(underTest.isInServiceNameSpace( - ShapeId.fromParts("com.amazonaws.alice", "bob") - )); - } + @Test + public void testIsInServiceNameSpaceNegative() { + assertFalse( + underTest.isInServiceNameSpace( + ShapeId.fromParts("com.amazonaws.alice", "bob") + ) + ); + } - @Test - public void testTypeForStructure() { - final TypeName expected = ClassName.bestGuess("com.amazonaws.services.kms.model.DoSomethingRequest"); - final TypeName actual = underTest.typeForShape( - ShapeId.fromParts("com.amazonaws.kms", "DoSomethingRequest") - ); - assertEquals(expected, actual); - } + @Test + public void testTypeForStructure() { + final TypeName expected = ClassName.bestGuess( + "com.amazonaws.services.kms.model.DoSomethingRequest" + ); + final TypeName actual = underTest.typeForShape( + ShapeId.fromParts("com.amazonaws.kms", "DoSomethingRequest") + ); + assertEquals(expected, actual); + } - @Test - public void testTypeForServiceKMS() { - final TypeName expected = ClassName.bestGuess("com.amazonaws.services.kms.AWSKMS"); - final TypeName actual = underTest.typeForShape( - ShapeId.fromParts("com.amazonaws.kms", "KeyManagementService") - ); - assertEquals(expected, actual); - } + @Test + public void testTypeForServiceKMS() { + final TypeName expected = ClassName.bestGuess( + "com.amazonaws.services.kms.AWSKMS" + ); + final TypeName actual = underTest.typeForShape( + ShapeId.fromParts("com.amazonaws.kms", "KeyManagementService") + ); + assertEquals(expected, actual); + } - @Test - public void testBaseErrorForServiceKMS() { - final TypeName expected = ClassName.bestGuess( - "com.amazonaws.services.kms.model.AWSKMSException"); - final TypeName actual = underTest.baseErrorForService(); - assertEquals(expected, actual); - } + @Test + public void testBaseErrorForServiceKMS() { + final TypeName expected = ClassName.bestGuess( + "com.amazonaws.services.kms.model.AWSKMSException" + ); + final TypeName actual = underTest.baseErrorForService(); + assertEquals(expected, actual); + } - @Test - public void checkForAwsServiceConstants() { - Model localModel = TestModel.setupModel( - (builder, modelAssembler) -> modelAssembler - .addUnparsedModel("test.smithy", ModelConstants.OTHER_NAMESPACE)); - ServiceShape serviceShape = ModelUtils.serviceFromNamespace( - localModel, AwsSdkNameResolverHelpers.namespaceForService("other")); - assertThrows(IllegalArgumentException.class, - () -> new AwsSdkNativeV1(serviceShape, localModel)); - } + @Test + public void checkForAwsServiceConstants() { + Model localModel = TestModel.setupModel((builder, modelAssembler) -> + modelAssembler.addUnparsedModel( + "test.smithy", + ModelConstants.OTHER_NAMESPACE + ) + ); + ServiceShape serviceShape = ModelUtils.serviceFromNamespace( + localModel, + AwsSdkNameResolverHelpers.namespaceForService("other") + ); + assertThrows( + IllegalArgumentException.class, + () -> new AwsSdkNativeV1(serviceShape, localModel) + ); + } - static AwsSdkNativeV1 setupLocalModel( - String rawModel, - String awsServiceName - ) { - Model localModel = TestModel.setupModel( - (builder, modelAssembler) -> modelAssembler - .addUnparsedModel("test.smithy", rawModel)); - ServiceShape serviceShape = ModelUtils.serviceFromNamespace( - localModel, AwsSdkNameResolverHelpers.namespaceForService(awsServiceName)); - return new AwsSdkNativeV1(serviceShape, localModel); - } + static AwsSdkNativeV1 setupLocalModel( + String rawModel, + String awsServiceName + ) { + Model localModel = TestModel.setupModel((builder, modelAssembler) -> + modelAssembler.addUnparsedModel("test.smithy", rawModel) + ); + ServiceShape serviceShape = ModelUtils.serviceFromNamespace( + localModel, + AwsSdkNameResolverHelpers.namespaceForService(awsServiceName) + ); + return new AwsSdkNativeV1(serviceShape, localModel); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/nameresolver/DafnyTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/nameresolver/DafnyTest.java index 4606578a98..17efb401c9 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/nameresolver/DafnyTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/smithyjava/nameresolver/DafnyTest.java @@ -2,12 +2,15 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.polymorph.smithyjava.nameresolver; +import static org.junit.Assert.assertEquals; +import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; + import com.squareup.javapoet.CodeBlock; import com.squareup.javapoet.TypeName; - +import java.util.Arrays; +import java.util.Collection; import org.junit.Before; import org.junit.Test; - import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import software.amazon.polymorph.smithydafny.DafnyVersion; @@ -23,160 +26,195 @@ import software.amazon.smithy.model.shapes.ShapeId; import software.amazon.smithy.model.shapes.StructureShape; -import java.util.Arrays; -import java.util.Collection; - -import static org.junit.Assert.assertEquals; -import static software.amazon.polymorph.util.Tokenizer.tokenizeAndAssertEqual; - public class DafnyTest extends ForEachDafnyTest { - Dafny underTest; - protected Model model; - - public DafnyTest(DafnyVersion dafnyVersion) { - String rawModel = """ - namespace smithy.example - service Example {} - resource MyResource {} - list MyList { member: String } - map MyMap { key: String, value: String } - structure MyStructure {} - """; - model = TestModel.setupModel( - (builder, modelAssembler) -> modelAssembler - .addUnparsedModel("test.smithy", rawModel)); - ServiceShape serviceShape = ModelUtils.serviceFromNamespace(model, "smithy.example"); - underTest = new Dafny("Dafny.Smithy.Example", model, serviceShape, CodegenSubject.AwsSdkVersion.V2, dafnyVersion); - } - - @Test - public void packageName() { - final String expected = "Dafny.Smithy.Example"; - final String actual = underTest.packageName(); - assertEquals(expected, actual); - } - - @Test - public void typeForShapeBlob() { - final String expected = "dafny.DafnySequence"; - final TypeName actual = underTest.typeForShape(ShapeId.fromParts("smithy.api", "Blob")); - final String actualString = actual.toString(); - assertEquals(expected, actualString); - } - - @Test - public void typeForShapeBoolean() { - final String expected = "java.lang.Boolean"; - final TypeName actual = underTest.typeForShape(ShapeId.fromParts("smithy.api", "Boolean")); - final String actualString = actual.toString(); - assertEquals(expected, actualString); - } - - @Test - public void typeForShapeString() { - final String expected = "dafny.DafnySequence"; - final TypeName actual = underTest.typeForShape(ShapeId.fromParts("smithy.api", "String")); - final String actualString = actual.toString(); - assertEquals(expected, actualString); - } - - @Test - public void typeForShapeInteger() { - final String expected = "java.lang.Integer"; - final TypeName actual = underTest.typeForShape(ShapeId.fromParts("smithy.api", "Integer")); - final String actualString = actual.toString(); - assertEquals(expected, actualString); - } - - @Test - public void typeForShapeTimestamp() { - final String expected = "dafny.DafnySequence"; - final TypeName actual = underTest.typeForShape(ShapeId.fromParts("smithy.api", "Timestamp")); - final String actualString = actual.toString(); - assertEquals(expected, actualString); - } - - @Test - public void typeForShapeListOfStrings() { - final String expected = "dafny.DafnySequence>"; - final TypeName actual = underTest.typeForShape(ShapeId.fromParts("smithy.example", "MyList")); - final String actualString = actual.toString(); - assertEquals(expected, actualString); - } - - @Test - public void typeForShapeMapKeyStringValueString() { - final String expected = "dafny.DafnyMap<" + - "? extends dafny.DafnySequence, " + - "? extends dafny.DafnySequence" + - ">"; - final TypeName actual = underTest.typeForShape(ShapeId.fromParts("smithy.example", "MyMap")); - final String actualString = actual.toString(); - assertEquals(expected, actualString); - } - - @Test - @SuppressWarnings("OptionalGetWithoutIsPresent") - public void getMemberField() { - Model localModel = TestSetupUtils.setupTwoLocalModel( - ModelConstants.KMS_KITCHEN, - ModelConstants.OTHER_NAMESPACE - ); - ShapeId structureId = ShapeId.fromParts("com.amazonaws.kms", "Kitchen"); - StructureShape structureShape = localModel.expectShape(structureId, StructureShape.class); - MemberShape stringMember = structureShape.getMember("name").get(); - CodeBlock actual = Dafny.getMemberField(stringMember); - String expected = "dtor_name()"; - tokenizeAndAssertEqual(expected, actual.toString()); - } - - @Test - @SuppressWarnings("OptionalGetWithoutIsPresent") - public void getMemberFieldValue() { - Model localModel = TestSetupUtils.setupTwoLocalModel( - ModelConstants.KMS_KITCHEN, - ModelConstants.OTHER_NAMESPACE - ); - ShapeId structureId = ShapeId.fromParts("com.amazonaws.kms", "Kitchen"); - StructureShape structureShape = localModel.expectShape(structureId, StructureShape.class); - // if required, get via Field - MemberShape requiredMember = structureShape.getMember("name").get(); - CodeBlock actualRequired = Dafny.getMemberFieldValue(requiredMember); - String expectedRequired = "dtor_name()"; - tokenizeAndAssertEqual(expectedRequired, actualRequired.toString()); - // if optional, get via dtor_value() - MemberShape optionalField = structureShape.getMember("message").get(); - CodeBlock actualOptional = Dafny.getMemberFieldValue(optionalField); - String expectedOptional = "dtor_message().dtor_value()"; - tokenizeAndAssertEqual(expectedOptional, actualOptional.toString()); - } - - @Test - public void typeForShapeMember() { - } - - @Test - public void typeForShapeStructure() { - final String expected = "smithy.example.internaldafny.types.MyStructure"; - TypeName actual = underTest.typeForShape(ShapeId.fromParts("smithy.example", "MyStructure")); - final String actualString = actual.toString(); - assertEquals(expected, actualString); - } - - @Test - public void typeForShapeService() { - final String expected = "smithy.example.internaldafny.types.IExampleClient"; - TypeName actual = underTest.typeForShape(ShapeId.fromParts("smithy.example", "Example")); - final String actualString = actual.toString(); - assertEquals(expected, actualString); - } - - @Test - public void typeForShapeResource() { - final String expected = "smithy.example.internaldafny.types.IMyResource"; - TypeName actual = underTest.typeForShape(ShapeId.fromParts("smithy.example", "MyResource")); - final String actualString = actual.toString(); - assertEquals(expected, actualString); - } + Dafny underTest; + protected Model model; + + public DafnyTest(DafnyVersion dafnyVersion) { + String rawModel = + """ + namespace smithy.example + service Example {} + resource MyResource {} + list MyList { member: String } + map MyMap { key: String, value: String } + structure MyStructure {} + """; + model = + TestModel.setupModel((builder, modelAssembler) -> + modelAssembler.addUnparsedModel("test.smithy", rawModel) + ); + ServiceShape serviceShape = ModelUtils.serviceFromNamespace( + model, + "smithy.example" + ); + underTest = + new Dafny( + "Dafny.Smithy.Example", + model, + serviceShape, + CodegenSubject.AwsSdkVersion.V2, + dafnyVersion + ); + } + + @Test + public void packageName() { + final String expected = "Dafny.Smithy.Example"; + final String actual = underTest.packageName(); + assertEquals(expected, actual); + } + + @Test + public void typeForShapeBlob() { + final String expected = "dafny.DafnySequence"; + final TypeName actual = underTest.typeForShape( + ShapeId.fromParts("smithy.api", "Blob") + ); + final String actualString = actual.toString(); + assertEquals(expected, actualString); + } + + @Test + public void typeForShapeBoolean() { + final String expected = "java.lang.Boolean"; + final TypeName actual = underTest.typeForShape( + ShapeId.fromParts("smithy.api", "Boolean") + ); + final String actualString = actual.toString(); + assertEquals(expected, actualString); + } + + @Test + public void typeForShapeString() { + final String expected = + "dafny.DafnySequence"; + final TypeName actual = underTest.typeForShape( + ShapeId.fromParts("smithy.api", "String") + ); + final String actualString = actual.toString(); + assertEquals(expected, actualString); + } + + @Test + public void typeForShapeInteger() { + final String expected = "java.lang.Integer"; + final TypeName actual = underTest.typeForShape( + ShapeId.fromParts("smithy.api", "Integer") + ); + final String actualString = actual.toString(); + assertEquals(expected, actualString); + } + + @Test + public void typeForShapeTimestamp() { + final String expected = + "dafny.DafnySequence"; + final TypeName actual = underTest.typeForShape( + ShapeId.fromParts("smithy.api", "Timestamp") + ); + final String actualString = actual.toString(); + assertEquals(expected, actualString); + } + + @Test + public void typeForShapeListOfStrings() { + final String expected = + "dafny.DafnySequence>"; + final TypeName actual = underTest.typeForShape( + ShapeId.fromParts("smithy.example", "MyList") + ); + final String actualString = actual.toString(); + assertEquals(expected, actualString); + } + + @Test + public void typeForShapeMapKeyStringValueString() { + final String expected = + "dafny.DafnyMap<" + + "? extends dafny.DafnySequence, " + + "? extends dafny.DafnySequence" + + ">"; + final TypeName actual = underTest.typeForShape( + ShapeId.fromParts("smithy.example", "MyMap") + ); + final String actualString = actual.toString(); + assertEquals(expected, actualString); + } + + @Test + @SuppressWarnings("OptionalGetWithoutIsPresent") + public void getMemberField() { + Model localModel = TestSetupUtils.setupTwoLocalModel( + ModelConstants.KMS_KITCHEN, + ModelConstants.OTHER_NAMESPACE + ); + ShapeId structureId = ShapeId.fromParts("com.amazonaws.kms", "Kitchen"); + StructureShape structureShape = localModel.expectShape( + structureId, + StructureShape.class + ); + MemberShape stringMember = structureShape.getMember("name").get(); + CodeBlock actual = Dafny.getMemberField(stringMember); + String expected = "dtor_name()"; + tokenizeAndAssertEqual(expected, actual.toString()); + } + + @Test + @SuppressWarnings("OptionalGetWithoutIsPresent") + public void getMemberFieldValue() { + Model localModel = TestSetupUtils.setupTwoLocalModel( + ModelConstants.KMS_KITCHEN, + ModelConstants.OTHER_NAMESPACE + ); + ShapeId structureId = ShapeId.fromParts("com.amazonaws.kms", "Kitchen"); + StructureShape structureShape = localModel.expectShape( + structureId, + StructureShape.class + ); + // if required, get via Field + MemberShape requiredMember = structureShape.getMember("name").get(); + CodeBlock actualRequired = Dafny.getMemberFieldValue(requiredMember); + String expectedRequired = "dtor_name()"; + tokenizeAndAssertEqual(expectedRequired, actualRequired.toString()); + // if optional, get via dtor_value() + MemberShape optionalField = structureShape.getMember("message").get(); + CodeBlock actualOptional = Dafny.getMemberFieldValue(optionalField); + String expectedOptional = "dtor_message().dtor_value()"; + tokenizeAndAssertEqual(expectedOptional, actualOptional.toString()); + } + + @Test + public void typeForShapeMember() {} + + @Test + public void typeForShapeStructure() { + final String expected = "smithy.example.internaldafny.types.MyStructure"; + TypeName actual = underTest.typeForShape( + ShapeId.fromParts("smithy.example", "MyStructure") + ); + final String actualString = actual.toString(); + assertEquals(expected, actualString); + } + + @Test + public void typeForShapeService() { + final String expected = "smithy.example.internaldafny.types.IExampleClient"; + TypeName actual = underTest.typeForShape( + ShapeId.fromParts("smithy.example", "Example") + ); + final String actualString = actual.toString(); + assertEquals(expected, actualString); + } + + @Test + public void typeForShapeResource() { + final String expected = "smithy.example.internaldafny.types.IMyResource"; + TypeName actual = underTest.typeForShape( + ShapeId.fromParts("smithy.example", "MyResource") + ); + final String actualString = actual.toString(); + assertEquals(expected, actualString); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/util/TestModel.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/util/TestModel.java index de4518ea1a..a65a3e7eca 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/util/TestModel.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/util/TestModel.java @@ -3,6 +3,7 @@ package software.amazon.polymorph.util; +import java.util.function.BiConsumer; import software.amazon.polymorph.utils.ModelUtils; import software.amazon.smithy.model.Model; import software.amazon.smithy.model.loader.ModelAssembler; @@ -11,46 +12,57 @@ import software.amazon.smithy.model.shapes.StructureShape; import software.amazon.smithy.model.traits.RequiredTrait; -import java.util.function.BiConsumer; - public class TestModel { - public static final String SERVICE_NAMESPACE = "test.foobar"; - public static final String SERVICE_NAME = "FoobarServiceFactory"; - public static final ShapeId SERVICE_SHAPE_ID = ShapeId.fromParts(SERVICE_NAMESPACE, SERVICE_NAME); - - /** - * Sets up a test model. The updater can modify the {@link ServiceShape.Builder} or the {@link ModelAssembler} - * before either is assembled. The updater is not responsible for adding the ServiceShape to the model assembler; - * this method will do so before returning the assembled model. - */ - public static Model setupModel(final BiConsumer updater) { - final ServiceShape.Builder serviceShapeBuilder = new ServiceShape.Builder() - .version("1.0") - .id(SERVICE_SHAPE_ID); - final ModelAssembler assembler = new ModelAssembler(); - ModelUtils.addCustomTraitsToModelAssembler(assembler); - - updater.accept(serviceShapeBuilder, assembler); - assembler.addShape(serviceShapeBuilder.build()); - return assembler.assemble().unwrap(); - } - - /** - * Sets up a test model containing only the service shape. - */ - public static Model setupModel() { - return setupModel((ServiceShape.Builder _builder, ModelAssembler _assembler) -> {}); - } - - /** - * Sets up a simple "Foobar" structure shape. - */ - public static StructureShape setupFoobarStructureShape() { - return StructureShape.builder() - .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar")) - .addMember("someInt", ShapeId.from("smithy.api#Integer")) - .addMember("someString", ShapeId.from("smithy.api#String")) - .addMember("someBool", ShapeId.from("smithy.api#Boolean"), memberUpdater -> memberUpdater.addTrait(new RequiredTrait())) - .build(); - } + + public static final String SERVICE_NAMESPACE = "test.foobar"; + public static final String SERVICE_NAME = "FoobarServiceFactory"; + public static final ShapeId SERVICE_SHAPE_ID = ShapeId.fromParts( + SERVICE_NAMESPACE, + SERVICE_NAME + ); + + /** + * Sets up a test model. The updater can modify the {@link ServiceShape.Builder} or the {@link ModelAssembler} + * before either is assembled. The updater is not responsible for adding the ServiceShape to the model assembler; + * this method will do so before returning the assembled model. + */ + public static Model setupModel( + final BiConsumer updater + ) { + final ServiceShape.Builder serviceShapeBuilder = new ServiceShape.Builder() + .version("1.0") + .id(SERVICE_SHAPE_ID); + final ModelAssembler assembler = new ModelAssembler(); + ModelUtils.addCustomTraitsToModelAssembler(assembler); + + updater.accept(serviceShapeBuilder, assembler); + assembler.addShape(serviceShapeBuilder.build()); + return assembler.assemble().unwrap(); + } + + /** + * Sets up a test model containing only the service shape. + */ + public static Model setupModel() { + return setupModel( + (ServiceShape.Builder _builder, ModelAssembler _assembler) -> {} + ); + } + + /** + * Sets up a simple "Foobar" structure shape. + */ + public static StructureShape setupFoobarStructureShape() { + return StructureShape + .builder() + .id(ShapeId.fromParts(SERVICE_NAMESPACE, "Foobar")) + .addMember("someInt", ShapeId.from("smithy.api#Integer")) + .addMember("someString", ShapeId.from("smithy.api#String")) + .addMember( + "someBool", + ShapeId.from("smithy.api#Boolean"), + memberUpdater -> memberUpdater.addTrait(new RequiredTrait()) + ) + .build(); + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/util/Tokenizer.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/util/Tokenizer.java index de00cd8817..c08aa2635d 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/util/Tokenizer.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/polymorph/util/Tokenizer.java @@ -3,42 +3,42 @@ package software.amazon.polymorph.util; +import java.util.List; +import java.util.Objects; import org.antlr.v4.runtime.CharStream; import org.antlr.v4.runtime.CharStreams; import org.antlr.v4.runtime.Lexer; import org.antlr.v4.runtime.Token; -import software.amazon.polymorph.antlr.CSharpLexer; - -import java.util.List; -import java.util.Objects; - import org.junit.Assert; +import software.amazon.polymorph.antlr.CSharpLexer; /** * Simple tokenizer for C# source code, intended for testing generated code in a format-agnostic manner. * Uses the ANTLR-generated parser. */ public class Tokenizer { - public static List tokenize(final String source) { - final CharStream charStream = CharStreams.fromString(source); - final Lexer lexer = new CSharpLexer(charStream); - final List lexemes = lexer.getAllTokens(); - return lexemes - .stream() - .filter(lexeme -> lexeme.getType() != CSharpLexer.WHITESPACES) - .map(lexeme -> new ParseToken(lexeme.getText(), lexeme.getType())).toList(); - } - public static record ParseToken(String text, int type) {} + public static List tokenize(final String source) { + final CharStream charStream = CharStreams.fromString(source); + final Lexer lexer = new CSharpLexer(charStream); + final List lexemes = lexer.getAllTokens(); + return lexemes + .stream() + .filter(lexeme -> lexeme.getType() != CSharpLexer.WHITESPACES) + .map(lexeme -> new ParseToken(lexeme.getText(), lexeme.getType())) + .toList(); + } + + public static record ParseToken(String text, int type) {} - public static void tokenizeAndAssertEqual(String expected, String actual) { - final List actualTokens = tokenize(actual); - final List expectedTokens = tokenize(expected); - if (!Objects.equals(expectedTokens, actualTokens)) { - // If the tokens aren't equal, assert the original strings are equal - // knowing it is guaranteed to fail, - // just so that we get a much more readable diff in tooling. - Assert.assertEquals(expected, actual); - } + public static void tokenizeAndAssertEqual(String expected, String actual) { + final List actualTokens = tokenize(actual); + final List expectedTokens = tokenize(expected); + if (!Objects.equals(expectedTokens, actualTokens)) { + // If the tokens aren't equal, assert the original strings are equal + // knowing it is guaranteed to fail, + // just so that we get a much more readable diff in tooling. + Assert.assertEquals(expected, actual); } + } } diff --git a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPluginTest.java b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPluginTest.java index d7e0dde17b..5eafad3eea 100644 --- a/codegen/smithy-dafny-codegen/src/test/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPluginTest.java +++ b/codegen/smithy-dafny-codegen/src/test/java/software/amazon/smithy/dafny/codegen/DafnyClientCodegenPluginTest.java @@ -3,14 +3,15 @@ package software.amazon.smithy.dafny.codegen; -import org.junit.Test; - import static org.junit.Assert.assertTrue; +import org.junit.Test; + public class DafnyClientCodegenPluginTest { - @Test - public void emptyTest() { - // FIXME placeholder test - assertTrue(true); - } + + @Test + public void emptyTest() { + // FIXME placeholder test + assertTrue(true); + } } diff --git a/smithy-dafny-conversion/README.md b/smithy-dafny-conversion/README.md index cf3c3ab837..74f5cdb0d1 100644 --- a/smithy-dafny-conversion/README.md +++ b/smithy-dafny-conversion/README.md @@ -1,4 +1,5 @@ ## Smithy Dafny Conversion + A Java 8 Library that converts from idiomatic Java types to Dafny Runtime types and vice versa. The code generated by `smithy-dafny` will include runtime references to @@ -9,13 +10,16 @@ to the Dafny Runtime jar inside a major version. This isn't currently guaranteed by the Dafny implementation, so this library may need to be updated with each new Dafny release. -*WARNING: All internal and external interfaces are considered unstable and subject to change without notice.* +_WARNING: All internal and external interfaces are considered unstable and subject to change without notice._ ### Compile src + `./gradlew assemble` ### Compile src, test, and run tests + `./gradlew build` ### Publish to Maven local + `./gradlew publishToMavenLocal` diff --git a/smithy-dafny-conversion/src/main/java/software/amazon/smithy/dafny/conversion/ToDafny.java b/smithy-dafny-conversion/src/main/java/software/amazon/smithy/dafny/conversion/ToDafny.java index 2fe3c4bac8..f3deb8a1ba 100644 --- a/smithy-dafny-conversion/src/main/java/software/amazon/smithy/dafny/conversion/ToDafny.java +++ b/smithy-dafny-conversion/src/main/java/software/amazon/smithy/dafny/conversion/ToDafny.java @@ -2,6 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.smithy.dafny.conversion; +import dafny.Array; +import dafny.DafnyMap; +import dafny.DafnySequence; +import dafny.DafnySet; +import dafny.Tuple2; +import dafny.TypeDescriptor; import java.math.BigInteger; import java.nio.ByteBuffer; import java.nio.CharBuffer; @@ -18,14 +24,6 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; -import dafny.Array; -import dafny.DafnyMap; -import dafny.DafnySequence; -import dafny.DafnySet; -import dafny.Tuple2; -import dafny.TypeDescriptor; - - /** * Methods that convert from a Native Java type to a Dafny Runtime type.

* Every Method here has its inverse is {@link ToNative}. @@ -33,234 +31,246 @@ */ public class ToDafny { + /** + * Methods that convert from a Native Java type + * to a Dafny Java type, + * for Smithy's definition of Simple shapes. + * @see Smithy Simple Types + */ + public static class Simple { + /** - * Methods that convert from a Native Java type - * to a Dafny Java type, - * for Smithy's definition of Simple shapes. - * @see Smithy Simple Types + * @param blob The Java type for a blob can be an array of bytes. + * @return The Dafny Runtime type for a blob is a {@link DafnySequence} of {@link Byte}s. + * @see ToNative.Simple#ByteBuffer */ - public static class Simple { - /** - * @param blob The Java type for a blob can be an array of bytes. - * @return The Dafny Runtime type for a blob is a {@link DafnySequence} of {@link Byte}s. - * @see ToNative.Simple#ByteBuffer - */ - // BLOB("blob", BlobShape.class, Category.SIMPLE), - public static DafnySequence ByteSequence(byte[] blob) { - return DafnySequence.fromArray(TypeDescriptor.BYTE, Array.wrap(blob)); - } - - /** - * Copy {@code limit} bytes from {@code byteBuffer} starting at {@code start}, - * and return them as a Dafny Runtime {@link DafnySequence} of {@link Byte}s. - * @param byteBuffer The Java type for a blob can be a {@link ByteBuffer}. - * @param start The index in the byteBuffer from which to start at. - * @param limit The number of bytes to copy. - * @return A {@link DafnySequence} of {@link Byte}s, containing the copied bytes. - * @see ToNative.Simple#ByteBuffer - */ - // BLOB("blob", BlobShape.class, Category.SIMPLE), - public static DafnySequence ByteSequence( - final ByteBuffer byteBuffer, - final int start, - final int limit) { - byte[] rawArray = new byte[limit - start]; - byteBuffer.position(start); - byteBuffer.get(rawArray, 0, limit); - return ByteSequence(rawArray); - } - - /** - * A convenience function for converting all the bytes from a ByteBuffer. - *

- * Note: Regardless of the buffer's mark, position, or capacity, - * this will return the bytes from 0 till limit. - * - * @param byteBuffer The Java type for a blob can be a ByteBuffer. - * @return A {@link DafnySequence} of {@link Byte}s, - * containing the bytes in the {@code byteBuffer}, - * starting from 0 until the buffer's limit. - * @see ToNative.Simple#ByteBuffer - */ - // BLOB("blob", BlobShape.class, Category.SIMPLE), - public static DafnySequence ByteSequence(ByteBuffer byteBuffer) { - return ByteSequence(byteBuffer, 0, byteBuffer.limit()); - } + // BLOB("blob", BlobShape.class, Category.SIMPLE), + public static DafnySequence ByteSequence(byte[] blob) { + return DafnySequence.fromArray(TypeDescriptor.BYTE, Array.wrap(blob)); + } - /** - * At this time, Dafny does not have an idiomatic Double type in the language or any standard library.

- * Instead, the Double is serialized into bytes, - * which are then wrapped as a DafnySequence of Bytes.

- * Note: This serialization is NOT guaranteed to be - * consistent among different Dafny Runtimes or - * even native distributions. - * @param aDouble The Java type for a double can be a {@link Double}. - * @return A {@link DafnySequence} of {@link Byte}s containing the serialization of the {@code aDouble}. - * @see ToNative.Simple#Double - */ - // DOUBLE("double", DoubleShape.class, Category.SIMPLE), - public static DafnySequence Double(Double aDouble) { - ByteBuffer doubleBytes = ByteBuffer.allocate(8).putDouble(aDouble); - return ByteSequence(doubleBytes, 0, 8); - } + /** + * Copy {@code limit} bytes from {@code byteBuffer} starting at {@code start}, + * and return them as a Dafny Runtime {@link DafnySequence} of {@link Byte}s. + * @param byteBuffer The Java type for a blob can be a {@link ByteBuffer}. + * @param start The index in the byteBuffer from which to start at. + * @param limit The number of bytes to copy. + * @return A {@link DafnySequence} of {@link Byte}s, containing the copied bytes. + * @see ToNative.Simple#ByteBuffer + */ + // BLOB("blob", BlobShape.class, Category.SIMPLE), + public static DafnySequence ByteSequence( + final ByteBuffer byteBuffer, + final int start, + final int limit + ) { + byte[] rawArray = new byte[limit - start]; + byteBuffer.position(start); + byteBuffer.get(rawArray, 0, limit); + return ByteSequence(rawArray); + } - /** - * @param aString The Java type for a String is {@link String}. - * @return The Dafny Runtime type for a String is A {@link DafnySequence} of {@link Character}s. - * @see ToNative.Simple#String - */ - // STRING("string", StringShape.class, Category.SIMPLE), - public static DafnySequence CharacterSequence(String aString) { - return DafnySequence.asString(aString); - } + /** + * A convenience function for converting all the bytes from a ByteBuffer. + *

+ * Note: Regardless of the buffer's mark, position, or capacity, + * this will return the bytes from 0 till limit. + * + * @param byteBuffer The Java type for a blob can be a ByteBuffer. + * @return A {@link DafnySequence} of {@link Byte}s, + * containing the bytes in the {@code byteBuffer}, + * starting from 0 until the buffer's limit. + * @see ToNative.Simple#ByteBuffer + */ + // BLOB("blob", BlobShape.class, Category.SIMPLE), + public static DafnySequence ByteSequence(ByteBuffer byteBuffer) { + return ByteSequence(byteBuffer, 0, byteBuffer.limit()); + } - /** - * At this time, Dafny does not have an idiomatic Timestamp or Date type in the language or any standard library.

- * Instead, the Timestamp is serialized as seconds from epoch, as a string, - * which is than wrapped as a {@link DafnySequence} of {@link Character}s. - * @param timestamp The Java type for a Smithy timestamp can be {@link Date}. - * @return A {@link DafnySequence} of {@link Character}s containing the serialization of the {@code timestamp}. - * @see ToNative.Simple#Date(DafnySequence) - */ - // TIMESTAMP("timestamp", TimestampShape.class, Category.SIMPLE), - public static DafnySequence CharacterSequence(Date timestamp) { - // KMS uses unix timestamp, or seconds from epoch, as its serialized timestamp - // Other services may use other formats - return CharacterSequence(String.format("%d", (timestamp.getTime() / 1000L))); - } + /** + * At this time, Dafny does not have an idiomatic Double type in the language or any standard library.

+ * Instead, the Double is serialized into bytes, + * which are then wrapped as a DafnySequence of Bytes.

+ * Note: This serialization is NOT guaranteed to be + * consistent among different Dafny Runtimes or + * even native distributions. + * @param aDouble The Java type for a double can be a {@link Double}. + * @return A {@link DafnySequence} of {@link Byte}s containing the serialization of the {@code aDouble}. + * @see ToNative.Simple#Double + */ + // DOUBLE("double", DoubleShape.class, Category.SIMPLE), + public static DafnySequence Double(Double aDouble) { + ByteBuffer doubleBytes = ByteBuffer.allocate(8).putDouble(aDouble); + return ByteSequence(doubleBytes, 0, 8); + } - /** - * At this time, Dafny does not have an idiomatic Timestamp or Date type in the language or any standard library.

- * Instead, the Timestamp is serialized as seconds from epoch, as a string, - * which is than wrapped as a DafnySequence of Charters. - * @param timestamp The Java type for a timestamp can be {@link Instant}. - * @return A {@link DafnySequence} of {@link Character}s containing the serialization of the {@code timestamp}. - * @see ToNative.Simple#Instant(DafnySequence) - */ - // TIMESTAMP("timestamp", TimestampShape.class, Category.SIMPLE), - public static DafnySequence CharacterSequence(Instant timestamp) { - // KMS uses unix timestamp, or seconds from epoch, as its serialized timestamp - // Other services may use other formats - return CharacterSequence(String.format("%d", timestamp.getEpochSecond())); - } + /** + * @param aString The Java type for a String is {@link String}. + * @return The Dafny Runtime type for a String is A {@link DafnySequence} of {@link Character}s. + * @see ToNative.Simple#String + */ + // STRING("string", StringShape.class, Category.SIMPLE), + public static DafnySequence CharacterSequence(String aString) { + return DafnySequence.asString(aString); + } - /** - * Dafny can be configured to represent Strings in an encoding OTHER THAN UTF-8.

- * (Until recently, it only supported UTF-16.)

- * Regardless of how the Dafny Compiler is configured, - * this method can be used to reliably convert a Java String - * to a DafnySequence of UTF-8 Encoded bytes. - * @param aString The Java type for a String is {@link String} - * @return A {@link DafnySequence} of {@link Byte}s containing {@code aString} as UTF-8 Encoded Bytes. - * @see ToNative.Simple#DafnyUtf8Bytes(DafnySequence) - */ - public static DafnySequence DafnyUtf8Bytes(String aString) { - Charset utf8 = StandardCharsets.UTF_8; - // The only way to keep this thread/concurrent safe/ is - // to create a new Coder everytime. - // If we wanted to increase performance, - // we could declare this NOT thread/concurrent safe, - // and reset the coder everytime. - CharsetEncoder coder = utf8.newEncoder(); - CharBuffer inBuffer = CharBuffer.wrap(aString); - inBuffer.position(0); - try { - ByteBuffer outBuffer = coder.encode(inBuffer); - // outBuffer's capacity can be much higher than the limit. - // By taking just the limit, we ensure we do not include - // any allocated but un-filled space. - return ByteSequence(outBuffer, 0, outBuffer.limit()); - } catch (CharacterCodingException ex) { - throw new RuntimeException("Could not encode input to Dafny Bytes.", ex); - } - } + /** + * At this time, Dafny does not have an idiomatic Timestamp or Date type in the language or any standard library.

+ * Instead, the Timestamp is serialized as seconds from epoch, as a string, + * which is than wrapped as a {@link DafnySequence} of {@link Character}s. + * @param timestamp The Java type for a Smithy timestamp can be {@link Date}. + * @return A {@link DafnySequence} of {@link Character}s containing the serialization of the {@code timestamp}. + * @see ToNative.Simple#Date(DafnySequence) + */ + // TIMESTAMP("timestamp", TimestampShape.class, Category.SIMPLE), + public static DafnySequence CharacterSequence(Date timestamp) { + // KMS uses unix timestamp, or seconds from epoch, as its serialized timestamp + // Other services may use other formats + return CharacterSequence( + String.format("%d", (timestamp.getTime() / 1000L)) + ); + } + /** + * At this time, Dafny does not have an idiomatic Timestamp or Date type in the language or any standard library.

+ * Instead, the Timestamp is serialized as seconds from epoch, as a string, + * which is than wrapped as a DafnySequence of Charters. + * @param timestamp The Java type for a timestamp can be {@link Instant}. + * @return A {@link DafnySequence} of {@link Character}s containing the serialization of the {@code timestamp}. + * @see ToNative.Simple#Instant(DafnySequence) + */ + // TIMESTAMP("timestamp", TimestampShape.class, Category.SIMPLE), + public static DafnySequence CharacterSequence( + Instant timestamp + ) { + // KMS uses unix timestamp, or seconds from epoch, as its serialized timestamp + // Other services may use other formats + return CharacterSequence(String.format("%d", timestamp.getEpochSecond())); } /** - * Methods that convert from a Native Java type - * to a Dafny Runtime type, - * for Smithy's definition of Aggregate shapes. - * @see Smithy Aggregate Types + * Dafny can be configured to represent Strings in an encoding OTHER THAN UTF-8.

+ * (Until recently, it only supported UTF-16.)

+ * Regardless of how the Dafny Compiler is configured, + * this method can be used to reliably convert a Java String + * to a DafnySequence of UTF-8 Encoded bytes. + * @param aString The Java type for a String is {@link String} + * @return A {@link DafnySequence} of {@link Byte}s containing {@code aString} as UTF-8 Encoded Bytes. + * @see ToNative.Simple#DafnyUtf8Bytes(DafnySequence) */ - public static class Aggregate { + public static DafnySequence DafnyUtf8Bytes(String aString) { + Charset utf8 = StandardCharsets.UTF_8; + // The only way to keep this thread/concurrent safe/ is + // to create a new Coder everytime. + // If we wanted to increase performance, + // we could declare this NOT thread/concurrent safe, + // and reset the coder everytime. + CharsetEncoder coder = utf8.newEncoder(); + CharBuffer inBuffer = CharBuffer.wrap(aString); + inBuffer.position(0); + try { + ByteBuffer outBuffer = coder.encode(inBuffer); + // outBuffer's capacity can be much higher than the limit. + // By taking just the limit, we ensure we do not include + // any allocated but un-filled space. + return ByteSequence(outBuffer, 0, outBuffer.limit()); + } catch (CharacterCodingException ex) { + throw new RuntimeException( + "Could not encode input to Dafny Bytes.", + ex + ); + } + } + } - /** - * @param nativeValues The Java type for a list can be {@link List}. - * @param converter A {@link Function} that converts from a natural Java Type to a Dafny Runtime Type. - * @param typeDescriptor A {@link TypeDescriptor} that describes the Dafny Runtime Type. - * @param The natural Java Type. - * @param The Dafny Runtime Type. - * @return A {@link DafnySequence} of {@code }, - * which is the result of applying {@code converter} to - * every member of {@code nativeValues}. - * @see ToNative.Aggregate#GenericToList(DafnySequence, Function) - */ - // LIST("list", ListShape.class, Category.AGGREGATE), - public static DafnySequence GenericToSequence( - List nativeValues, - Function converter, - TypeDescriptor typeDescriptor - ) { - return DafnySequence.Create( - typeDescriptor, - BigInteger.valueOf(nativeValues.size()), - index -> converter.apply(nativeValues.get(index.intValue()))); - } + /** + * Methods that convert from a Native Java type + * to a Dafny Runtime type, + * for Smithy's definition of Aggregate shapes. + * @see Smithy Aggregate Types + */ + public static class Aggregate { + /** + * @param nativeValues The Java type for a list can be {@link List}. + * @param converter A {@link Function} that converts from a natural Java Type to a Dafny Runtime Type. + * @param typeDescriptor A {@link TypeDescriptor} that describes the Dafny Runtime Type. + * @param The natural Java Type. + * @param The Dafny Runtime Type. + * @return A {@link DafnySequence} of {@code }, + * which is the result of applying {@code converter} to + * every member of {@code nativeValues}. + * @see ToNative.Aggregate#GenericToList(DafnySequence, Function) + */ + // LIST("list", ListShape.class, Category.AGGREGATE), + public static DafnySequence GenericToSequence( + List nativeValues, + Function converter, + TypeDescriptor typeDescriptor + ) { + return DafnySequence.Create( + typeDescriptor, + BigInteger.valueOf(nativeValues.size()), + index -> converter.apply(nativeValues.get(index.intValue())) + ); + } - /** - * Note: Sets in Java and in Dafny DO NOT preserve order; Smithy discourages un-ordered Sets. - * @see Simthy 1.0's Set - * @param nativeValues The Java type for a set can be {@link Set}. - * @param converter A {@link Function} that converts from a natural Java Type to a Dafny Runtime Type. - * @param The natural Java Type. - * @param The Dafny Runtime Type. - * @return A {@link DafnySet} of {@code }, - * which is the result of applying {@code converter} to - * every member of {@code nativeValues}. - * @see ToNative.Aggregate#GenericToSet(DafnySet, Function) - */ - // SET("set", SetShape.class, Category.AGGREGATE), - // TODO: Frankly, we should avoid Dafny Sets since they do not preserve order; - // Smithy 2.0 deprecates Sets for Unique Lists to ensure order is preserved. - // But, we would need to implement our own Dafny Ordered Set... - public static DafnySet GenericToSet( - Set nativeValues, - Function converter - ) { - HashSet hashSet = new HashSet<>(nativeValues.size(), 1); - nativeValues.forEach(v -> hashSet.add(converter.apply(v))); - return new DafnySet<>(hashSet); - } + /** + * Note: Sets in Java and in Dafny DO NOT preserve order; Smithy discourages un-ordered Sets. + * @see Simthy 1.0's Set + * @param nativeValues The Java type for a set can be {@link Set}. + * @param converter A {@link Function} that converts from a natural Java Type to a Dafny Runtime Type. + * @param The natural Java Type. + * @param The Dafny Runtime Type. + * @return A {@link DafnySet} of {@code }, + * which is the result of applying {@code converter} to + * every member of {@code nativeValues}. + * @see ToNative.Aggregate#GenericToSet(DafnySet, Function) + */ + // SET("set", SetShape.class, Category.AGGREGATE), + // TODO: Frankly, we should avoid Dafny Sets since they do not preserve order; + // Smithy 2.0 deprecates Sets for Unique Lists to ensure order is preserved. + // But, we would need to implement our own Dafny Ordered Set... + public static DafnySet GenericToSet( + Set nativeValues, + Function converter + ) { + HashSet hashSet = new HashSet<>(nativeValues.size(), 1); + nativeValues.forEach(v -> hashSet.add(converter.apply(v))); + return new DafnySet<>(hashSet); + } - /** - * @param nativeValues The Java type for a map can be {@link Map}. - * @param keyConverter A {@link Function} that converts natural Java Type for the Key to a Dafny Runtime Type. - * @param valueConverter A {@link Function} that converts natural Java Type for the Value to a Dafny Runtime Type. - * @param The natural Java Type for the Key - * @param The natural Java Type for the Value - * @param The Dafny Runtime Type for the Key. - * @param The Dafny Runtime Type for the Value. - * @return A {@link DafnyMap} of {@code }, - * which is the result of applying {@code keyConverter} and {@code valueConverter} to - * every member of {@code nativeValues}. - * @see ToNative.Aggregate#GenericToMap(DafnyMap, Function, Function) - */ - // MAP("map", MapShape.class, Category.AGGREGATE), - // Technically, a smithy Map's Key value will always be a String - public static DafnyMap GenericToMap( - Map nativeValues, - Function keyConverter, - Function valueConverter - ) { - @SuppressWarnings("unchecked") - Tuple2[] tuples = new Tuple2[nativeValues.size()]; - AtomicInteger counter = new AtomicInteger(0); - nativeValues.forEach((k, v) -> tuples[counter.getAndIncrement()] = new Tuple2<>( - keyConverter.apply(k), valueConverter.apply(v)) - ); - return DafnyMap.fromElements(tuples); - } + /** + * @param nativeValues The Java type for a map can be {@link Map}. + * @param keyConverter A {@link Function} that converts natural Java Type for the Key to a Dafny Runtime Type. + * @param valueConverter A {@link Function} that converts natural Java Type for the Value to a Dafny Runtime Type. + * @param The natural Java Type for the Key + * @param The natural Java Type for the Value + * @param The Dafny Runtime Type for the Key. + * @param The Dafny Runtime Type for the Value. + * @return A {@link DafnyMap} of {@code }, + * which is the result of applying {@code keyConverter} and {@code valueConverter} to + * every member of {@code nativeValues}. + * @see ToNative.Aggregate#GenericToMap(DafnyMap, Function, Function) + */ + // MAP("map", MapShape.class, Category.AGGREGATE), + // Technically, a smithy Map's Key value will always be a String + public static DafnyMap< + OUT_KEY, + OUT_VALUE + > GenericToMap( + Map nativeValues, + Function keyConverter, + Function valueConverter + ) { + @SuppressWarnings("unchecked") + Tuple2[] tuples = new Tuple2[nativeValues.size()]; + AtomicInteger counter = new AtomicInteger(0); + nativeValues.forEach((k, v) -> + tuples[counter.getAndIncrement()] = + new Tuple2<>(keyConverter.apply(k), valueConverter.apply(v)) + ); + return DafnyMap.fromElements(tuples); } + } } diff --git a/smithy-dafny-conversion/src/main/java/software/amazon/smithy/dafny/conversion/ToNative.java b/smithy-dafny-conversion/src/main/java/software/amazon/smithy/dafny/conversion/ToNative.java index da744a90e4..b84d5f3d54 100644 --- a/smithy-dafny-conversion/src/main/java/software/amazon/smithy/dafny/conversion/ToNative.java +++ b/smithy-dafny-conversion/src/main/java/software/amazon/smithy/dafny/conversion/ToNative.java @@ -2,6 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.smithy.dafny.conversion; +import dafny.DafnyMap; +import dafny.DafnySequence; +import dafny.DafnySet; +import dafny.TypeDescriptor; import java.math.BigDecimal; import java.nio.ByteBuffer; import java.nio.CharBuffer; @@ -22,11 +26,6 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; -import dafny.DafnyMap; -import dafny.DafnySequence; -import dafny.DafnySet; -import dafny.TypeDescriptor; - /** * Methods that convert from a Dafny Runtime Type to native (natural) Java Type.

* Every Method here has its inverse is {@link ToDafny}. @@ -34,200 +33,220 @@ */ public class ToNative { + /** + * Methods that convert from a Dafny Runtime Type + * to a native Java type, + * for Smithy's definition of Simple shapes. + * @see Smithy Simple Types + */ + public static class Simple { + /** - * Methods that convert from a Dafny Runtime Type - * to a native Java type, - * for Smithy's definition of Simple shapes. - * @see Smithy Simple Types + * @param dafnySequence The Dafny Runtime type for a blob is a {@link DafnySequence} of {@link Byte}s. + * @return The Java type for a blob can be a {@link ByteBuffer}. + * @see ToDafny.Simple#ByteSequence */ - public static class Simple { - - /** - * @param dafnySequence The Dafny Runtime type for a blob is a {@link DafnySequence} of {@link Byte}s. - * @return The Java type for a blob can be a {@link ByteBuffer}. - * @see ToDafny.Simple#ByteSequence - */ - // BLOB("blob", BlobShape.class, Category.SIMPLE), - static public ByteBuffer ByteBuffer(DafnySequence dafnySequence) { - return ByteBuffer.wrap((byte[]) dafnySequence.toRawArray()); - } + // BLOB("blob", BlobShape.class, Category.SIMPLE), + public static ByteBuffer ByteBuffer( + DafnySequence dafnySequence + ) { + return ByteBuffer.wrap((byte[]) dafnySequence.toRawArray()); + } - /** - * @param dafnySequence The Dafny Runtime type for a String is A {@link DafnySequence} of {@link Character}s. - * @return The Java type for a String is {@link String}. - * @see ToDafny.Simple#CharacterSequence - */ - // STRING("string", StringShape.class, Category.SIMPLE), - public static String String(DafnySequence dafnySequence) { - Stream chars = StreamSupport.stream(dafnySequence.spliterator(), false); - return chars.map(Object::toString).collect(Collectors.joining()); - } + /** + * @param dafnySequence The Dafny Runtime type for a String is A {@link DafnySequence} of {@link Character}s. + * @return The Java type for a String is {@link String}. + * @see ToDafny.Simple#CharacterSequence + */ + // STRING("string", StringShape.class, Category.SIMPLE), + public static String String( + DafnySequence dafnySequence + ) { + Stream chars = StreamSupport.stream( + dafnySequence.spliterator(), + false + ); + return chars.map(Object::toString).collect(Collectors.joining()); + } - /** - * Deserialize the 8 Bytes from a {@link DafnySequence} of {@link Byte}s - * into a {@link Double}.

- * At this time, - * Dafny does not have an idiomatic Double type - * in the language or any standard library.

- * As such, Doubles are represented as the serialized bytes of - * their Native Type.

- * Note: This serialization is NOT guaranteed to be - * consistent among different Dafny Runtimes or - * even native distributions. - * @param dafnySequence A {@link DafnySequence} of 8 {@link Byte}s - * @return The Java type for a double can be a {@link Double}. - * @see ToDafny.Simple#Double - */ - // DOUBLE("double", DoubleShape.class, Category.SIMPLE), - public static Double Double(DafnySequence dafnySequence) { - return ByteBuffer(dafnySequence).getDouble(); - } + /** + * Deserialize the 8 Bytes from a {@link DafnySequence} of {@link Byte}s + * into a {@link Double}.

+ * At this time, + * Dafny does not have an idiomatic Double type + * in the language or any standard library.

+ * As such, Doubles are represented as the serialized bytes of + * their Native Type.

+ * Note: This serialization is NOT guaranteed to be + * consistent among different Dafny Runtimes or + * even native distributions. + * @param dafnySequence A {@link DafnySequence} of 8 {@link Byte}s + * @return The Java type for a double can be a {@link Double}. + * @see ToDafny.Simple#Double + */ + // DOUBLE("double", DoubleShape.class, Category.SIMPLE), + public static Double Double(DafnySequence dafnySequence) { + return ByteBuffer(dafnySequence).getDouble(); + } - /** - * Parse a {@link DafnySequence} of {@link Character}s into a {@link Date}.

- * At this time, Dafny does not have an idiomatic Timestamp or Date type - * in the language or any standard library.

- * Instead, the Timestamp is serialized as seconds from epoch, as a string. - * @param dafnySequence {@link DafnySequence} of {@link Character}s containing the serialization of the {@code timestamp}. - * @return The Java type for a Smithy timestamp can be {@link Date}. - * @see ToDafny.Simple#CharacterSequence(Date) - */ - // TIMESTAMP("timestamp", TimestampShape.class, Category.SIMPLE), - public static Date Date(DafnySequence dafnySequence) { - // KMS uses unix timestamp, or seconds from epoch, as its serialized timestamp - // Other services may use other formats - BigDecimal dateValue = new BigDecimal(Simple.String(dafnySequence)); - return new Date(dateValue.scaleByPowerOfTen(3).longValue()); - } + /** + * Parse a {@link DafnySequence} of {@link Character}s into a {@link Date}.

+ * At this time, Dafny does not have an idiomatic Timestamp or Date type + * in the language or any standard library.

+ * Instead, the Timestamp is serialized as seconds from epoch, as a string. + * @param dafnySequence {@link DafnySequence} of {@link Character}s containing the serialization of the {@code timestamp}. + * @return The Java type for a Smithy timestamp can be {@link Date}. + * @see ToDafny.Simple#CharacterSequence(Date) + */ + // TIMESTAMP("timestamp", TimestampShape.class, Category.SIMPLE), + public static Date Date(DafnySequence dafnySequence) { + // KMS uses unix timestamp, or seconds from epoch, as its serialized timestamp + // Other services may use other formats + BigDecimal dateValue = new BigDecimal(Simple.String(dafnySequence)); + return new Date(dateValue.scaleByPowerOfTen(3).longValue()); + } - /** - * Parse a {@link DafnySequence} of {@link Character}s into a {@link Instant}.

- * At this time, Dafny does not have an idiomatic Timestamp or Date type - * in the language or any standard library.

- * Instead, the Timestamp is serialized as seconds from epoch, as a string. - * @param dafnySequence {@link DafnySequence} of {@link Character}s containing the serialization of the {@code timestamp}. - * @return The Java type for a Smithy timestamp can be {@link Instant}. - * @see ToDafny.Simple#CharacterSequence(Instant) - */ - // TIMESTAMP("timestamp", TimestampShape.class, Category.SIMPLE), - public static Instant Instant(DafnySequence dafnySequence) { - // KMS uses unix timestamp, or seconds from epoch, as its serialized timestamp - // Other services may use other formats - BigDecimal dateValue = new BigDecimal(Simple.String(dafnySequence)); - return Instant.ofEpochMilli(dateValue.scaleByPowerOfTen(3).longValue()); - } + /** + * Parse a {@link DafnySequence} of {@link Character}s into a {@link Instant}.

+ * At this time, Dafny does not have an idiomatic Timestamp or Date type + * in the language or any standard library.

+ * Instead, the Timestamp is serialized as seconds from epoch, as a string. + * @param dafnySequence {@link DafnySequence} of {@link Character}s containing the serialization of the {@code timestamp}. + * @return The Java type for a Smithy timestamp can be {@link Instant}. + * @see ToDafny.Simple#CharacterSequence(Instant) + */ + // TIMESTAMP("timestamp", TimestampShape.class, Category.SIMPLE), + public static Instant Instant( + DafnySequence dafnySequence + ) { + // KMS uses unix timestamp, or seconds from epoch, as its serialized timestamp + // Other services may use other formats + BigDecimal dateValue = new BigDecimal(Simple.String(dafnySequence)); + return Instant.ofEpochMilli(dateValue.scaleByPowerOfTen(3).longValue()); + } - /** - * Decode a {@link DafnySequence} of UTF-8 {@link Byte}s into a {@link String}. - * @param dafnySequence A {@link DafnySequence} of {@link Byte}s. - * @return The Java type for a String is {@link String} - * @see ToDafny.Simple#DafnyUtf8Bytes(String) - */ - public static String DafnyUtf8Bytes(DafnySequence dafnySequence) { - Charset utf8 = StandardCharsets.UTF_8; - // The only way to keep this thread/concurrent safe/ is - // to create a new Coder everytime. - // If we wanted to increase performance, - // we could declare this NOT thread/concurrent safe, - // and reset the coder everytime. - CharsetDecoder coder = utf8.newDecoder(); - ByteBuffer inBuffer = ByteBuffer(dafnySequence); - inBuffer.position(0); - try { - CharBuffer outBuffer = coder.decode(inBuffer); - outBuffer.position(0); - // Compared to the ByteBuffer in ToDafny.Simple.DafnyUtf8Bytes, - // CharBuffer's toString is very user-friendly. - // It appears to only read to the limit, - // as compared to the capacity. - return outBuffer.toString(); - } catch (CharacterCodingException ex) { - throw new RuntimeException("Could not encode input to Dafny Bytes.", ex); - } - } + /** + * Decode a {@link DafnySequence} of UTF-8 {@link Byte}s into a {@link String}. + * @param dafnySequence A {@link DafnySequence} of {@link Byte}s. + * @return The Java type for a String is {@link String} + * @see ToDafny.Simple#DafnyUtf8Bytes(String) + */ + public static String DafnyUtf8Bytes( + DafnySequence dafnySequence + ) { + Charset utf8 = StandardCharsets.UTF_8; + // The only way to keep this thread/concurrent safe/ is + // to create a new Coder everytime. + // If we wanted to increase performance, + // we could declare this NOT thread/concurrent safe, + // and reset the coder everytime. + CharsetDecoder coder = utf8.newDecoder(); + ByteBuffer inBuffer = ByteBuffer(dafnySequence); + inBuffer.position(0); + try { + CharBuffer outBuffer = coder.decode(inBuffer); + outBuffer.position(0); + // Compared to the ByteBuffer in ToDafny.Simple.DafnyUtf8Bytes, + // CharBuffer's toString is very user-friendly. + // It appears to only read to the limit, + // as compared to the capacity. + return outBuffer.toString(); + } catch (CharacterCodingException ex) { + throw new RuntimeException( + "Could not encode input to Dafny Bytes.", + ex + ); + } } + } + + /** + * Methods that convert from a Dafny Runtime type + * to a Native Java type, + * for Smithy's definition of Aggregate shapes. + * @see Smithy Aggregate Types + */ + public static class Aggregate { /** - * Methods that convert from a Dafny Runtime type - * to a Native Java type, - * for Smithy's definition of Aggregate shapes. - * @see Smithy Aggregate Types + * @param dafnyValues The Dafny Runtime Type for a List is a {@link DafnySequence}. + * @param converter A {@link Function} that converts from a Dafny Runtime Type to a Native Java Type. + * @param The Dafny Runtime Type. + * @param The Native Java Type. + * @return A {@link List} of {@code }, + * which is the result of applying {@code converter} to + * every member of {@code dafnyValues}. + * @see ToDafny.Aggregate#GenericToSequence(List, Function, TypeDescriptor) */ - public static class Aggregate { - /** - * @param dafnyValues The Dafny Runtime Type for a List is a {@link DafnySequence}. - * @param converter A {@link Function} that converts from a Dafny Runtime Type to a Native Java Type. - * @param The Dafny Runtime Type. - * @param The Native Java Type. - * @return A {@link List} of {@code }, - * which is the result of applying {@code converter} to - * every member of {@code dafnyValues}. - * @see ToDafny.Aggregate#GenericToSequence(List, Function, TypeDescriptor) - */ - // LIST("list", ListShape.class, Category.AGGREGATE), - public static List GenericToList( - DafnySequence dafnyValues, - Function converter - ) { - List returnList = new ArrayList<>(dafnyValues.length()); - dafnyValues.forEach(value -> - returnList.add(converter.apply(value)) - ); - return returnList; - } + // LIST("list", ListShape.class, Category.AGGREGATE), + public static List GenericToList( + DafnySequence dafnyValues, + Function converter + ) { + List returnList = new ArrayList<>(dafnyValues.length()); + dafnyValues.forEach(value -> returnList.add(converter.apply(value))); + return returnList; + } - /** - * @param dafnyValues The Dafny Runtime Type for a Set is a {@link DafnySet}. - * @param converter A {@link Function} that converts from a Dafny Runtime Type to a Native Java Type. - * @param The Dafny Runtime Type. - * @param The Native Java Type. - * @return A {@link Set} of {@code }, - * which is the result of applying {@code converter} to - * every member of {@code dafnyValues}. - * @see ToDafny.Aggregate#GenericToSet(Set, Function) - */ - // SET("set", SetShape.class, Category.AGGREGATE), - // technically, sets are deprecated in Smithy - // They have been replaced with LIST w/ the uniqueItem trait - public static Set GenericToSet( - DafnySet dafnyValues, - Function converter - ) { - // From the Smithy Docs: - // "Implementations SHOULD use insertion ordered sets" - // https://smithy.io/1.0/spec/core/model.html#set - // Thus, we use a LinkedHashSet - Set returnSet = new LinkedHashSet<>(dafnyValues.size(), 1); - dafnyValues.Elements().forEach(value -> - returnSet.add(converter.apply(value)) - ); - return returnSet; - } + /** + * @param dafnyValues The Dafny Runtime Type for a Set is a {@link DafnySet}. + * @param converter A {@link Function} that converts from a Dafny Runtime Type to a Native Java Type. + * @param The Dafny Runtime Type. + * @param The Native Java Type. + * @return A {@link Set} of {@code }, + * which is the result of applying {@code converter} to + * every member of {@code dafnyValues}. + * @see ToDafny.Aggregate#GenericToSet(Set, Function) + */ + // SET("set", SetShape.class, Category.AGGREGATE), + // technically, sets are deprecated in Smithy + // They have been replaced with LIST w/ the uniqueItem trait + public static Set GenericToSet( + DafnySet dafnyValues, + Function converter + ) { + // From the Smithy Docs: + // "Implementations SHOULD use insertion ordered sets" + // https://smithy.io/1.0/spec/core/model.html#set + // Thus, we use a LinkedHashSet + Set returnSet = new LinkedHashSet<>(dafnyValues.size(), 1); + dafnyValues + .Elements() + .forEach(value -> returnSet.add(converter.apply(value))); + return returnSet; + } - /** - * @param dafnyValues The Dafny Runtime type for a map can be {@link DafnyMap}. - * @param keyConverter A {@link Function} that converts Dafny Runtime Type for the Key to a Native Java Type. - * @param valueConverter A {@link Function} that converts Dafny Runtime Type for the Value to a Native Java Type. - * @param The Dafny Runtime Type for the Key. - * @param The Dafny Runtime Type for the Value. - * @param The Native Java Type for the Key. - * @param The Native Java Type for the Value. - * @return A {@link Map} of {@code }, - * which is the result of applying {@code keyConverter} and {@code valueConverter} to - * every member of {@code dafnyValues}. - * @see ToDafny.Aggregate#GenericToMap(Map, Function, Function) - */ - // MAP("map", MapShape.class, Category.AGGREGATE), - // Technically, a smithy Map's Key value will always be a String - public static Map GenericToMap( - DafnyMap dafnyValues, - Function keyConverter, - Function valueConverter - ) { - Map returnMap = new LinkedHashMap<>(dafnyValues.size(), 1); - dafnyValues.forEach((k, v) -> - returnMap.put(keyConverter.apply(k), valueConverter.apply(v))); - return returnMap; - } + /** + * @param dafnyValues The Dafny Runtime type for a map can be {@link DafnyMap}. + * @param keyConverter A {@link Function} that converts Dafny Runtime Type for the Key to a Native Java Type. + * @param valueConverter A {@link Function} that converts Dafny Runtime Type for the Value to a Native Java Type. + * @param The Dafny Runtime Type for the Key. + * @param The Dafny Runtime Type for the Value. + * @param The Native Java Type for the Key. + * @param The Native Java Type for the Value. + * @return A {@link Map} of {@code }, + * which is the result of applying {@code keyConverter} and {@code valueConverter} to + * every member of {@code dafnyValues}. + * @see ToDafny.Aggregate#GenericToMap(Map, Function, Function) + */ + // MAP("map", MapShape.class, Category.AGGREGATE), + // Technically, a smithy Map's Key value will always be a String + public static Map< + OUT_KEY, + OUT_VALUE + > GenericToMap( + DafnyMap dafnyValues, + Function keyConverter, + Function valueConverter + ) { + Map returnMap = new LinkedHashMap<>( + dafnyValues.size(), + 1 + ); + dafnyValues.forEach((k, v) -> + returnMap.put(keyConverter.apply(k), valueConverter.apply(v)) + ); + return returnMap; } + } } diff --git a/smithy-dafny-conversion/src/test/java/software/amazon/smithy/dafny/conversion/ToDafnyTest.java b/smithy-dafny-conversion/src/test/java/software/amazon/smithy/dafny/conversion/ToDafnyTest.java index a554841f05..b16ee9ffca 100644 --- a/smithy-dafny-conversion/src/test/java/software/amazon/smithy/dafny/conversion/ToDafnyTest.java +++ b/smithy-dafny-conversion/src/test/java/software/amazon/smithy/dafny/conversion/ToDafnyTest.java @@ -2,8 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.smithy.dafny.conversion; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import dafny.DafnyMap; +import dafny.DafnySequence; +import dafny.DafnySet; +import dafny.TypeDescriptor; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; @@ -19,156 +23,182 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.function.Function; import java.util.stream.Collectors; - -import dafny.DafnyMap; -import dafny.DafnySequence; -import dafny.DafnySet; -import dafny.TypeDescriptor; - -import static org.junit.Assert.assertEquals; +import org.junit.Test; public class ToDafnyTest { - private static final ArrayList INPUT_LIST = new ArrayList<>(); - private static final String SMALL_STRING = "This is a string."; - - static { - INPUT_LIST.add("Three"); - INPUT_LIST.add("Two"); - INPUT_LIST.add("One"); - } - - - private static DafnySequence> ListString( - List list - ) { - return ToDafny.Aggregate.GenericToSequence(list, - ToDafny.Simple::CharacterSequence, - DafnySequence._typeDescriptor(TypeDescriptor.CHAR)); - } - - @Test - public void testGenericToSequence() { - ArrayList input = (ArrayList) INPUT_LIST.clone(); - class Local { - public DafnySequence ByIndex(BigInteger index) { - return DafnySequence.asString(input.get(index.intValue())); - } - } - Local local = new Local(); - DafnySequence> expected = DafnySequence.Create( - DafnySequence._typeDescriptor(TypeDescriptor.CHAR), - BigInteger.valueOf(3), - local::ByIndex - ); - DafnySequence> actual = ListString(input); - assertEquals(expected, actual); - } - - private static DafnySet> SetString(Set set) { - return ToDafny.Aggregate.GenericToSet(set, ToDafny.Simple::CharacterSequence); - } - - @Test - public void testGenericToSet() { - Set input = new LinkedHashSet<>((ArrayList)INPUT_LIST.clone()); - Set> temp = input.stream().map(ToDafny.Simple::CharacterSequence).collect(Collectors.toSet()); - @SuppressWarnings({"unchecked", "rawtypes"}) - DafnySet expected = new DafnySet(temp); - DafnySet> actual = SetString(input); - assertEquals(expected, actual); - } - - private static DafnyMap, DafnySequence> MapStringString(Map map) { - return ToDafny.Aggregate.GenericToMap(map, - ToDafny.Simple::CharacterSequence, - ToDafny.Simple::CharacterSequence); - } - - @Test - public void testGenericToMap() { - Map, DafnySequence> temp = new LinkedHashMap<>(); - temp.put(DafnySequence.asString("one"), DafnySequence.asString("value")); - temp.put(DafnySequence.asString("two"), DafnySequence.asString("value")); - DafnyMap, DafnySequence> expected = new DafnyMap<>(temp); - Map input = new LinkedHashMap<>(); - input.put("one", "value"); - input.put("two", "value"); - DafnyMap, DafnySequence> actual = MapStringString(input); - assertEquals(expected, actual); - } - - private static DafnySet SetInteger(Set set) { - return ToDafny.Aggregate.GenericToSet(set, Function.identity()); + private static final ArrayList INPUT_LIST = new ArrayList<>(); + private static final String SMALL_STRING = "This is a string."; + + static { + INPUT_LIST.add("Three"); + INPUT_LIST.add("Two"); + INPUT_LIST.add("One"); + } + + private static DafnySequence< + ? extends DafnySequence + > ListString(List list) { + return ToDafny.Aggregate.GenericToSequence( + list, + ToDafny.Simple::CharacterSequence, + DafnySequence._typeDescriptor(TypeDescriptor.CHAR) + ); + } + + @Test + public void testGenericToSequence() { + ArrayList input = (ArrayList) INPUT_LIST.clone(); + class Local { + + public DafnySequence ByIndex(BigInteger index) { + return DafnySequence.asString(input.get(index.intValue())); + } } - - @Test - public void testGenericToSetInteger() { - Set input = new LinkedHashSet<>(Arrays.asList(1, 2, 3)); - @SuppressWarnings({"unchecked", "rawtypes"}) - DafnySet expected = new DafnySet(input); - DafnySet actual = SetInteger(input); - assertEquals(expected, actual); - } - - @Test - public void testDafnyUtf8BytesSmall() { - DafnySequence actualDafny = ToDafny.Simple.DafnyUtf8Bytes(SMALL_STRING); - assertEquals(17, actualDafny.length()); - String actualNative = ToNative.Simple.DafnyUtf8Bytes(actualDafny); - assertEquals(SMALL_STRING, actualNative); - } - - @Test - public void testDafnyUtf8BytesDemo() throws IOException { - // UTF-8-Demo.txt is written by Markus Kuhn - // It was retrieved on 2022/12/11 from: - // https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt - String expectedString = getResourceFileAsString("UTF-8-demo.txt"); - DafnySequence actualDafny = ToDafny.Simple.DafnyUtf8Bytes(expectedString); - String actualNative = ToNative.Simple.DafnyUtf8Bytes(actualDafny); - assertEquals(expectedString, actualNative); + Local local = new Local(); + DafnySequence> expected = + DafnySequence.Create( + DafnySequence._typeDescriptor(TypeDescriptor.CHAR), + BigInteger.valueOf(3), + local::ByIndex + ); + DafnySequence> actual = + ListString(input); + assertEquals(expected, actual); + } + + private static DafnySet> SetString( + Set set + ) { + return ToDafny.Aggregate.GenericToSet( + set, + ToDafny.Simple::CharacterSequence + ); + } + + @Test + public void testGenericToSet() { + Set input = new LinkedHashSet<>( + (ArrayList) INPUT_LIST.clone() + ); + Set> temp = input + .stream() + .map(ToDafny.Simple::CharacterSequence) + .collect(Collectors.toSet()); + @SuppressWarnings({ "unchecked", "rawtypes" }) + DafnySet expected = new DafnySet(temp); + DafnySet> actual = SetString(input); + assertEquals(expected, actual); + } + + private static DafnyMap< + DafnySequence, + DafnySequence + > MapStringString(Map map) { + return ToDafny.Aggregate.GenericToMap( + map, + ToDafny.Simple::CharacterSequence, + ToDafny.Simple::CharacterSequence + ); + } + + @Test + public void testGenericToMap() { + Map, DafnySequence> temp = + new LinkedHashMap<>(); + temp.put(DafnySequence.asString("one"), DafnySequence.asString("value")); + temp.put(DafnySequence.asString("two"), DafnySequence.asString("value")); + DafnyMap, DafnySequence> expected = + new DafnyMap<>(temp); + Map input = new LinkedHashMap<>(); + input.put("one", "value"); + input.put("two", "value"); + DafnyMap, DafnySequence> actual = + MapStringString(input); + assertEquals(expected, actual); + } + + private static DafnySet SetInteger(Set set) { + return ToDafny.Aggregate.GenericToSet(set, Function.identity()); + } + + @Test + public void testGenericToSetInteger() { + Set input = new LinkedHashSet<>(Arrays.asList(1, 2, 3)); + @SuppressWarnings({ "unchecked", "rawtypes" }) + DafnySet expected = new DafnySet(input); + DafnySet actual = SetInteger(input); + assertEquals(expected, actual); + } + + @Test + public void testDafnyUtf8BytesSmall() { + DafnySequence actualDafny = ToDafny.Simple.DafnyUtf8Bytes( + SMALL_STRING + ); + assertEquals(17, actualDafny.length()); + String actualNative = ToNative.Simple.DafnyUtf8Bytes(actualDafny); + assertEquals(SMALL_STRING, actualNative); + } + + @Test + public void testDafnyUtf8BytesDemo() throws IOException { + // UTF-8-Demo.txt is written by Markus Kuhn + // It was retrieved on 2022/12/11 from: + // https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-demo.txt + String expectedString = getResourceFileAsString("UTF-8-demo.txt"); + DafnySequence actualDafny = ToDafny.Simple.DafnyUtf8Bytes( + expectedString + ); + String actualNative = ToNative.Simple.DafnyUtf8Bytes(actualDafny); + assertEquals(expectedString, actualNative); + } + + @Test + public void testDafnyUtf8BytesLarge() throws IOException { + // UTF-8-test.txt is written by Markus Kuhn + // It was retrieved on 2022/12/10 from: + // https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt + String expectedString = getResourceFileAsString("UTF-8-test.txt"); + DafnySequence actualDafny = ToDafny.Simple.DafnyUtf8Bytes( + expectedString + ); + String actualNative = ToNative.Simple.DafnyUtf8Bytes(actualDafny); + assertEquals(expectedString, actualNative); + } + + @Test + public void testDouble() { + for (int i = 0; i < 100; i++) { + double random = ThreadLocalRandom.current().nextDouble(); + DafnySequence actualDafny = ToDafny.Simple.Double(random); + Double actualDouble = ToNative.Simple.Double(actualDafny); + assertEquals((Double) random, actualDouble); } - - @Test - public void testDafnyUtf8BytesLarge() throws IOException { - // UTF-8-test.txt is written by Markus Kuhn - // It was retrieved on 2022/12/10 from: - // https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt - String expectedString = getResourceFileAsString("UTF-8-test.txt"); - DafnySequence actualDafny = ToDafny.Simple.DafnyUtf8Bytes(expectedString); - String actualNative = ToNative.Simple.DafnyUtf8Bytes(actualDafny); - assertEquals(expectedString, actualNative); - } - - @Test - public void testDouble() { - for (int i = 0; i < 100; i ++) { - double random = ThreadLocalRandom.current().nextDouble(); - DafnySequence actualDafny = ToDafny.Simple.Double(random); - Double actualDouble = ToNative.Simple.Double(actualDafny); - assertEquals((Double) random, actualDouble); - } - } - - /** - * Reads given resource file as a string. - * - * @param fileName path to the resource file - * @return the file's contents - * @throws IOException if read fails for any reason - * - * @author - * Lucio Paiva - */ - static String getResourceFileAsString(String fileName) throws IOException { - ClassLoader classLoader = ClassLoader.getSystemClassLoader(); - try (InputStream is = classLoader.getResourceAsStream(fileName)) { - if (is == null) return null; - try (InputStreamReader isr = new InputStreamReader(is); - BufferedReader reader = new BufferedReader(isr)) { - return reader.lines().collect(Collectors.joining(System.lineSeparator())); - } - } + } + + /** + * Reads given resource file as a string. + * + * @param fileName path to the resource file + * @return the file's contents + * @throws IOException if read fails for any reason + * + * @author + * Lucio Paiva + */ + static String getResourceFileAsString(String fileName) throws IOException { + ClassLoader classLoader = ClassLoader.getSystemClassLoader(); + try (InputStream is = classLoader.getResourceAsStream(fileName)) { + if (is == null) return null; + try ( + InputStreamReader isr = new InputStreamReader(is); + BufferedReader reader = new BufferedReader(isr) + ) { + return reader + .lines() + .collect(Collectors.joining(System.lineSeparator())); + } } + } } diff --git a/smithy-dafny-conversion/src/test/java/software/amazon/smithy/dafny/conversion/ToNativeTest.java b/smithy-dafny-conversion/src/test/java/software/amazon/smithy/dafny/conversion/ToNativeTest.java index 37592c7a38..adc4a5d73e 100644 --- a/smithy-dafny-conversion/src/test/java/software/amazon/smithy/dafny/conversion/ToNativeTest.java +++ b/smithy-dafny-conversion/src/test/java/software/amazon/smithy/dafny/conversion/ToNativeTest.java @@ -2,8 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 package software.amazon.smithy.dafny.conversion; -import org.junit.Test; +import static org.junit.Assert.assertEquals; +import dafny.DafnyMap; +import dafny.DafnySequence; +import dafny.DafnySet; +import dafny.TypeDescriptor; import java.math.BigInteger; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -12,82 +16,93 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; +import org.junit.Test; -import dafny.DafnyMap; -import dafny.DafnySequence; -import dafny.DafnySet; -import dafny.TypeDescriptor; +public class ToNativeTest { -import static org.junit.Assert.assertEquals; + private static final ArrayList INPUT_LIST = new ArrayList<>(); -public class ToNativeTest { - private static final ArrayList INPUT_LIST = new ArrayList<>(); + static { + INPUT_LIST.add("Three"); + INPUT_LIST.add("Two"); + INPUT_LIST.add("One"); + } - static { - INPUT_LIST.add("Three"); - INPUT_LIST.add("Two"); - INPUT_LIST.add("One"); - } - private static List ListString( - DafnySequence> seq - ) { - return ToNative.Aggregate.GenericToList( - seq, - ToNative.Simple::String - ); - } + private static List ListString( + DafnySequence> seq + ) { + return ToNative.Aggregate.GenericToList(seq, ToNative.Simple::String); + } - @Test - public void testGenericToList() { - List expected = (ArrayList) INPUT_LIST.clone(); - class Local { - public DafnySequence ByIndex(BigInteger index) { - return DafnySequence.asString(expected.get(index.intValue())); - } - } - Local local = new Local(); - DafnySequence> input = DafnySequence.Create( - DafnySequence._typeDescriptor(TypeDescriptor.CHAR), - BigInteger.valueOf(3), - local::ByIndex - ); - List actual = ListString(input); - assertEquals(expected, actual); - } + @Test + public void testGenericToList() { + List expected = (ArrayList) INPUT_LIST.clone(); + class Local { - private static Set SetString( - DafnySet> set - ) { - return ToNative.Aggregate.GenericToSet(set, ToNative.Simple::String); + public DafnySequence ByIndex(BigInteger index) { + return DafnySequence.asString(expected.get(index.intValue())); + } } + Local local = new Local(); + DafnySequence> input = + DafnySequence.Create( + DafnySequence._typeDescriptor(TypeDescriptor.CHAR), + BigInteger.valueOf(3), + local::ByIndex + ); + List actual = ListString(input); + assertEquals(expected, actual); + } - @Test - public void testGenericToSet() { - Set expected = new LinkedHashSet<>((ArrayList)INPUT_LIST.clone()); - Set> temp = expected.stream() - .map(ToDafny.Simple::CharacterSequence) - .collect(Collectors.toSet()); - DafnySet> input = new DafnySet<>(temp); - Set actual = SetString(input); - assertEquals(expected, actual); - } + private static Set SetString( + DafnySet> set + ) { + return ToNative.Aggregate.GenericToSet(set, ToNative.Simple::String); + } - private static Map MapStringString( - DafnyMap, DafnySequence> map - ) { - return ToNative.Aggregate.GenericToMap(map, ToNative.Simple::String, ToNative.Simple::String); - } + @Test + public void testGenericToSet() { + Set expected = new LinkedHashSet<>( + (ArrayList) INPUT_LIST.clone() + ); + Set> temp = expected + .stream() + .map(ToDafny.Simple::CharacterSequence) + .collect(Collectors.toSet()); + DafnySet> input = new DafnySet<>(temp); + Set actual = SetString(input); + assertEquals(expected, actual); + } - @Test - public void testGenericToMap() { - Map expected = new LinkedHashMap<>(); - expected.put("one", "value"); - expected.put("two", "value"); - Map, DafnySequence> temp = new LinkedHashMap<>(); - temp.put(DafnySequence.asString("one"), DafnySequence.asString("value")); - temp.put(DafnySequence.asString("two"), DafnySequence.asString("value")); - DafnyMap, DafnySequence> input = new DafnyMap<>(temp); - Map actual = MapStringString(input); - assertEquals(expected, actual); - } + private static Map MapStringString( + DafnyMap< + DafnySequence, + DafnySequence + > map + ) { + return ToNative.Aggregate.GenericToMap( + map, + ToNative.Simple::String, + ToNative.Simple::String + ); + } + + @Test + public void testGenericToMap() { + Map expected = new LinkedHashMap<>(); + expected.put("one", "value"); + expected.put("two", "value"); + Map< + DafnySequence, + DafnySequence + > temp = new LinkedHashMap<>(); + temp.put(DafnySequence.asString("one"), DafnySequence.asString("value")); + temp.put(DafnySequence.asString("two"), DafnySequence.asString("value")); + DafnyMap< + DafnySequence, + DafnySequence + > input = new DafnyMap<>(temp); + Map actual = MapStringString(input); + assertEquals(expected, actual); + } }